xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 30/45] x86/xen: Use get/put_online_cpus_atomic() to prevent CPU offline
       [not found] <20130623133642.19094.16038.stgit@srivatsabhat.in.ibm.com>
@ 2013-06-23 13:44 ` Srivatsa S. Bhat
  0 siblings, 0 replies; only message in thread
From: Srivatsa S. Bhat @ 2013-06-23 13:44 UTC (permalink / raw)
  To: peterz, tj, oleg, paulmck, rusty, mingo, akpm, namhyung, walken,
	vincent.guittot, laijs
  Cc: linux-arch, Jeremy Fitzhardinge, x86, H. Peter Anvin, nikunj,
	zhong, linux-pm, fweisbec, Konrad Rzeszutek Wilk, linux-kernel,
	rostedt, xiaoguangrong, sbw, Ingo Molnar, wangyun, srivatsa.bhat,
	netdev, Thomas Gleixner, virtualization, linuxppc-dev, xen-devel

Once stop_machine() is gone from the CPU offline path, we won't be able
to depend on disabling preemption 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: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: xen-devel@lists.xensource.com
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/xen/mmu.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index fdc3ba2..3229c4f 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -39,6 +39,7 @@
  * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
  */
 #include <linux/sched.h>
+#include <linux/cpu.h>
 #include <linux/highmem.h>
 #include <linux/debugfs.h>
 #include <linux/bug.h>
@@ -1163,9 +1164,13 @@ static void xen_drop_mm_ref(struct mm_struct *mm)
  */
 static void xen_exit_mmap(struct mm_struct *mm)
 {
-	get_cpu();		/* make sure we don't move around */
+	/*
+	 * Make sure we don't move around, and also prevent CPUs from
+	 * going offline.
+	 */
+	get_online_cpus_atomic();
 	xen_drop_mm_ref(mm);
-	put_cpu();
+	put_online_cpus_atomic();
 
 	spin_lock(&mm->page_table_lock);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-23 13:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20130623133642.19094.16038.stgit@srivatsabhat.in.ibm.com>
2013-06-23 13:44 ` [PATCH 30/45] x86/xen: Use get/put_online_cpus_atomic() to prevent CPU offline Srivatsa S. Bhat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).