[pve-devel] [PATCH qemu-server 4/7] cpu config: introduce vendor-agnostic 'nested-virt' CPU flag
Fiona Ebner
f.ebner at proxmox.com
Fri Nov 7 10:12:23 CET 2025
Am 06.11.25 um 6:00 PM schrieb Daniel Kral:
> On Fri Oct 31, 2025 at 1:27 PM CET, Fiona Ebner wrote:
>> @@ -578,8 +588,34 @@ sub print_cpu_device {
>> sub resolve_cpu_flags {
>> my $flags = {};
>>
>> + my $nested_flag;
>> + my $nested_flag_resolved;
>> + my $resolve_nested_flag = sub {
>> + if (!$nested_flag_resolved) {
>> + my $host_cpu_flags = PVE::ProcFSTools::read_cpuinfo()->{flags};
>> + if ($host_cpu_flags =~ m/\s(svm|vmx)\s/) {
>> + $nested_flag = $1;
>> + } else {
>> + log_warn("ignoring 'nested-virt' CPU flag - unable to resolve from host CPU flags");
>> + }
>> + $nested_flag_resolved = 1;
>> + }
>> + return $nested_flag;
>> + };
>> +
>> for my $hash (@_) {
>
> nit: maybe now's a good time to give @_ a name with the $nested_flag bit
> in between? But I can see the naming collision with $flags..
That's a good point, perlcritic also has a warning about this:
"Always unpack @_ first"
Will fix in v2.
More information about the pve-devel
mailing list