mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
acpi sleep: Must acquire hypercall_deadlock_mutex when a domain
freezes its own vcpus. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This commit is contained in:
1 parent
d8ffa3fa6b
commit
37cd685b75
1 file changed
+16
-3
@@ -74,11 +74,14 @@ 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(¤t->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(¤t->domain->hypercall_deadlock_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void thaw_domains(void)
|
||||
@@ -254,16 +261,22 @@ int acpi_enter_sleep(struct xenpf_enter_acpi_sleep *sleep)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||