WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Update comments around spin_trylock() usa

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Update comments around spin_trylock() usage for sysctl and xenpf locks.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Apr 2010 21:50:18 -0700
Delivery-date: Sun, 18 Apr 2010 11:04:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Update comments around spin_trylock() usage for sysctl and xenpf locks., Xen patchbot-unstable <=