* [PATCH] powerpc: Fix spin_event_timeout() to be robust over context switches
@ 2009-06-29 23:40 Grant Likely
2009-06-30 15:02 ` Timur Tabi
0 siblings, 1 reply; 2+ messages in thread
From: Grant Likely @ 2009-06-29 23:40 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel, timur, jonsmirl
From: Grant Likely <grant.likely@secretlab.ca>
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: Grant Likely <grant.likely@secretlab.ca>
---
arch/powerpc/include/asm/delay.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/delay.h b/arch/powerpc/include/asm/delay.h
index 1e2eb41..52e4d54 100644
--- a/arch/powerpc/include/asm/delay.h
+++ b/arch/powerpc/include/asm/delay.h
@@ -63,6 +63,8 @@ extern void udelay(unsigned long usecs);
udelay(delay); \
else \
cpu_relax(); \
+ if (!__ret) \
+ __ret = (condition); \
__ret; \
})
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: Fix spin_event_timeout() to be robust over context switches
2009-06-29 23:40 [PATCH] powerpc: Fix spin_event_timeout() to be robust over context switches Grant Likely
@ 2009-06-30 15:02 ` Timur Tabi
0 siblings, 0 replies; 2+ messages in thread
From: Timur Tabi @ 2009-06-30 15:02 UTC (permalink / raw)
To: Grant Likely, Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
On Mon, Jun 29, 2009 at 6:40 PM, Grant Likely<grant.likely@secretlab.ca> wr=
ote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> Current implementation of spin_event_timeout can be interrupted by an
> IRQ or context switch after testing the condition, but before checking
> the timeout. =A0This 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: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Timur Tabi <timur@freescale.com>
Ben, please pick this up for the next rc of 2.6.31.
--=20
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-01 0:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-29 23:40 [PATCH] powerpc: Fix spin_event_timeout() to be robust over context switches Grant Likely
2009-06-30 15:02 ` Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).