From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Daniel Kral <d.kral@proxmox.com>
Subject: Re: [pve-devel] [PATCH common v2 1/1] procfs: cpuinfo: expose x86_phys_bits and x86_virt_bits values
Date: Fri, 5 Sep 2025 11:10:22 +0200 [thread overview]
Message-ID: <e4ea5dcc-5a37-47eb-8ee7-2ecc3a3ba077@proxmox.com> (raw)
In-Reply-To: <20250902112307.124706-2-d.kral@proxmox.com>
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 <d.kral@proxmox.com>
> ---
> 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
next prev parent reply other threads:[~2025-09-05 9:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 11:21 [pve-devel] [PATCH common/qemu-server v2 0/5] fix issues with viommu+vfio passthrough in #6608, #6378 Daniel Kral
2025-09-02 11:21 ` [pve-devel] [PATCH common v2 1/1] procfs: cpuinfo: expose x86_phys_bits and x86_virt_bits values Daniel Kral
2025-09-05 9:10 ` Fiona Ebner [this message]
2025-09-05 11:47 ` Daniel Kral
2025-09-02 11:21 ` [pve-devel] [PATCH qemu-server v2 1/4] fix #6608: expose viommu driver aw-bits option Daniel Kral
2025-09-05 10:07 ` Fiona Ebner
2025-09-05 11:45 ` Daniel Kral
2025-09-05 12:00 ` Fiona Ebner
2025-09-05 14:18 ` Daniel Kral
2025-09-02 11:21 ` [pve-devel] [PATCH qemu-server v2 2/4] cpu config: factor out gathering common cpu properties Daniel Kral
2025-09-05 10:32 ` Fiona Ebner
2025-09-02 11:22 ` [pve-devel] [RFC qemu-server v2 3/4] fix #6378 (continued): warn intel-iommu users about iommu and host aw bits mismatch Daniel Kral
2025-09-02 11:26 ` Daniel Kral
2025-09-05 10:50 ` Fiona Ebner
2025-09-05 11:38 ` Daniel Kral
2025-09-05 12:52 ` Fiona Ebner
2025-09-02 11:22 ` [pve-devel] [RFC qemu-server v2 4/4] machine: warn intel-iommu users about too large address width Daniel Kral
2025-09-05 10:55 ` Fiona Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e4ea5dcc-5a37-47eb-8ee7-2ecc3a3ba077@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=d.kral@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox