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 E85BABA525
 for <pve-devel@lists.proxmox.com>; Thu, 14 Dec 2023 10:13:06 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id BE88F14925
 for <pve-devel@lists.proxmox.com>; Thu, 14 Dec 2023 10:13:06 +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>; Thu, 14 Dec 2023 10:13:06 +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 DE9D847526
 for <pve-devel@lists.proxmox.com>; Thu, 14 Dec 2023 10:13:05 +0100 (CET)
Message-ID: <2bcdb6c7-bcff-4e65-8c7d-fbab100d2a6d@proxmox.com>
Date: Thu, 14 Dec 2023 10:13:02 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Filip Schauer <f.schauer@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20231211141256.27565-1-f.schauer@proxmox.com>
 <474c3df6-a8ed-4294-8e46-37c3f2008689@proxmox.com>
 <544700e6-14ca-4db8-88b4-117202a972d9@proxmox.com>
 <93b6aa58-fea8-48ba-b007-a08fd02c734a@proxmox.com>
 <7d2ebfc9-7172-410a-be4c-1fc681d07e43@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <7d2ebfc9-7172-410a-be4c-1fc681d07e43@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.077 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] Properly identify the CPU
 architecture of 32-bit VMs
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: Thu, 14 Dec 2023 09:13:07 -0000

Am 13.12.23 um 18:31 schrieb Filip Schauer:
> On 12/12/2023 12:48, Fiona Ebner wrote:
>> Am 12.12.23 um 11:39 schrieb Filip Schauer:
>>> It's actually not a different binary. qemu-system-i386 is a symlink that
>>> points to qemu-system-x86_64. But still this does indeed break migration
>>> between a node that has this patch applied and another node without the
>>> patch.
>>>
>> Oh, okay. But then that's a bit surprising. From a quick glance, we do
>> have some logic matching arch 'x86_64' specifically in CPUConfig.pm, so
>> that might be it. E.g.:
>>
>>>      my $pve_forced_flags = {};
>>>      $pve_forced_flags->{'enforce'} = {
>>>          reason => "error if requested CPU settings not available",
>>>      } if $cputype ne 'host' && $kvm && $arch eq 'x86_64';
> 
> 
> This check does not make any difference in my case since $kvm is not set
> when using a qemu32 CPU.
> 

Well, that is just one example for such a flag, there are others ;)

>From a quick look, if kvm is not explicitly turned off in the config and
if you are not using arch i386/aarch64 in the config, the $kvm option
will get set. It does not seem to depend on the CPU type:

> sub is_native($) {
>     my ($arch) = @_;
>     return get_host_arch() eq $arch;
> }   
>                         
> sub get_vm_arch {
>     my ($conf) = @_;
>     return $conf->{arch} // get_host_arch();
> }   

> sub config_to_command {

...

>     my $kvm = $conf->{kvm};
>     my $nodename = nodename();
>     
>     my $arch = get_vm_arch($conf);

...

>     $kvm //= 1 if is_native($arch);

If you really want to know what causes the issue, you can compare the
QEMU commandline on source and target of the migration.