[SERVER-54684] Decreased JS performance on arm64 due to mising init function Created: 21/Feb/21  Updated: 29/Oct/23  Resolved: 24/Feb/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0, 4.2.13, 4.4.5

Type: Bug Priority: Major - P3
Reporter: Tsahi Zidenberg Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2
Sprint: Dev Platform 2021-03-08
Participants:

 Description   

This bug is in mozjs(firefox) esr-60.

The function vixl::CPU::SetUp() is never called. As a result, on arm64 MozJS will clear instruction cache separately for each byte, greatly impacting JS performance. This is especially important on Graviton2 processors, where advanced kernels expose instruction cacheline size of a full page (usually, 4KB)

In firefox esr 68, the SetUp function is called from js::jit::InitProcessExecutableMemory.



 Comments   
Comment by Githook User [ 26/Feb/21 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-54684 Apply upstream fix for MozJS bug 1442583

Please see https://bugzilla.mozilla.org/show_bug.cgi?id=1442583 for
the upstream bug. The patch applied here was derived from the
following commit:

https://github.com/mozilla/gecko-dev/commit/7371a080accd8dfcaf0d24072b787e143846973a
(cherry picked from commit 25d0ab84369a09112978d399ccc09b55b7009023)
(cherry picked from commit 775f2dfe30552cb2b808bcc320021c01eb5bb518)
Branch: v4.2
https://github.com/mongodb/mongo/commit/16e8cfc7eec8d270e328f4162accb23def2e25a5

Comment by Githook User [ 26/Feb/21 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-54684 Apply upstream fix for MozJS bug 1442583

Please see https://bugzilla.mozilla.org/show_bug.cgi?id=1442583 for
the upstream bug. The patch applied here was derived from the
following commit:

https://github.com/mozilla/gecko-dev/commit/7371a080accd8dfcaf0d24072b787e143846973a
(cherry picked from commit 25d0ab84369a09112978d399ccc09b55b7009023)
Branch: v4.4
https://github.com/mongodb/mongo/commit/775f2dfe30552cb2b808bcc320021c01eb5bb518

Comment by Githook User [ 24/Feb/21 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-54684 Apply upstream fix for MozJS bug 1442583

Please see https://bugzilla.mozilla.org/show_bug.cgi?id=1442583 for
the upstream bug. The patch applied here was derived from the
following commit:

https://github.com/mozilla/gecko-dev/commit/7371a080accd8dfcaf0d24072b787e143846973a
Branch: master
https://github.com/mongodb/mongo/commit/25d0ab84369a09112978d399ccc09b55b7009023

Comment by Tsahi Zidenberg [ 21/Feb/21 ]

I don't know the MozJs ticket.. but here is the commit: https://github.com/mozilla/gecko-dev/commit/7371a080accd8dfcaf0d24072b787e143846973a

 

Comment by Andrew Morrow (Inactive) [ 21/Feb/21 ]

tsahee@amazon.com - That's fascinating. Is there a MozJS ticket for this issue? Generally we like to inspect the MozJS fix for such an issue and attempt to cherry-pick it back into our vendored MozJS sources if possible.

Comment by Tsahi Zidenberg [ 21/Feb/21 ]

As an aside:

Graviton2 shows a huge instruction cacheline size due to this workaround: https://lore.kernel.org/linux-arm-kernel/bad51442-adba-8b21-0eb2-8d1665c71524@arm.com/T/

 

Generated at Thu Feb 08 05:34:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.