-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
@sergiy-k / @jkotas please review. |
SLOT nextInstr; | ||
SLOT target = getTargetOfCall(savedInstrPtr, regs, &nextInstr); | ||
|
||
if (target == (SLOT)JIT_RareDisableHelper) { |
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.
Instead of doing all this call target decoding, would it be better to just check whether we are in preemptive mode?
The call target decoding will need ongoing tweaks, e.g. I hope to add support for interop transitions for ReadyToRun (based on CORJIT_FLG2_USE_PINVOKE_HELPERS
) - that will use a different helper.
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 just spoke with @jkotas.
The check for PremptiveMode will not work, because when returning from a PInvoke epilog, the thread is already in cooperative mode.
Can we also delete |
Yes, we can remove the In the case of PInvoke,
We currently do two GCStress collections:
(1) is not wrong, but is unnecessary coverage, because that code will never trigger a GC during normal execution. So, I agree that its a good idea to remove this |
@dotnet-bot test Windows_NT x64 Checked gcstress0xc |
@dotnet-bot test Windows_NT Checked arm64 |
This change ensures that calls to CORINFO_HELP_STOP_FOR_GC() themselves are not converted to GC-Stress traps -- thus preventing the race between the GC thread, and a managed thread under GCStress. Identification of calls to CORINFO_HELP_STOP_FOR_GC(): Since this is a GCStress only requirement, its not worth special identification in the GcInfo Since CORINFO_HELP_STOP_FOR_GC() calls are realized as indirect calls by the JIT, we cannot identify them by address at the time of SprinkleBreakpoints(). So, we actually let the SprinkleBreakpoints() replace the call to CORINFO_HELP_STOP_FOR_GC() with a trap, and revert it back to the original instruction the first time we hit the trap in OnGcCoverageInterrupt(). Upside: No change to GCInfo or JIT is necessary Downside: Need to decode a few bytes on every GCStress interrupt. Fixes #4794
The latest commit is to fix an X86 build break, by fixing an |
@dotnet-bot test Windows_NT x64 Checked gcstress0xc |
@dotnet-bot test Windows_NT Checked arm64 |
@dotnet-bot test Windows_NT Checked arm |
@dotnet-bot test Windows_NT Checked x64 gcstress0xc |
@dotnet-bot test Windows_NT gcstress0xc |
@dotnet-bot test Windows_NT arm64 Checked |
@dotnet-bot test Windows_NT arm Checked |
@jkotas: Checking if you had any more corrections. |
@dotnet-bot test Windows_NT gcstress0xc |
The failures in GCStress are pres-existing / timeouts. |
LGTM |
Looks like this change also fixes https://github.com/dotnet/coreclr/issues/5310 and https://github.com/dotnet/coreclr/issues/2785 |
GCStress: Fix a race-condition Commit migrated from dotnet/coreclr@2fc2547
This change ensures that calls to
CORINFO_HELP_STOP_FOR_GC()
themselvesare not converted to GC-Stress traps -- thus preventing the race between
the GC thread, and a managed thread under GCStress.
Identification of calls to
CORINFO_HELP_STOP_FOR_GC()
:Since this is a GCStress only requirement, its not worth special identification in the GcInfo
Since
CORINFO_HELP_STOP_FOR_GC()
calls are realized as indirect calls by the JIT, we cannot identifythem by address at the time of
SprinkleBreakpoints()
.So, we actually let the
SprinkleBreakpoints()
replace the call toCORINFO_HELP_STOP_FOR_GC()
with a trap, and revert it back to the original instruction the first time we hit the trap in
OnGcCoverageInterrupt()
.Upside: No change to GCInfo or JIT is necessary
Downside: Need to decode a few bytes on every GCStress interrupt.
Local testing with
COMPlus_GCStress=0xC
andCOMPlus_GCConcurrent=1
did not encounter the race condition in #4794Fixes #4794