Commit graph

926 commits

Author SHA1 Message Date
Linus Torvalds
2b38afce25 tools/power turbostat: version 2025.09.09
Probe and display L3 Cache topology
 Add ability to average an added counter
 	(useful for pre-integrated "counters", such as Watts)
 Break the limit of 64 built-in counters.
 Assorted bug fixes and minor feature tweaks
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmiX9oQUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3NhfNYg/+Lh6tMh84N0ziNpX31mWCJChlGJXq
 7vR4J8E9GSO7Ixz9HGGQxvPAXp/FNuOCYJ6LNOpyzauoxwtF836MABGhQveBUzfu
 /0wmkN/DEUb0FTRHPR1LiGDarl42g8CsaQfrCzAvO9WUviOHOicfM6duk5hVItQd
 5QotmHuLJtEbwxnYdVZW5FbXFMFU/C1z/8zk3VcoW8H2gV3qR/MXuzyOcp8C2pdU
 x7/i5FlAOEabhL8liOx1x8OcCo5NGne+eV7tr1SE6Duykg9aIL3o/KdfQhEI7uF0
 f8Ya7Sol0d6kFTJNnSOPWa5QNkLOW5ib4iTyDkvaFHY8CeakMLNjIkdcLXKRsYCs
 yWszWtUMECC/GprDwl5Aq77a54p/2gp6Ntekhn1aWw0/jhBIf/ZTAiFA2OcG3Ikd
 RWAn3veaVRNxrHA6Ck7US/sJAiE3VNod+eIFA+/4NaQEpVJdtHlkwNwjwgF6pwaM
 PakryoT4v6ZfC7FfCBH3wMSlWmO5612zNqQM35yWuGMXMBHZKcuSQUliXkN5KfpX
 /ShjYbBUhiK6MiswZaXsWEdocqjX4t4QHRGAi75mGDpBey7gd62RQH+8R5bcLiVH
 258Y/Zg+yvHrcq3rmpK0tF/nTI+WrXlcsv6sGHW/QJ3Fet0iXlI9kLtzRANwkcYk
 Zfvwnp9BP3Q6FRg=
 =1iYa
 -----END PGP SIGNATURE-----

Merge tag 'turbostat-2025.09.09' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:
 "tools/power turbostat: version 2025.09.09

   - Probe and display L3 Cache topology

   - Add ability to average an added counter (useful for pre-integrated
     "counters", such as Watts)

   - Break the limit of 64 built-in counters

   - Assorted bug fixes and minor feature tweaks"

* tag 'turbostat-2025.09.09' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: version 2025.09.09
  tools/power turbostat: Handle non-root legacy-uncore sysfs permissions
  tools/power turbostat: standardize PER_THREAD_PARAMS
  tools/power turbostat: Fix DMR support
  tools/power turbostat: add format "average" for external attributes
  tools/power turbostat: delete GET_PKG()
  tools/power turbostat: probe and display L3 cache topology
  tools/power turbostat: Support more than 64 built-in-counters
  tools/power turbostat.8: Document Totl%C0, Any%C0, GFX%C0, CPUGFX% columns
  tools/power turbostat: Fix bogus SysWatt for forked program
  tools/power turbostat: Handle cap_get_proc() ENOSYS
  tools/power turbostat: Fix build with musl
  tools/power turbostat: verify arguments to params --show and --hide
  tools/power turbostat: regression fix: --show C1E%
2025-08-10 09:02:36 +03:00
Len Brown
5e98a5e73e tools/power turbostat: version 2025.09.09
Probe and display L3 Cache topology
Add ability to average an added counter
	(useful for pre-integrated "counters", such as Watts)
Break the limit of 64 built-in counters.
Assorted bug fixes and minor feature tweaks

Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Len Brown
e60a13bcef tools/power turbostat: Handle non-root legacy-uncore sysfs permissions
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/
may be readable by all, but
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/current_freq_khz
may be readable only by root.

Non-root turbostat users see complaints in this scenario.

Fail probe of the interface if we can't read current_freq_khz.

Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Original-patch-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Len Brown
378e901160 tools/power turbostat: standardize PER_THREAD_PARAMS
use a macro for PER_THREAD_PARAMS to make adding one later more clear.

no functional change

Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Zhang Rui
3a088b07c4 tools/power turbostat: Fix DMR support
Together with the RAPL MSRs, there are more MSRs gone on DMR, including
PLR (Perf Limit Reasons), and IRTL (Package cstate Interrupt Response
Time Limit) MSRs. The configurable TDP info should also be retrieved
from TPMI based Intel Speed Select Technology feature.

Remove the access of these MSRs for DMR. Improve the DMR platform
feature table to make it more readable at the same time.

Fixes: 83075bd59d ("tools/power turbostat: Add initial support for DMR")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Michael Hebenstreit
dcd1c379b0 tools/power turbostat: add format "average" for external attributes
External atributes with format "raw" are not printed in summary lines
for nodes/packages (or with option -S). The new format "average"
behaves like "raw" but also adds the summary data

Signed-off-by: Michael Hebenstreit <michael.hebenstreit@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Len Brown
a5015d945d tools/power turbostat: delete GET_PKG()
pkg_base[pkg_id] is a simple array of structure pointers,
let the compiler treat it that way.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Len Brown
5f961fb2a7 tools/power turbostat: probe and display L3 cache topology
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:24:46 -04:00
Len Brown
8d14a098b4 tools/power turbostat: Support more than 64 built-in-counters
We have out-grown the ability to use a 64-bit memory location
to inventory every possible built-in counter.
Leverage the the CPU_SET(3) macros to break this barrier.

Also, break the Joules & Watts counters into two,
since we can no longer 'or' them together...

Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 21:23:45 -04:00
Len Brown
d240b441b5 tools/power turbostat.8: Document Totl%C0, Any%C0, GFX%C0, CPUGFX% columns
Explain the meaning of the Totl%C0, Any%C0, GFX%C0, CPUGFX% columns.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-09 11:14:30 -04:00
Zhang Rui
44207567fa tools/power turbostat: Fix bogus SysWatt for forked program
Similar to delta_cpu(), delta_platform() is called in turbostat main
loop. This ensures accurate SysWatt readings in periodic monitoring mode
$ sudo turbostat -S -q --show power -i 1
CoreTmp	PkgTmp	PkgWatt	CorWatt	GFXWatt	RAMWatt	PKG_%	RAM_%	SysWatt
60	61	6.21	1.13	0.16	0.00	0.00	0.00	13.07
58	61	6.00	1.07	0.18	0.00	0.00	0.00	12.75
58	61	5.74	1.05	0.17	0.00	0.00	0.00	12.22
58	60	6.27	1.11	0.24	0.00	0.00	0.00	13.55

However, delta_platform() is missing for forked program and causes bogus
SysWatt reporting,
$ sudo turbostat -S -q --show power sleep 1
1.004736 sec
CoreTmp	PkgTmp	PkgWatt	CorWatt	GFXWatt	RAMWatt	PKG_%	RAM_%	SysWatt
57	58	6.05	1.02	0.16	0.00	0.00	0.00	0.03

Add missing delta_platform() for forked program.

Fixes: e5f687b89b ("tools/power turbostat: Add RAPL psys as a built-in counter")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-08 16:05:54 -04:00
Calvin Owens
d34fe509f5 tools/power turbostat: Handle cap_get_proc() ENOSYS
Kernels configured with CONFIG_MULTIUSER=n have no cap_get_proc().
Check for ENOSYS to recognize this case, and continue on to
attempt to access the requested MSRs (such as temperature).

Signed-off-by: Calvin Owens <calvin@wbinvd.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-08 16:05:53 -04:00
Calvin Owens
6ea0ec1b95 tools/power turbostat: Fix build with musl
turbostat.c: In function 'parse_int_file':
    turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in this function)
     5567 |         char path[PATH_MAX];
          |                   ^~~~~~~~

    turbostat.c: In function 'probe_graphics':
    turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in this function)
     6787 |         char path[PATH_MAX];
          |                   ^~~~~~~~

Signed-off-by: Calvin Owens <calvin@wbinvd.org>
Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-08 16:05:53 -04:00
Len Brown
d44c40e4e3 tools/power turbostat: verify arguments to params --show and --hide
$ sudo turbostat --quiet --show junk
turbostat: Counter 'junk' can not be added.

Previously, invalid arguments to --show and --hide were silently ignored

Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-08-08 16:05:27 -04:00
Len Brown
5d939fbdd4 tools/power turbostat: regression fix: --show C1E%
The new default idle counter groupings broke "--show C1E%" (or any other C-state %)

Also delete a stray debug printf from the same offending commit.

Reported-by: Zhang Rui <rui.zhang@intel.com>
Fixes: ec4acd3166 ("tools/power turbostat: disable "cpuidle" invocation counters, by default")
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-09 23:43:14 -04:00
Linus Torvalds
939f15e640 turbostat v2025.06.08
Add initial DMR support, which required smarter RAPL probe
 Fix AMD MSR RAPL energy reporting
 Add RAPL power limit configuration output
 Minor fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmhF0rgUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3NhcwRA/+IHnZoisw+uxY2TVY99Oi6mUx7i2r
 UH8Q6USFj4FVY1UXLeL4OfEY1pGukM+plDD+GjfzCgOsI6prARwEfQuR9to/lWaF
 in+EpSPJLpaLvRlug0fC+MENbPI/lR2NMq9SUd9WGyUZRfrVqyMgqOnogUzpMVxZ
 nvjtxO7scG5Vlqz7jTzyYquF9wZJjHMY0uUTOSydEAYMBH1X2TtG0N0TfoorGedf
 nZ/eEOCmoMIn0MD25tL8NZ1FaSR8p21r/aTP3zLj6y2bMmYEUGEzDfaHTSXjOzNK
 xQNIvxWdeo4PtF6ydxm5jmbW5aw8/iigGWnRJEltIJiAC5LcU4EFPVpqiYxp+ks4
 Ci+TbgypCg2W5XwnHEEG4aKwIPAJXfkvZgoyPac0jP4q6CZqVfy8zxNijZvuSkdq
 fzbjYfUtdgCIeiFex2txJPgHfv5VyOtN1vlPuVjQiZGYnyDXOhVZv67Rb8xTZxk1
 OUbxdewAB6Z2oLhUYYYH576yjF1U2ec2mRNVIWDZ549RFoyVjMJGYta8iabMJrRV
 hM6N61LzJb8/xQsFtZh5hmc6Z/+lfQKUn3idb1eN65vFf2QUfzcc+oBP5IwL0oIf
 sOJc4NLph4VwctKv+xekHPFmy1OMa2OmgC96VYMrFGvd3YKvmMB4JwxzVk0N49pq
 qLZd7ZHha5llG/w=
 =ZmFu
 -----END PGP SIGNATURE-----

Merge tag 'turbostat-2025.06.08' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:

 - Add initial DMR support, which required smarter RAPL probe

 - Fix AMD MSR RAPL energy reporting

 - Add RAPL power limit configuration output

 - Minor fixes

* tag 'turbostat-2025.06.08' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: version 2025.06.08
  tools/power turbostat: Add initial support for BartlettLake
  tools/power turbostat: Add initial support for DMR
  tools/power turbostat: Dump RAPL sysfs info
  tools/power turbostat: Avoid probing the same perf counters
  tools/power turbostat: Allow probing RAPL with platform_features->rapl_msrs cleared
  tools/power turbostat: Clean up add perf/msr counter logic
  tools/power turbostat: Introduce add_msr_counter()
  tools/power turbostat: Remove add_msr_perf_counter_()
  tools/power turbostat: Remove add_cstate_perf_counter_()
  tools/power turbostat: Remove add_rapl_perf_counter_()
  tools/power turbostat: Quit early for unsupported RAPL counters
  tools/power turbostat: Always check rapl_joules flag
  tools/power turbostat: Fix AMD package-energy reporting
  tools/power turbostat: Fix RAPL_GFX_ALL typo
  tools/power turbostat: Add Android support for MSR device handling
  tools/power turbostat.8: pm_domain wording fix
  tools/power turbostat.8: fix typo: idle_pct should be pct_idle
2025-06-08 11:44:41 -07:00
Len Brown
42fd37dcc4 tools/power turbostat: version 2025.06.08
Add initial DMR support, which required smarter RAPL probe
Fix AMD MSR RAPL energy reporting
Add RAPL power limit configuration output
Minor fixes

Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:17 -04:00
Zhang Rui
d8c0f5d973 tools/power turbostat: Add initial support for BartlettLake
Add initial support for BartlettLake.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:17 -04:00
Zhang Rui
83075bd59d tools/power turbostat: Add initial support for DMR
Add initial support for DMR.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
2a535d6cc3 tools/power turbostat: Dump RAPL sysfs info
for example:

intel-rapl:1: psys 28.0s:100W 976.0us:100W
intel-rapl:0: package-0 28.0s:57W,max:15W 2.4ms:57W
intel-rapl:0/intel-rapl:0:0: core disabled
intel-rapl:0/intel-rapl:0:1: uncore disabled
intel-rapl-mmio:0: package-0 28.0s:28W,max:15W 2.4ms:57W

[lenb: simplified format]

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

squish me

Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
69078520fd tools/power turbostat: Avoid probing the same perf counters
For the RAPL package energy status counter, Intel and AMD share the same
perf_subsys and perf_name, but with different MSR addresses.

Both rapl_counter_arch_infos[0] and rapl_counter_arch_infos[1] are
introduced to describe this counter for different Vendors.

As a result, the perf counter is probed twice, and causes a failure in
in get_rapl_counters() because expected_read_size and actual_read_size
don't match.

Fix the problem by skipping the already probed counter.

Note, this is not a perfect fix. For example, if different
vendors/platforms use the same MSR value for different purpose, the code
can be fooled when it probes a rapl_counter_arch_infos[] entry that does
not belong to the running Vendor/Platform.

In a long run, better to put rapl_counter_arch_infos[] into the
platform_features so that this becomes Vendor/Platform specific.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
ff3d019e98 tools/power turbostat: Allow probing RAPL with platform_features->rapl_msrs cleared
platform_features->rapl_msrs describes the RAPL MSRs supported. While
RAPL Perf counters can be exposed from different kernel backend drivers,
e.g. RAPL MSR I/F driver, or RAPL TPMI I/F driver.

Thus, turbostat should first blindly probe all the available RAPL Perf
counters, and falls back to the RAPL MSR counters if they are listed in
platform_features->rapl_msrs.

With this, platforms that don't have RAPL MSRs can clear the
platform_features->rapl_msrs bits and use RAPL Perf counters only.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
0362337968 tools/power turbostat: Clean up add perf/msr counter logic
Increase the code readability by moving the no_perf/no_msr flag and the
cai->perf_name/cai->msr sanity checks into the counter probe functions.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
1ab2e19b4c tools/power turbostat: Introduce add_msr_counter()
probe_rapl_msr() is reused for probing RAPL MSR counters, cstate MSR
counters and MPERF/APERF/SMI MSR counters, thus its name is misleading.

Similar to add_perf_counter(), introduce add_msr_counter() to probe a
counter via MSR. Introduce wrapper function add_rapl_msr_counter() at
the same time to add extra check for Zero return value for specified
RAPL counters.

No functional change intended.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
3403e89f97 tools/power turbostat: Remove add_msr_perf_counter_()
As the only caller of add_msr_perf_counter_(), add_msr_perf_counter()
just gives extra debug output on top. There is no need to keep both
functions.

Remove add_msr_perf_counter_() and move all the logic to
add_msr_perf_counter().

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
4d6ced7bef tools/power turbostat: Remove add_cstate_perf_counter_()
As the only caller of add_cstate_perf_counter_(),
add_cstate_perf_counter() just gives extra debug output on top. There is
no need to keep both functions.

Remove add_cstate_perf_counter_() and move all the logic to
add_cstate_perf_counter().

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
c8bca955da tools/power turbostat: Remove add_rapl_perf_counter_()
As the only caller of add_rapl_perf_counter_(), add_rapl_perf_counter()
just gives extra debug output on top. There is no need to keep both
functions.

Remove add_rapl_perf_counter_() and move all the logic to
add_rapl_perf_counter().

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
57b53787f0 tools/power turbostat: Quit early for unsupported RAPL counters
Quit early for unsupported RAPL counters.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Zhang Rui
fdea6b883b tools/power turbostat: Always check rapl_joules flag
rapl_joules bit should always be checked even if
platform_features->rapl_msrs is not set or no_msr flag is used.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Gautham R. Shenoy
adb49732c8 tools/power turbostat: Fix AMD package-energy reporting
commit 05a2f07db8 ("tools/power turbostat: read RAPL counters via
perf") that adds support to read RAPL counters via perf defines the
notion of a RAPL domain_id which is set to physical_core_id on
platforms which support per_core_rapl counters (Eg: AMD processors
Family 17h onwards) and is set to the physical_package_id on all the
other platforms.

However, the physical_core_id is only unique within a package and on
platforms with multiple packages more than one core can have the same
physical_core_id and thus the same domain_id. (For eg, the first cores
of each package have the physical_core_id = 0). This results in all
these cores with the same physical_core_id using the same entry in the
rapl_counter_info_perdomain[]. Since rapl_perf_init() skips the
perf-initialization for cores whose domain_ids have already been
visited, cores that have the same physical_core_id always read the
perf file corresponding to the physical_core_id of the first package
and thus the package-energy is incorrectly reported to be the same
value for different packages.

Note: This issue only arises when RAPL counters are read via perf and
not when they are read via MSRs since in the latter case the MSRs are
read separately on each core.

Fix this issue by associating each CPU with rapl_core_id which is
unique across all the packages in the system.

Fixes: 05a2f07db8 ("tools/power turbostat: read RAPL counters via perf")
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Kaushlendra Kumar
b4a734d383 tools/power turbostat: Fix RAPL_GFX_ALL typo
Fix typo in the currently unused RAPL_GFX_ALL macro definition.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Kaushlendra Kumar
5663785ae0 tools/power turbostat: Add Android support for MSR device handling
It uses /dev/msrN device paths on Android instead of /dev/cpu/N/msr,
updates error messages and permission checks to reflect the Android
device path, and wraps platform-specific code with #if defined(ANDROID)
to ensure correct behavior on both Android and non-Android systems.
These changes improve compatibility and usability of turbostat on
Android devices.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Len Brown
c967900fcb tools/power turbostat.8: pm_domain wording fix
turbostat.8: clarify that uncore "domains" are Power Management domains,
aka pm_domains.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:16 -04:00
Len Brown
394c1127ab tools/power turbostat.8: fix typo: idle_pct should be pct_idle
idle_pct should be pct_idle

Signed-off-by: Len Brown <len.brown@intel.com>
2025-06-08 14:10:01 -04:00
Srinivas Pandruvada
6dfe26cb1c tools/power/x86/intel-speed-select: v1.23 release
This version includes the following changes:
- Displays SST-PP2 revision fields.
- Skips updating uncore frequency limits on newer generations of CPUs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-05-09 11:12:31 -07:00
Srinivas Pandruvada
51272ca7c3 tools/power/x86/intel-speed-select: Skip uncore frequency update
On SST PP level switch, skip adjusting the uncore frequency limit and
allow the hardware to handle this on newer platforms.

As newer generations of CPUs have changed the extended family identifier,
use this identifier to exclude the update.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-05-09 11:04:19 -07:00
Srinivas Pandruvada
5aa63cab70 tools/power/x86/intel-speed-select: Support SST PP revision 2 fields
Display fields added by SST PP revision 2. They include:
uncore P0 (max frequency), P1 (base frequency) and Pm (min frequency)
for uncore fabric 1.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-05-09 10:58:39 -07:00
Linus Torvalds
710329254d Turbostat 2025.05.06
Support up to 8192 processors
 Add cpuidle governor debug telemetry, disabled by default
 Update default output to exclude cpuidle invocation counts
 Bug fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmfyzZcUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3Nhf/WA//YUPcKo4IW2Mp2i5qlN2kTFZ8WfH0
 naTO5HUgIr+zF+j+StuUL6tp/eR8QcW8BSl10wzawg3DR0+nFnnmga63dPELj5+g
 2Wh0HXR0x916UWrU+PLcgADhbU35QCQcdzZVPonFm2yj5TzvAk8AopEz+OZ2mVIP
 vt7Fe+9iCTXMr/MlKMJv5wnAR5dsXiQ8z7djcDML7QT/EO3lqG01EvFB8eKeT+Md
 qNfNA+4oIfZ4U9uoIJiqtQQxhpbvmz0IkPQjMyGPzgItCwqaG/HzsPq7gnt0AnN5
 p1vJuq8eyDI0JzCl85LFka3vJdscRalimO4J0Jii/XkaK7lJSbvtq4nBazFMaWoO
 dt2D1E0z2KMJnAzqHOGnYUKNAVcLQRMSUyHcD+5Cw8QcN1/dT8+O8saT2CCZvBcE
 g6x9Pm2IUIATtgvxEPZ8aGPUl6eWHmh6loXSKdgsZZmtzaTEsDPDVTXgdAayK6Mg
 kip5eFqP9btD7FsbBrm6FaC4gfw0KX5Uwr9HcqCrNIUngC+Rj84zwoI7h/GbOldc
 Wtb5tgYKRaTk7EQZAmXfBDlad1YB7sQ8HlcIbxawtgxPg9Nln07OojjuB8qGyqLy
 5Xi5JhT2y+71RYizrRZ3Q5Anq7ZXvST5jR35+TpGJj6e5oUJ6UyLiL3vp60HEeQQ
 JKb19ERnItMtnTk=
 =xW5/
 -----END PGP SIGNATURE-----

Merge tag 'turbostat-2025.05.06' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:

 - support up to 8192 processors

 - add cpuidle governor debug telemetry, disabled by default

 - update default output to exclude cpuidle invocation counts

 - bug fixes

* tag 'turbostat-2025.05.06' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: v2025.05.06
  tools/power turbostat: disable "cpuidle" invocation counters, by default
  tools/power turbostat: re-factor sysfs code
  tools/power turbostat: Restore GFX sysfs fflush() call
  tools/power turbostat: Document GNR UncMHz domain convention
  tools/power turbostat: report CoreThr per measurement interval
  tools/power turbostat: Increase CPU_SUBSET_MAXCPUS to 8192
  tools/power turbostat: Add idle governor statistics reporting
  tools/power turbostat: Fix names matching
  tools/power turbostat: Allow Zero return value for some RAPL registers
  tools/power turbostat: Clustered Uncore MHz counters should honor show/hide options
2025-04-06 12:32:43 -07:00
Len Brown
03e00e373c tools/power turbostat: v2025.05.06
Support up to 8192 processors
Add cpuidle governor debug telemetry, disabled by default
Update default output to exclude cpuidle invocation counts
Bug fixes

Signed-off-by: Len Brown <len.brown@intel.com>
2025-04-06 14:49:20 -04:00
Len Brown
ec4acd3166 tools/power turbostat: disable "cpuidle" invocation counters, by default
Create "pct_idle" counter group, the sofware notion of residency
so it can now be singled out, independent of other counter groups.

Create "cpuidle" group, the cpuidle invocation counts.
Disable "cpuidle", by default.

Create "swidle" = "cpuidle" + "pct_idle".
Undocument "sysfs", the old name for "swidle", but keep it working
for backwards compatibilty.

Create "hwidle", all the HW idle counters

Modify "idle", enabled by default
"idle" = "hwidle" + "pct_idle" (and now excludes "cpuidle")

Signed-off-by: Len Brown <len.brown@intel.com>
2025-04-06 14:29:57 -04:00
Len Brown
994633894f tools/power turbostat: re-factor sysfs code
Probe cpuidle "sysfs" residency and counts separately,
since soon we will make one disabled on, and the
other disabled off.

Clarify that some BIC (build-in-counters) are actually "groups".
since we're about to re-name some of those groups.

no functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-04-06 12:53:18 -04:00
Zhang Rui
f8b136ef26 tools/power turbostat: Restore GFX sysfs fflush() call
Do fflush() to discard the buffered data, before each read of the
graphics sysfs knobs.

Fixes: ba99a4fc8c ("tools/power turbostat: Remove unnecessary fflush() call")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-04-06 12:36:03 -04:00
Len Brown
3ae8508663 tools/power turbostat: Document GNR UncMHz domain convention
Document that on Intel Granite Rapids Systems,
Uncore domains 0-2 are CPU domains, and
uncore domains 3-4 are IO domains.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-04-06 12:31:59 -04:00
Len Brown
f729775f79 tools/power turbostat: report CoreThr per measurement interval
The CoreThr column displays total thermal throttling events
since boot time.

Change it to report events during the measurement interval.

This is more useful for showing a user the current conditions.
Total events since boot time are still available to the user via
/sys/devices/system/cpu/cpu*/thermal_throttle/*

Document CoreThr on turbostat.8

Fixes: eae97e053f ("turbostat: Support thermal throttle count print")
Reported-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Chen Yu <yu.c.chen@intel.com>
2025-04-06 12:21:25 -04:00
Justin Ernst
eb187540d1 tools/power turbostat: Increase CPU_SUBSET_MAXCPUS to 8192
On systems with >= 1024 cpus (in my case 1152), turbostat fails with the error output:
	"turbostat: /sys/fs/cgroup/cpuset.cpus.effective: cpu str malformat 0-1151"

A similar error appears with the use of turbostat --cpu when the inputted cpu
range contains a cpu number >= 1024:
	# turbostat -c 1100-1151
	"--cpu 1100-1151" malformed
	...

Both errors are caused by parse_cpu_str() reaching its limit of CPU_SUBSET_MAXCPUS.

It's a good idea to limit the maximum cpu number being parsed, but 1024 is too low.
For a small increase in compute and allocated memory, increasing CPU_SUBSET_MAXCPUS
brings support for parsing cpu numbers >= 1024.

Increase CPU_SUBSET_MAXCPUS to 8192, a common setting for CONFIG_NR_CPUS on x86_64.

Signed-off-by: Justin Ernst <justin.ernst@hpe.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-04-06 12:14:14 -04:00
Linus Torvalds
fb1ceb29b2 platform-drivers-x86 for v6.15-1
Highlights:
 
  - alienware-wmi: Refactor and split WMAX/legacy drivers
 
  - dell-ddv:
 
     - Correct +0.1 offset in temperature
 
     - Use the power supply extension mechanism for battery temperatures
 
  - intel/pmc:
 
     - Refactor init to mostly use a common init function
 
     - Add support for Arrow Lake U/H
 
     - Add support for Panther Lake
 
  - intel/sst:
 
     - Improve multi die handling
 
     - Prefix header search path with sysroot (fixes cross-compiling)
 
  - lenovo-wmi-hotkey-utilities: Support for mic & audio mute LEDs
 
  - samsung-galaxybook: Add driver for Samsung Galaxy Book series
 
  - wmi:
 
     - Rework WCxx/WExx ACPI method handling
 
     - Enable data block collection when the data block is set
 
  - platform/arm:
 
     - Add Huawei Matebook E Go EC driver
 
  - platform/mellanox:
 
     - Relocate to drivers/platform/mellanox/
 
     - mlxbf-bootctl: RTC battery status sysfs support
 
  - Miscellaneous cleanups / refactoring / improvements
 
 The following is an automated shortlog grouped by driver:
 
 alienware-wmi:
  -  Add a state container for LED control feature
  -  Add a state container for thermal control methods
  -  Add alienware-wmi.h
  -  Add WMI Drivers
  -  Refactor hdmi, amplifier, deepslp methods
  -  Refactor LED control methods
  -  Refactor thermal control methods
  -  Rename alienware-wmi.c
  -  Split DMI table
  -  Split the alienware-wmi driver
  -  Update alienware-wmi config entries
  -  Update header and module information
 
 amd/pmc:
  -  fix leak in probe()
  -  Move macros and structures to the PMC header file
  -  Notify user when platform does not support s0ix transition
  -  Remove unnecessary line breaks
  -  Use managed APIs for mutex
 
 amd/pmf:
  -  convert timeouts to secs_to_jiffies()
 
 amd:
  -  Use *-y instead of *-objs in Makefiles
 
 arm64:
  -  add Huawei Matebook E Go EC driver
 
 arm64: dts: qcom: gaokun3:
  -  Add Embedded Controller node
 
 compal-laptop:
  -  Do not include <linux/fb.h>
 
 dell-ddv:
  -  Fix temperature calculation
  -  Use devm_battery_hook_register
  -  Use the power supply extension mechanism
 
 dell: dell-wmi-sysman:
  -  Use *-y instead of *-objs in Makefile
 
 dell:
  -  Modify Makefile alignment
  -  Use *-y instead of *-objs in Makefile
 
 dell-uart-backlight:
  -  Make dell_uart_bl_serdev_driver static
 
 dt-bindings: platform:
  -  Add Huawei Matebook E Go EC
 
 hp-bioscfg:
  -  Replace deprecated strncpy() with strscpy()
  -  Use wmi_instance_count()
 
 hp:
  -  Use *-y instead of *-objs in Makefile
 
 hwmon:
  -  (hp-wmi-sensors) Use the WMI bus API when accessing sensors
 
 ideapad-laptop:
  -  use dev_groups to register attribute groups
 
 int3472:
  -  Call "func" "con_id" instead
 
 intel/pmc:
  -  Add Arrow Lake U/H support to intel_pmc_core driver
  -  Add Panther Lake support to intel_pmc_core
  -  Create generic_core_init() for all platforms
  -  Make tgl_core_generic_init() static
  -  Move arch specific action to init function
  -  Remove duplicate enum
  -  Remove simple init functions
  -  Remove unnecessary declarations in header
  -  Remove unneeded extern keyword in header
 
 intel:
  -  Use *-y instead of *-objs in Makefile
 
 irqdomain: platform/x86:
  -  Switch to irq_domain_create_linear()
 
 lenovo-wmi-hotkey-utilities.c:
  -  Support for mic and audio mute LEDs
 
 lenovo-yoga-tab2-pro-1380-fastcharger:
  -  Make symbol static
 
 MAINTAINERS:
  -  Add documentation reference for Mellanox platform
  -  Update ALIENWARE WMI DRIVER entry
 
 mellanox:
  -  Relocate mlx-platform driver
 
 mlxbf-bootctl:
  -  Support sysfs entries for RTC battery status
 
 mlx-platform:
  -  Change register name
  -  Cosmetic changes
 
 samsung-galaxybook:
  -  Add samsung-galaxybook driver
  -  Fix block_recording not supported logic
 
 sonypi:
  -  Use str_on_off() helper in sonypi_display_info()
 
 think-lmi:
  -  Use ACPI object when extracting strings
  -  Use WMI bus API when accessing BIOS settings
 
 thinkpad_acpi:
  -  check the return value of devm_mutex_init()
  -  convert timeouts to secs_to_jiffies()
  -  Do not include <linux/fb.h>
  -  Move HWMON initialization to tpacpi_hwmon_pdriver's probe
  -  Move subdriver initialization to tpacpi_pdriver's probe.
 
 tools/power/x86/intel-speed-select:
  -  Die ID for IO dies
  -  Fix the condition to check multi die system
  -  Prefix header search path with sysroot
  -  Prevent increasing MAX_DIE_PER_PACKAGE
  -  v1.22 release
 
 wmi:
  -  Call WCxx methods when setting data blocks
  -  Rework WCxx/WExx ACPI method handling
  -  Update documentation regarding the GUID-based API
  -  Use devres to disable the WMI device
 
 x86-android-tablets:
  -  Add select POWER_SUPPLY to Kconfig
 
 Merges:
  -  Merge branch 'fixes' into for-next
  -  Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into review-ilpo-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZ+QJyQAKCRBZrE9hU+XO
 MUPYAP4sjtB8DKTIHgiQqado7PJZmdgpeJfAplitwKGe4BOcEQEA1mhuqMA5n6S+
 jvbTtRF+jiKxis/5zAtAdChScM/pIgo=
 =W+gy
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform drivers updates from Ilpo Järvinen:

 - alienware-wmi:
     - Refactor and split WMAX/legacy drivers

 - dell-ddv:
     - Correct +0.1 offset in temperature
     - Use the power supply extension mechanism for battery temperatures

 - intel/pmc:
     - Refactor init to mostly use a common init function
     - Add support for Arrow Lake U/H
     - Add support for Panther Lake

 - intel/sst:
     - Improve multi die handling
     - Prefix header search path with sysroot (fixes cross-compiling)

 - lenovo-wmi-hotkey-utilities:
     - Support for mic & audio mute LEDs

 - samsung-galaxybook:
     - Add driver for Samsung Galaxy Book series

 - wmi:
     - Rework WCxx/WExx ACPI method handling
     - Enable data block collection when the data block is set

 - platform/arm:
     - Add Huawei Matebook E Go EC driver

 - platform/mellanox:
     - Relocate to drivers/platform/mellanox/
     - mlxbf-bootctl:
     - RTC battery status sysfs support

 - Miscellaneous cleanups / refactoring / improvements

* tag 'platform-drivers-x86-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (75 commits)
  platform/x86: x86-android-tablets: Add select POWER_SUPPLY to Kconfig
  platform/x86/amd/pmf: convert timeouts to secs_to_jiffies()
  platform/x86: thinkpad_acpi: convert timeouts to secs_to_jiffies()
  irqdomain: platform/x86: Switch to irq_domain_create_linear()
  platform/x86/amd/pmc: fix leak in probe()
  tools/power/x86/intel-speed-select: v1.22 release
  tools/power/x86/intel-speed-select: Prefix header search path with sysroot
  tools/power/x86/intel-speed-select: Die ID for IO dies
  tools/power/x86/intel-speed-select: Fix the condition to check multi die system
  tools/power/x86/intel-speed-select: Prevent increasing MAX_DIE_PER_PACKAGE
  platform/x86/amd/pmc: Use managed APIs for mutex
  platform/x86/amd/pmc: Remove unnecessary line breaks
  platform/x86/amd/pmc: Move macros and structures to the PMC header file
  platform/x86/amd/pmc: Notify user when platform does not support s0ix transition
  platform/x86: dell-ddv: Use the power supply extension mechanism
  platform/x86: dell-ddv: Use devm_battery_hook_register
  platform/x86: dell-ddv: Fix temperature calculation
  platform/x86: thinkpad_acpi: check the return value of devm_mutex_init()
  platform/x86: samsung-galaxybook: Fix block_recording not supported logic
  platform/x86: dell-uart-backlight: Make dell_uart_bl_serdev_driver static
  ...
2025-03-26 09:54:40 -07:00
Srinivas Pandruvada
7dd556365b tools/power/x86/intel-speed-select: v1.22 release
This version has fix for:
- Display of die ID and optimize array size for multi package
systems.
- Fix build warning with cross compiler

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-03-07 08:00:21 -08:00
Khem Raj
8d9cfb6d71 tools/power/x86/intel-speed-select: Prefix header search path with sysroot
This helps when using a cross-compiler for building intel-speed-select,
currently, its hardcoded to pick libnl3 headers from build host which may
not be same as build target when cross compiling.

cc -print-sysroot will print nothing if compiler is configured without
a sysroot and result in same string as it is now.

Fixes errors with gcc configured with host include poisoning e.g.

cc1: error: include location "/usr/include/libnl3" is unsafe for
 cross-compilation [-Werror=poison-system-directories]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
[ srinivas: Changelog edits for checkpatch warning ]
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-03-07 08:00:21 -08:00
Srinivas Pandruvada
7ad93737dd tools/power/x86/intel-speed-select: Die ID for IO dies
Instead of displaying "-1" for IO dies, display "IO".

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-03-07 08:00:21 -08:00
Srinivas Pandruvada
c49e805db3 tools/power/x86/intel-speed-select: Fix the condition to check multi die system
Even when there is no die exported by CPUID leaf 0x1F, the kernel version
after 6.9 will show non zero die_id in the sysfs. In that case maximum
die_id can still match maximum power domain ID. So the condition to check
if the power domain ID is same a die_id to prevent duplicate display
doesn't hold true.

The better condition is to check if the maximum die_id is more than the
maximum package_id. If the die_id is exposed by CPUID leaf 0x1F, the
maximum die_id will be more than maximum package_id.

With this change tracking of max_punit_id is not used, so remove storing
max_punit_id.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-03-07 08:00:21 -08:00