public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v3 0/8] pci: bridges: cleanup and hotplug fix
Date: Tue,  8 Sep 2026 15:52:00 +0200	[thread overview]
Message-ID: <20260908135729.3869365-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.

This version adds a few more cleanup/maintenance patches and tests, but
they should be relatively self-explaining.

changes from v2:
* rebase on master
* improve wording and commit message/subject
* add new tests and factor out some changes
* rename qemu_add_pci_bridges to assert_pci_bridge_present and remove
  its now unneeded parameters (and the unnecessary variable in the
  vm_deviceplug)
* rename get_bridges to get_pci_bridges to make it clear its virtual
  hardware related
* rename get_bridge_for device to get_pci_bridge_for_device to be
  consistent
* new patch that increases the minimum machine version to 5.0
  (was already technically enforced by qemu, just not by our code)
* new patch to add pci.4 by default starting with machine version 11.1
* surely some things i forgot to write down...

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 (8):
  tests: cfg2cmd: add test for ivshmem with q35
  tests: cfg2cmd: add q35 + win7 + hostpci test
  code cleanup: pci: don't export print_pcie_root_port
  code cleanup: hot-plug: simplify getting bridge for device
  hotplug: don't try to hotplug bridges
  cfg2cmd: reject guests with machine version below 5.0
  cfg2cmd: pci: add bridges to device list up front
  cfg2cmd: pci: add pci.4 by default starting with machine version 11.1

 src/PVE/QemuServer.pm                         | 134 ++++++------------
 src/PVE/QemuServer/Drive.pm                   |   2 +-
 src/PVE/QemuServer/DriveDevice.pm             |  23 ++-
 src/PVE/QemuServer/PCI.pm                     |  68 ++++++++-
 src/PVE/QemuServer/RNG.pm                     |   4 +-
 src/PVE/QemuServer/USB.pm                     |   8 +-
 src/test/cfg2cmd/efi-raw-old.conf             |   4 +-
 src/test/cfg2cmd/efi-raw-old.conf.cmd         |   4 +-
 src/test/cfg2cmd/linux-bridges-qemu-11.1.conf |  14 ++
 .../cfg2cmd/linux-bridges-qemu-11.1.conf.cmd  |  36 +++++
 .../old-unsupported-machine-version.conf      |   4 +
 src/test/cfg2cmd/pinned-version-pxe-pve.conf  |   2 +-
 .../cfg2cmd/pinned-version-pxe-pve.conf.cmd   |   2 +-
 src/test/cfg2cmd/pinned-version.conf          |   2 +-
 src/test/cfg2cmd/pinned-version.conf.cmd      |   4 +-
 src/test/cfg2cmd/q35-linux-ivshmem.conf       |  13 ++
 src/test/cfg2cmd/q35-linux-ivshmem.conf.cmd   |  35 +++++
 src/test/cfg2cmd/q35-usb13-error.conf         |   2 +-
 src/test/cfg2cmd/q35-usb2.conf                |   2 +-
 src/test/cfg2cmd/q35-usb2.conf.cmd            |   4 +-
 src/test/cfg2cmd/q35-usb3.conf                |   2 +-
 src/test/cfg2cmd/q35-usb3.conf.cmd            |   4 +-
 src/test/cfg2cmd/q35-win7-hostpci.conf        |  17 +++
 src/test/cfg2cmd/q35-win7-hostpci.conf.cmd    |  37 +++++
 src/test/cfg2cmd/spice-enhancments.conf       |   2 +-
 src/test/cfg2cmd/spice-enhancments.conf.cmd   |   4 +-
 ...ce-linux-4.1.conf => spice-linux-5.0.conf} |   2 +-
 ...-4.1.conf.cmd => spice-linux-5.0.conf.cmd} |   2 +-
 src/test/cfg2cmd/spice-usb3.conf              |   2 +-
 src/test/cfg2cmd/spice-usb3.conf.cmd          |   4 +-
 src/test/cfg2cmd/spice-win.conf               |   2 +-
 src/test/cfg2cmd/spice-win.conf.cmd           |   2 +-
 src/test/cfg2cmd/usb13-error.conf             |   2 +-
 33 files changed, 316 insertions(+), 133 deletions(-)
 create mode 100644 src/test/cfg2cmd/linux-bridges-qemu-11.1.conf
 create mode 100644 src/test/cfg2cmd/linux-bridges-qemu-11.1.conf.cmd
 create mode 100644 src/test/cfg2cmd/old-unsupported-machine-version.conf
 create mode 100644 src/test/cfg2cmd/q35-linux-ivshmem.conf
 create mode 100644 src/test/cfg2cmd/q35-linux-ivshmem.conf.cmd
 create mode 100644 src/test/cfg2cmd/q35-win7-hostpci.conf
 create mode 100644 src/test/cfg2cmd/q35-win7-hostpci.conf.cmd
 rename src/test/cfg2cmd/{spice-linux-4.1.conf => spice-linux-5.0.conf} (92%)
 rename src/test/cfg2cmd/{spice-linux-4.1.conf.cmd => spice-linux-5.0.conf.cmd} (97%)

-- 
2.47.3





             reply	other threads:[~2026-09-08 13:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 13:52 Dominik Csapak [this message]
2026-09-08 13:52 ` [PATCH qemu-server v3 1/8] tests: cfg2cmd: add test for ivshmem with q35 Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 2/8] tests: cfg2cmd: add q35 + win7 + hostpci test Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 3/8] code cleanup: pci: don't export print_pcie_root_port Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 4/8] code cleanup: hot-plug: simplify getting bridge for device Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 5/8] hotplug: don't try to hotplug bridges Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 6/8] cfg2cmd: reject guests with machine version below 5.0 Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 7/8] cfg2cmd: pci: add bridges to device list up front Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 8/8] cfg2cmd: pci: add pci.4 by default starting with machine version 11.1 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=20260908135729.3869365-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal