All of lore.kernel.org
 help / color / mirror / Atom feed
* warn if we sleep in an irq for a long time.
@ 2005-12-12 20:51 Dave Jones
  0 siblings, 0 replies; only message in thread
From: Dave Jones @ 2005-12-12 20:51 UTC (permalink / raw)
  To: akpm; +Cc: arjanv, linux-kernel

We've been carrying this in Fedora/RHEL for a dogs age.
It occasionally trips something up (especially in out-of-tree modules)

(Originally by Arjan, with trivial rediffing by me over time)

Cc: Arjan van de Ven <arjanv@infradead.org>
Signed-off-by: Dave Jones <davej@redhat.com>

diff -urNp --exclude-from=/home/davej/.exclude linux-3022/include/linux/delay.h linux-10000/include/linux/delay.h
--- linux-3022/include/linux/delay.h
+++ linux-10000/include/linux/delay.h
@@ -10,7 +10,7 @@
 extern unsigned long loops_per_jiffy;
 
 #include <asm/delay.h>
-
+#include <linux/hardirq.h>
 /*
  * Using udelay() for intervals greater than a few milliseconds can
  * risk overflow for high loops_per_jiffy (high bogomips) machines. The
@@ -25,14 +25,13 @@ extern unsigned long loops_per_jiffy;
 #define MAX_UDELAY_MS	5
 #endif
 
-#ifdef notdef
-#define mdelay(n) (\
-	{unsigned long __ms=(n); while (__ms--) udelay(1000);})
-#else
-#define mdelay(n) (\
-	(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
-	({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
-#endif
+#define mdelay(n) (					\
+	{						\
+		static int warned=0; 			\
+		unsigned long __ms=(n); 		\
+		WARN_ON(in_irq() && !(warned++)); 	\
+		while (__ms--) udelay(1000);		\
+	})
 
 #ifndef ndelay
 #define ndelay(x)	udelay(((x)+999)/1000)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-12 20:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-12 20:51 warn if we sleep in an irq for a long time Dave Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.