From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 7C2511FF146 for ; Tue, 12 May 2026 10:11:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6E97A7A53; Tue, 12 May 2026 10:11:22 +0200 (CEST) Date: Tue, 12 May 2026 10:11:15 +0200 From: Arthur Bied-Charreton To: Fiona Ebner Subject: Re: [PATCH docs/manager/qemu-server v4 00/17] Add API and UI for custom CPU models Message-ID: References: <20260430160109.565536-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778573364785 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.764 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 Message-ID-Hash: NYUIIV2ISYXF3MTWSACP5HW4UIURWZ7L X-Message-ID-Hash: NYUIIV2ISYXF3MTWSACP5HW4UIURWZ7L X-MailFrom: a.bied-charreton@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, May 11, 2026 at 12:42:02PM +0200, Fiona Ebner wrote: > I found a pre-existing bug in query_supported_cpu_flags() that we should > fix. Namely the following replacement is wrong in general: > > > foreach my $prop (keys %$props) { > > next if $props->{$prop} ne '1'; > > # QEMU returns some flags multiple times, with '_', '.' or '-' > > # (e.g. lahf_lm and lahf-lm; sse4.2, sse4-2 and sse4_2; ...). > > # We only keep those with underscores, to match /proc/cpuinfo > > $prop =~ s/\.|-/_/g; > > $flags->{$prop} = 1; > > } > > In particular, flags like 'virt-ssbd' or 'amd-ssbd' or 'amd-no-ssb' are > not present multiple times, but only in their exact form. Because of the > replacement, we only consider e.g. 'virt_ssbd' and then mistakenly > detect the flags as not supported on any node. > > Let's just make an explicit map of what is actually duplicate and not do > such general replacement here. After looking a little more into it I think we should also apply the same logic to the recognized CPU flags, or normalize the flags in query_supported_cpu_flags() to match the `qemu-system-$arch -cpu help` output rather than /proc/cpuinfo, since that is the source we use? For example, /proc/cpuinfo writes the sse4.2 flag as sse4_2, while `qemu-system-$arch -cpu help` writes it as sse4.2, so normalizing it to sse4_2 in query_supported_cpu_flags() means it does not match anything in the output of query_understood_cpu_flags(). QEMU accepts both versions. Is there a reason why we need to match /proc/cpuinfo specifically that I am overlooking, or is it just about having a consistent output for CPU flags in general?