Skip to content

Commit 99e9722

Browse files
committed
runtime/rp2040: avoid GC race when leaving flash-safe handler
1 parent 48b3105 commit 99e9722

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/runtime/runtime_rp2040_flashsafe_cores.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ func rp2FlashSafeInterruptHandler(core uint32) {
9696
arm.Asm("wfe")
9797
}
9898

99-
interrupt.Restore(state)
100-
99+
// Publish Idle before restoring interrupts. The initiator spins for Idle
100+
// with interrupts disabled, so taking a pending GC interrupt first would
101+
// deadlock: it would wait for an ACK the initiator cannot send.
101102
rp2040FlashSafeState.Set(rp2040FlashSafeIdle)
102103
arm.Asm("sev")
104+
105+
interrupt.Restore(state)
103106
}

0 commit comments

Comments
 (0)