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

[Xen-changelog] [xen-unstable] Update comments around spin_trylock() usage for sysctl and xenpf locks.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271327619 -3600
# Node ID 85ab727868ea68bef59947f676f03a1669a83fae
# Parent  6eda8033bb6dfdb72aa8041425b9b55daca69085
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@xxxxxxxxxx>
---
 xen/arch/x86/platform_hypercall.c |    6 +++++-
 xen/common/sysctl.c               |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff -r 6eda8033bb6d -r 85ab727868ea xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Thu Apr 15 11:31:58 2010 +0100
+++ b/xen/arch/x86/platform_hypercall.c Thu Apr 15 11:33:39 2010 +0100
@@ -73,7 +73,11 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
     if ( op->interface_version != XENPF_INTERFACE_VERSION )
         return -EACCES;
 
-    /* spin_trylock() avoids deadlock with stop_machine_run(). */
+    /*
+     * Trylock here avoids deadlock with an existing platform critical section
+     * which might (for some current or future reason) want to synchronise
+     * with this vcpu.
+     */
     while ( !spin_trylock(&xenpf_lock) )
         if ( hypercall_preempt_check() )
             return hypercall_create_continuation(
diff -r 6eda8033bb6d -r 85ab727868ea xen/common/sysctl.c
--- a/xen/common/sysctl.c       Thu Apr 15 11:31:58 2010 +0100
+++ b/xen/common/sysctl.c       Thu Apr 15 11:33:39 2010 +0100
@@ -48,7 +48,11 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
     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(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.