Skip to content

Commit

Permalink
xen: don't hang when resuming PCI device
Browse files Browse the repository at this point in the history
If a xen domain with at least two VCPUs has a PCI device attached which
enters the D3hot state during suspend, the kernel may hang while
resuming, depending on the core on which an async resume task gets
scheduled.

The bug occurs because xen's do_suspend calls dpm_resume_start while
only the timer of the boot CPU has been resumed (when xen_suspend called
syscore_resume), before calling xen_arch_suspend to resume the timers of
the other CPUs. This breaks pci_dev_d3_sleep.

Thus this patch moves the call to xen_arch_resume before the call to
dpm_resume_start, eliminating the hangs and restoring the stack-like
structure of the suspend/restore procedure.

Signed-off-by: Jakub Kądziołka <niedzejkob@invisiblethingslab.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20220323012103.2537-1-niedzejkob@invisiblethingslab.com
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
  • Loading branch information
meithecatte authored and Boris Ostrovsky committed Mar 25, 2022
1 parent 309b517 commit ff32baa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ static void do_suspend(void)

raw_notifier_call_chain(&xen_resume_notifier, 0, NULL);

xen_arch_resume();

dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE);

if (err) {
pr_err("failed to start xen_suspend: %d\n", err);
si.cancelled = 1;
}

xen_arch_resume();

out_resume:
if (!si.cancelled)
xs_resume();
Expand Down

0 comments on commit ff32baa

Please sign in to comment.