mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	David Miller <davem@davemloft.net>, Ferenc Wagner <wferi@niif.hu>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] softirq: Fix warnings triggered by netconsole
Date: Wed, 19 Nov 2008 08:41:26 +0000	[thread overview]
Message-ID: <20081119084125.GB6699@ff.dom.local> (raw)
In-Reply-To: <87y6zwwy5c.fsf@tac.ki.iif.hu>

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

  parent reply	other threads:[~2008-11-19  8:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87y6zwwy5c.fsf@tac.ki.iif.hu>
2008-11-17 13:35 ` [PATCH] softirq: Use local_irq_save() in local_bh_enable() Jarek Poplawski
2008-11-17 14:18   ` Johannes Berg
2008-11-18  7:49     ` Jarek Poplawski
2008-11-17 16:16   ` Ingo Molnar
2008-11-18  7:38     ` Jarek Poplawski
2008-11-19  8:41 ` [PATCH] netconsole: Disable softirqs in write_msg() Jarek Poplawski
2008-11-19  9:30   ` Ingo Molnar
2008-11-19  9:42     ` David Miller
2008-11-19 10:14       ` Ingo Molnar
2008-11-19 10:17         ` David Miller
2008-11-19 10:21           ` Ingo Molnar
2008-11-19 10:22             ` David Miller
2008-11-19 10:10   ` David Miller
2008-11-19  8:41 ` Jarek Poplawski [this message]
2008-11-19  9:32   ` [PATCH] softirq: Fix warnings triggered by netconsole Ingo Molnar
2008-11-19 11:07     ` Jarek Poplawski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081119084125.GB6699@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=wferi@niif.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®