linux/tools/power/cpupower/utils
He Rongguang 3ea492386b cpupower: fix TSC MHz calculation
[ Upstream commit 9d6c0e5851 ]

Commit 'cpupower: Make TSC read per CPU for Mperf monitor' (c2adb1877b)
changes TSC counter reads per cpu, but left time diff global (from start
of all cpus to end of all cpus), thus diff(time) is too large for a
cpu's tsc counting, resulting in far less than acutal TSC_Mhz and thus
`cpupower monitor` showing far less than actual cpu realtime frequency.

/proc/cpuinfo shows frequency:
cat /proc/cpuinfo | egrep -e 'processor' -e 'MHz'
...
processor : 171
cpu MHz   : 4108.498
...

before fix (System 100% busy):
    | Mperf              || Idle_Stats
 CPU| C0   | Cx   | Freq  || POLL | C1   | C2
 171|  0.77| 99.23|  2279||  0.00|  0.00|  0.00

after fix (System 100% busy):
    | Mperf              || Idle_Stats
 CPU| C0   | Cx   | Freq  || POLL | C1   | C2
 171|  0.46| 99.54|  4095||  0.00|  0.00|  0.00

Fixes: c2adb1877b ("cpupower: Make TSC read per CPU for Mperf monitor")
Signed-off-by: He Rongguang <herongguang@linux.alibaba.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-02-21 13:49:00 +01:00
..
helpers tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUs 2024-07-25 09:49:08 +02:00
idle_monitor cpupower: fix TSC MHz calculation 2025-02-21 13:49:00 +01:00
builtin.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpufreq-info.c cpupower: Add "perf" option to print AMD P-State information 2022-02-23 17:46:21 -07:00
cpufreq-set.c cpupower: Provide online and offline CPU information 2020-10-26 13:36:24 -06:00
cpuidle-info.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
cpuidle-set.c cpupower: Provide online and offline CPU information 2020-10-26 13:36:24 -06:00
cpupower-info.c tools/power/cpupower: Read energy_perf_bias from sysfs 2020-11-16 17:42:12 +01:00
cpupower-set.c tools/power/cpupower: Read energy_perf_bias from sysfs 2020-11-16 17:42:12 +01:00
cpupower.c cpupower: Provide online and offline CPU information 2020-10-26 13:36:24 -06:00
version-gen.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00