On Fri, Apr 22, 2022 at 10:07:03AM -0400, Jason Andryuk wrote: > PCI device assignment to an HVM with stubdom is potentially racy. First > the PCI device is assigned to the stubdom via the PV PCI protocol. Then > QEMU is sent a QMP command to attach the PCI device to QEMU running > within the stubdom. However, the sysfs entries within the stubdom may > not have appeared by the time QEMU receives the device_add command > resulting in errors like: > > libxl_qmp.c:1838:qmp_ev_parse_error_messages:Domain 10:Could not open > '/sys/bus/pci/devices/0000:00:1f.3/config': No such file or directory > > This patch retries the device assignment up to 10 times with a 1 second > delay between. That roughly matches the overall hotplug timeout for > pci_add_timeout. pci_add_timeout's initialization is moved to > do_pci_add since retries call into pci_add_qmp_device_add again. > > The qmp_ev_parse_error_messages error is still printed since it happens > at a lower level than the pci code controlling the retries. With that, > the "Retrying PCI add %d" message is also printed at ERROR level to > clarify what is happening. > > Signed-off-by: Jason Andryuk <jandr...@gmail.com> > --- > v2: > Only retry when a stubdom is present. > Move pci_add_timeout initialization. > Use pas->aodev->ao directly.
Reviewed-by: Anthony PERARD <anthony.per...@citrix.com> Thanks, -- Anthony PERARD