Repository navigation
Read NetBSD processor identity, topology and caches - #3818
Conversation
NetBSD prefixes every dmesg line with a timestamp, "[ 1.000004] ", so none of the shared BSD dmesg patterns matched: every NetBSD machine reported one physical core, no caches and no feature flags. The shared base now strips the timestamps and also accepts NetBSD's topology line, "cpuN: [node N, ]package P, core C, smt S", and its ARM cache lines, "L1 64KB/64B 4-way (256 set) VIPT Instruction cache". The ", id 0x..." suffix NetBSD appends to the model line is dropped; on ARM it is the affinity register, which differs on every processor and would make each core look like a different type. On AArch64 the vendor, part number, variant and revision now come from the Main ID Register, the first member of the struct in machdep.cpu0.cpu_id, in the form Linux reports them. The name comes from the processor's dmesg line, since hw.model names the board. On x86 the family, model and stepping come from the CPUID signature dmesg prints. 64-bit is read from hw.machine_arch, since hw.machine is the port (evbarm). Two pre-existing bugs in ProcessorIdentifier, affecting every platform: the ARM microarchitecture lookup built the key "arm..0xd0c" against a table keyed "arm.0xd0c", so it never matched; and the identifier string used the raw implementer "0x41" rather than the vendor it maps to. Verified on NetBSD 10.1 aarch64 (cfarm428, KVM Neoverse N1) in all three configurations: 16 cores, Neoverse-N1, MIDR 413FD0C1, full test suite passing. The x86 fixtures are from NetBSD 10.1 amd64 on the CI VM.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3818 +/- ##
============================================
- Coverage 80.92% 80.87% -0.05%
Complexity 674 674
============================================
Files 725 725
Lines 26045 26090 +45
Branches 4422 4428 +6
============================================
+ Hits 21076 21100 +24
- Misses 2757 2774 +17
- Partials 2212 2216 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
NetBSD prefixes every
dmesgline with a timestamp ([ 1.000004]), so none of the shared BSDdmesgpatterns matched. Every NetBSD machine reported one physical core, no caches and no feature flags.Changes:
cpuN: [node N, ]package P, core C, smt S) and its ARM cache lines (L1 64KB/64B 4-way (256 set) VIPT Instruction cache). The, id 0x...suffix on the model line is dropped. On ARM that is the affinity register, which differs per core and would make each core look like a different type.machdep.cpu0.cpu_id(struct aarch64_sysctl_cpu_id), in the form Linux reports it. The name comes from the processor'sdmesgline, becausehw.modelnames the board.dmesgprints (id 0xa00f11).hw.machine_arch.hw.machineis the port name (evbarm).Two older bugs in
ProcessorIdentifier, affecting every platform:arm..0xd0cagainst a table keyedarm.0xd0c, so it never matched.0x41rather than the vendor it maps to (ARM).Verified on NetBSD 10.1 aarch64 (cfarm428, KVM Neoverse N1) in all three configurations (JNA without native library, JNA native, FFM):
./mvnw clean test -Paggregate-coveragepasses there in every module. The x86 test fixtures come from NetBSD 10.1 amd64 on the GitHub Actions VM;cpuctl identifythere agrees with the decoded family 25, model 1, stepping 1.Not addressed: on x86 the vendor still comes from SMBIOS, which is
QEMUon a VM, and x86 cache sizes appear only incpuctl identify, not indmesg.Summary by CodeRabbit