Re: udelay() & preemption & drifty ITCs

From: Jesse Barnes <jbarnes_at_sgi.com>
Date: 2003-11-25 08:00:43
On Sun, Nov 23, 2003 at 02:39:29PM -0800, Jesse Barnes wrote:
> Yep, it appears so.  I guess we need a 'preempt_disable/disable()' pair
> around the itc access.  Of course, callers under a spinlock are already
> protected, so maybe exposure to this problem isn't that large?

Here's the patch.  Compiles and boots, but I haven't made a test module
that illustrates this bug, so I haven't tested it.

Jesse

diff -Nru a/include/asm-ia64/delay.h b/include/asm-ia64/delay.h
--- a/include/asm-ia64/delay.h	Mon Nov 24 13:59:12 2003
+++ b/include/asm-ia64/delay.h	Mon Nov 24 13:59:12 2003
@@ -15,6 +15,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/preempt.h>
 #include <linux/compiler.h>
 
 #include <asm/intrinsics.h>
@@ -32,8 +33,10 @@
 {
 	unsigned long result;
 
+	preempt_disable();
 	result = ia64_getreg(_IA64_REG_CR_ITM);
 	ia64_srlz_d();
+	preempt_enable();
 	return result;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Nov 24 16:02:54 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:20 EST