sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.65k stars 300 forks source link

Bug: cpu freq parse failure #882

Closed undefined-moe closed 5 months ago

undefined-moe commented 5 months ago

Describe the bug On VMware workstation pro 17.5 (client system Ubuntu 23.10 Kernel 6.7.0-rc3), systeminfo.cpu() failed to parse cpu speed.

node -e "require('systeminformation').cpu().then(console.log)" returns:

{
  manufacturer: 'Intel',
  brand: 'Gen Intel® Core™ i5-13500H',
  vendor: 'Intel',
  family: '6',
  model: '186',
  stepping: '2',
  revision: '',
  voltage: '',
  speed: 0,
  speedMin: NaN,
  speedMax: NaN,
  governor: '',
  cores: 6,
  physicalCores: 6,
  performanceCores: 6,
  efficiencyCores: 0,
  processors: 1,
  socket: '',
  flags: 'fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni arat umip gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm serialize flush_l1d arch_capabilities',
  virtualization: false,
  cache: { l1d: 294912, l1i: 196608, l2: 7340032, l3: 18874368 }
}

Related: https://github.com/hydro-dev/Hydro/issues/708

lscpu output:

Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      45 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             6
On-line CPU(s) list:                0-5
Vendor ID:                          GenuineIntel
BIOS Vendor ID:                     GenuineIntel
Model name:                         13th Gen Intel(R) Core(TM) i5-13500H
BIOS Model name:                    13th Gen Intel(R) Core(TM) i5-13500H  CPU @ 3.2GHz
BIOS CPU family:                    2
CPU family:                         6
Model:                              186
Thread(s) per core:                 1
Core(s) per socket:                 6
Socket(s):                          1
Stepping:                           2
BogoMIPS:                           6374.42
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni arat umip gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm serialize flush_l1d arch_capabilities
Hypervisor vendor:                  VMware
Virtualization type:                full
L1d cache:                          288 KiB (6 instances)
L1i cache:                          192 KiB (6 instances)
L2 cache:                           7.5 MiB (6 instances)
L3 cache:                           18 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-5
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Mitigation; PTE Inversion
Vulnerability Mds:                  Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown:             Mitigation; PTI
Vulnerability Mmio stale data:      Unknown: No mitigations
Vulnerability Retbleed:             Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; IBRS, IBPB conditional, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

refer to https://github.com/sebhildebrandt/systeminformation/blob/5c5efe269eb0eedcb985a3e4be14652e37e75a3b/lib/cpu.js#L735 it parses first occured Model name while in this case that information's in BIOS Model name.

Lixuannan commented 5 months ago

This bug also work in Debian 12 with kernal 6.1.0-17-amd64

sebhildebrandt commented 5 months ago

Hi @undefined-moe , @Lixuannan , I will have a look at it!

@Lixuannan : can you provide the output of the following on your machine?

lscpu
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
dmidecode –t 4
cat /proc/cpuinfo
sebhildebrandt commented 5 months ago

@undefined-moe ... just to be sure ... your Ubuntu 23.10 is running in VMWare as a client host system (so on an virtual machine), right? On the host itself all is fine? But inside the VMware client we have this behavior?

undefined-moe commented 5 months ago

Can't confirm. I'm just forwarding this bug report from the original issue :(

but it seems that on lots of environments the cpu freq is in BIOS Model name after Model name line.

check Jeff Bastian's comment (2021-01-19 15:06:53) on https://bugzilla.redhat.com/show_bug.cgi?id=1882740 .

sebhildebrandt commented 5 months ago

@undefined-moe @Lixuannan ... should be fixed, can you test this? Version 5.21.23 just released.