Skip to content

Add support for s390x (IBM Z) architecture in CPU detection #437

@ashokpariya0

Description

@ashokpariya0

Feature Request

The ghw library currently does not support the s390x architecture (IBM Z/LinuxONE mainframes). On s390x systems, CPU() returns an empty Processors slice due to differences in /proc/cpuinfo format:

  • s390x format: Single global vendor_id : IBM/S390 line, followed by processor N: version = ...blocks with topology like book id, drawer id (no per-processor vendor_id).

    Example output from s390x arch.

[root@ logs]# cat /proc/cpuinfo 
vendor_id       : IBM/S390
# processors    : 38
bogomips per cpu: 28901.00
max thread id   : 1
features	: esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx vxd vxe gs vxe2 vxp sort dflt vxp2 nnpa pcimio sie 
facilities      : 0 1 2 3 4 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 64 65 66 67 68 69 70 71 72 73 75 76 77 78 80 81 82 84 85 86 87 129 130 131 132 133 134 135 138 139 141 142 144 145 146 148 149 150 151 152 153 155 156 158 165 170 192 193 194 196 197 198 199 200 201
cache0          : level=1 type=Data scope=Private size=128K line_size=256 associativity=8
cache1          : level=1 type=Instruction scope=Private size=128K line_size=256 associativity=8
cache2          : level=2 type=Unified scope=Private size=36864K line_size=256 associativity=18
cache3          : level=3 type=Unified scope=Shared size=368640K line_size=256 associativity=180
processor 0: version = 00,  identification = 271F08,  machine = 9175
processor 1: version = 00,  identification = 271F08,  machine = 9175
processor 2: version = 00,  identification = 271F08,  machine = 9175
processor 3: version = 00,  identification = 271F08,  machine = 9175
processor 4: version = 00,  identification = 271F08,  machine = 9175
processor 5: version = 00,  identification = 271F08,  machine = 9175
processor 6: version = 00,  identification = 271F08,  machine = 9175
processor 7: version = 00,  identification = 271F08,  machine = 9175
processor 8: version = 00,  identification = 271F08,  machine = 9175
processor 9: version = 00,  identification = 271F08,  machine = 9175
processor 10: version = 00,  identification = 271F08,  machine = 9175
processor 11: version = 00,  identification = 271F08,  machine = 9175
processor 12: version = 00,  identification = 271F08,  machine = 9175
processor 13: version = 00,  identification = 271F08,  machine = 9175
processor 14: version = 00,  identification = 271F08,  machine = 9175
processor 15: version = 00,  identification = 271F08,  machine = 9175
processor 16: version = 00,  identification = 271F08,  machine = 9175
processor 17: version = 00,  identification = 271F08,  machine = 9175
processor 18: version = 00,  identification = 271F08,  machine = 9175
processor 19: version = 00,  identification = 271F08,  machine = 9175
processor 20: version = 00,  identification = 271F08,  machine = 9175
processor 21: version = 00,  identification = 271F08,  machine = 9175
processor 22: version = 00,  identification = 271F08,  machine = 9175
processor 23: version = 00,  identification = 271F08,  machine = 9175
processor 24: version = 00,  identification = 271F08,  machine = 9175
processor 25: version = 00,  identification = 271F08,  machine = 9175
processor 26: version = 00,  identification = 271F08,  machine = 9175
processor 27: version = 00,  identification = 271F08,  machine = 9175
processor 28: version = 00,  identification = 271F08,  machine = 9175
processor 29: version = 00,  identification = 271F08,  machine = 9175
processor 30: version = 00,  identification = 271F08,  machine = 9175
processor 31: version = 00,  identification = 271F08,  machine = 9175
processor 32: version = 00,  identification = 271F08,  machine = 9175
processor 33: version = 00,  identification = 271F08,  machine = 9175
processor 34: version = 00,  identification = 271F08,  machine = 9175
processor 35: version = 00,  identification = 271F08,  machine = 9175
processor 36: version = 00,  identification = 271F08,  machine = 9175
processor 37: version = 00,  identification = 271F08,  machine = 9175

cpu number      : 0
physical id     : 2
core id         : 0
book id         : 2
drawer id       : 2
dedicated       : 0
address         : 0
siblings        : 12
cpu cores       : 6
version         : 00
identification  : 271F08
machine         : 9175
cpu MHz dynamic : 5508
cpu MHz static  : 5508

cpu number      : 1
physical id     : 2
core id         : 0
book id         : 2
drawer id       : 2
dedicated       : 0
address         : 1
siblings        : 12
cpu cores       : 6
version         : 00
identification  : 271F08
machine         : 9175
cpu MHz dynamic : 5508
cpu MHz static  : 5508

cpu number      : 2


  • ghw behavior: Parser expects x86-style per-processor vendor_id lines → skips all processors → empty slice → errors in callers.
    Output for x86 node:
# cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 85
model name	: Intel Xeon Processor (Cascadelake)
stepping	: 6
microcode	: 0x1
cpu MHz		: 2394.308
cache size	: 16384 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions