[pve-devel] [PATCH qemu-server 5/5] cpu config: die on hotplug of non x86_64 CPUs

Fiona Ebner f.ebner at proxmox.com
Fri Mar 8 14:53:00 CET 2024


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 at 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




More information about the pve-devel mailing list