Commit ad9064d5 authored by Grant Likely's avatar Grant Likely Committed by Benjamin Herrenschmidt

powerpc: Fix spin_event_timeout() to be robust over context switches

Current implementation of spin_event_timeout can be interrupted by an
IRQ or context switch after testing the condition, but before checking
the timeout.  This can cause the loop to report a timeout when the
condition actually became true in the middle.

This patch adds one final check of the condition upon exit of the loop
if the last test of the condition was still false.
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Acked-by: default avatarTimur Tabi <timur@freescale.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 30c5af43
...@@ -63,6 +63,8 @@ extern void udelay(unsigned long usecs); ...@@ -63,6 +63,8 @@ extern void udelay(unsigned long usecs);
udelay(delay); \ udelay(delay); \
else \ else \
cpu_relax(); \ cpu_relax(); \
if (!__ret) \
__ret = (condition); \
__ret; \ __ret; \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment