Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
xen/manage: Always freeze/thaw processes when suspend/resuming
Browse files Browse the repository at this point in the history
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: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: stable@vger.kernel.org
  • Loading branch information
rosslagerwall authored and David Vrabel committed Sep 2, 2014
1 parent 7d951f3 commit 61a734d
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,11 @@ static void do_suspend(void)

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();
if (err) {
pr_err("%s: freeze failed %d\n", __func__, err);
goto out;
}
#endif

err = dpm_suspend_start(PMSG_FREEZE);
if (err) {
Expand Down Expand Up @@ -157,10 +152,8 @@ static void do_suspend(void)
dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE);

out_thaw:
#ifdef CONFIG_PREEMPT
thaw_processes();
out:
#endif
shutting_down = SHUTDOWN_INVALID;
}
#endif /* CONFIG_HIBERNATE_CALLBACKS */
Expand Down

0 comments on commit 61a734d

Please sign in to comment.