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

[Xen-changelog] [xen-unstable] acpi sleep: Must acquire hypercall_deadlock_mutex when a domain



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271333208 -3600
# Node ID fddff17c7c741d85a9a07c1cc3aa2e5921551175
# Parent  22339e54f0bb0ebceee90e9b39c896ff004c6a02
acpi sleep: Must acquire hypercall_deadlock_mutex when a domain
freezes its own vcpus.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/acpi/power.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff -r 22339e54f0bb -r fddff17c7c74 xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c Thu Apr 15 12:29:48 2010 +0100
+++ b/xen/arch/x86/acpi/power.c Thu Apr 15 13:06:48 2010 +0100
@@ -74,10 +74,13 @@ static void device_power_up(void)
     console_resume();
 }
 
-static void freeze_domains(void)
+static int freeze_domains(void)
 {
     struct domain *d;
     struct vcpu *v;
+
+    if ( !spin_trylock(&current->domain->hypercall_deadlock_mutex) )
+        return -EBUSY;
 
     rcu_read_lock(&domlist_read_lock);
     for_each_domain ( d )
@@ -91,6 +94,10 @@ static void freeze_domains(void)
         }
     }
     rcu_read_unlock(&domlist_read_lock);
+
+    spin_unlock(&current->domain->hypercall_deadlock_mutex);
+
+    return 0;
 }
 
 static void thaw_domains(void)
@@ -254,16 +261,22 @@ int acpi_enter_sleep(struct xenpf_enter_
 
     printk(XENLOG_INFO "Preparing system for ACPI S%d state.", state);
 
-    freeze_domains();
+    rc = freeze_domains();
+    if ( rc )
+        goto unlock_and_fail;
 
     rc = continue_hypercall_on_cpu(0, enter_state_helper, &acpi_sinfo);
     if ( rc )
     {
         /* Continuation will not execute: undo our own work so far. */
         thaw_domains();
-        spin_unlock(&pm_lock);
-    }
-
+        goto unlock_and_fail;
+    }
+
+    return 0;
+
+ unlock_and_fail:
+    spin_unlock(&pm_lock);
     return rc;
 }
 

_______________________________________________
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®.