Bug 212357 - Turbostat has stopped working for Ryzen 3700X
Summary: Turbostat has stopped working for Ryzen 3700X
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 blocking
Assignee: Tools.Other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-19 12:19 UTC by Artem S. Tashkinov
Modified: 2021-05-05 01:00 UTC (History)
3 users (show)

See Also:
Kernel Version: 5.10.24, 5.11.7, 5.12
Tree: Mainline
Regression: Yes


Attachments
test fix (884 bytes, patch)
2021-04-17 12:49 UTC, Borislav Petkov
Details | Diff

Description Artem S. Tashkinov 2021-03-19 12:19:29 UTC
I used to run this:

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

to get my Ryzen 3700X power use. With turbostat version 20.09.30 this command doesn't return anything at all.

Also, turbostat used to run indefinitely by default and report all the values, now it just exits:

# turbostat
turbostat version 20.09.30 - Len Brown <lenb@kernel.org>
CPUID(0): AuthenticAMD 0x10 CPUID levels; 0x80000020 xlevels; family:model:stepping 0x17:71:0 (23:113:0)
CPUID(1): SSE3 MONITOR - - - TSC MSR - HT -
CPUID(6): APERF, No-TURBO, No-DTS, No-PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, No-EPB
CPUID(7): No-SGX
RAPL: 234 sec. Joule Counter Range, at 280 Watts
/dev/cpu_dma_latency: 2000000000 usec (default)
current_driver: acpi_idle
current_governor: menu
current_governor_ro: menu
cpu2: POLL: CPUIDLE CORE POLL IDLE
cpu2: C1: ACPI FFH MWAIT 0x0
cpu2: C2: ACPI IOPORT 0x414
cpu2: cpufreq driver: acpi-cpufreq
cpu2: cpufreq governor: ondemand
cpufreq boost: 0
cpu0: MSR_RAPL_PWR_UNIT: 0x000a1003 (0.125000 Watts, 0.000015 Joules, 0.000977 sec.)

Why have you completely broken the utility?
Comment 1 Artem S. Tashkinov 2021-03-19 12:19:58 UTC
Why have you completely broken the turbostat utility?
Comment 2 Artem S. Tashkinov 2021-03-21 09:14:32 UTC
From -h

> If no COMMAND is specified, turbostat wakes every 5-seconds to print
> statistics, until interrupted.

# turbostat 
turbostat version 20.09.30 - Len Brown <lenb@kernel.org>
CPUID(0): AuthenticAMD 0x10 CPUID levels; 0x80000020 xlevels; family:model:stepping 0x17:71:0 (23:113:0)
CPUID(1): SSE3 MONITOR - - - TSC MSR - HT -
CPUID(6): APERF, No-TURBO, No-DTS, No-PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, No-EPB
CPUID(7): No-SGX
RAPL: 234 sec. Joule Counter Range, at 280 Watts
/dev/cpu_dma_latency: 2000000000 usec (default)
current_driver: acpi_idle
current_governor: menu
current_governor_ro: menu
cpu0: POLL: CPUIDLE CORE POLL IDLE
cpu0: C1: ACPI FFH MWAIT 0x0
cpu0: C2: ACPI IOPORT 0x414
cpu0: cpufreq driver: acpi-cpufreq
cpu0: cpufreq governor: ondemand
cpufreq boost: 0
cpu0: MSR_RAPL_PWR_UNIT: 0x000a1003 (0.125000 Watts, 0.000015 Joules, 0.000977 sec.)
[root@zen ~]# echo $?
243
Comment 3 Artem S. Tashkinov 2021-03-21 09:16:14 UTC
Downgraded to turbostat from kernel 5.8, it works just fine.
Comment 4 Artem S. Tashkinov 2021-03-30 18:06:21 UTC
Len? Are you still there?
Comment 5 Artem S. Tashkinov 2021-04-10 21:34:55 UTC
It's been three weeks, how can I get your attention please?
Comment 6 Artem S. Tashkinov 2021-04-17 11:37:42 UTC
CC'ing Borislav.
Comment 7 Borislav Petkov 2021-04-17 12:49:07 UTC
Yah, that thing needs some more testing on AMD. I believe something like the attached patch should work but someone needs to audit this thing on AMD and verify it works properly.
Comment 8 Borislav Petkov 2021-04-17 12:49:48 UTC
Created attachment 296423 [details]
test fix
Comment 9 Artem S. Tashkinov 2021-04-17 13:59:41 UTC
(In reply to Borislav Petkov from comment #8)
> Created attachment 296423 [details]
> test fix

Thanks, the patch works! Please, if possible, push it to 5.12/5.11 stable.
Comment 10 Borislav Petkov 2021-04-19 20:21:12 UTC
This looks like the proper patch:

https://lkml.kernel.org/r/20210419195812.147710-1-terry.bowman@amd.com

It would be cool if you could test it and give a Tested-by.

Thx.
Comment 11 Artem S. Tashkinov 2021-04-20 04:53:36 UTC
(In reply to Borislav Petkov from comment #10)
> This looks like the proper patch:
> 
> https://lkml.kernel.org/r/20210419195812.147710-1-terry.bowman@amd.com
> 
> It would be cool if you could test it and give a Tested-by.
> 
> Thx.

patch -p5 < patch-amd.c 
patching file turbostat.c
Hunk #1 FAILED at 291.
Hunk #2 succeeded at 320 with fuzz 2.
Hunk #3 succeeded at 349 with fuzz 2.
Hunk #4 succeeded at 368 with fuzz 2.
Hunk #5 FAILED at 3317.
Hunk #6 FAILED at 3326.
Hunk #7 FAILED at 5393.
4 out of 7 hunks FAILED -- saving rejects to file turbostat.c.rej

No idea how to apply it. I'm using turbostat from kernel 5.11 (5.12 has not had changes to it).
Comment 12 Artem S. Tashkinov 2021-05-05 01:00:36 UTC
Will be fixed in 5.13.

Note You need to log in before you can comment on or make changes to this bug.