* [PATCH common] procfs: cpuinfo: count CPUs and report the machine type on s390x
@ 2026-11-18 9:18 Yvan Janssens
0 siblings, 0 replies; only message in thread
From: Yvan Janssens @ 2026-11-18 9:18 UTC (permalink / raw)
To: pve-devel
On s390x, /proc/cpuinfo has no 'processor : N' lines; each per-CPU block
starts with 'cpu number : N' instead. read_cpuinfo thus reports 0 CPUs,
and qemu-server refuses to start any VM ("MAX 0 vcpus allowed per VM on
this node").
Count the 'cpu number' lines as well. As there is no 'model name' line
either, fall back to the machine type for the model, similar to arm64.
Signed-off-by: Yvan Janssens <yvanj@cyber.gent>
---
Excerpt of /proc/cpuinfo on an s390x host (IBM z14 ZR1 LPAR, 6 IFLs,
Debian 13 kernel 6.12), trimmed, CPU serial number redacted:
vendor_id : IBM/S390
# processors : 6
[...]
processor 0: version = 00, identification = **REDACTED**, machine = 3907
processor 1: version = 00, identification = **REDACTED**, machine = 3907
[...]
cpu number : 0
physical id : 1
core id : 0
book id : 0
drawer id : 0
dedicated : 1
address : 0
siblings : 1
cpu cores : 1
version : 00
identification : **REDACTED**
machine : 3907
cpu MHz dynamic : 4504
cpu MHz static : 4504
[...]
read_cpuinfo before: cpus=0 sockets=2 cores=6 model=unknown
read_cpuinfo after: cpus=6 sockets=2 cores=6 model=IBM 3907
src/PVE/ProcFSTools.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 12e0358..9a86baa 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -93,9 +93,9 @@ sub read_cpuinfo {
my $cpuid = 0;
my $idhash = {};
my $count = 0;
- my ($cpu_implementer, $cpu_part);
+ my ($cpu_implementer, $cpu_part, $s390_machine);
while (defined(my $line = <$fh>)) {
- if ($line =~ m/^processor\s*:\s*\d+\s*$/i) {
+ if ($line =~ m/^(?:processor|cpu number)\s*:\s*\d+\s*$/i) {
$count++;
} elsif ($line =~ m/^model\s+name\s*:\s*(.*)\s*$/i) {
$res->{model} = $1 if $res->{model} eq 'unknown';
@@ -116,6 +116,8 @@ sub read_cpuinfo {
$cpu_implementer //= hex($1);
} elsif ($line =~ m/^CPU part\s*:\s*(0x[0-9a-fA-F]+)\s*$/) {
$cpu_part //= hex($1);
+ } elsif ($line =~ m/^machine\s*:\s*(\d+)\s*$/) {
+ $s390_machine //= $1;
}
}
@@ -129,6 +131,10 @@ sub read_cpuinfo {
}
}
+ # s390x has no 'model name' either; report the machine type, like lscpu does
+ $res->{model} = "IBM $s390_machine"
+ if $res->{vendor} eq 'IBM/S390' && $res->{model} eq 'unknown' && defined($s390_machine);
+
# Hardware Virtual Machine (Intel VT / AMD-V)
$res->{hvm} = $res->{flags} =~ m/\s(vmx|svm)\s/;
--
2.54.0 (Apple Git-157)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-18 9:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 9:18 [PATCH common] procfs: cpuinfo: count CPUs and report the machine type on s390x Yvan Janssens
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.