From: Yvan Janssens <yvanj@cyber.gent>
To: pve-devel@lists.proxmox.com
Subject: [PATCH common] procfs: cpuinfo: count CPUs and report the machine type on s390x
Date: Wed, 18 Nov 2026 10:18:48 +0100 [thread overview]
Message-ID: <20261118091848.72539-1-yvanj@cyber.gent> (raw)
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)
reply other threads:[~2026-11-18 9:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261118091848.72539-1-yvanj@cyber.gent \
--to=yvanj@cyber.gent \
--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