cpuinfo: parse arm64 CPU identity fields (implementer/variant/part/revision) - #876
Open
CodeAlex52 wants to merge 2 commits into
Open
CodeAlex52 wants to merge 2 commits into
CodeAlex52 wants to merge 2 commits into
Conversation
…vision) The arm64 parser only read processor/BogoMIPS/Features/model name. arm64 kernels do not emit a "model name" line, so VendorID, CPUFamily, Model and Stepping were always empty and node_cpu_info lost all CPU identity labels on arm64 hosts. Parse the CPU implementer/variant/part/revision lines into the existing identity fields, following the kernel's arch/arm64/kernel/cpuinfo.c output. Non-arm64 behavior is unchanged. Regression: two-CPU arm64 fixture asserting the identity fields. Closes prometheus#875 Signed-off-by: CodeAlex <59381946+CodeAlex52@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The arm64 cpuinfo parser only read
processor,BogoMIPS,Featuresandmodel name. arm64 kernels do not emit amodel nameline, soVendorID,CPUFamily,ModelandSteppingwere always empty andnode_cpu_infolost all CPU identity labels on arm64 hosts.Root cause
The arm64 kernel (
arch/arm64/kernel/cpuinfo.c) identifies each CPU through theCPU implementer,CPU variant,CPU partandCPU revisionlines; the parser ignored all four.Fix
Parse those lines into the existing identity fields, preserving the parser's per-processor structure (each processor block repeats the implementer/variant/part/revision values). Non-arm64 behavior is unchanged.
Testing
TestParseCPUInfoARM64IdentityFields(two-CPU arm64 cpuinfo in the kernel's format): assertsVendorID=0x41,CPUFamily=0x1,Model=0xd40,Stepping=0per CPU.masteras-is, tests only): identity fields come back empty — https://github.com/CodeAlex52/procfs-arm64-verify/actions/runs/36533390261Fixes #875