[PATCH] softirq: Fix warnings triggered by netconsole

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jarek Poplawski
Date: Wednesday, November 19, 2008 - 1:41 am

Consider netconsole case as special in local_bh_enable()/_disable().
This patch skips in_irq() and irqs_disabled() warnings for NETPOLL
configs when it's safe wrt. do_softirq().

Reported-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
[apply on top of my first softirq patch in this thread]

diff -Nurp a/kernel/softirq.c b/kernel/softirq.c
--- a/kernel/softirq.c	2008-11-19 07:33:23.000000000 +0000
+++ b/kernel/softirq.c	2008-11-19 07:26:28.000000000 +0000
@@ -76,7 +76,12 @@ static void __local_bh_disable(unsigned 
 {
 	unsigned long flags;
 
+#ifdef CONFIG_NETPOLL
+	if (!softirq_count())
+		WARN_ON_ONCE(in_irq());
+#else
 	WARN_ON_ONCE(in_irq());
+#endif
 
 	raw_local_irq_save(flags);
 	add_preempt_count(SOFTIRQ_OFFSET);
@@ -138,7 +143,16 @@ static inline void _local_bh_enable_ip(u
 #ifdef CONFIG_TRACE_IRQFLAGS
 	unsigned long flags;
 #endif
+#ifdef CONFIG_NETPOLL
+	/*
+	 * Special-case - netconsole runs network code with all interrupts
+	 * disabled. Warn only if it can be really dangerous:
+	 */
+	if (softirq_count() == SOFTIRQ_OFFSET)
+		WARN_ON_ONCE(in_irq() || irqs_disabled());
+#else
 	WARN_ON_ONCE(in_irq() || irqs_disabled());
+#endif
 #ifdef CONFIG_TRACE_IRQFLAGS
 	local_irq_save(flags);
 #endif
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
two warns on slowpath, Ferenc Wagner, (Thu Nov 6, 10:40 am)
[PATCH] softirq: Use local_irq_save() in local_bh_enable(), Jarek Poplawski, (Mon Nov 17, 6:35 am)
[PATCH] netconsole: Disable softirqs in write_msg(), Jarek Poplawski, (Wed Nov 19, 1:41 am)
[PATCH] softirq: Fix warnings triggered by netconsole, Jarek Poplawski, (Wed Nov 19, 1:41 am)
Re: [PATCH] netconsole: Disable softirqs in write_msg(), David Miller, (Wed Nov 19, 2:42 am)
Re: [PATCH] netconsole: Disable softirqs in write_msg(), David Miller, (Wed Nov 19, 3:10 am)
Re: [PATCH] netconsole: Disable softirqs in write_msg(), David Miller, (Wed Nov 19, 3:17 am)
Re: [PATCH] netconsole: Disable softirqs in write_msg(), David Miller, (Wed Nov 19, 3:22 am)
Re: [PATCH] softirq: Fix warnings triggered by netconsole, Jarek Poplawski, (Wed Nov 19, 4:07 am)