summaryrefslogtreecommitdiffstats
path: root/sys/dev/xen/control/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/xen/control/control.c')
-rw-r--r--sys/dev/xen/control/control.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c
index c03d536..bc59fa0 100644
--- a/sys/dev/xen/control/control.c
+++ b/sys/dev/xen/control/control.c
@@ -173,8 +173,6 @@ static struct xctrl_shutdown_reason xctrl_shutdown_reasons[] = {
};
struct xctrl_softc {
-
- /** Must be first */
struct xs_watch xctrl_watch;
};
@@ -203,24 +201,29 @@ xctrl_suspend()
unsigned long max_pfn, start_info_mfn;
#ifdef SMP
- cpumask_t map;
+ struct thread *td;
+ cpuset_t map;
/*
* Bind us to CPU 0 and stop any other VCPUs.
*/
- thread_lock(curthread);
- sched_bind(curthread, 0);
- thread_unlock(curthread);
+ td = curthread;
+ thread_lock(td);
+ sched_bind(td, 0);
+ thread_unlock(td);
KASSERT(PCPU_GET(cpuid) == 0, ("xen_suspend: not running on cpu 0"));
- map = PCPU_GET(other_cpus) & ~stopped_cpus;
- if (map)
+ sched_pin();
+ map = PCPU_GET(other_cpus);
+ sched_unpin();
+ CPU_NAND(&map, &stopped_cpus);
+ if (!CPU_EMPTY(&map))
stop_cpus(map);
#endif
if (DEVICE_SUSPEND(root_bus) != 0) {
printf("xen_suspend: device_suspend failed\n");
#ifdef SMP
- if (map)
+ if (!CPU_EMPTY(&map))
restart_cpus(map);
#endif
return;
@@ -289,7 +292,7 @@ xctrl_suspend()
thread_lock(curthread);
sched_unbind(curthread);
thread_unlock(curthread);
- if (map)
+ if (!CPU_EMPTY(&map))
restart_cpus(map);
#endif
}
@@ -445,6 +448,7 @@ xctrl_attach(device_t dev)
/* Activate watch */
xctrl->xctrl_watch.node = "control/shutdown";
xctrl->xctrl_watch.callback = xctrl_on_watch_event;
+ xctrl->xctrl_watch.callback_data = (uintptr_t)xctrl;
xs_register_watch(&xctrl->xctrl_watch);
#ifndef XENHVM
OpenPOWER on IntegriCloud