nokyan / resources

Keep an eye on system resources
GNU General Public License v3.0
662 stars 54 forks source link

Wrong max CPU freq: displayed 6.08 GHz <-> actual 5.14 GHz #314

Open DmitryYudin opened 1 month ago

DmitryYudin commented 1 month ago

Is there an existing issue for this?

Current Behavior

image

I also do observe a difference in mem stats. This might not be a problem at all, but please take a look. image

Expected Behavior

5.14 GHz

Steps To Reproduce

N/A

Environment

v 1.5.1 (flatpack)

Anything else?

No response

nokyan commented 1 month ago

Hi, thanks for the issue. Can you please send the output of running lscpu in your terminal? In regards to the memory readings, I don't know what you're comparing Resources with but Resources' readings (of maximally available memory as used memory is not as clear cut) are consistent with GNOME System Monitor's and htop's (depending on data unit prefix), so I'd cautiously assume that the issue may be with the other program's readings.

DmitryYudin commented 1 month ago

Ooops, it really reports 6 GHz (bottom list), but in fact cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq 5137000 cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 5137000

cpupower frequency-info

analyzing CPU 14:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 14
  CPUs which need to have their frequency coordinated by software: 14
  maximum transition latency: 20.0 us
  hardware limits: 400 MHz - 5.45 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 400 MHz and 5.45 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.13 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    AMD PSTATE Highest Performance: 208. Maximum Frequency: 5.45 GHz.
    AMD PSTATE Nominal Performance: 145. Nominal Frequency: 3.80 GHz.
    AMD PSTATE Lowest Non-linear Performance: 42. Lowest Non-linear Frequency: 1.10 GHz.
    AMD PSTATE Lowest Performance: 16. Lowest Frequency: 400 MHz.

lscpu

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         48 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  16
  On-line CPU(s) list:   0-15
Vendor ID:               AuthenticAMD
  Model name:            AMD Ryzen 7 7840H with Radeon 780M Graphics
    CPU family:          25
    Model:               116
    Thread(s) per core:  2
    Core(s) per socket:  8
    Socket(s):           1
    Stepping:            1
    Frequency boost:     enabled
    CPU max MHz:         6080.0000
    CPU min MHz:         400.0000
    BogoMIPS:            7586.10
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nons
                         top_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse
                         4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced
                         vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm
                         _llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists paus
                         efilter pfthreshold v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov
                          succor smca fsrm flush_l1d
Virtualization features:
  Virtualization:        AMD-V
Caches (sum of all):
  L1d:                   256 KiB (8 instances)
  L1i:                   256 KiB (8 instances)
  L2:                    8 MiB (8 instances)
  L3:                    16 MiB (1 instance)
NUMA:
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-15
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:  Vulnerable
  Spec store bypass:     Vulnerable
  Spectre v1:            Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
  Spectre v2:            Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BHI: Not affected
  Srbds:                 Not affected
  Tsx async abort:       Not affected
DmitryYudin commented 1 month ago

Memory:

Resources

Mem:  6.09 / 29.08
Swap: 4.05 / 68.72

free -h

               total        used        free      shared  buff/cache   available
Mem:            27Gi       5.0Gi        14Gi       204Mi       7.7Gi        21Gi
Swap:           63Gi       3.8Gi        60Gi

free

               total        used        free      shared  buff/cache   available
Mem:        28402148     5267288    15037116      208936     8097744    22488584
Swap:       67108860     3956224    63152636
awumii commented 1 month ago

I'm pretty sure the frequency scaling is wrong on your CPU because Heterogeneous Core Type support is not merged yet into the mainline Linux kernel. https://www.phoronix.com/news/AMD-Heterogeneous-P-State-Linux https://bugzilla.kernel.org/show_bug.cgi?id=218759

DmitryYudin commented 1 month ago

You might be correct, but I guess the lscpu utility shows a kind of "static data" for the CPU (i.e. theoretical limit), but a real frequency range is controlled by the driver which is an amd_pstate in passive mode in this case. What is the max-freq to be displayed as a single value: max{core}{theoretical or real} or maybe avg{core}{max}{theoretical or real} there is a question)

nokyan commented 1 month ago

What is the max-freq to be displayed as a single value: max{core}{theoretical or real} or maybe avg{core}{max}{theoretical or real} there is a question)

I'm sorry but I don't quite understand what you mean by that.