]> git.baikalelectronics.ru Git - kernel.git/commit
xen-pcifront: Handle missed Connected state
authorJason Andryuk <jandryuk@gmail.com>
Mon, 29 Aug 2022 15:15:36 +0000 (11:15 -0400)
committerJuergen Gross <jgross@suse.com>
Tue, 4 Oct 2022 15:47:03 +0000 (17:47 +0200)
commit07031fa7c7ba73007b33b7703493ac3053f1178a
tree879b49c777c7a69e2ca26f2a0746b1d3e5a109ec
parentcd962d61087ba5774d85fb8749a1b9e527177ac7
xen-pcifront: Handle missed Connected state

An HVM guest with linux stubdomain and 2 PCI devices failed to start as
libxl timed out waiting for the PCI devices to be added.  It happens
intermittently but with some regularity.  libxl wrote the two xenstore
entries for the devices, but then timed out waiting for backend state 4
(Connected) - the state stayed at 7 (Reconfiguring).  (PCI passthrough
to an HVM with stubdomain is PV passthrough to the stubdomain and then
HVM passthrough with the QEMU inside the stubdomain.)

The stubdomain kernel never printed "pcifront pci-0: Installing PCI
frontend", so it seems to have missed state 4 which would have
called pcifront_try_connect() -> pcifront_connect_and_init_dma()

Have pcifront_detach_devices() special-case state Initialised and call
pcifront_connect_and_init_dma().  Don't use pcifront_try_connect()
because that sets the xenbus state which may throw off the backend.
After connecting, skip the remainder of detach_devices since none have
been initialized yet.  When the backend switches to Reconfigured,
pcifront_attach_devices() will pick them up again.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20220829151536.8578-1-jandryuk@gmail.com
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/pci/xen-pcifront.c