[pve-devel] [PATCH common v2 1/1] procfs: cpuinfo: expose x86_phys_bits and x86_virt_bits values
Daniel Kral
d.kral at proxmox.com
Tue Sep 2 13:21:57 CEST 2025
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 at 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) {
+ $res->{phys_bits} = $1 if !$res->{phys_bits};
+ $res->{virt_bits} = $2 if !$res->{virt_bits};
}
}
--
2.47.2
More information about the pve-devel
mailing list