-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[coop] Turn hybrid suspend on by default on desktop platforms #9811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[coop] Turn hybrid suspend on by default on desktop platforms #9811
Conversation
676ae02 to
598fcbd
Compare
|
We should add an x64 Linux (and OSX?) preemptive suspend CI lane after this is merged so we can keep testing the previous configuration. (There's already a |
luhenry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to disable it for iOS and Android in https://github.com/mono/mono/blob/master/sdks/builds/ios.mk and https://github.com/mono/mono/blob/master/sdks/builds/android.mk respectively. Only disable it on the devices and simulator builds, not the host ones (iOSDeviceTemplate, iOSSimulatorTemplate and AndroidTargetTemplate).
|
@luhenry Updated to explicitly pass |
|
Now I'm second-guessing myself - do I actually want to check the HOST not the TARGET? this isn't an (AOT) compiler related feature so I think checking HOST is more correct. |
be614db to
59c678c
Compare
|
Could I get another review of this? I switched the configure logic to look at I don't think it matters (since this isn't an AOT thing), but I'd love some feedback. |
|
Good point. Host should be correct. "runtimes" only have a host. I mean, even if the AOT compiler itself used a garbage collector, and configurable suspension, "host" would be correct. |
|
Unless the compiler had to inject safe points into the AOT code depending on suspension mechanism, then target could be relevant. |
configure.ac
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure processor is relevant..but I guess ok, it disambiguates darwin, and we don't have Windows/arm support. What about Linux/arm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME? add host_macos, host_ios, and either remove host_darwin or make it clear host_darwin is maco | ios? And never say "osx"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does coop work w/o coop handles finished? We just treat transition from jit=>native differently based on if it is a handles() transition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The processor check is specifically because we only want to turn this on on Intel for now - it feels like there are more deadlocks to chase down on linux on ARM.
The coop handles (plus precise managed stack scanning) would allow us to skip the "copy stackdata" step when a thread self-suspends and to stop scanning the native stack conservatively. So not having them doesn't preclude using hybrid suspend today.
jaykrell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want another authority on this but ok by me.
|
@monojenkins build failed |
|
@lambdageek disabling on CI will not fix the Interpreter by default, so either we always disable Hybrid Suspend while running with the interpreter, either we fix the Interpreter. I would go for the latter one, but I don't have a good idea of how long it's going to take. |
|
@luhenry The interpreter doesn't have safepoints right now - #7046 (comment). I'm not sure if there's a usecase for interp + hybrid on desktop. So I would prefer to go with a warning and a switch to preemptive if the interpreter and hybrid or coop are specified simultaneously. |
|
@lambdageek sounds good to me, let's do that. /cc @lewurm @BrzVlad |
59c678c to
48b9dd8
Compare
|
Updated to always switch to preemptive suspend if using the interpreter. |
Use hybrid suspend by default on x86 and amd64 OSX, Windows and Linux Pass `--disable-hybrid-suspend` to configure to disable at build time, or set the enrivonment variable `MONO_THREADS_SUSPEND=preemptive` when running Mono to use preemptive suspend (the previous default). Pass `--disable-hybrid-suspend --enable-cooperative-suspend` to configure cooperative suspend at build time.
Only the devices and simulator builds, not the host ones.
Do not use it. It provides a last resort method to ignore configure and environment settings and use a hardcoded threads suspend policy.
Until the interpreter supports safepoints and performs threads suspend states switches in its trampolines, always use preemptive suspend if the interpreter is used.
Like other uses of mono_threads_join_lock, enter GC Safe before trying to take the lock.
48b9dd8 to
ffb1ca8
Compare
|
Pushed a fix for sgen-new-threads-collect failures on OSX - need to take the join lock in GC Safe mode. |
Move safepoint suspend check to mono_runtime_set_execution_mode
…orce preemptive suspend Force preemptive suspend in fullaotmixedcheck. We must compile the AOT images without safepoints.
… usable with embedding See mono/mono#9811. Hopefully this doesn't get removed.
…ono#9811) * [coop] Turn hybrid suspend on by default on desktop platforms Use hybrid suspend by default on x86 and amd64 OSX, Windows and Linux Pass `--disable-hybrid-suspend` to configure to disable at build time, or set the environment variable `MONO_THREADS_SUSPEND=preemptive` when running Mono to use preemptive suspend (the previous default). Pass `--disable-hybrid-suspend --enable-cooperative-suspend` to configure cooperative suspend at build time. * [sdks] Disable coop and hybrid suspend for iOS and Android Only the devices and simulator builds, not the host ones. * [coop] Add mono_threads_suspend_override_policy () Do not use it. It provides a last resort method to ignore configure and environment settings and use a hardcoded threads suspend policy. * [interp] Override suspend policy - warn and use preemptive Until the interpreter supports safepoints and performs threads suspend states switches in its trampolines, always use preemptive suspend if the interpreter is used. * [coop] Enter GC Safe around mono_threads_join_lock () Like other uses of mono_threads_join_lock, enter GC Safe before trying to take the lock. * [interp] Use preemptive suspend with --full-aot-interp Move safepoint suspend check to mono_runtime_set_execution_mode * [test] fullaotmixed - force preemptive suspend[test] fullaotmixed - force preemptive suspend Force preemptive suspend in fullaotmixedcheck. We must compile the AOT images without safepoints. Commit migrated from mono/mono@a7c699a
Use hybrid suspend by default on x86 and amd64 OSX, Windows and Linux.
Pass
--disable-hybrid-suspendto configure to disable at build time, or setthe enrivonment variable
MONO_THREADS_SUSPEND=preemptivewhen running Mono to use preemptive suspend (the previous default).Pass
--disable-hybrid-suspend --enable-cooperative-suspendto configurecooperative suspend at build time.