mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: <linux-kernel@vger.kernel.org>
Cc: "Andi Kleen" <andi@firstfloor.org>
Subject: [PATCH] eliminate spurious pointless WARN_ON()s
Date: Thu, 12 Mar 2009 12:16:33 +0000	[thread overview]
Message-ID: <49B90B31.76E4.0078.0@novell.com> (raw)

Namely during early boot, the panic() or BUG() paths may end up in
smp_call_function_*() with just a single online CPU. In that situation
the warnings generated are not only meaningless, but also result in
relevant output being cluttered.

Therefore, defer the WARN_ON() checks until after the (unaffected from
the problem that is being attempted to be detected here) cases have
been handled.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Andi Kleen <andi@firstfloor.org>

---
 kernel/smp.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- linux-2.6.29-rc7/kernel/smp.c	2009-03-04 09:11:00.000000000 +0100
+++ 2.6.29-rc7-smp-call-defer-warn/kernel/smp.c	2009-02-13 12:17:02.000000000 +0100
@@ -222,9 +222,6 @@ int smp_call_function_single(int cpu, vo
 	int me = get_cpu();
 	int err = 0;
 
-	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
-
 	if (cpu == me) {
 		local_irq_save(flags);
 		func(info);
@@ -232,6 +229,9 @@ int smp_call_function_single(int cpu, vo
 	} else if ((unsigned)cpu < nr_cpu_ids && cpu_online(cpu)) {
 		struct call_single_data *data;
 
+		/* Can deadlock when called with interrupts disabled */
+		WARN_ON(irqs_disabled());
+
 		if (!wait) {
 			/*
 			 * We are calling a function on a single CPU
@@ -325,9 +325,6 @@ void smp_call_function_many(const struct
 	unsigned long flags;
 	int cpu, next_cpu;
 
-	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
-
 	/* So, what's a CPU they want?  Ignoring this one. */
 	cpu = cpumask_first_and(mask, cpu_online_mask);
 	if (cpu == smp_processor_id())
@@ -347,6 +344,9 @@ void smp_call_function_many(const struct
 		return;
 	}
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data = kmalloc(sizeof(*data) + cpumask_size(), GFP_ATOMIC);
 	if (unlikely(!data)) {
 		/* Slow path. */




             reply	other threads:[~2009-03-12 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 12:16 Jan Beulich [this message]
2009-03-12 12:19 ` Ingo Molnar

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=49B90B31.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®