File linux-2.6-debug-sleep-in-irq-warning.patch of Package kernel
warn if we sleep in an irq for a long time.
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
@@ -26,9 +26,13 @@ extern unsigned long loops_per_jiffy;
#endif
#ifndef mdelay
-#define mdelay(n) (\
- (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
- ({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
+#define mdelay(n) ( \
+{ \
+ static int warned=0; \
+ unsigned long __ms=(n); \
+ WARN_ON(in_irq() && !(warned++)); \
+ while (__ms--) udelay(1000); \
+})
#endif
#ifndef ndelay