Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen Use xcall to suspend/resume clocks on _all_...



details:   https://anonhg.NetBSD.org/src/rev/ff7e1c1af96d
branches:  trunk
changeset: 362881:ff7e1c1af96d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jun 30 14:55:13 2018 +0000

description:
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

diffstat:

 sys/arch/xen/xen/xen_machdep.c |  29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diffs (77 lines):

diff -r 0b0466e32c75 -r ff7e1c1af96d sys/arch/xen/xen/xen_machdep.c
--- a/sys/arch/xen/xen/xen_machdep.c    Sat Jun 30 14:21:19 2018 +0000
+++ b/sys/arch/xen/xen/xen_machdep.c    Sat Jun 30 14:55:13 2018 +0000
@@ -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 @@
 
 }
 
+static xcfunc_t xen_suspendclocks_xc;
+static xcfunc_t xen_resumeclocks_xc;
+
 /*
  * Last operations before suspending domain
  */
@@ -289,7 +292,7 @@
        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 @@
 
 }
 
+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_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;



Home | Main Index | Thread Index | Old Index