aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-12-10 00:04:45 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2022-06-21 15:13:20 +0000
commitdb761c6a649ce2ed988a4bd477e3c785e5a852a3 (patch)
tree1d4486ce9a3b88c017d045767378a32f55ddf107 /sys/dev/xen
parent14f7dd4744e4ff0e4447fb6b07aea24dbfbda31c (diff)
Create wrapper for Giant taken for newbus
Create a wrapper for newbus to take giant and for busses to take it too. bus_topo_lock() should be called before interacting with newbus routines and unlocked with bus_topo_unlock(). If you need the topology lock for some reason, bus_topo_mtx() will provide that. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31831 (cherry picked from commit c6df6f5322f7004c71216391e1c0b374d853704a)
Diffstat (limited to 'sys/dev/xen')
-rw-r--r--sys/dev/xen/control/control.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c
index a9738eeb7c2b..a2a50fec48a3 100644
--- a/sys/dev/xen/control/control.c
+++ b/sys/dev/xen/control/control.c
@@ -223,12 +223,11 @@ xctrl_suspend()
KASSERT((PCPU_GET(cpuid) == 0), ("Not running on CPU#0"));
/*
- * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
- * drivers need this.
+ * Be sure to hold Giant across DEVICE_SUSPEND/RESUME.
*/
- mtx_lock(&Giant);
+ bus_topo_lock();
if (DEVICE_SUSPEND(root_bus) != 0) {
- mtx_unlock(&Giant);
+ bus_topo_unlock();
printf("%s: device_suspend failed\n", __func__);
return;
}
@@ -299,7 +298,7 @@ xctrl_suspend()
* similar.
*/
DEVICE_RESUME(root_bus);
- mtx_unlock(&Giant);
+ bus_topo_unlock();
/*
* Warm up timecounter again and reset system clock.