Closed Bug 1877605 Opened 3 months ago Closed 3 months ago

spectre mitigation speculation barriers are still used in generateVMWrappers

Categories

(Core :: JavaScript Engine: JIT, defect)

defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox123 --- fixed
firefox124 --- fixed

People

(Reporter: jrmuizel, Assigned: jrmuizel, NeedInfo)

References

(Blocks 1 open bug)

Details

(Keywords: perf-alert, Whiteboard: [sp3])

Attachments

(1 file)

I think this is unintentional and seems to be showing up pretty prominently on M1 macs

js::jit::MacroAssembler::speculationBarrier() [/Users/mstange/code/mozilla/js/src/jit/arm64/MacroAssembler-arm64.cpp]
js::jit::JitRuntime::generateVMWrapper(JSContext*, js::jit::MacroAssembler&, js::jit::VMFunctionId, js::jit::VMFunctionData const&, js::jit::DynFn, unsigned int*) [/Users/mstange/code/mozilla/js/src/jit/arm64/Trampoline-arm64.cpp]
js::jit::JitRuntime::generateVMWrappers(JSContext*, js::jit::MacroAssembler&, js::jit::PerfSpewerRangeRecorder&) [/Users/mstange/code/mozilla/js/src/jit/VMFunctions.cpp]
js::jit::JitRuntime::generateTrampolines(JSContext*) [/Users/mstange/code/mozilla/js/src/jit/Ion.cpp]
js::jit::JitRuntime::initialize(JSContext*) [/Users/mstange/code/mozilla/js/src/jit/Ion.cpp]
JSRuntime::createJitRuntime(JSContext*) [/Users/mstange/code/mozilla/js/src/vm/Realm.cpp]
JS::InitSelfHostedCode(JSContext*, mozilla::Span<unsigned char const, (unsigned long)18446744073709551615>, bool (*)(JSContext*, mozilla::Span<unsigned char const, (unsigned long)18446744073709551615>)) [/Users/mstange/code/mozilla/js/src/vm/Initialization.cpp]
XPCJSContext::Initialize() [/Users/mstange/code/mozilla/js/xpconnect/src/XPCJSContext.cpp]
XPCJSContext::NewXPCJSContext() [/Users/mstange/code/mozilla/js/xpconnect/src/XPCJSContext.cpp]
nsXPConnect::InitJSContext() [/Users/mstange/code/mozilla/js/xpconnect/src/nsXPConnect.cpp]
xpc::InitializeJSContext() [/Users/mstange/code/mozilla/js/xpconnect/src/nsXPConnect.cpp]
NS_InitXPCOM [/Users/mstange/code/mozilla/xpcom/build/XPCOMInit.cpp]
mozilla::dom::ContentProcess::Init(int, char**) [/Users/mstange/code/mozilla/dom/ipc/ContentProcess.cpp]
XRE_InitChildProcess(int, char**, XREChildData const*) [/Users/mstange/code/mozilla/toolkit/xre/nsEmbedFunctions.cpp]
XRE_InitChildProcess
content_process_main(mozilla::Bootstrap*, int, char**) [/Users/mstange/code/mozilla/ipc/app/../contentproc/plugin-container.cpp]
main [/Users/mstange/code/mozilla/ipc/app/MozillaRuntimeMain.cpp]

We want this disabled early so that it's not used in generateVMWrapper
during initialization.

This mitigation has only theoretical value and a very real performance
cost.

Assignee: nobody → jmuizelaar
Status: NEW → ASSIGNED
Blocks: speedometer3
Severity: -- → S3

Here are profiles of the todos function from react-redux:
before: https://share.firefox.dev/3Shwwhn (272 samples)
after: https://share.firefox.dev/49hGKFa (230 samples)

Pushed by jmuizelaar@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dabc78ed3644
Disable spectreJitToCxxCalls everywhere. r=jandem

Comment on attachment 9377326 [details]
Bug 1877605. Disable spectreJitToCxxCalls everywhere.

Beta/Release Uplift Approval Request

  • User impact if declined: 2.8% on Speedometer3 on ARM64 macOS
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This is effectively just a pref change. We already expected it to be off it just wasn't working properly.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9377326 - Flags: approval-mozilla-beta?

Try results suggest that this is a 2.8% improvement on ARM64 macOS

Pushed by jmuizelaar@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fedb6cd9dddf
Disable spectreJitToCxxCalls everywhere. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch

Comment on attachment 9377326 [details]
Bug 1877605. Disable spectreJitToCxxCalls everywhere.

Approved for 123 beta 6, thanks.

Attachment #9377326 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

(In reply to Pulsebot from comment #6)

Pushed by jmuizelaar@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dabc78ed3644
Disable spectreJitToCxxCalls everywhere. r=jandem

== Change summary for alert #41256 (as of Wed, 31 Jan 2024 22:48:17 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
3% speedometer3 macosx1300-64-shippable-qr fission webrender 31.23 -> 32.02 Before/After

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=41256

Keywords: perf-alert

A lot of improvements on DevTools tests

== Change summary for alert #41293 (as of Fri, 02 Feb 2024 15:12:47 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
15% damp source-map.SourceMapGenerator-toString.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 339.63 -> 287.67
15% damp source-map.SourceMapGenerator-toString.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender-sw 344.84 -> 293.09
14% damp source-map.SourceMapGenerator-toString.DAMP windows10-64-shippable-qr e10s fission stylo webrender 328.80 -> 281.43
14% damp source-map.SourceMapGenerator-toString.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 329.68 -> 282.55
8% damp source-map.originalPositionFor.DAMP windows10-64-shippable-qr e10s fission stylo webrender-sw 268.44 -> 247.05
... ... ... ... ...
2% damp console.log-in-loop-content-process-error windows10-64-shippable-qr e10s fission stylo webrender 91.71 -> 89.85

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=41293

Whiteboard: [sp3]

== Change summary for alert #41295 (as of Fri, 02 Feb 2024 21:19:25 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
10% dromaeo_css windows10-64-shippable-qr e10s fission stylo webrender 23,137.72 -> 25,355.40
9% dromaeo_css macosx1015-64-shippable-qr e10s fission stylo webrender 19,824.69 -> 21,621.37

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=41295

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: