Patchwork [v6,40/46] powerpc: Use get/put_online_cpus_atomic() to prevent CPU offline

mail settings
Submitter Srivatsa S. Bhat
Date Feb. 18, 2013, 12:43 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/221297/
State Not Applicable
Delegated to: David Miller
Headers show


Srivatsa S. Bhat - Feb. 18, 2013, 12:43 p.m.
Once stop_machine() is gone from the CPU offline path, we won't be able to
depend on preempt_disable() or local_irq_disable() to prevent CPUs from
going offline from under us.

Use the get/put_online_cpus_atomic() APIs to prevent CPUs from going offline,
while invoking from atomic context.

Cc: Benjamin Herrenschmidt <>
Cc: Paul Mackerras <>
Signed-off-by: Srivatsa S. Bhat <>

 arch/powerpc/mm/mmu_context_nohash.c |    2 ++
 1 file changed, 2 insertions(+)

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at


diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index e779642..29f58cf 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -196,6 +196,7 @@  void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 	/* No lockless fast path .. yet */
+	get_online_cpus_atomic();
 	pr_hard("[%d] activating context for mm @%p, active=%d, id=%d",
 		cpu, next, next->, next->;
@@ -279,6 +280,7 @@  void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 	/* Flick the MMU and release lock */
 	pr_hardcont(" -> %d\n", id);
 	set_context(id, next->pgd);
+	put_online_cpus_atomic();