From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.schauer@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 3B5EFB8A96
 for <pve-devel@lists.proxmox.com>; Mon, 11 Mar 2024 11:13:44 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 2381F67CD
 for <pve-devel@lists.proxmox.com>; Mon, 11 Mar 2024 11:13:44 +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, 11 Mar 2024 11:13:40 +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 685CF488FA
 for <pve-devel@lists.proxmox.com>; Mon, 11 Mar 2024 11:13:40 +0100 (CET)
Message-ID: <82fac45c-4c07-4e06-a62c-47d94f1d3acd@proxmox.com>
Date: Mon, 11 Mar 2024 11:13:39 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Fiona Ebner <f.ebner@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Thomas Lamprecht <t.lamprecht@proxmox.com>
References: <20240221143317.134090-1-f.schauer@proxmox.com>
 <20240221143317.134090-7-f.schauer@proxmox.com>
 <3b011cca-126a-46ec-9ecd-fcb421dcb675@proxmox.com>
 <ca9582b3-5f71-4191-a072-784227a2fd29@proxmox.com>
From: Filip Schauer <f.schauer@proxmox.com>
In-Reply-To: <ca9582b3-5f71-4191-a072-784227a2fd29@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.095 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 5/5] cpu config: die on hotplug
 of non x86_64 CPUs
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, 11 Mar 2024 10:13:44 -0000

Here is a fixed patch v2:

https://lists.proxmox.com/pipermail/pve-devel/2024-March/062153.html

On 08/03/2024 14:53, Fiona Ebner wrote:
> Am 08.03.24 um 14:34 schrieb Thomas Lamprecht:
>> Am 21/02/2024 um 15:33 schrieb Filip Schauer:
>>> When attempting a CPU hotplug on an architecture other than x86_64, die
>>> with a clean error instead of attempting a hotplug with a known
>>> non-working device command line. Also move the corresponding FIXME up to
>>> the error.
>>>
>>> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
>>> ---
>>>   PVE/QemuServer/CPUConfig.pm | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm
>>> index 7d471f4..01e4515 100644
>>> --- a/PVE/QemuServer/CPUConfig.pm
>>> +++ b/PVE/QemuServer/CPUConfig.pm
>>> @@ -417,6 +417,9 @@ sub get_custom_model {
>>>   sub print_cpu_device {
>>>       my ($conf, $arch, $id) = @_;
>>>   
>>> +    # FIXME: hot plugging other architectures like our unofficial arch64 support?
>>> +    die "Hotplug of non x86_64 CPU not yet supported" if $arch != 'x86_64';
>> arbitrary strings need to be compared using `eq` and `ne`, as `==` and `!=` can
>> only be used for numerics or strings that can be interpreted to one, so this never
>> could work.
>>
>> Interestingly the if never triggers in the `!=` case but always triggers in the
>> `==` case.
>>
> Because strings that cannot be parsed as a number are interpreted as 0,
> so both (invalid) sides will be 0. Description of parsing rules (from
> [0], wasn't able to find in official docs):
>
>> It follows these basic rules:
>>
>>      Ignore leading whitespace. This is handy when you extract a field out of columnar data and the number doesn't take up the entire column.
>>      Allow for a single leading sign (+ or -)
>>      Skip leading zeros (so, no octal)
>>      Capture decimal ASCII digits (0,1,2,3,4,5,6,7,8,9), allowing for a single decimal point (so, no semantic versioning numbers)
>>      Stop at the first non-decimal-digit character
>>      Whatever you have so far is the number. If you have nothing, the number is 0.
>
> [0]:
> https://stackoverflow.com/questions/70482447/why-is-00-equal-to-0-in-perl/70496787#70496787