Commit 11d3b506 authored by Ross Lagerwall's avatar Ross Lagerwall Committed by Ben Hutchings

xen/manage: Always freeze/thaw processes when suspend/resuming

commit 61a734d3 upstream.

Always freeze processes when suspending and thaw processes when resuming
to prevent a race noticeable with HVM guests.

This prevents a deadlock where the khubd kthread (which is designed to
be freezable) acquires a usb device lock and then tries to allocate
memory which requires the disk which hasn't been resumed yet.
Meanwhile, the xenwatch thread deadlocks waiting for the usb device
lock.

Freezing processes fixes this because the khubd thread is only thawed
after the xenwatch thread finishes resuming all the devices.
Signed-off-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent dd27db6d
...@@ -108,16 +108,11 @@ static void do_suspend(void) ...@@ -108,16 +108,11 @@ static void do_suspend(void)
shutting_down = SHUTDOWN_SUSPEND; shutting_down = SHUTDOWN_SUSPEND;
#ifdef CONFIG_PREEMPT
/* If the kernel is preemptible, we need to freeze all the processes
to prevent them from being in the middle of a pagetable update
during suspend. */
err = freeze_processes(); err = freeze_processes();
if (err) { if (err) {
printk(KERN_ERR "xen suspend: freeze failed %d\n", err); printk(KERN_ERR "xen suspend: freeze failed %d\n", err);
goto out; goto out;
} }
#endif
err = dpm_suspend_start(PMSG_FREEZE); err = dpm_suspend_start(PMSG_FREEZE);
if (err) { if (err) {
...@@ -172,10 +167,8 @@ static void do_suspend(void) ...@@ -172,10 +167,8 @@ static void do_suspend(void)
clock_was_set(); clock_was_set();
out_thaw: out_thaw:
#ifdef CONFIG_PREEMPT
thaw_processes(); thaw_processes();
out: out:
#endif
shutting_down = SHUTDOWN_INVALID; shutting_down = SHUTDOWN_INVALID;
} }
#endif /* CONFIG_HIBERNATE_CALLBACKS */ #endif /* CONFIG_HIBERNATE_CALLBACKS */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment