File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,16 +23,20 @@ var rp2040FlashSafeState volatile.Register8
2323// rp2040EnterFlashSafeSection enters a section in which RP2040 flash operations
2424// may temporarily disable XIP.
2525//
26- // The multicore path asks the other core to enter the flash-safe interrupt
27- // handler and waits until it acknowledges that it is parked. Local interrupts
28- // are disabled after the other core is parked.
26+ // The multicore path serializes flash-safe initiators, then disables local
27+ // interrupts before asking the other core to park. Keeping local interrupts
28+ // disabled while waiting for the acknowledgement prevents a GC stop-the-world
29+ // interrupt from blocking this core while the other core is parked in the
30+ // flash-safe handler.
2931func rp2040EnterFlashSafeSection () interrupt.State {
3032 if ! secondaryCoresStarted {
3133 return interrupt .Disable ()
3234 }
3335
3436 flashSafeLock .Lock ()
3537
38+ state := interrupt .Disable ()
39+
3640 core := currentCPU ()
3741 rp2040FlashSafeState .Set (rp2040FlashSafeIdle )
3842
@@ -47,7 +51,7 @@ func rp2040EnterFlashSafeSection() interrupt.State {
4751 spinLoopWait ()
4852 }
4953
50- return interrupt . Disable ()
54+ return state
5155}
5256
5357// rp2040ExitFlashSafeSection exits a section entered by
You can’t perform that action at this time.
0 commit comments