fix-interrupt-race #45

Merged
matthias merged 2 commits from fix-interrupt-race into main 2025-10-30 16:52:26 +00:00
Owner

Fix two wait-for-interrupt race windows using the pattern from 6f155ebb55 ("audiocore: Fix small race window in get_fifo_read_value_blocking").

Fix two wait-for-interrupt race windows using the pattern from 6f155ebb5516 ("audiocore: Fix small race window in get_fifo_read_value_blocking").
matthias self-assigned this 2025-10-27 20:29:42 +00:00
matthias added 2 commits 2025-10-27 20:29:43 +00:00
Similar to the fix in 6f155ebb55 ("audiocore: Fix small race window in
get_fifo_read_value_blocking"), a race and deadlock is possible when
calling __wfi with interrupts enabled. Fix it in sd_spi_wait_complete by
copying the fix from the above commit.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
audiocore: Fix race window in i2s_stop
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m23s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 10s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
Run pytests / Check-Pytest (push) Successful in 10s
23d5b050dc
Apply the same pattern as in 6f155ebb55 ("audiocore: Fix small race
window in get_fifo_read_value_blocking") and 2a4033d3ca ("rp2_sd: Fix
race window in sd_spi_wait_complete") to the wait for interrupt in
i2s_stop too.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
matthias requested review from Members 2025-10-27 20:29:43 +00:00
stefank approved these changes 2025-10-29 15:41:58 +00:00
stefank left a comment
Member

Looks legit. Did we ever see this happen?

Looks legit. Did we ever see this happen?
Author
Owner

Looks legit. Did we ever see this happen?

I encountered the sd_spi_wait_complete race. The i2s_stop race is theoretical, but I just decided to apply the same pattern to all __wfi users at this point.

> Looks legit. Did we ever see this happen? > I encountered the sd_spi_wait_complete race. The i2s_stop race is theoretical, but I just decided to apply the same pattern to all __wfi users at this point.
matthias merged commit a81952fb8a into main 2025-10-30 16:52:26 +00:00
matthias deleted branch fix-interrupt-race 2025-10-30 16:52:26 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TonBERRY/tonberry-pico#45