From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 5F7F5932DF
 for <pve-devel@lists.proxmox.com>; Mon, 19 Feb 2024 15:47:28 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 48A4631E6D
 for <pve-devel@lists.proxmox.com>; Mon, 19 Feb 2024 15:47:28 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Mon, 19 Feb 2024 15:47:27 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 891FD43715
 for <pve-devel@lists.proxmox.com>; Mon, 19 Feb 2024 15:47:27 +0100 (CET)
Message-ID: <c70d600b-fdeb-48bf-b989-8f43be4bae24@proxmox.com>
Date: Mon, 19 Feb 2024 15:47:26 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Filip Schauer <f.schauer@proxmox.com>
References: <20231219094023.25726-1-f.schauer@proxmox.com>
 <20231219094023.25726-6-f.schauer@proxmox.com>
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20231219094023.25726-6-f.schauer@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.071 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pve-devel] [PATCH qemu-server 4/4] cpu config: Unify the
 default value for 'kvm'
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 19 Feb 2024 14:47:28 -0000

Am 19.12.23 um 10:40 schrieb Filip Schauer:
> Make the default value for 'kvm' consistent and take into account
> whether the VM will run on the same CPU architecture as the host. This
> is a breaking change for VMs with a different CPU architecture running
> on an x86_64 host, since in this case the default CPU type for
> CPU hotplug switches from 'kvm64' to 'qemu64'.
> 

On an x86_64 host, for guests using a different architecture (i.e.
aarch64), hot-plugging is already broken, because we try to hotplug a
CPU of type "$cpu-x86_64-cpu,XYZ" which won't work anyways:

vcpus: hotplug problem - VM 130 qmp command 'device_add' failed -
'kvm64-x86_64-cpu' is not a valid device model name

The actual breaking change is for the host arch being something other
than x86_64 (which isn't officially supported) and the VM being x86_64, ...

> @@ -414,9 +415,9 @@ sub get_custom_model {
>  
>  # Print a QEMU device node for a given VM configuration for hotplugging CPUs
>  sub print_cpu_device {
> -    my ($conf, $id) = @_;
> +    my ($conf, $arch, $id) = @_;
>  
> -    my $kvm = $conf->{kvm} // 1;
> +    my $kvm = $conf->{kvm} // is_native($arch);
>      my $cpu = get_default_cpu_type('x86_64', $kvm);

...because in that case, before this patch we got kvm64 here, but with
the patch we get qemu64 which would be a problem for live-migration.

>      if (my $cputype = $conf->{cpu}) {
>  	my $cpuconf = PVE::JSONSchema::parse_property_string('pve-vm-cpu-conf', $cputype)