<div dir="auto"><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 8, 2022 at 21:21 Laine Stump <<a href="mailto:laine@redhat.com">laine@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Aha! the domain of <a href="mailto:qemu-devel@nongnu.org" target="_blank">qemu-devel@nongnu.org</a> was incorrect in the original <br>
send (it was "<a href="http://nognu.org" rel="noreferrer" target="_blank">nognu.org</a>"), so none of this thread was making it to that <br>
list. I've corrected it in this message, but interested parties from <br>
qemu-devel will need to look on the libvir-list archives for the actual <br>
patch mails:<br>
<br>
<a href="https://listman.redhat.com/archives/libvir-list/2022-March/229089.html" rel="noreferrer" target="_blank">https://listman.redhat.com/archives/libvir-list/2022-March/229089.html</a><br>
<br>
Anyone else who responds to any of the mail on this thread should fix <br>
the qemu-devel address accordingly.</blockquote><div dir="auto"><br></div><div dir="auto">This patch set has been a true test of my diligence and perseverance ðŸ™‚</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)" dir="auto"><br>
<br>
On 3/8/22 10:33 AM, Laine Stump wrote:<br>
> On 3/8/22 1:39 AM, Ani Sinha wrote:<br>
>> Changelog:<br>
>> v2 - rebased the patch series to latest master.<br>
>><br>
>> I am re-introducing the patchset for <acpi-hotplug-bridge> which got<br>
>> reverted here few months back:<br>
>><br>
>> <a href="https://www.spinics.net/linux/fedora/libvir/msg224089.html" rel="noreferrer" target="_blank">https://www.spinics.net/linux/fedora/libvir/msg224089.html</a><br>
>><br>
>> The reason for the reversal was that there seemed to be some<br>
>> instability/issues around the use of the qemu commandline which this<br>
>> patchset tries to support. In particular, some guest operating systems<br>
>> did not like the way QEMU was trying to disable native hotplug on pcie<br>
>> root ports.<br>
> <br>
> My memory isn't completely clear, but I think there was also the issue <br>
> that the option claims to enable ACPI hotplug when set to on, but <br>
> instead what it actually does (in the Q35 case at least) is to enable <br>
> native PCI hotplug when set to off (without actually disabling ACPI <br>
> hotplug) and disable native PCI hotplug when set to on, or something <br>
> like that. This ends up leaving it up to the guest OS to decide which <br>
> type of hotplug to use, meaning its decision could override what's in <br>
> the libvirt config, thus confusing everyone. Again, I probably have the <br>
> details mixed up, but it was something like this.<br>
> <br>
> I asked mst about this this morning, and he suggested something that <br>
> you've already done - Cc'ing the series to qemu-devel and the relevant <br>
> maintainers so we can have a discussion with all involved parties about <br>
> their opinions on whether we really should expose this existing option <br>
> in libvirt, or if we should instead have two new options that are more <br>
> orthogonal about enabling/disabling the two types of hotplug, so that <br>
> libvirt config can more accurately represent what is being presented to <br>
> the guest rather than a "best guess" of what we think the guest is going <br>
> to do with what is presented.<br>
> <br>
> (Michael did also say that, with the current flurry of bug reports for <br>
> the QEMU rc's, this discusion may not happen until closer to release <br>
> when the bug reports die down. I know this doesn't mesh with your desire <br>
> to "push now to allow for testing" (which in general would be a good <br>
> thing if we were certain that we wanted the option like this and were <br>
> just expecting some minor bugs that could be fixed), but my opinion is <br>
> that 1) it's possible for anyone interested to test the functionality <br>
> using <qemu:commandline>, and 2) we should avoid turning libvirt git <br>
> into a revolving door of experiments. The only practical difference <br>
> between using <qemu:commandline> and having a dedicated option is that <br>
> the use of <qemu:commandline> causes the domain to be tainted, and the <br>
> XML is a bit more complicated. But since the people we're talking about <br>
> here will already have built their own libvirt binaries, the tainted <br>
> status of any guests is irrelevant and the extra complexity of using <br>
> <qemu:commandline> is probably trivial to them :-).<br>
> <br>
>> Subsequently, in QEMU 6.2, we have changed our mechanism<br>
>> using which we disable native hotplug. As I understand, we do not have<br>
>> any reported issues so far in 6.2 around this area. QEMU will enter a<br>
>> soft feature freeze in the first week of march in prep for 7.0 release.<br>
>> Libvirt is also entering a new release cycle phaze. Hence, I am<br>
>> introducing this patchset early enough in the release cycles so that if<br>
>> we do see any issues on the qemu side during the rc0, rc1 cycles and if<br>
>> reversal of this patchset is again required, it can be done in time<br>
>> before the next libvirt release end of March.<br>
>><br>
>> All the patches in this series had been previously reviewed. Some<br>
>> subsequent fixes were made after my initial patches were pushed. I have<br>
>> squashed all those fixes and consolidated them into four patches. I have<br>
>> also updated the documentation to reflect the new changes from the QEMU<br>
>> side and rebased my changes fixing the tests in the process.<br>
>><br>
>> What changed in QEMU post version 6.1 ?<br>
>> =========================================<br>
>><br>
>> We have made basically two major changes in QEMU. First is this change:<br>
>><br>
>> (1) commit 211afe5c69b597acf85fdd577eb497f5be1ffbd8<br>
>> Author: Julia Suvorova <<a href="mailto:jusual@redhat.com" target="_blank">jusual@redhat.com</a>><br>
>> Date:   Fri Nov 12 06:08:56 2021 -0500<br>
>><br>
>> Â Â Â Â  hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC<br>
>> Â Â Â Â  There are two ways to enable ACPI PCI Hot-plug:<br>
>> Â Â Â Â Â Â Â Â Â Â Â Â  * Disable the Hot-plug Capable bit on PCIe slots.<br>
>> Â Â Â Â  This was the first approach which led to regression [1-2], as<br>
>> Â Â Â Â  I/O space for a port is allocated only when it is hot-pluggable,<br>
>> Â Â Â Â  which is determined by HPC bit.<br>
>> Â Â Â Â Â Â Â Â Â Â Â Â  * Leave the HPC bit on and disable PCIe Native Hot-plug <br>
>> in _OSC<br>
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â  method.<br>
>> Â Â Â Â  This removes the (future) ability of hot-plugging switches with PCIe<br>
>> Â Â Â Â  Native hotplug since ACPI PCI Hot-plug only works with cold-plugged<br>
>> Â Â Â Â  bridges. If the user wants to explicitely use this feature, they can<br>
>> Â Â Â Â  disable ACPI PCI Hot-plug with:<br>
>> Â Â Â Â Â Â Â Â Â Â Â Â  --global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off<br>
>> Â Â Â Â  Change the bit in _OSC method so that the OS selects ACPI PCI <br>
>> Hot-plug<br>
>> Â Â Â Â  instead of PCIe Native.<br>
>> Â Â Â Â  [1] <a href="https://gitlab.com/qemu-project/qemu/-/issues/641" rel="noreferrer" target="_blank">https://gitlab.com/qemu-project/qemu/-/issues/641</a><br>
>> Â Â Â Â  [2] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=2006409" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=2006409</a><br>
>> Â Â Â Â  Signed-off-by: Julia Suvorova <<a href="mailto:jusual@redhat.com" target="_blank">jusual@redhat.com</a>><br>
>> Â Â Â Â  Signed-off-by: Igor Mammedov <<a href="mailto:imammedo@redhat.com" target="_blank">imammedo@redhat.com</a>><br>
>> Â Â Â Â  Message-Id: <<a href="mailto:20211112110857.3116853-5-imammedo@redhat.com" target="_blank">20211112110857.3116853-5-imammedo@redhat.com</a>><br>
>> Â Â Â Â  Reviewed-by: Ani Sinha <<a href="mailto:ani@anisinha.ca" target="_blank">ani@anisinha.ca</a>><br>
>> Â Â Â Â  Reviewed-by: Michael S. Tsirkin <<a href="mailto:mst@redhat.com" target="_blank">mst@redhat.com</a>><br>
>> Â Â Â Â  Signed-off-by: Michael S. Tsirkin <<a href="mailto:mst@redhat.com" target="_blank">mst@redhat.com</a>><br>
>><br>
>><br>
>> The patch description says it all. Instead of masking out the HPC bit in<br>
>> pcie slots, we keep them turned on. Instead, we do not advertize native<br>
>> hotplug capability for PCIE using _OSC control method. See section<br>
>> 6.2.11 in ACPI spec 6.2. At the same time, we turn on ACPI hotplug for<br>
>> these slots so now the guest OS can select ACPI hotplug instead.<br>
>><br>
>> The second change is introduction of a property with which we keep the<br>
>> existing behavior for pc-q35-6.1 machines. This means HPC bit is masked<br>
>> and ACPI hotplug is enabled by default for pcie root ports.<br>
>> The QEMU commit is:<br>
>><br>
>> (2) commit c318bef76206c2ecb6016e8e68c4ac6ff9a4c8cb<br>
>> Author: Julia Suvorova <<a href="mailto:jusual@redhat.com" target="_blank">jusual@redhat.com</a>><br>
>> Date:   Fri Nov 12 06:08:54 2021 -0500<br>
>><br>
>> Â Â Â Â  hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine <br>
>> type<br>
>> Â Â Â Â  To solve issues [1-2] the Hot Plug Capable bit in PCIe Slots will be<br>
>> Â Â Â Â  turned on, while the switch to ACPI Hot-plug will be done in the<br>
>> Â Â Â Â  DSDT table.<br>
>> Â Â Â Â  Introducing 'x-keep-native-hpc' property disables the HPC bit only<br>
>> Â Â Â Â  in 6.1 and as a result keeps the forced 'reserve-io' on<br>
>> Â Â Â Â  pcie-root-ports in 6.1 too.<br>
>> Â Â Â Â  [1] <a href="https://gitlab.com/qemu-project/qemu/-/issues/641" rel="noreferrer" target="_blank">https://gitlab.com/qemu-project/qemu/-/issues/641</a><br>
>> Â Â Â Â  [2] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=2006409" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=2006409</a><br>
>> Â Â Â Â  Signed-off-by: Julia Suvorova <<a href="mailto:jusual@redhat.com" target="_blank">jusual@redhat.com</a>><br>
>> Â Â Â Â  Signed-off-by: Igor Mammedov <<a href="mailto:imammedo@redhat.com" target="_blank">imammedo@redhat.com</a>><br>
>> Â Â Â Â  Message-Id: <<a href="mailto:20211112110857.3116853-3-imammedo@redhat.com" target="_blank">20211112110857.3116853-3-imammedo@redhat.com</a>><br>
>> Â Â Â Â  Reviewed-by: Michael S. Tsirkin <<a href="mailto:mst@redhat.com" target="_blank">mst@redhat.com</a>><br>
>> Â Â Â Â  Signed-off-by: Michael S. Tsirkin <<a href="mailto:mst@redhat.com" target="_blank">mst@redhat.com</a>><br>
>><br>
>> Lastly, as a related side note, because from QEMU 6.2 onwards, we do not<br>
>> mask out HPC bit in PCIE, the work done by this patch is no longer<br>
>> needed:<br>
>><br>
>> (3) commit e2a6290aab578b2170c1f5909fa556385dc0d820<br>
>> Author: Marcel Apfelbaum <<a href="mailto:marcel.apfelbaum@gmail.com" target="_blank">marcel.apfelbaum@gmail.com</a>><br>
>> Date:   Mon Aug 2 12:00:57 2021 +0300<br>
>><br>
>> Â Â Â Â  hw/pcie-root-port: Fix hotplug for PCI devices requiring IO<br>
>> Â Â Â Â  Q35 has now ACPI hotplug enabled by default for PCI(e) devices.<br>
>> Â Â Â Â  As opposed to native PCIe hotplug, guests like Fedora 34<br>
>> Â Â Â Â  will not assign IO range to pcie-root-ports not supporting<br>
>> Â Â Â Â  native hotplug, resulting into a regression.<br>
>> Â Â Â Â  Reproduce by:<br>
>> Â Â Â Â Â Â Â Â  qemu-bin -M q35 -device pcie-root-port,id=p1 -monitor stdio<br>
>> Â Â Â Â Â Â Â Â  device_add e1000,bus=p1<br>
>> Â Â Â Â  In the Guest OS the respective pcie-root-port will have the IO range<br>
>> Â Â Â Â  disabled.<br>
>> Â Â Â Â  Fix it by setting the "reserve-io" hint capability of the<br>
>> Â Â Â Â  pcie-root-ports so the firmware will allocate the IO range instead.<br>
>> Â Â Â Â  Acked-by: Igor Mammedov <<a href="mailto:imammedo@redhat.com" target="_blank">imammedo@redhat.com</a>><br>
>> Â Â Â Â  Signed-off-by: Marcel Apfelbaum <<a href="mailto:marcel@redhat.com" target="_blank">marcel@redhat.com</a>><br>
>> Â Â Â Â  Message-Id: <<a href="mailto:20210802090057.1709775-1-marcel@redhat.com" target="_blank">20210802090057.1709775-1-marcel@redhat.com</a>><br>
>> Â Â Â Â  Reviewed-by: Michael S. Tsirkin <<a href="mailto:mst@redhat.com" target="_blank">mst@redhat.com</a>><br>
>> Â Â Â Â  Signed-off-by: Michael S. Tsirkin <<a href="mailto:mst@redhat.com" target="_blank">mst@redhat.com</a>><br>
>><br>
>> This is what commit (2) alludes to. In pc-q35-6.1 machines we do need<br>
>> patch (3) since we mask out HPC bit from pcie ports.<br>
>><br>
>><br>
>> I know this is convoluted mess. In fairness I am trying all I can in my<br>
>> spare time to help from the QEMU side. I am determined to see this<br>
>> patchset through into libvirt.<br>
>><br>
>> Thanks<br>
>><br>
>><br>
>> Ani Sinha (4):<br>
>> Â Â  qemu: capablities: detect acpi-pci-hotplug-with-bridge-support<br>
>> Â Â  conf: introduce support for acpi-bridge-hotplug feature<br>
>> Â Â  qemu: command: add support for acpi-bridge-hotplug feature<br>
>> Â Â  NEWS: document new acpi pci hotplug config option<br>
>><br>
>> Â  NEWS.rst                                      |  8 ++<br>
>> Â  docs/formatdomain.rst                         | 32 +++++++<br>
>> Â  docs/schemas/domaincommon.rng                 | 15 ++++<br>
>> Â  src/conf/domain_conf.c                        | 89 ++++++++++++++++++-<br>
>> Â  src/conf/domain_conf.h                        |  9 ++<br>
>> Â  src/qemu/qemu_capabilities.c                  |  4 +<br>
>> Â  src/qemu/qemu_capabilities.h                  |  3 +<br>
>> Â  src/qemu/qemu_command.c                       | 19 ++++<br>
>> Â  src/qemu/qemu_validate.c                      | 42 +++++++++<br>
>> Â  .../caps_6.1.0.x86_64.xml                     |  1 +<br>
>> Â  .../caps_6.2.0.x86_64.xml                     |  1 +<br>
>> Â  .../caps_7.0.0.x86_64.xml                     |  1 +<br>
>> Â  ...-hotplug-bridge-disable.aarch64-latest.err |  1 +<br>
>> Â  .../aarch64-acpi-hotplug-bridge-disable.xml   | 13 +++<br>
>> Â  ...-hotplug-bridge-disable.x86_64-latest.args | 35 ++++++++<br>
>> Â  .../pc-i440fx-acpi-hotplug-bridge-disable.xml | 36 ++++++++<br>
>> Â  .../pc-i440fx-acpi-hotplug-bridge-enable.xml  | 36 ++++++++<br>
>> Â  ...pi-hotplug-bridge-disable.x86_64-6.0.0.err |  1 +<br>
>> Â  ...-hotplug-bridge-disable.x86_64-latest.args | 38 ++++++++<br>
>> Â  .../q35-acpi-hotplug-bridge-disable.xml       | 53 +++++++++++<br>
>> Â  .../q35-acpi-hotplug-bridge-enable.xml        | 53 +++++++++++<br>
>> Â  tests/qemuxml2argvtest.c                      |  7 ++<br>
>> Â  ...i-hotplug-bridge-disable.x86_64-latest.xml |  1 +<br>
>> Â  ...pi-hotplug-bridge-enable.x86_64-latest.xml |  1 +<br>
>> Â  ...i-hotplug-bridge-disable.x86_64-latest.xml |  1 +<br>
>> Â  ...pi-hotplug-bridge-enable.x86_64-latest.xml |  1 +<br>
>> Â  tests/qemuxml2xmltest.c                       |  4 +<br>
>> Â  27 files changed, 504 insertions(+), 1 deletion(-)<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.aarch64-latest.err <br>
>><br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.xml<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x86_64-latest.args <br>
>><br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.xml<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-enable.xml<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-6.0.0.err<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.x86_64-latest.args<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.xml<br>
>> Â  create mode 100644 <br>
>> tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-enable.xml<br>
>> Â  create mode 120000 <br>
>> tests/qemuxml2xmloutdata/pc-i440fx-acpi-hotplug-bridge-disable.x86_64-latest.xml <br>
>><br>
>> Â  create mode 120000 <br>
>> tests/qemuxml2xmloutdata/pc-i440fx-acpi-hotplug-bridge-enable.x86_64-latest.xml <br>
>><br>
>> Â  create mode 120000 <br>
>> tests/qemuxml2xmloutdata/q35-acpi-hotplug-bridge-disable.x86_64-latest.xml <br>
>><br>
>> Â  create mode 120000 <br>
>> tests/qemuxml2xmloutdata/q35-acpi-hotplug-bridge-enable.x86_64-latest.xml<br>
>><br>
> <br>
<br>
</blockquote></div></div>