xen: don't hang when resuming PCI device
authorJakub Kądziołka <niedzejkob@invisiblethingslab.com>
Wed, 23 Mar 2022 01:21:03 +0000 (02:21 +0100)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 25 Mar 2022 19:22:15 +0000 (14:22 -0500)
commitff32baa1f39b1adb519479a51e7acbcbfdd2206c
treea0f939e111048f10f935bcf6cdb45a2c45821154
parent309b517276f21dc7e6315c6637792f8bbfdf7ec4
xen: don't hang when resuming PCI device

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>
drivers/xen/manage.c