[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090629234035.12475.58493.stgit@localhost.localdomain>
Date: Mon, 29 Jun 2009 17:40:51 -0600
From: Grant Likely <grant.likely@...retlab.ca>
To: linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org,
timur@...escale.com, jonsmirl@...il.com
Subject: [PATCH] powerpc: Fix spin_event_timeout() to be robust over context
switches
From: Grant Likely <grant.likely@...retlab.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@...retlab.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; \
})
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists