ocerman / zenpower

Zenpower is Linux kernel driver for reading temperature, voltage(SVI2), current(SVI2) and power(SVI2) for AMD Zen family CPUs.
GNU General Public License v2.0
448 stars 45 forks source link

Speaking of SVI2_P_Core #11

Closed birdie-github closed 4 years ago

birdie-github commented 5 years ago

What does this sensor mean exactly?

It surely doesn't report the correct power consumption because it remains fairly constant (~31W) despite any load, while e.g.

turbostat --quiet --num_iterations 1 --interval 1 --show PkgWatt --Summary

reports the correct values (from 15W to 91W for my Ryzen 7 3700X CPU).

ocerman commented 5 years ago

Core power (SVI2_P_Core) = Core current (SVI2_C_Core) * Core voltage (SVI2_Core)

However the Core current is not accurate on some systems so reported wattage/amperage may not be accurate (I have updated the readme about this issue).

ocerman commented 5 years ago

@birdie-github can you please try to update zenpower to new version and post debug data to #12 ?

birdie-github commented 5 years ago

Ryzen 7 3700X on a X570 motherboard.

0005a008 = 00000002
0005a00c = 014a001b
0005a010 = 01660003
000598bc = 0fff0fff
0005994c = 00000000
00059954 = 00000a90
00059958 = 00000000
0005995c = 00000000

Linux 5.2 with the two patches which allow the k10temp driver to recognize my CPU.

ocerman commented 5 years ago

Hello, I have released the new version, can you try it? The old version had soc/core values swapped and the formulas for wattage/amperage were not accurate. This should be fixed.

birdie-github commented 5 years ago

I've compiled the master. The values are still not correct (relatively idle):

zenpower-pci-00c3
Adapter: PCI adapter
SVI2_Core:    +0.91 V
SVI2_SoC:     +1.09 V
Tdie:         +38.4°C  (high = +70.0°C)
Tctl:         +38.4°C
SVI2_P_Core:   1.80 W
SVI2_P_SoC:    8.65 W
SVI2_C_Core:  +1.98 A
SVI2_C_SoC:   +7.95 A

turbostat shows around 25W.


Under load

zenpower-pci-00c3
Adapter: PCI adapter
SVI2_Core:    +1.33 V
SVI2_SoC:     +1.09 V
Tdie:         +55.6°C  (high = +70.0°C)
Tctl:         +55.6°C
SVI2_P_Core:  15.87 W
SVI2_P_SoC:    9.28 W
SVI2_C_Core: +11.86 A
SVI2_C_SoC:   +8.53 A

turbostat shows around 65W.

ocerman commented 4 years ago

So I have done some testing today with my 3700x. With 7z b SVI2 Core power is ~42W and turbostat shows ~90W.

Because AMD did not publish documentation about SVI2 stuff, my goal is to show same values as HWiNFO. And on my system it seems all right (screenshots below).

According to HWiNFO developer (source) there is a difference between SVI2 Power(SVI2_P_Core+SVI2_P_SoC) and CPU Package Power (smu/rapl/turbostat):

AMD Zen CPUs have multiple voltage rails: VDDCR_CPU and VDDCR_SOC CPU Core Power (SVI2 TFN) is measured via SVI2 telemetry and it reflects only the core (VDDCR_CPU) rail. SoC Power reflects the VDDCR_SOC rail. So VDDCR_CPU + VDDCR_SOC + (additional rest-of-chip power that can't be measured) should equal the total CPU Package Power.

I suggest to watch the CPU Package Power (SMU) value only as this is the total telemetry provided internally by the CPU.

zenpower

hwinfo

@birdie-github 16W under load seems wrong. The debug data that you have posted were under load?

birdie-github commented 4 years ago

After compiling the master:

7z b

zenpower-pci-00c3
Adapter: PCI adapter
SVI2_Core:    +1.29 V  
SVI2_SoC:     +1.09 V  
Tdie:         +54.5°C  (high = +70.0°C)
Tctl:         +54.5°C  
Tccd1:        +58.8°C  
SVI2_P_Core:  35.64 W  
SVI2_P_SoC:    9.61 W  
SVI2_C_Core: +27.01 A  
SVI2_C_SoC:   +8.83 A  

So, the question remains, could you export Package Power in the zenpower kernel module, so that running the GUI utility is not necessary to see the real/overall/net CPU power consumption?

ocerman commented 4 years ago

Yes, it is possible to export cpu package power to the hwmon kernel driver. I will try to do it soon, however I won't put it into this kernel module and instead I will make a new one.