From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id F259A1FF165 for ; Thu, 6 Nov 2025 18:00:22 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A890F1E016; Thu, 6 Nov 2025 18:01:03 +0100 (CET) Mime-Version: 1.0 Date: Thu, 06 Nov 2025 18:00:59 +0100 Message-Id: From: "Daniel Kral" To: "Proxmox VE development discussion" X-Mailer: aerc 0.21.0-10-gf12c391cb5b4 References: <20251031122834.62482-1-f.ebner@proxmox.com> <20251031122834.62482-5-f.ebner@proxmox.com> In-Reply-To: <20251031122834.62482-5-f.ebner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762448440296 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 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 Subject: Re: [pve-devel] [PATCH qemu-server 4/7] cpu config: introduce vendor-agnostic 'nested-virt' CPU flag X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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.. > for my $flag_name (keys %$hash) { > + if ($flag_name eq 'nested-virt') { > + my $nested_flag_name = $resolve_nested_flag->() or next; > + if ($hash->{$nested_flag_name}) { > + warn "warning: CPU flag '$flag_name' overrides '$nested_flag_name'\n"; > + } else { > + print "CPU flag '$flag_name' resolved to '$nested_flag_name'\n"; > + } > + $hash->{$nested_flag_name} = delete($hash->{$flag_name}); > + $flag_name = $nested_flag_name; > + } > + > my $flag = $hash->{$flag_name}; > my $old_flag = $flags->{$flag_name}; > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel