aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/sysctl.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-04-15 11:33:39 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-04-15 11:33:39 +0100
commit86cd882200f54655c553c40341cd8ab3ecf378ad (patch)
tree2386ccfe170580b1af61061f05cb44d47ff5610f /xen/common/sysctl.c
parentdcc9060e4a4a7bb6287ca346580529c8d803c780 (diff)
downloadxen-86cd882200f54655c553c40341cd8ab3ecf378ad.tar.gz
xen-86cd882200f54655c553c40341cd8ab3ecf378ad.tar.bz2
xen-86cd882200f54655c553c40341cd8ab3ecf378ad.zip
Update comments around spin_trylock() usage for sysctl and xenpf locks.
Since the execution of stop_machine_run() via cpu_down() is now always deferred to a hypercall continuation context, the above locks are not held at that time. Hence the trylock is not specifically to avoid deadlock with stop_machine_run(), but rather a more general paranoia about deadlocks in general. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/sysctl.c')
-rw-r--r--xen/common/sysctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index ba16353266..db27fc233c 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -48,7 +48,11 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
if ( op->interface_version != XEN_SYSCTL_INTERFACE_VERSION )
return -EACCES;
- /* spin_trylock() avoids deadlock with stop_machine_run(). */
+ /*
+ * Trylock here avoids deadlock with an existing sysctl critical section
+ * which might (for some current or future reason) want to synchronise
+ * with this vcpu.
+ */
while ( !spin_trylock(&sysctl_lock) )
if ( hypercall_preempt_check() )
return hypercall_create_continuation(