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 0/4] pci: bridges: cleanup and hotplug fix
Date: Mon,  7 Sep 2026 13:00:17 +0200	[thread overview]
Message-ID: <20260907110621.2122120-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.

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                         | 100 +++++-------------
 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 +-
 .../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, 225 insertions(+), 85 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





             reply	other threads:[~2026-09-07 11:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 11:00 Dominik Csapak [this message]
2026-09-07 11:00 ` [PATCH qemu-server 1/4] tests: add test with q35 and scsihw2 Dominik Csapak
2026-09-07 11:00 ` [PATCH qemu-server 2/4] tests: add test for legacy-igd passthrough Dominik Csapak
2026-09-07 11:00 ` [PATCH qemu-server 3/4] pci: don't try to hotplug bridges Dominik Csapak
2026-09-07 11:00 ` [PATCH qemu-server 4/4] pci: bridges: add bridges to devices up front Dominik Csapak
2026-09-07 12:47 ` superseded: [PATCH qemu-server 0/4] pci: bridges: cleanup and hotplug fix 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=20260907110621.2122120-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