[riot-notifications] [RIOT-OS/RIOT] fe310: Fix potential deadlock in thread_yield_higher (#15277)
benpicco
notifications at github.com
Mon Nov 23 13:51:17 CET 2020
@benpicco commented on this pull request.
> @@ -180,8 +180,10 @@ void thread_yield_higher(void)
/* Use SW intr to schedule context switch */
CLINT_REG(CLINT_MSIP) = 1;
- /* Latency of SW intr can be 4-7 cycles; wait for the SW intr */
- __asm__ volatile ("wfi");
+ /* Latency of SW intr can be a few cycles; wait for the SW intr.
+ * We cannot use WFI here as the SW intr may be delivered before we
+ * reach the WFI instruction, thereby causing a thread deadlock. */
+ while (CLINT_REG(CLINT_MSIP) == 1) {};
So ACK?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15277#discussion_r528680364
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201123/cc64414e/attachment.htm>
More information about the notifications
mailing list