From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 0/4] pci: bridges: cleanup and hotplug fix
Date: Mon, 7 Sep 2026 14:41:46 +0200 [thread overview]
Message-ID: <20260907124335.2822329-1-d.csapak@proxmox.com> (raw)
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
next reply other threads:[~2026-09-07 12:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 12:41 Dominik Csapak [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260907124335.2822329-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox