Skip to content

Add support for s390x architecture#447

Merged
jaypipes merged 6 commits intojaypipes:mainfrom
ibm-adarsh:s390x
Feb 9, 2026
Merged

Add support for s390x architecture#447
jaypipes merged 6 commits intojaypipes:mainfrom
ibm-adarsh:s390x

Conversation

@ibm-adarsh
Copy link
Contributor

@ibm-adarsh ibm-adarsh commented Feb 9, 2026

PR introduces support for IBM Z (s390x) architecture in the CPU collector as asked part of #437. Unlike x86 or ARM, s390x provides CPU metadata in a hierarchical format where certain system-wide attributes (like vendor_id and machine) are listed in a header, while individual logical processors are identified by the cpu number key.

Key Changes:

  • Parser Update: Modified logicalProcessorsFromProcCPUInfo to recognize cpu number as a valid logical processor identifier (mapping to processor on other architectures).
  • Attribute Persistence: Updated the logic to retain attributes collected in the /proc/cpuinfo header. This ensures that vendor_id and machine (Model) metadata are correctly associated with the processor entries rather than being discarded when the parser hits a blank line.
  • New Key Mappings: Added support for the features key to populate CPU capabilities on s390x.
  • Snapshot Testing: Added a new s390x test snapshot and a corresponding unit test to ensure long-term stability.

Testing Performed

  • Architecture Verified: s390x (IBM z16).
image image
  • Unit Tests:
  • Added TestS390xCPU in pkg/cpu/cpu_linux_test.go.
image
  • Verified that Vendor reports as IBM/S390 and Model reports the machine type (e.g., 3931).

  • Confirmed Capabilities are correctly parsed from the features line.

  • Regression Testing:

  • Ran existing TestArmCPU and TestCheckCPUTopologyFilesForOfflineCPU on x86/ARM snapshots to ensure no regressions in the standard parsing logic.

  • All tests passed: go test -v ./pkg/cpu/...

image

Impact

Users running ghw on s390x will now see populated Vendor, Model, and Capabilities fields in the CPUInfo struct, which previously returned empty strings.


@ibm-adarsh ibm-adarsh marked this pull request as draft February 9, 2026 12:05
@ibm-adarsh ibm-adarsh marked this pull request as draft February 9, 2026 12:05
@jaypipes jaypipes self-requested a review February 9, 2026 12:28
Signed-off-by: Adarsh Kumar Yadav <adarsh.kumar.yadav1@ibm.com>
Signed-off-by: ibm-adarsh <adarsh.kumar.yadav1@ibm.com>
Signed-off-by: Adarsh Kumar Yadav <adarsh.kumar.yadav1@ibm.com>
Signed-off-by: Adarsh Kumar Yadav <adarsh.kumar.yadav1@ibm.com>
Signed-off-by: Adarsh Kumar Yadav <adarsh.kumar.yadav1@ibm.com>
@ibm-adarsh ibm-adarsh requested a review from jaypipes February 9, 2026 13:51
@ibm-adarsh ibm-adarsh marked this pull request as ready for review February 9, 2026 13:52
Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good @ibm-adarsh thank you! :)

@jaypipes jaypipes merged commit bea5316 into jaypipes:main Feb 9, 2026
18 checks passed
@jaypipes
Copy link
Owner

jaypipes commented Feb 9, 2026

@ibm-adarsh welcome to the ghw contributors club :) thanks again for your efforts here!

@ashokpariya0
Copy link

@jaypipes Could we please create a release tag including this change whenever possible?

@jaypipes
Copy link
Owner

@ashokpariya0 you're all set :) release v0.23.0 includes this patch.

@ashokpariya0
Copy link

@ashokpariya0 you're all set :) release v0.23.0 includes this patch.

thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments