Macchina-CLI / macchina

A system information frontend with an emphasis on performance.
https://crates.io/crates/macchina
MIT License
1.41k stars 51 forks source link

Display aarch64 CPU info #293

Open daniejstriata opened 1 year ago

daniejstriata commented 1 year ago

The aarch64 CPU cannot be queried with /proc/cpuinfo as the CPU name is not in there. Version 6.1.8 is not getting the CPU name correctly on my host. image You can see there is a space pushing the core count (2) out.

$ cat /proc/cpuinfo
processor   : 0
BogoMIPS    : 243.75
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x3
CPU part    : 0xd0c
CPU revision    : 1

processor   : 1
BogoMIPS    : 243.75
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x3
CPU part    : 0xd0c
CPU revision    : 1

lscpu has more info:

Architecture:           aarch64
  CPU op-mode(s):       32-bit, 64-bit
  Byte Order:           Little Endian
CPU(s):                 2
  On-line CPU(s) list:  0,1
Vendor ID:              ARM
  Model name:           Neoverse-N1
    Model:              1
    Thread(s) per core: 1
    Core(s) per socket: 2
    Socket(s):          1
    Stepping:           r3p1
    BogoMIPS:           243.75
    Flags:              fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
Caches (sum of all):    
  L1d:                  128 KiB (2 instances)
  L1i:                  128 KiB (2 instances)
  L2:                   2 MiB (2 instances)
  L3:                   32 MiB (1 instance)
NUMA:                   
  NUMA node(s):         1
  NUMA node0 CPU(s):    0,1
Vulnerabilities:        
  Gather data sampling: Not affected
  Itlb multihit:        Not affected
  L1tf:                 Not affected
  Mds:                  Not affected
  Meltdown:             Not affected
  Mmio stale data:      Not affected
  Retbleed:             Not affected
  Spec rstack overflow: Not affected
  Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:           Mitigation; __user pointer sanitization
  Spectre v2:           Mitigation; CSV2, BHB
  Srbds:                Not affected
  Tsx async abort:      Not affected

To Reproduce Steps to reproduce the behavior: 1. 2. 3.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

macchina --doctor output Add a screenshot or copy and paste the output of --doctor if an element you're supposed to be seeing isn't showing up.

System Information You don't have to provide this information if you're not comfortable doing so, but it'll help us solve the issue a lot faster.

grtcdr commented 7 months ago

I'm surprised to see such an edge case. I suspect this issue is due to manufacturer negligence. I wonder what else lspcu could be querying besides /proc/cpuinfo which has been extremely reliable up until this point.

daniejstriata commented 7 months ago

similar issue was resolved in FastFetch here: https://github.com/fastfetch-cli/fastfetch/issues/567 Use lscpu to detect CPU name for ARM CPUs (CPU, Linux)

grtcdr commented 7 months ago

I don't think this is a good solution. There are many instances where we shell out to some command-line tool, but I'd like to see that number decrease, not the other way around.

If you have the free time to study the other workarounds that lscpu implements in their code base to be able to show the proper information, and the know-how to port it over to Rust, I'd be more than happy to review and get it merged.