TheTumultuousUnicornOfDarkness / CPU-X

CPU-X is a Free software that gathers information on CPU, motherboard and more
https://thetumultuousunicornofdarkness.github.io/CPU-X
GNU General Public License v3.0
2k stars 132 forks source link

CPU frequency incorrect #64

Closed ghost closed 6 years ago

ghost commented 6 years ago

CPU frequency is locked at 4000MHz in CPU-X. I believe this is due to this: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1727158

I suggest grabbing the CPU frequency from _*/sys/devices/system/cpu/cpu/cpufreq/scaling_curfreq** instead.

lscpu shows the wrong frequency: CPU MHz: 4000.000 CPU max MHz: 4500.0000 CPU min MHz: 800.0000

While scaling_cur_freq shows the right frequency: cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq 800024 800029 800118 800211 800189 800118 800007 800046

Operating system name and version: Arch (4.14.12-1-ARCH)

CPU-X installation type: e.g. package/portable version/built from source Package

cpu-x --issue-fmt command output (as root):

CPU-X 3.1.3 (up-to-date)
Copyright © 2014-2016 Xorg

This is free software: you are free to change and redistribute it.
This program comes with ABSOLUTELY NO WARRANTY
See the GPLv3 license: <http://www.gnu.org/licenses/gpl.txt>

Built on Jan  8 2018, 19:52:36 (with GNU 7.2.1 20171128 on linux64).
-- GTK       version: 3.22.26
-- NCURSES   version: 6.0.20170902
-- LIBCURL   version: 7.57.0
-- LIBCPUID  version: 0.4.0
-- LIBPCI    version: 3.5.6
-- LIBPROCPS version: 3.3.12
-- DMIDECODE version: 3.0.20160907
-- BANDWIDTH version: 1.3.1

Setting label names
Calling dmidecode
Calling libcpuid for retrieving static data
Finding CPU technology
version=0.4.0
basic_cpuid[0]=00000016 756e6547 6c65746e 49656e69
basic_cpuid[1]=000506e3 00100800 7ffafbbf bfebfbff
basic_cpuid[2]=76036301 00f0b5ff 00000000 00c30000
basic_cpuid[3]=00000000 00000000 00000000 00000000
basic_cpuid[4]=1c004121 01c0003f 0000003f 00000000
basic_cpuid[5]=00000040 00000040 00000003 00142120
basic_cpuid[6]=000027f7 00000002 00000001 00000000
basic_cpuid[7]=00000000 029c6fbf 00000000 00000000
basic_cpuid[8]=00000000 00000000 00000000 00000000
basic_cpuid[9]=00000000 00000000 00000000 00000000
basic_cpuid[10]=07300404 00000000 00000000 00000603
basic_cpuid[11]=00000001 00000002 00000100 00000000
basic_cpuid[12]=00000000 00000000 00000000 00000000
basic_cpuid[13]=0000001f 00000440 00000440 00000000
basic_cpuid[14]=00000000 00000000 00000000 00000000
basic_cpuid[15]=00000000 00000000 00000000 00000000
basic_cpuid[16]=00000000 00000000 00000000 00000000
basic_cpuid[17]=00000000 00000000 00000000 00000000
basic_cpuid[18]=00000000 00000000 00000000 00000000
basic_cpuid[19]=00000000 00000000 00000000 00000000
basic_cpuid[20]=00000001 0000000f 00000007 00000000
basic_cpuid[21]=00000002 0000014e 00000000 00000000
basic_cpuid[22]=00000fa0 00001194 00000064 00000000
basic_cpuid[23]=00000fa0 00001194 00000064 00000000
basic_cpuid[24]=00000fa0 00001194 00000064 00000000
basic_cpuid[25]=00000fa0 00001194 00000064 00000000
basic_cpuid[26]=00000fa0 00001194 00000064 00000000
basic_cpuid[27]=00000fa0 00001194 00000064 00000000
basic_cpuid[28]=00000fa0 00001194 00000064 00000000
basic_cpuid[29]=00000fa0 00001194 00000064 00000000
basic_cpuid[30]=00000fa0 00001194 00000064 00000000
basic_cpuid[31]=00000fa0 00001194 00000064 00000000
ext_cpuid[0]=80000008 00000000 00000000 00000000
ext_cpuid[1]=00000000 00000000 00000121 2c100800
ext_cpuid[2]=65746e49 2952286c 726f4320 4d542865
ext_cpuid[3]=37692029 3037362d 43204b30 40205550
ext_cpuid[4]=302e3420 7a484730 00000000 00000000
ext_cpuid[5]=00000000 00000000 00000000 00000000
ext_cpuid[6]=00000000 00000000 01006040 00000000
ext_cpuid[7]=00000000 00000000 00000000 00000100
ext_cpuid[8]=00003027 00000000 00000000 00000000
ext_cpuid[9]=00000fa0 00001194 00000064 00000000
ext_cpuid[10]=00000fa0 00001194 00000064 00000000
ext_cpuid[11]=00000fa0 00001194 00000064 00000000
ext_cpuid[12]=00000fa0 00001194 00000064 00000000
ext_cpuid[13]=00000fa0 00001194 00000064 00000000
ext_cpuid[14]=00000fa0 00001194 00000064 00000000
ext_cpuid[15]=00000fa0 00001194 00000064 00000000
ext_cpuid[16]=00000fa0 00001194 00000064 00000000
ext_cpuid[17]=00000fa0 00001194 00000064 00000000
ext_cpuid[18]=00000fa0 00001194 00000064 00000000
ext_cpuid[19]=00000fa0 00001194 00000064 00000000
ext_cpuid[20]=00000fa0 00001194 00000064 00000000
ext_cpuid[21]=00000fa0 00001194 00000064 00000000
ext_cpuid[22]=00000fa0 00001194 00000064 00000000
ext_cpuid[23]=00000fa0 00001194 00000064 00000000
ext_cpuid[24]=00000fa0 00001194 00000064 00000000
ext_cpuid[25]=00000fa0 00001194 00000064 00000000
ext_cpuid[26]=00000fa0 00001194 00000064 00000000
ext_cpuid[27]=00000fa0 00001194 00000064 00000000
ext_cpuid[28]=00000fa0 00001194 00000064 00000000
ext_cpuid[29]=00000fa0 00001194 00000064 00000000
ext_cpuid[30]=00000fa0 00001194 00000064 00000000
ext_cpuid[31]=00000fa0 00001194 00000064 00000000
intel_fn4[0]=1c004121 01c0003f 0000003f 00000000
intel_fn4[1]=1c004122 01c0003f 0000003f 00000000
intel_fn4[2]=1c004143 00c0003f 000003ff 00000000
intel_fn4[3]=1c03c163 03c0003f 00001fff 00000006
intel_fn4[4]=00000000 00000000 00000000 00000000
intel_fn4[5]=00000000 00000000 00000000 00000000
intel_fn4[6]=00000000 00000000 00000000 00000000
intel_fn4[7]=00000000 00000000 00000000 00000000
intel_fn11[0]=00000001 00000002 00000100 00000000
intel_fn11[1]=00000004 00000008 00000201 00000000
intel_fn11[2]=00000000 00000000 00000002 00000000
intel_fn11[3]=00000000 00000000 00000003 00000000
intel_fn12h[0]=00000000 00000000 00000000 00000000
intel_fn12h[1]=00000000 00000000 00000000 00000000
intel_fn12h[2]=00000000 00000000 00000000 00000000
intel_fn12h[3]=00000000 00000000 00000000 00000000
intel_fn14h[0]=00000001 0000000f 00000007 00000000
intel_fn14h[1]=02490002 003f3fff 00000000 00000000
intel_fn14h[2]=00000000 00000000 00000000 00000000
intel_fn14h[3]=00000000 00000000 00000000 00000000
Calling libcpuid for retrieving CPU MSR static values
Finding devices
Finding graphic card driver
Identifying running system
Calling libcpuid for retrieving dynamic data
Calling libcpuid for retrieving CPU MSR dynamic values
Calculating CPU usage
Calculating CPU multipliers
Calling bandwidth
Calling libprocps
Retrieving GPU temperature
Updating benchmark status
Replacing undefined labels by an empty string
Checking on Internet for a new version...
No new version available
Dumping data...
  >>>>>>>>>> CPU <<<<<<<<<<

        ***** Processor *****
          Vendor: Intel
       Code Name: Skylake (Core i7)
         Package: LGA1151
      Technology: 14 nm
         Voltage: 1.310 V
   Specification: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
          Family: 6
     Ext. Family: 6
           Model: 14 (E)
      Ext. Model: 94 (5E)
           Temp.: 51°C
        Stepping: 3
    Instructions: MMX, SSE (1, 2, 3S, 4.1, 4.2), AES, AVX, VT-x, HT, Intel64

        ***** Clocks *****
      Core Speed: 4000 MHz
      Multiplier: x39.9 (8-45)
       Bus Speed: 100.17 MHz
           Usage:   7.60 %

        ***** Cache *****
         L1 Data: 4 x   32 KB,  8-way
        L1 Inst.: 4 x   32 KB,  8-way
         Level 2: 4 x  256 KB,  4-way
         Level 3:    8 MB, 16-way

        ***** * *****
       Socket(s): 1
         Core(s): 4
       Thread(s): 8

  >>>>>>>>>> Caches <<<<<<<<<<

        ***** L1 Cache *****
            Size: 4 x 32 KB, 8-way associative, 64-byte line size
           Speed: 137217.50 MB/s

        ***** L2 Cache *****
            Size: 4 x 256 KB, 4-way associative, 64-byte line size
           Speed: 77182.20 MB/s

        ***** L3 Cache *****
            Size: 8 MB, 16-way associative, 64-byte line size
           Speed: 57511.20 MB/s

  >>>>>>>>>> Motherboard <<<<<<<<<<

        ***** Motherboard *****
    Manufacturer: ASUSTeK COMPUTER INC.
           Model: Z170 PRO GAMING
        Revision: Rev X.0x

        ***** BIOS *****
           Brand: American Megatrends Inc.
         Version: 3501
            Date: 06/23/2017
        ROM Size:  64 kB / 16384 kB

        ***** Chipset *****
          Vendor: Intel Corporation
           Model: Sunrise Point-H LPC Controller

  >>>>>>>>>> Memory <<<<<<<<<<

        ***** Bank 0 *****
       Reference: Not Specified Not Specified, Empty @ (Unknown Unknown)

        ***** Bank 1 *****
       Reference: G-Skill F4-2400C15-8GVR .   , 8192 MB @ 2400MHz (DIMM DDR4)

        ***** Bank 2 *****
       Reference: Not Specified Not Specified, Empty @ (Unknown Unknown)

        ***** Bank 3 *****
       Reference: G-Skill F4-2400C15-8GVR     , 8192 MB @ 2400MHz (DIMM DDR4)

  >>>>>>>>>> System <<<<<<<<<<

        ***** Operating System *****
          Kernel: Linux 4.14.12-1-ARCH
    Distribution: Arch Linux
        Hostname: josh-arch
          Uptime: 0 days, 2 hours, 54 minutes, 10 seconds
        Compiler: cc (GCC) 7.2.1 20171224

        ***** Memory *****
            Used:  2326 MB / 16368 MB
         Buffers:   120 MB / 16368 MB
          Cached:  2851 MB / 16368 MB
            Free: 11069 MB / 16368 MB
            Swap:     0 MB /     0 MB

  >>>>>>>>>> Graphics <<<<<<<<<<

        ***** Card 0 *****
          Vendor: NVIDIA (nvidia driver)
           Model: GM204 [GeForce GTX 970]
     Temperature: 46.00°C

Freeing memory
TheTumultuousUnicornOfDarkness commented 6 years ago

Indeed, I've got the same issue with Linux 4.14.12-3-ck-sandybridge. This is related to kernel, due to it is working with LTS kernel (Linux 4.9).

Actually, the frequency is provided by libcpuid cpu_clock() (see here), and this function calls cpu_clock_by_os(): on Linux, it reads the /proc/cpuinfo file.

Some kernel patches related to this issue: v4.13-rc1: torvalds/linux@51204e0639c49ada02fd823782ad673b6326d748 v4.14-rc8: torvalds/linux@890da9cf098364b11a7f7f5c22fa652531624d03 v4.15-rc1: torvalds/linux@7d5905dc14a87805a59f3c5bf70173aac2bb18f8 The last patch will be backported in Linux 4.14.13.

Just wait and see...

TheTumultuousUnicornOfDarkness commented 6 years ago

Workaround in e6b199a: you can set CPUX_FORCE_FREQ_FALLBACK=1 environment variable to use /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq.

TheTumultuousUnicornOfDarkness commented 6 years ago

Just updated to Linux 4.14.13: problem fixed. 😉