public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH qemu-server v2 0/4] pci: bridges: cleanup and hotplug fix
@ 2026-09-07 12:41 Dominik Csapak
  2026-09-07 12:41 ` [PATCH qemu-server v2 1/4] tests: add test with q35 and scsihw2 Dominik Csapak
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-09-07 12:41 UTC (permalink / raw)
  To: pve-devel

Main motivation for this series was a defect in how we handle
hotplugging certain devices:

When e.g. adding scsi15 on a vm with i440fx + lsi controller, we'd need
scsihw2 (since only 7 devices can live on scsihw0 and scsihw1
respectively) which sits on bus pci.4. This itself is not added by
default to the config, so we tried to hotplug the bridge. This works,
but without SHPC (which is neither the default, nor does it work
reliably in all guests) one cannot hot-plug anything into a hot-plugged
bridge. So when hotplugging scsi15 in this example, we'd hot-plug
pci.4, but adding scsihw2 would fail and leave the disk in 'pending'.

When now a live-migration is initiated, the already added bridge is
never recorded in the config, and the guest crashes on the remote
after it's resumed.

Since this is a rather narrow case, I'd opted for preventing
hot-plugging bridges completely.

Further I tried to refactor and  cleanup the bridge adding code a bit,
so we don't have to pass the 'bridges' hash around anymore. (patch 4/4)

To be sure, I added two tests for cases we didn't cover yet. (patches 1
and 2, these could be applied anyway since they just test the status
quo).

Further improvement could be to always add pci.4 with the next machine
version, but this can be done as a follow up or separate series later
too.

changes from v1:
* updated a few callsites of methods which removed the bridges parameter
  which i originally forgot (used 'undef' as that parameter)
* added a fixes trailer for the hotplug commit
* use hostpci_fmt schema to check legacy-igd. parsing twice is not
  optimal, but it's only 16 lines and we can improve upon that later too

Dominik Csapak (4):
  tests: add test with q35 and scsihw2
  tests: add test for legacy-igd passthrough
  pci: don't try to hotplug bridges
  pci: bridges: add bridges to devices up front

 src/PVE/QemuServer.pm                         | 117 +++++-------------
 src/PVE/QemuServer/Drive.pm                   |   2 +-
 src/PVE/QemuServer/DriveDevice.pm             |  23 +++-
 src/PVE/QemuServer/PCI.pm                     |  71 ++++++++++-
 src/PVE/QemuServer/RNG.pm                     |   4 +-
 src/PVE/QemuServer/USB.pm                     |   8 +-
 .../cfg2cmd/linux-hostpci-legacy-igd.conf     |  16 +++
 .../cfg2cmd/linux-hostpci-legacy-igd.conf.cmd |  38 ++++++
 src/test/cfg2cmd/q35-scsihw2.conf             |  13 ++
 src/test/cfg2cmd/q35-scsihw2.conf.cmd         |  37 ++++++
 src/test/run_config2command_tests.pl          |   1 +
 11 files changed, 233 insertions(+), 97 deletions(-)
 create mode 100644 src/test/cfg2cmd/linux-hostpci-legacy-igd.conf
 create mode 100644 src/test/cfg2cmd/linux-hostpci-legacy-igd.conf.cmd
 create mode 100644 src/test/cfg2cmd/q35-scsihw2.conf
 create mode 100644 src/test/cfg2cmd/q35-scsihw2.conf.cmd

-- 
2.47.3





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-08 13:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 12:41 [PATCH qemu-server v2 0/4] pci: bridges: cleanup and hotplug fix Dominik Csapak
2026-09-07 12:41 ` [PATCH qemu-server v2 1/4] tests: add test with q35 and scsihw2 Dominik Csapak
2026-09-07 12:41 ` [PATCH qemu-server v2 2/4] tests: add test for legacy-igd passthrough Dominik Csapak
2026-09-07 12:41 ` [PATCH qemu-server v2 3/4] pci: don't try to hotplug bridges Dominik Csapak
2026-09-08  9:59   ` Fiona Ebner
2026-09-07 12:41 ` [PATCH qemu-server v2 4/4] pci: bridges: add bridges to devices up front Dominik Csapak
2026-09-08  9:59   ` Fiona Ebner
2026-09-08  9:59 ` partially-applied: [PATCH qemu-server v2 0/4] pci: bridges: cleanup and hotplug fix Fiona Ebner
2026-09-08 13:58 ` superseded: " Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal