public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Reiter <s.reiter@proxmox.com>
Subject: Re: [pve-devel] [PATCH 4/4] cfg2cmd: switch off ACPI hotplug on bridges for q35 VMs
Date: Thu, 21 Oct 2021 11:47:05 +0200	[thread overview]
Message-ID: <8d65a4f5-ab0c-43c7-2c1e-9b3209ea6427@proxmox.com> (raw)
In-Reply-To: <c40e59dd-1716-1bf1-c40b-ff14ba8b1787@proxmox.com>

On 21.10.21 11:34, Stefan Reiter wrote:
> On 10/21/21 10:36 AM, Thomas Lamprecht wrote:
>> See commit 17858a1695 (hw/acpi/ich9: Set ACPI PCI hot-plug as default
>> on Q35)[0] in upstream QEMU repository for details about why the
>> change was made.
>>
>> As that change affects systemds predictable interface naming[1],
>> e.g., by going from a previously `ens18` name to `enp6s18`, it may
>> have rather bad effects for users that did not setup some .link files
>> to enforce a specific naming by an more stable information like the
>> NIC's MAC-Address
>>
>> The alternative would be making the preferred mode of hotplug an
>> option like `hotplug-mode=<acpi|pcie>`, but it does not seems like
>> one would like to change that much in the first place...
>>
>> Note the changes to the tests and especially the tests with q35
>> machines that did not change.
>>
>> [0]: https://gitlab.com/qemu-project/qemu/-/commit/17858a1695
>> [1]: https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html#Naming
>>
>> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
>> ---
>>   PVE/QemuServer.pm                              | 18 ++++++++++++++++++
>>   .../q35-linux-hostpci-multifunction.conf.cmd   |  1 +
>>   test/cfg2cmd/q35-linux-hostpci.conf.cmd        |  1 +
>>   test/cfg2cmd/q35-simple.conf.cmd               |  1 +
>>   test/cfg2cmd/q35-win10-hostpci.conf.cmd        |  1 +
>>   5 files changed, 22 insertions(+)
>>
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index b10f1b5..84caee7 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -3534,6 +3534,24 @@ sub config_to_command {
>>       }
>>       }
>>   +    my $meta = parse_meta_info($conf->{meta}) // {};
>> +    # check if we need to apply some handling for VMs that always use the latest machine version but
>> +    # had a machine version transition happen that affected HW such that, e.g., an OS config change
>> +    # would be required (we do not want to pin machine version for non-windows OS type)
>> +    my $create_qemu_vers = $meta->{'creation-qemu'};
>> +    if (
>> +    (!defined($conf->{machine}) || $conf->{machine} =~ m/^(?:pc|q35|virt)$/) # non-versioned machine
>> +    && (!defined($create_qemu_vers) || !min_version($create_qemu_vers, 6, 1)) # created before 6.1
>> +    && (!$forcemachine || min_version($forcemachine, 6, 1)) # handle snapshot-rollback/migrations
> 
> $forcemachine is not in QEMU version format, it contains a machine type (with a version at the end), e.g.: "pc-i440fx-6.1+pve0". 'min_version' cannot handle that.
> 
>> +    && min_version($kvmver, 6, 1) # only need to apply the first change with 6.1
>> +    ) {
>> +    if ($q35) {
> 
> I think this could go into the outer if as well, so it shortcircuits for i440fx.

It can and I had it that way but I wanted to have above simpler to adapt to more of
such changes.

> Or even just change:
> 
>   (!defined($conf->{machine}) || $conf->{machine} =~ m/^(?:pc|q35|virt)$/)
> to
>   (defined($conf->{machine}) && $conf->{machine} eq 'q35')
> 
> as the default can never be q35.
> 
>> +        # this changed to default-on in Q 6.1 for q35 machines, it will mess with PCI slot view
>> +        # and thus with the predictable interface naming of systemd
>> +        push @$cmd, '-global', 'ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off';
>> +    }
>> +    }
>> +
> 
> Considering the 'meta' property is supposed to be generic and might see more use in the future, I'd put this in a seperate function, 'add_qemu_version_fixups' or so.
> 

yes, that would be def. nicer




  reply	other threads:[~2021-10-21  9:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  8:36 [pve-devel] [PATCH 0/4] add meta info and bandaid for QEMU 6.1 and unpinned q35 machine backward compat Thomas Lamprecht
2021-10-21  8:36 ` [pve-devel] [PATCH 1/4] config: add new meta property withe creation time Thomas Lamprecht
2021-10-21  8:36 ` [pve-devel] [PATCH 2/4] config: meta: also save the QEMU version installed during creation Thomas Lamprecht
2021-10-21  8:36 ` [pve-devel] [PATCH 3/4] tests: cfg2cmd: add a few q35 related tests Thomas Lamprecht
2021-10-21  9:34   ` Stefan Reiter
2021-10-21  9:45     ` Thomas Lamprecht
2021-10-21  8:36 ` [pve-devel] [PATCH 4/4] cfg2cmd: switch off ACPI hotplug on bridges for q35 VMs Thomas Lamprecht
2021-10-21  9:34   ` Stefan Reiter
2021-10-21  9:47     ` Thomas Lamprecht [this message]
2021-10-21  9:34 ` [pve-devel] [PATCH 0/4] add meta info and bandaid for QEMU 6.1 and unpinned q35 machine backward compat Stefan Reiter
2021-10-21  9:47   ` Thomas Lamprecht
2021-10-21  9:56     ` Stefan Reiter
2021-10-21 10:01       ` Thomas Lamprecht

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=8d65a4f5-ab0c-43c7-2c1e-9b3209ea6427@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.reiter@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