Module Name:    src
Committed By:   riastradh
Date:           Sat Jun 30 14:55:14 UTC 2018

Modified Files:
        src/sys/arch/xen/xen: xen_machdep.c

Log Message:
Use xcall to suspend/resume clocks on _all_ CPUs, not just current.

Compile-tested only -- kernel still runs but I haven't exercised this
code path.

By code inspection, this change or something like it is obviously
_necessary_ for Xen MP suspend/resume -- otherwise there's no logic
to suspend/resume the clocks on any CPU except the one that actually
triggers sysctl -w machdep.xen.suspend=1.

Whether this change is _sufficient_ for Xen MP suspend/resume to
work, I don't know.

ok cherry


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xen/xen_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.16 src/sys/arch/xen/xen/xen_machdep.c:1.17
--- src/sys/arch/xen/xen/xen_machdep.c:1.16	Sun Jun 24 20:28:58 2018
+++ src/sys/arch/xen/xen/xen_machdep.c	Sat Jun 30 14:55:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.16 2018/06/24 20:28:58 jdolecek Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.17 2018/06/30 14:55:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.16 2018/06/24 20:28:58 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.17 2018/06/30 14:55:13 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -279,6 +279,9 @@ sysctl_xen_suspend(SYSCTLFN_ARGS)
 
 }
 
+static xcfunc_t xen_suspendclocks_xc;
+static xcfunc_t xen_resumeclocks_xc;
+
 /*
  * Last operations before suspending domain
  */
@@ -289,7 +292,7 @@ xen_prepare_suspend(void)
 	kpreempt_disable();
 
 	pmap_xen_suspend();
-	xen_suspendclocks(curcpu());
+	xc_wait(xc_broadcast(0, &xen_suspendclocks_xc, NULL, NULL));
 
 	/*
 	 * save/restore code does not translate these MFNs to their
@@ -312,6 +315,15 @@ xen_prepare_suspend(void)
 
 }
 
+static void
+xen_suspendclocks_xc(void *a, void *b)
+{
+
+	kpreempt_disable();
+	xen_suspendclocks(curcpu());
+	kpreempt_enable();
+}
+
 /*
  * First operations before restoring domain context
  */
@@ -342,13 +354,22 @@ xen_prepare_resume(void)
 
 	xen_suspend_allow = false;
 
-	xen_resumeclocks(curcpu());
+	xc_wait(xc_broadcast(0, xen_resumeclocks_xc, NULL, NULL));
 
 	kpreempt_enable();
 
 }
 
 static void
+xen_resumeclocks_xc(void *a, void *b)
+{
+
+	kpreempt_disable();
+	xen_resumeclocks(curcpu());
+	kpreempt_enable();
+}
+
+static void
 xen_suspend_domain(void)
 {
 	paddr_t mfn;

Reply via email to