All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Tejun Heo <tj@kernel.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	torvalds@linux-foundation.org, penberg@kernel.org,
	peterz@infradead.org, tj@kernel.org, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:core/urgent] smp: Allow on_each_cpu() to be called while early_boot_irqs_disabled status to init/main.c
Date: Thu, 20 Jan 2011 20:22:06 GMT	[thread overview]
Message-ID: <tip-bd924e8cbd4b73ffb7d707a774c04f7e2cae88ed@git.kernel.org> (raw)
In-Reply-To: <20110120110713.GC6036@htj.dyndns.org>

Commit-ID:  bd924e8cbd4b73ffb7d707a774c04f7e2cae88ed
Gitweb:     http://git.kernel.org/tip/bd924e8cbd4b73ffb7d707a774c04f7e2cae88ed
Author:     Tejun Heo <tj@kernel.org>
AuthorDate: Thu, 20 Jan 2011 12:07:13 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 20 Jan 2011 13:32:34 +0100

smp: Allow on_each_cpu() to be called while early_boot_irqs_disabled status to init/main.c

percpu may end up calling vfree() during early boot which in
turn may call on_each_cpu() for TLB flushes.  The function of
on_each_cpu() can be done safely while IRQ is disabled during
early boot but it assumed that the function is always called
with local IRQ enabled which ended up enabling local IRQ
prematurely during boot and triggering a couple of warnings.

This patch updates on_each_cpu() and smp_call_function_many()
such on_each_cpu() can be used safely while
early_boot_irqs_disabled is set.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <20110120110713.GC6036@htj.dyndns.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Reported-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/smp.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 4ec30e0..4b83cd6 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -430,7 +430,7 @@ void smp_call_function_many(const struct cpumask *mask,
 	 * can't happen.
 	 */
 	WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled()
-		     && !oops_in_progress);
+		     && !oops_in_progress && !early_boot_irqs_disabled);
 
 	/* So, what's a CPU they want? Ignoring this one. */
 	cpu = cpumask_first_and(mask, cpu_online_mask);
@@ -533,17 +533,20 @@ void ipi_call_unlock_irq(void)
 #endif /* USE_GENERIC_SMP_HELPERS */
 
 /*
- * Call a function on all processors
+ * Call a function on all processors.  May be used during early boot while
+ * early_boot_irqs_disabled is set.  Use local_irq_save/restore() instead
+ * of local_irq_disable/enable().
  */
 int on_each_cpu(void (*func) (void *info), void *info, int wait)
 {
+	unsigned long flags;
 	int ret = 0;
 
 	preempt_disable();
 	ret = smp_call_function(func, info, wait);
-	local_irq_disable();
+	local_irq_save(flags);
 	func(info);
-	local_irq_enable();
+	local_irq_restore(flags);
 	preempt_enable();
 	return ret;
 }

  reply	other threads:[~2011-01-20 20:23 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 23:54 Linux 2.6.38-rc1 Linus Torvalds
2011-01-19  2:07 ` Linus Torvalds
2011-01-19  3:42   ` Justin Mattock
2011-01-19  3:53     ` Linus Torvalds
2011-01-19  4:05       ` Justin Mattock
2011-01-19  5:10       ` nobody
2011-01-19  5:42         ` Linus Torvalds
2011-01-19  5:56           ` Linus Torvalds
2011-01-19 18:07             ` Steven Rostedt
2011-01-19 18:26               ` Linus Torvalds
2011-01-21  3:23           ` tag&track [Re: Linux 2.6.38-rc1] nobody
2011-01-21  8:24             ` Alexey Dobriyan
2011-01-23  8:13   ` Linux 2.6.38-rc1 Török Edwin
2011-01-19  7:39 ` Linux 2.6.38-rc1 doesn't boot Markus Trippelsdorf
2011-01-19  7:46   ` Shaohua Li
2011-01-19  7:55     ` Markus Trippelsdorf
2011-01-19  7:49   ` Markus Trippelsdorf
2011-01-19  8:12     ` Shaohua Li
2011-01-19  8:56       ` H. Peter Anvin
2011-01-19  9:09         ` Ingo Molnar
2011-01-20  2:08           ` Shaohua Li
2011-01-20  3:32             ` Lu, Hongjiu
2011-01-20 11:25             ` Ingo Molnar
2011-01-20 15:08               ` Anvin, H Peter
2011-01-21  7:18                 ` Shaohua Li
2011-01-21  7:55                   ` Shaohua Li
2011-01-21 15:28                   ` H. Peter Anvin
2011-01-21 15:37                     ` Lu, Hongjiu
2011-01-21 21:09                       ` Ingo Molnar
2011-01-19  9:33         ` [tip:x86/urgent] Revert "x86: Make relocatable kernel work with new binutils" tip-bot for Ingo Molnar
2011-01-20  4:59     ` Linux 2.6.38-rc1 doesn't boot Alexandre Courbot
2011-01-19  8:39 ` PPS parport boot lockup: INFO: HARDIRQ-READ-safe -> HARDIRQ-READ-unsafe lock order detected Ingo Molnar
2011-01-20 13:04   ` Alexander Gordeev
2011-01-21 14:44   ` Alexander Gordeev
2011-01-21 16:37     ` Linus Torvalds
2011-01-21 19:43       ` Ingo Molnar
2011-01-24 23:28         ` Alexander Gordeev
2011-01-24 23:46         ` [PATCH] pps: claim parallel port exclusively Alexander Gordeev
2011-01-25  0:19           ` Ingo Molnar
2011-01-24 15:00       ` PPS parport boot lockup: INFO: HARDIRQ-READ-safe -> HARDIRQ-READ-unsafe lock order detected Alexander Gordeev
2011-01-24 15:12   ` [PATCH] parport: make lockdep happy with waitlist_lock Alexander Gordeev
2011-01-24 15:28     ` Ingo Molnar
2011-01-24 15:33       ` Alexander Gordeev
2011-01-19 12:02 ` percpu related boot crash on x86 (was: Linux 2.6.38-rc1) Ingo Molnar
2011-01-19 12:44   ` Tejun Heo
2011-01-19 12:48   ` Peter Zijlstra
2011-01-19 12:56     ` Pekka Enberg
2011-01-19 13:12       ` Peter Zijlstra
2011-01-19 13:13       ` Tejun Heo
2011-01-19 20:53         ` Ingo Molnar
2011-01-19 23:11           ` Ingo Molnar
2011-01-20  8:31             ` percpu related boot crash on x86 Pekka Enberg
2011-01-20 10:47               ` Peter Zijlstra
2011-01-20 11:12                 ` Eric Dumazet
2011-01-20 11:19                   ` Tejun Heo
2011-01-20 11:06   ` [PATCH 1/2] lockdep: move early boot local IRQ enable/disable status to init/main.c Tejun Heo
2011-01-20 11:07     ` [PATCH 2/2] smp: allow on_each_cpu() to be called while early_boot_irqs_disabled " Tejun Heo
2011-01-20 20:22       ` tip-bot for Tejun Heo [this message]
2011-01-20 11:11     ` [PATCH 1/2] lockdep: move early boot local IRQ enable/disable " Tejun Heo
2011-01-20 11:23       ` Peter Zijlstra
2011-01-20 11:26         ` Tejun Heo
2011-01-20 11:30           ` Pekka Enberg
2011-01-20 11:38           ` Peter Zijlstra
2011-01-20 12:00       ` Ingo Molnar
2011-01-20 12:20         ` [PATCH UPDATED " Tejun Heo
2011-01-20 11:51     ` [PATCH " Ingo Molnar
2011-01-20 20:21     ` [tip:core/urgent] lockdep: Move " tip-bot for Tejun Heo
2011-01-19 21:40 ` Linux 2.6.38-rc1 Alan Cox
2011-01-21 15:30   ` Aaro Koskinen

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=tip-bd924e8cbd4b73ffb7d707a774c04f7e2cae88ed@git.kernel.org \
    --to=tj@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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 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.