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 E145E1FF15C for ; Fri, 5 Sep 2025 11:10:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B260D1012B; Fri, 5 Sep 2025 11:10:25 +0200 (CEST) Message-ID: Date: Fri, 5 Sep 2025 11:10:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Daniel Kral References: <20250902112307.124706-1-d.kral@proxmox.com> <20250902112307.124706-2-d.kral@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20250902112307.124706-2-d.kral@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757063404300 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.023 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [procfstools.pm] Subject: Re: [pve-devel] [PATCH common v2 1/1] procfs: cpuinfo: expose x86_phys_bits and x86_virt_bits values 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" Am 02.09.25 um 1:23 PM schrieb Daniel Kral: > The address sizes line is taken from the kernel's implementation of > /proc/cpuinfo in arch/x86/kernel/cpu/proc.c. > > Signed-off-by: Daniel Kral > --- > src/PVE/ProcFSTools.pm | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm > index 9bfac2c..41efd1f 100644 > --- a/src/PVE/ProcFSTools.pm > +++ b/src/PVE/ProcFSTools.pm > @@ -32,6 +32,8 @@ sub read_cpuinfo { > cpus => 1, > sockets => 1, > flags => '', > + phys_bits => 0, > + virt_bits => 0, > }; > > my $fh = IO::File->new($fn, "r"); > @@ -54,6 +56,9 @@ sub read_cpuinfo { > $idhash->{$1} = 1 if not defined($idhash->{$1}); > } elsif ($line =~ m/^cpu cores\s*:\s*(\d+)\s*$/i) { > $idhash->{$cpuid} = $1 if defined($idhash->{$cpuid}); > + } elsif ($line =~ m/^address sizes\t: (\d+) bits physical, (\d+) bits virtual$/i) { I'd prefer to match whitespaces with \s* and also allow whitespaces at the end like is done in the regex for CPU cores. This is for future-proofing, because e.g. the file could get a new option with a long name for which additional tabs will be introduced. > + $res->{phys_bits} = $1 if !$res->{phys_bits}; > + $res->{virt_bits} = $2 if !$res->{virt_bits}; > } > } > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel