Commit graph

1563 commits

Author SHA1 Message Date
Linus Torvalds
7ad54bbbc9 turbostat-2026.02.14-AMD-RAPL-fix
Fix a recent AMD regression due to errant code cleanup.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmmVTxQUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3Nhd7fxAAtzAu/NDP1pRaJkHQtMBVf9E1RUKZ
 4HLoOxwdOqId3spfYRXIcQ0M9o31MBdNNjnSeJgwVIdPu1ie91SPjMcRZv+xqA4z
 Z6mowdhDYvmrtQbi9KcPKtYqmujA+NimobYVlY9ze7q2kI8GC3ogyb1m1BkN/wYA
 GYFez5d2PyS3A/X3sC9eMLwJv9w/8E3n52X8gDvxzGazP51jkgDo5reoW+tm3y/d
 Tr0YUzZOVYVhnorJm90lY5VTQZZ7/RFgPClvb7Izk3nueXHbM/5p26avDOmBEyPQ
 1s5CU/1niMOy3dTUDUY5h6hEoOig1+qcg0GIgmrrbvhBmhlvVEB5Me999u2/5nUN
 ZCCRPrpXRCTysg/3wGx+0O0L32cTf59mHiGyToFB46LTTA0JOj1j45h7mNwI2yfa
 wZwhwbcOwXzMAO9TIbXIvN0xd++9QhTz5XDivZcQSHRYLVzP6nRizO40+1F2PMyG
 iBah5zFtIzfqWEUSOkj/Nce7u+I/Dp75lI6yiHp2RYJ3GkTjr9/09SaHjmSXlJ56
 9QV16lmWB0i59cMVH2n+b9DADP3piVU8FLXFjr0B3SHT2Ayg6sXWNHrk8Loa5qZM
 8kd8HtBEZTVwfREWW3772ZjkEfT1WprEsF7pbHHUoqtPqa3X2G47xOC4ZZY81UqH
 gml3aw66jhIHlps=
 =THke
 -----END PGP SIGNATURE-----

Merge tag 'turbostat-2026.02.14-AMD-RAPL-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat fix from Len Brown:
 "Fix a recent AMD regression due to errant code cleanup"

* tag 'turbostat-2026.02.14-AMD-RAPL-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: Fix AMD RAPL regression
2026-02-18 09:52:38 -08:00
Len Brown
ef0e60083f tools/power turbostat: Fix AMD RAPL regression
turbostat.c:8688: rapl_perf_init: Assertion `next_domain < num_domains' failed.

Two recent cleanup patches that were not supposed to change anything
broke the core_id code needed for AMD RAPL initialization:

commit 070e92361e ("tools/power turbostat: Enhance HT enumeration")
commit ddf60e38ca ("tools/power turbostat: Simplify global core_id calculation")

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-17 23:27:52 -06:00
Linus Torvalds
2961f841b0 turbostat-2026.02.14
Since release 2025.12.02:
 
 	Add L2 statistics columns for recent Intel processors:
 		L2MRPS = L2 Cache M-References Per Second
 		L2%hit = L2 Cache Hit %
 
 	Sort work and output by cpu# rather than core#
 
 	Minor features and fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmmPhVYUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3NhfpyxAAuAjLE5AD+pHSSMW/wOXU5YxU5L5g
 xIo5rWrgMIwx3IGDZE3EO45N0GpMDrL1hwmjPT/NtF+RESlzxo7NrsdrAM9+u8Eu
 qMu+Krd45cGwi/q37QD337pIMLvG1nT46BLt4eQk2TpUJSJynNF4WiwJ32enHoSh
 lwG76mChITxOdGDYfAvLZknsJqJgpv9sBbJzm3M7HxIKEnobKfE4A3Urooq+sz5X
 zWcNSPBWNnVLSIs79INbgSaFBY51P3HtIaXvmivfAKS5BWcUZ6/5BAiCG+QjSqIe
 l6bW4HU0UdVwzX76g2mApeeU40mz53xO5uDN9oriXOAEFh3unf4ui0I62TBgjDCB
 Y86XfFAXzjYMfml9rM8pA7U6Rj+3XrMFjRdrO+7itKHotaWrXylr6qO3bNO6DxN1
 OTcveL8hdnTunGOsiOuG2CFfwLxMhpyyb9+MBA5JNofltCmzgrhW7TjzLKPXM4fE
 xCIe16RR/1DEw1PnPzYABU8gNmhTjm0zbUC8tlQhe8G9tSAXtBoz9Zv5bnqHr++6
 ETlipyt9u7awj9APX/Oye/0eskcYVgST3XimXxD5rQrtveRyg/4B8PTej9eXNIp3
 8eJjFkv+I+/740KetJFD/6gP8SBbO0bRV5yjDDXJ8ihbqm8854tFaOSef3W8zXNc
 8iuNqxby3SVZc7Q=
 =UG/p
 -----END PGP SIGNATURE-----

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

Pull turbostat updates from Len Brown:

 - Add L2 statistics columns for recent Intel processors:
	L2MRPS = L2 Cache M-References Per Second
	L2%hit = L2 Cache Hit %

 - Sort work and output by cpu# rather than core#

 - Minor features and fixes

* tag 'turbostat-2026.02.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (23 commits)
  tools/power turbostat: version 2026.02.14
  tools/power turbostat: Fix and document --header_iterations
  tools/power turbostat: Use strtoul() for iteration parsing
  tools/power turbostat: Favor cpu# over core#
  tools/power turbostat: Expunge logical_cpu_id
  tools/power turbostat: Enhance HT enumeration
  tools/power turbostat: Simplify global core_id calculation
  tools/power turbostat: Unify even/odd/average counter referencing
  tools/power turbostat: Allocate average counters dynamically
  tools/power turbostat: Delete core_data.core_id
  tools/power turbostat: Rename physical_core_id to core_id
  tools/power turbostat: Cleanup package_id
  tools/power turbostat: Cleanup internal use of "base_cpu"
  tools/power turbostat: Add L2 cache statistics
  tools/power turbostat: Remove redundant newlines from err(3) strings
  tools/power turbostat: Allow more use of is_hybrid flag
  tools/power turbostat: Rename "LLCkRPS" column to "LLCMRPS"
  tools/power turbostat.8: Document the "--force" option
  tools/power turbostat: Harden against unexpected values
  tools/power turbostat: Dump hypervisor name
  ...
2026-02-17 15:51:14 -08:00
Linus Torvalds
f50822fd86 platform-drivers-x86 for v7.0-1
Highlights:
 
 - amd/pmf:
   - Avoid overwriting BIOS input values when events occur rapidly
   - Fix PMF driver issues related to S4 (in part on crypto/ccp side)
   - Add NPU metrics API (for accel side consumers)
   - Allow disabling Smart PC function through a module parameter
 
 - asus-wmi & HID/asus:
   - Unification of backlight control (replaces quirks)
   - Support multiple interfaces for controlling keyboard/RGB brightness
   - Simplify init sequence
 
 - hp-wmi:
   - Add manual fan control for Victus S models
   - Add fan mode keep-alive
   - Fix platform profile values for Omen 16-wf1xxx
   - Add EC offset to get the thermal profile
 
 - intel/pmc: Show substate residencies also for non-primary PMCs
 
 - intel/ISST:
   - Store and restore data for all domains
   - Write interface improvements
 
 - lenovo-wmi:
   - Support multiple Capability Data
   - Add HWMON reporting and tuning support
 
 - mellanox/mlx-platform: Add HI173 & HI174 support
 
 - surface/aggregator_registry: Add Surface Pro 11 (QCOM)
 
 - thinkpad_acpi: Add support for HW damage detection capability
 
 - uniwill: Implement cTGP setting
 
 - wmi:
   - Introduce marshalling support
   - Convert a few drivers to use the new buffer-based WMI API
 
 - tools/power/x86/intel-speed-select: Allow read operations for non-root
 
 - Miscellaneous cleanups / refactoring / improvements
 
 The following is an automated shortlog grouped by driver:
 
 amd/pmf:
  -  Added a module parameter to disable the Smart PC function
  -  Introduce new interface to export NPU metrics
  -  Prevent TEE errors after hibernate
  -  Use ring buffer to store custom BIOS input values
 
 amd:
  -  Use scope-based cleanup for wbrf_record()
 
 asus-wmi:
  -  add keyboard brightness event handler
  -  Add support for multiple kbd led handlers
  -  remove unused keyboard backlight quirk
 
 crypto:
  -  ccp - Add an S4 restore flow
  -  ccp - Declare PSP dead if PSP_CMD_TEE_RING_INIT fails
  -  ccp - Factor out ring destroy handling to a helper
  -  ccp - Send PSP_CMD_TEE_RING_DESTROY when PSP_CMD_TEE_RING_INIT fails
 
 HID: asus:
  -  add support for the asus-wmi brightness handler
  -  early return for ROG devices
  -  fortify keyboard handshake
  -  initialize additional endpoints only for certain devices
  -  listen to the asus-wmi brightness device instead of creating one
  -  move vendor initialization to probe
  -  simplify RGB init sequence
  -  use same report_id in response
 
 hp-wmi:
  -  Add EC offsets to read Victus S thermal profile
  -  add manual fan control for Victus S models
  -  fix platform profile values for Omen 16-wf1xxx
  -  implement fan keep-alive
  -  order include headers
 
 ideadpad-laptop:
  -  Clean up style warnings and checks
 
 intel/pmc:
  -  Change LPM mode fields to u8
  -  Enable substate residencies for multiple PMCs
  -  Move LPM mode attributes to PMC
  -  Remove double empty line
 
 intel/pmt:
  -  Replace sprintf() with sysfs_emit()
 
 intel/uncore-freq:
  -  Replace sprintf() with scnprintf()
  -  Replace sprintf() with sysfs_emit()
 
 intel-wmi-sbl-fw-update:
  -  Use new buffer-based WMI API
 
 intel/wmi: thunderbolt:
  -  Use new buffer-based WMI API
 
 ISST:
  -  Add missing write block check
  -  Check for admin capability for write commands
  -  Optimize suspend/resume callbacks
  -  Store and restore all domains data
 
 lenovo-wmi-capdata:
  -  Add support for Capability Data 00
  -  Add support for Fan Test Data
 
 lenovo-wmi-{capdata,other}:
  -  Fix HWMON channel visibility
  -  Support multiple Capability Data
 
 lenovo-wmi-capdata:
  -  Wire up Fan Test Data
 
 lenovo-wmi-helpers:
  -  Convert returned buffer into u32
 
 lenovo-wmi-other:
  -  Add HWMON for fan reporting/tuning
 
 mlx-platform:
  -  Add support DGX flavor of next-generation 800GB/s ethernet switch.
  -  Add support for new Nvidia DGX system based on class VMOD0010
 
 Rename lenovo-wmi-capdata01 to lenovo-wmi-capdata:
  - Rename lenovo-wmi-capdata01 to lenovo-wmi-capdata
 
 surface: aggregator_registry:
  -  Add Surface Pro 11 (QCOM)
 
 surface:
  -  Replace deprecated strcpy() in surface_button_add()
 
 thinkpad_acpi:
  -  Add support to detect hardware damage detection capability.
  -  Add sysfs to display details of damaged device.
 
 tools/power/x86/intel-speed-select:
  -  Allow non root users
  -  Fix file descriptor leak in isolate_cpus()
  -  Use pkg-config for libnl-3.0 detection
  -  v1.25 release
 
 uniwill:
  -  Implement cTGP setting
 
 uniwill-laptop:
  -  Introduce device descriptor system
 
 wmi:
  -  Add helper functions for WMI string conversions
  -  Add kunit test for the marshalling code
  -  Add kunit test for the string conversion code
 
 wmi-bmof:
  -  Use new buffer-based WMI API
 
 wmi:
  -  Introduce marshalling support
 
 wmi: string-kunit:
  -  Add missing oversized string test case
 
 wmi:
  -  Update driver development guide
 
 xiaomi-wmi:
  -  Use new buffer-based WMI API
 
 yogabook:
  -  Clean up code style
 
 Merges:
  -  Merge branch 'fixes' of into for-next
  -  Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into for-next
  -  Merge branch 'platform-drivers-x86-asus-kbd' into for-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCaY9soAAKCRBZrE9hU+XO
 MT5EAP9aK1wHlVGDfuC2k07X4gk8ZX5Ks9anXJlBcZFrpC9okwD5Aeqj3XLK338x
 g5k/x+r87GwXjcBLnFi2TnNA2c8SWQY=
 =eGAm
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver updates from Ilpo Järvinen:
 "Highlights:

   - amd/pmf:
      - Avoid overwriting BIOS input values when events occur rapidly
      - Fix PMF driver issues related to S4 (in part on crypto/ccp side)
      - Add NPU metrics API (for accel side consumers)
      - Allow disabling Smart PC function through a module parameter

   - asus-wmi & HID/asus:
      - Unification of backlight control (replaces quirks)
      - Support multiple interfaces for controlling keyboard/RGB brightness
      - Simplify init sequence

   - hp-wmi:
      - Add manual fan control for Victus S models
      - Add fan mode keep-alive
      - Fix platform profile values for Omen 16-wf1xxx
      - Add EC offset to get the thermal profile

   - intel/pmc: Show substate residencies also for non-primary PMCs

   - intel/ISST:
      - Store and restore data for all domains
      - Write interface improvements

   - lenovo-wmi:
      - Support multiple Capability Data
      - Add HWMON reporting and tuning support

   - mellanox/mlx-platform: Add HI173 & HI174 support

   - surface/aggregator_registry: Add Surface Pro 11 (QCOM)

   - thinkpad_acpi: Add support for HW damage detection capability

   - uniwill: Implement cTGP setting

   - wmi:
      - Introduce marshalling support
      - Convert a few drivers to use the new buffer-based WMI API

   - tools/power/x86/intel-speed-select: Allow read operations for non-root

   - Miscellaneous cleanups / refactoring / improvements"

* tag 'platform-drivers-x86-v7.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (68 commits)
  platform/x86: lenovo-wmi-{capdata,other}: Fix HWMON channel visibility
  platform/x86: hp-wmi: Add EC offsets to read Victus S thermal profile
  platform: mellanox: mlx-platform: Add support DGX flavor of next-generation 800GB/s ethernet switch.
  platform: mellanox: mlx-platform: Add support for new Nvidia DGX system based on class VMOD0010
  HID: asus: add support for the asus-wmi brightness handler
  platform/x86: asus-wmi: add keyboard brightness event handler
  platform/x86: asus-wmi: remove unused keyboard backlight quirk
  HID: asus: listen to the asus-wmi brightness device instead of creating one
  platform/x86: asus-wmi: Add support for multiple kbd led handlers
  HID: asus: early return for ROG devices
  HID: asus: move vendor initialization to probe
  HID: asus: fortify keyboard handshake
  HID: asus: use same report_id in response
  HID: asus: initialize additional endpoints only for certain devices
  HID: asus: simplify RGB init sequence
  platform/wmi: string-kunit: Add missing oversized string test case
  platform/x86/amd/pmf: Added a module parameter to disable the Smart PC function
  platform/x86/uniwill: Implement cTGP setting
  platform/x86: uniwill-laptop: Introduce device descriptor system
  platform/x86/amd: Use scope-based cleanup for wbrf_record()
  ...
2026-02-13 15:39:15 -08:00
Len Brown
51496091dd tools/power turbostat: version 2026.02.14
Since release 2025.12.02:

Add L2 statistics columns for recent Intel processors:
	L2MRPS = L2 Cache M-References Per Second
	L2%hit = L2 Cache Hit %

Sort work and output by cpu# rather than core#

This commit:
	Version number and white space (indent -l160)
	No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 14:08:33 -06:00
Len Brown
96718ad296 tools/power turbostat: Fix and document --header_iterations
The "header_iterations" option is commonly used to de-clutter
the screen of redundant header label rows in an interactive session:
Eg. every 10 rows:

$ sudo turbostat --header_iterations 10 -S -q -i 1

But --header_iterations was missing from turbostat.8

Also turbostat help advertised the "-N" short option
that did not actually work:

$ turbostat --help
  -N, --header_iterations num
		print header every num iterations

Repair "-N"
Document "--header_iterations" on turbostat.8

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 14:03:17 -06:00
Kaushlendra Kumar
8e5c0cc326 tools/power turbostat: Use strtoul() for iteration parsing
Replace strtod() with strtoul() and check errno for -n/-N options, since
num_iterations and header_iterations are unsigned long counters. Reject
zero and conversion errors; negative inputs wrap to large positive values
per standard unsigned semantics.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 14:03:17 -06:00
Len Brown
a2b4d0f8bf tools/power turbostat: Favor cpu# over core#
Turbostat collects statistics and outputs results in "topology order",
which means it prioritizes the core# over the cpu#.
The strategy is to minimize wakesups to a core -- which is
important when measuring an idle system.

But core order is problematic, because Linux core#'s are physical
(within each package), and thus subject to APIC-id scrambling
that may be done by the hardware or the BIOS.

As a result users may be are faced with rows in a confusing order:

sudo turbostat -q --show topology,Busy%,CPU%c6,UncMHz sleep 1
Core	CPU	Busy%	CPU%c6	UncMHz
-	-	1.25	72.18	3400
0	4	7.74	0.00
1	5	1.77	88.59
2	6	0.48	96.73
3	7	0.21	98.34
4	8	0.14	96.85
5	9	0.26	97.55
6	10	0.44	97.24
7	11	0.12	96.18
8	0	5.41	0.31	3400
8	1	0.19
12	2	0.41	0.22
12	3	0.08
32	12	0.04	99.21
33	13	0.25	94.92

Abandon the legacy "core# topology order" in favor of simply
ordering by cpu#, with a special case to handle HT siblings
that may not have adjacent cpu#'s.

sudo ./turbostat -q --show topology,Busy%,CPU%c6,UncMHz sleep 1
1.003001 sec
Core	CPU	Busy%	CPU%c6	UncMHz
-	-	1.38	80.55	1600
8	0	10.94	0.00	1600
8	1	0.53
12	2	2.90	0.45
12	3	0.11
0	4	1.96	91.20
1	5	0.97	96.40
2	6	0.24	94.72
3	7	0.31	98.01
4	8	0.20	98.20
5	9	0.62	96.00
6	10	0.06	98.15
7	11	0.12	99.31
32	12	0.04	99.07
33	13	0.27	95.09

The result is that cpu#'s now take precedence over core#'s.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 14:03:10 -06:00
Len Brown
6be5c151eb tools/power turbostat: Expunge logical_cpu_id
There is only once cpu_id name space -- cpu_id.
Expunge the term logical_cpu_id.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
070e92361e tools/power turbostat: Enhance HT enumeration
Record the cpu_id of each CPU HT sibling -- will need this later.

Rename "thread_id" to "ht_id" to disambiguate that the scope
of this id is within a Core -- it is not a global cpu_id.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
ddf60e38ca tools/power turbostat: Simplify global core_id calculation
Standardize the generation of globally unique core_id's
in a macro, and simplify the related code.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
a854684986 tools/power turbostat: Unify even/odd/average counter referencing
Update the syntax of accesses to the even and odd counters
to match the average counters.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
3cecd4a62d tools/power turbostat: Allocate average counters dynamically
The current static definition of average{} is inconsistent with
the dynamically allocated even{} and odd{} counters.

Allocate average{} counters dynamically.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
439632cf95 tools/power turbostat: Delete core_data.core_id
Delete redundant core_data.core_id.
Use cpus[].core_id as the single copy of the truth.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
5e160646f4 tools/power turbostat: Rename physical_core_id to core_id
The Linux Kernel topology sysfs is flawed.
core_id is not globally unique, but is per-package.

Turbostat works around this when it needs to, with

        rapl_core_id = cpus[cpu].core_id;
        rapl_core_id += cpus[cpu].package_id * nr_cores_per_package

Otherwise, turbostat handles core_id as subservient to each package.

As there is only one core_id namespace, rename
physical_core_id to simply be core_id.

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
4aaf7d07a0 tools/power turbostat: Cleanup package_id
The kernel topology sysfs uses the name "physical_package_id"
because it is allowed to be sparse.

Inside Turbostat, that physical package_id namespace is the only
package_id namespace, so re-name it to simply be "package_id"
in cpus[].

Delete the redundant copy of package_id in pkg_data.
Rely instead on the single copy of the truth in cpus[].

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
54ca69f33c tools/power turbostat: Cleanup internal use of "base_cpu"
Disambiguate the uses "base_cpu":

master_cpu: lowest permitted cpu#, read global MSRs here
package_data.first_cpu: lowest permitted cpu# in that package
core_data.first_cpu: lowest permitted cpu# in the core
current_cpu: where I'm running now

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:53:17 -06:00
Len Brown
dd23bfe4c3 tools/power turbostat: Add L2 cache statistics
version 2026.02.04

Add support for L2 cache statistics: L2MRPS and L2%hit
L2 statistics join the LLC in the "cache" counter group.

While the underlying LLC perf kernel support was architectural,
L2 perf counters are model-specific:

Support Intel Xeon -- Sapphire Rapids and newer.
Support Intel Atom -- Gracemont and newer.
Support Intel Hybrid -- Alder Lake and newer.

Example:

alder-lake-n$ sudo turbostat --quiet --show CPU,Busy%,cache my_workload
CPU	Busy%	LLCMRPS	LLC%hit	L2MRPS	L2%hit
-	49.82	1210	85.02	2909	31.63
0	99.14	322	88.89	767	32.38
1	0.91	1	32.47	1	18.86
2	0.20	0	40.78	0	23.34
3	99.17	295	81.79	706	31.89
4	0.68	1	58.71	1	15.61
5	99.16	299	85.65	726	31.32
6	0.08	0	45.35	0	31.71
7	99.21	293	83.63	707	30.92

where "my_workload" is a wrapper for a yogini workload
that has 4 fully-busy threads with 2MB working set each.

Note that analogous to the system summary for multiple LLC systems,
the system summary row for the L2 is the aggregate of all CPUS in the
system -- there is no per-cache roll-up.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-13 08:52:53 -06:00
Len Brown
a9c7a1a292 tools/power turbostat: Remove redundant newlines from err(3) strings
err(3) supplies a newline at the end of the string.
No need to end err(3) strings with '\n'.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:12 -06:00
Len Brown
b991074a51 tools/power turbostat: Allow more use of is_hybrid flag
The "is_hybrid" is set and used only in !quiet mode.

Make it valid in both quiet and !quiet mode to allow more uses.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:12 -06:00
Len Brown
041e975937 tools/power turbostat: Rename "LLCkRPS" column to "LLCMRPS"
The purpose of the LLC References per Second LLC column
is to qualify the significance of the LLC%hit column.

If RPS is high, then the hit rate matters.
If RPS is low, then the hit rate is not significant.

Remove unnecessary and distracting precision in the RPS column
by dividing my a million rather than by a thousand.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:12 -06:00
Len Brown
785953cf6e tools/power turbostat.8: Document the "--force" option
Starting in turbostat v2025.01.14, turbostat refused to run
on unsupported hardware, pointing to "RUN THE LATEST VERSION"
on turbostat(8).

At that time, turbostat supported and advertised the "--force"
parameter to run anyway (with unsupported results).

Also document "--force" on turbostat.8.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:12 -06:00
Len Brown
d0f7093ad5 tools/power turbostat: Harden against unexpected values
Divide-by-zero resulted if LLC references == 0

Pull the percentage division into pct() to centralize sanity checks there.

Fixes: 8808292799 ("tools/power turbostat: Print "nan" for out of range percentages")

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:11 -06:00
Len Brown
61764831d5 tools/power turbostat: Dump hypervisor name
Sometimes useful to know which hypervisor is running beneath us...

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:11 -06:00
Len Brown
00b9e2a7fa tools/power turbostat: Dump CPUID.1.ECX[31] (Hypervisor)
Both Intel and AMD use CPUID.1.ECX[31] to distinguish
between hypervisor and real hardware.
Indicate "HV" or "No-HV" accordingly.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:11 -06:00
Len Brown
bd1b6608d7 tools/power turbostat: Dump CPUID(1) consistently with CPUID(6)
We dumped selected CPUID(1) features using a format that showed '-'
for a missing feature.  Not so friendly to parse a bunch of dashes
when features are missing...

For CPUID(1) adopt the format we used for CPUID(6): 'No-FEATURE'
means that 'FEATURE' is not present.

Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:11 -06:00
Len Brown
16cc8f249c tools/power turbostat: AMD: msr offset 0x611 read failed: Input/output error
Turbostat exits during RAPL probe with:

turbostat: cpu0: msr offset 0x611 read failed: Input/output error

A binary with this bug can be used successfully with
the option "--no-msr"

Fix this regression by trusting the static AMD RAPL MSR offset.

Fixes: 19476a592b ("tools/power turbostat: Validate RAPL MSRs for AWS Nitro Hypervisor")
Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-04 14:52:11 -06:00
Srinivas Pandruvada
6142b726e6 tools/power/x86/intel-speed-select: v1.25 release
This version includes the following changes:
- Allow read only commands for non root users when permitted
- Fix file descriptor leak in isolate_cpus()
- Replace hardcoded libnl3 include path

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-01-16 16:03:21 -08:00
Malaya Kumar Rout
56c17ee151 tools/power/x86/intel-speed-select: Fix file descriptor leak in isolate_cpus()
The file descriptor opened in isolate_cpus() when (!level) is true was
not being closed before returning, causing a file descriptor leak in
both the error path and the success path.

When write() fails at line 950, the function returns at line 953 without
closing the file descriptor. Similarly, on success, the function returns
at line 956 without closing the file descriptor.

Add close(fd) calls before both return statements to fix the resource
leak. This follows the same pattern used elsewhere in the same function
where file descriptors are properly closed before returning (see lines
1005 and 1027).

Fixes: 997074df65 ("tools/power/x86/intel-speed-select: Use cgroup v2 isolation")
Signed-off-by: Malaya Kumar Rout <mrout@redhat.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-01-16 16:03:21 -08:00
Khem Raj
21adcd5ec9 tools/power/x86/intel-speed-select: Use pkg-config for libnl-3.0 detection
Replace hardcoded libnl3 include path with pkg-config detection to
improve portability across different distributions and build environments.

The previous implementation used a fixed path constructed from the
compiler's sysroot, which could fail on systems with non-standard
library installations. Now the build system:
- Attempts to detect libnl-3.0 include paths using pkg-config
- Falls back to /usr/include/libnl3 if pkg-config is unavailable
- Maintains backward compatibility with existing build configurations

This ensures the tool builds correctly on a wider range of systems
while preserving existing behavior when pkg-config is not present.

Closes:https://bugzilla.kernel.org/show_bug.cgi?id=220819
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-01-16 16:03:20 -08:00
Srinivas Pandruvada
6588b8845e tools/power/x86/intel-speed-select: Allow non root users
When permitted by the file /dev/isst_interface, allow to issue commands
for non root users.

When user id is non root, check if  "/dev/isst_interface" can still be
opened. If this file can be opened, allow all read only commands.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-01-16 16:03:20 -08:00
João Marcos Costa
7799ba2160 cpupower: make systemd unit installation optional
cpupower currently installs a cpupower.service unit file into unitdir
unconditionally, regardless of whether systemd is used by the host.

Improve the installation procedure by making this systemd step optional:
a 'SYSTEMD' build parameter that defaults to 'true' and can be set to
'false' to disable the installation of systemd's unit file.

Since 'SYSTEMD' defaults to true, the current behavior is kept as the
default.

Link: https://lore.kernel.org/r/20260113132753.1730020-2-joaomarcos.costa@bootlin.com
Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-01-16 13:41:26 -07:00
Kaushlendra Kumar
ff72619e11 tools/power cpupower: Show C0 in idle-info dump
`cpupower idle-info -o` skipped C0 because the loop began at 1:

  before:
    states:
      C1 ... latency[002] residency[00002]
      C2 ... latency[010] residency[00020]
      C3 ... latency[133] residency[00600]

  after:
    states:
      C0 ... latency[000] residency[00000]
      C1 ... latency[002] residency[00002]
      C2 ... latency[010] residency[00020]
      C3 ... latency[133] residency[00600]

Start iterating at index 0 so the idle report mirrors sysfs and
includes C0 stats.

Link: https://lore.kernel.org/r/20251202065403.1492807-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2025-12-15 12:33:29 -07:00
Kaushlendra Kumar
f9bd3762cf tools/power cpupower: Reset errno before strtoull()
cpuidle_state_get_one_value() never cleared errno before calling
strtoull(), so a prior ERANGE caused every cpuidle counter read to
return zero. Reset errno to 0 before the conversion so each sysfs read
is evaluated independently.

Link: https://lore.kernel.org/r/20251201121745.3776703-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2025-12-15 12:33:28 -07:00
Kaushlendra Kumar
1b9aaf36b7 tools/cpupower: Use strcspn() to strip trailing newline
Replace manual newline removal with strcspn() which is safer and
cleaner. This avoids potential out-of-bounds access on empty strings
and handles the case where no newline exists.

Link: https://lore.kernel.org/r/20251127044536.715722-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2025-12-15 12:33:28 -07:00
Kaushlendra Kumar
24858a8416 tools/cpupower: Fix inverted APERF capability check
The capability check was inverted, causing the function to return
error when APERF support is available and proceed when it is not.

Negate the condition to return error only when APERF capability
is absent.

Link: https://lore.kernel.org/r/20251126091613.567480-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2025-12-15 12:33:28 -07:00
Kaushlendra Kumar
6b401a5b2d cpupower: idle_monitor: fix incorrect value logged after stop
The cpuidle sysfs monitor printed the previous sample’s counter
value in cpuidle_stop() instead of the freshly read one. The dprint
line used previous_count[cpu][state] while current_count[cpu][state]
had just been populated. This caused misleading debug output.

Switch the logging to current_count so the post-interval snapshot
matches the displayed value.

Link: https://lore.kernel.org/r/20251202044012.3844790-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2025-12-15 12:33:28 -07:00
Linus Torvalds
9d588a1140 platform-drivers-x86 for v6.19-1
Highlights:
 
 - acer-wmi: Add PH16-72, PHN16-72, and PT14-51 fan control support
 
 - acpi: platform_profile: Add max-power profile option (power draw limited
                           by the cooling hardware, may exceed battery power
 			  draw limit when on AC power)
 
 - amd/hsmp: Allow >1 data-fabric per socket
 
 - asus-armoury: Add WMI attributes driver to expose miscellaneous
                 WMI functions through fw_attributes (deprecates
                 the custom BIOS features interface through asus-wmi)
 
 - asus-wmi: Use brightness_set_blocking() for kbd led
 
 - ayaneo-ec: Add Ayaneo Embedded Controller driver
 
 - fs/nls:
 
   - Fix utf16 -> utf8 string conversion in output size restricted cases
 
   - Improve error code consistency for utf8 -> utf32 conversions
 
 - ideapad-laptop: Fast (Rapid Charge) charge type support
 
 - intel/hid: Add Dell Pro Rugged 10/12 tablet to VGBS DMI quirks
 
 - intel/pmc:
 
   - Arrow Lake telemetry GUID improvements
 
   - Add support for Wildcat Lake PMC information
 
 - intel_pmc_ipc: Fix ACPI buffer memleak
 
 - intel/punit_ipc: Fix memory corruption
 
 - intel/vsec: Wildcat Lake PMT telemetry support
 
 - lenovo-wmi-gamezone: Map "Extreme" performance mode to max-power
 
 - lg-laptop: Add support for the HDAP opregion field
 
 - serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
 
 - thinkpad-t14s-ec: Improve suspend/resume support (lid LEDs, keyboard
                     backlight)
 
 - uniwill: Add Uniwill laptop driver
 
 - wmi: Move under drivers/platform/wmi as non-x86 WMI support is around
        the corner and other WMI features will require adding more C
        files as well
 
 - tools/power/x86/intel-speed-select: v1.24
 
   - Check feature status to check if the feature enablement was successful
 
   - Reset SST-TF bucket structure to display valid bucket info
 
 - Miscellaneous cleanups / refactoring / improvements
 
 The following is an automated shortlog grouped by driver:
 
 acer-wmi:
  -  Add fan control support
  -  Add support for PHN16-72
  -  Enable fan control for PH16-72 and PT14-51
  -  Fix setting of fan behavior
 
 acpi:
  -  platform_profile - Add max-power profile option
 
 Add Uniwill laptop driver:
  - Add Uniwill laptop driver
 
 alienware-wmi-wmax:
  -  Simplify FW profile to pprof matching
 
 amd: hfi:
  -  Remove redundant assignment to .owner
  -  Remove unused cpumask from cpuinfo struct
 
 amd/hsmp:
  -  Replace amd_num_nodes() with topology_max_packages()
 
 amd/pmf:
  -  Add BIOS_INPUTS_MAX macro to replace hardcoded array size
  -  Refactor repetitive BIOS output handling
  -  Rename IPU metrics fields to NPU for consistency
  -  Replace magic table id with METRICS_TABLE_ID
  -  Use devm_mutex_init() for mutex initialization
  -  Use explicit SET_CMD/GET_CMD flags in amd_pmf_send_cmd()
 
 arm64: thinkpad-t14s-ec:
  -  add suspend handler for keyboard backlight
  -  add system PM hooks
 
 asus-armoury:
  -  add apu-mem control support
  -  add panel_hd_mode attribute
  -  add ppt_* and nv_* tuning knobs
  -  add screen auto-brightness toggle
  -  add support for FA507UV
  -  add support for GA503QR
  -  Fix error code in mini_led_mode_current_value_store()
  -  fix mini-led mode show
  -  fix only DC tunables being available
  -  move existing tunings to asus-armoury module
 
 asus-wmi:
  -  deprecate bios features
  -  export symbols used for read/write WMI
  -  rename ASUS_WMI_DEVID_PPT_FPPT
  -  use brightness_set_blocking() for kbd led
 
 ayaneo-ec:
  -  Add Ayaneo Embedded Controller platform driver
  -  Add charge control support
  -  Add controller power and modules attributes
  -  Add hwmon support
  -  Add suspend hook
  -  Move Ayaneo devices from oxpec to ayaneo-ec
 
 Documentation: laptops:
  -  Add documentation for uniwill laptops
 
 fs/nls:
  -  Fix inconsistency between utf8_to_utf32() and utf32_to_utf8()
  -  Fix utf16 to utf8 conversion
 
 hp-wmi:
  -  Order DMI board name arrays
 
 ideapad-laptop: Add charge_types:
  - Fast (Rapid Charge)
 
 ideapad-laptop:
  -  Protect GBMD/SBMC calls with mutex
  -  Support multiple power_supply_ext definitions
  -  Use str_on_off() helper
 
 intel/hid:
  -  Add Dell Pro Rugged 10/12 tablet to VGBS DMI quirks
 
 intel/pmc:
  -  Add DMU GUID to Arrow Lake U/H
  -  Add support for multiple DMU GUIDs
  -  Enable SSRAM support for Wildcat Lake
 
 intel_pmc_ipc:
  -  fix ACPI buffer memory leak
 
 intel/pmc:
  -  Relocate lpm_req_guid to pmc_reg_map
  -  Remove redundant has_die_c6 variable
  -  Rename PMC index variable to pmc_idx
  -  Update Arrow Lake telemetry GUID
 
 intel/vsec:
  -  Add support for Wildcat Lake
 
 lenovo-wmi-gamezone Use max-power rather than balanced-performance:
  - lenovo-wmi-gamezone Use max-power rather than balanced-performance
 
 lg-laptop:
  -  Add support for the HDAP opregion field
 
 serial-multi-instantiate:
  -  Add IRQ_RESOURCE_OPT for IRQ missing projects
 
 surface: acpi-notify:
  -  add WQ_PERCPU to alloc_workqueue users
 
 surface: aggregator:
  -  Omit a variable reassignment in ssam_serial_hub_probe()
 
 surface:
  -  replace use of system_wq with system_percpu_wq
 
 tools/power/x86/intel-speed-select:
  -  Check feature status
  -  Reset isst_turbo_freq_info for invalid buckets
  -  v1.24 release
 
 uniwill:
  -  Add TUXEDO devices
  -  Handle more WMI events required for TUXEDO devices
 
 wmi-gamezone:
  -  Add Legion Go 2 Quirks
 
 wmi:
  -  Move WMI core code into a separate directory
  -  Remove extern keyword from prototypes
  -  Use correct type when populating ACPI objects
 
 x86-android-tablets:
  -  Omit a variable reassignment in lenovo_yoga_tab2_830_1050_init_codec()
 
 x86:
  -  replace use of system_wq with system_percpu_wq
 
 Merges:
  -  Merge branch 'fixes' of into for-next
  -  Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into for-next
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCaTgl5wAKCRBZrE9hU+XO
 McWDAP4nmj5+EeHsg3Kl0kQ1lqF9llWI4EM2NeRd6MwrV5klxgD9FLW6djGkmP2j
 RjtZ4CULbtQ3QMl7kmXhfAjRwJfiSgk=
 =yFvQ
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver updates from Ilpo Järvinen:

 - acer-wmi: Add PH16-72, PHN16-72, and PT14-51 fan control support

 - acpi: platform_profile: Add max-power profile option (power draw
   limited by the cooling hardware, may exceed battery power draw limit
   when on AC power)

 - amd/hsmp: Allow more than one data-fabric per socket

 - asus-armoury: Add WMI attributes driver to expose miscellaneous WMI
   functions through fw_attributes (deprecates the custom BIOS features
   interface through asus-wmi)

 - asus-wmi: Use brightness_set_blocking() for kbd led

 - ayaneo-ec: Add Ayaneo Embedded Controller driver

 - fs/nls:
     - Fix utf16 to utf8 string conversion when output size restricted
     - Improve error code consistency for utf8 to utf32 conversions

 - ideapad-laptop: Fast (Rapid Charge) charge type support

 - intel/hid: Add Dell Pro Rugged 10/12 tablet to VGBS DMI quirks

 - intel/pmc:
     - Arrow Lake telemetry GUID improvements
     - Add support for Wildcat Lake PMC information

 - intel_pmc_ipc: Fix ACPI buffer memleak

 - intel/punit_ipc: Fix memory corruption

 - intel/vsec: Wildcat Lake PMT telemetry support

 - lenovo-wmi-gamezone: Map "Extreme" performance mode to max-power

 - lg-laptop: Add support for the HDAP opregion field

 - serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing
   projects

 - thinkpad-t14s-ec: Improve suspend/resume support (lid LEDs, keyboard
   backlight)

 - uniwill: Add Uniwill laptop driver

 - wmi: Move under drivers/platform/wmi as non-x86 WMI support is around
   the corner and other WMI features will require adding more C files as
   well

 - tools/power/x86/intel-speed-select: v1.24
     - Check feature status to check if the feature enablement was
       successful
     - Reset SST-TF bucket structure to display valid bucket info

 - Miscellaneous cleanups / refactoring / improvements

* tag 'platform-drivers-x86-v6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (73 commits)
  tools/power/x86/intel-speed-select: v1.24 release
  tools/power/x86/intel-speed-select: Reset isst_turbo_freq_info for invalid buckets
  tools/power/x86/intel-speed-select: Check feature status
  platform/x86: asus-wmi: use brightness_set_blocking() for kbd led
  fs/nls: Fix inconsistency between utf8_to_utf32() and utf32_to_utf8()
  platform/x86: asus-armoury: add support for GA503QR
  platform/x86: intel_pmc_ipc: fix ACPI buffer memory leak
  platform/x86: hp-wmi: Order DMI board name arrays
  platform/x86/intel/hid: Add Dell Pro Rugged 10/12 tablet to VGBS DMI quirks
  platform: surface: replace use of system_wq with system_percpu_wq
  platform: x86: replace use of system_wq with system_percpu_wq
  platform/surface: acpi-notify: add WQ_PERCPU to alloc_workqueue users
  platform/x86: wmi-gamezone: Add Legion Go 2 Quirks
  platform/x86: lenovo-wmi-gamezone Use max-power rather than balanced-performance
  acpi: platform_profile - Add max-power profile option
  platform/x86/amd/pmf: Use devm_mutex_init() for mutex initialization
  platform/x86/amd/pmf: Add BIOS_INPUTS_MAX macro to replace hardcoded array size
  platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
  platform/x86/amd/pmf: Refactor repetitive BIOS output handling
  platform/x86/uniwill: Add TUXEDO devices
  ...
2025-12-10 06:38:17 +09:00
Linus Torvalds
10003ff8ce turbostat-v2025.12.02
Since turbostat-v2025.09.09:
 
 Add LLC statistics columns:
 	LLCkRPS = Last Level Cache Thousands of References Per Second
 	LLC%hit = Last Level Cache Hit %
 Recognize Wildcat Lake and Nova Lake platforms
 Add MSR check for Android
 Add APERF check for VMWARE
 Add RAPL check for AWS
 Minor fixes to turbostat (and x86_energy_perf_policy)
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmkvWPwUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3NhdjJRAAngCZNP1JONy7zqx8HsGJQ8+6WhEV
 E4F2mOHgeJd8Ws4iJUJHkEhNKK64J//RpKvyv0DWY/Zxb8i//+zv0FNd4LZTpBPk
 kKp/1AvJM1alfShQoxaHdCgrhsx4GiY9qPpGlGiNqJ3WNY0ikg+ayEQ+Iidot+5d
 YG57LdbAYe4eAnQzLIDrPG7sSNtvWdyYps41JhacoExPXjHfNMU3ZFGwXA0RExMy
 iyRW8t/Xllsvfnv2GDknUEfLJCpql43ukI+fvUAYuA104Rw7fOJsZp2/+AbWZPF8
 xqy2XWmuEeSwl7ed1hJhxQEV1w77FTs61tIQorFkLC8VkZhFWe4M6SK0TdE92SvC
 xpeSluw22YzGmWHsoclzL7Xf23i1L4cqMcaVbyxSiU5xzApolE1/khTbrJ2dlKxZ
 cWLSFUuvzRAGE0zicygaXPr6mMlPlbrbTu82slZMiN3uvd0+2sqD3MoUzZuei5Lp
 NJLKNAXbAHMtECHYKqed7p69xc+2Rob0dn27Dl8JOtqAzUeneytSg4tRVn+1YXxI
 NsJpgEFZ9FFQYuFW2vHuFJtpCnfVVKTFxml1q3Iy4T9Bh9VzVEwuRRpLpOhfD15I
 f/xR99AFXijJtzdLf3kWI198FP6RI5I04FJIl80RUYNmQRcQ2PSKq5xpkUP3f/dO
 LlCWw7HxP6It95g=
 =iMfD
 -----END PGP SIGNATURE-----

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

Pull turbostat updates from Len Brown:

 - Add LLC statistics columns:
	LLCkRPS = Last Level Cache Thousands of References Per Second
	LLC%hit = Last Level Cache Hit %

 - Recognize Wildcat Lake and Nova Lake platforms

 - Add MSR check for Android

 - Add APERF check for VMWARE

 - Add RAPL check for AWS

 - Minor fixes to turbostat (and x86_energy_perf_policy)

* tag 'turbostat-v2025.12.02' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (21 commits)
  tools/power turbostat: version 2025.12.02
  tools/power turbostat: Print wide names only for RAW 64-bit columns
  tools/power turbostat: Print percentages in 8-columns
  tools/power turbostat: Print "nan" for out of range percentages
  tools/power turbostat: Validate APERF access for VMWARE
  tools/power turbostat: Enhance perf probe
  tools/power turbostat: Validate RAPL MSRs for AWS Nitro Hypervisor
  tools/power x86_energy_perf_policy: Fix potential NULL pointer dereference
  tools/power x86_energy_perf_policy: Fix format string in error message
  tools/power x86_energy_perf_policy: Simplify Android MSR probe
  tools/power x86_energy_perf_policy: Add Android MSR device support
  tools/power turbostat: Add run-time MSR driver probe
  tools/power turbostat: Set per_cpu_msr_sum to NULL after free
  tools/power turbostat: Add LLC stats
  tools/power turbostat: Remove dead code
  tools/power turbostat: Refactor floating point printout code
  tools/power turbostat.8: Update example
  tools/power turbostat: Refactor added-counter value printing code
  tools/power turbostat: Refactor added column header printing
  tools/power turbostat: Add Wildcat Lake and Nova Lake support
  ...
2025-12-06 09:35:00 -08:00
Srinivas Pandruvada
ad374eb9b3 tools/power/x86/intel-speed-select: v1.24 release
This version includes the following changes:
- Check feature status to check if the feature enablement was successful
- Reset SST-TF bucket structure to display valid bucket info

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-12-03 08:29:13 -08:00
Srinivas Pandruvada
3bd486e2d9 tools/power/x86/intel-speed-select: Reset isst_turbo_freq_info for invalid buckets
With SST-TF version 2 only 3 buckets are present. The information in
others buckets can be junk. So initialize the info structure of type
isst_turbo_freq_info, before issing ioctl to get bucket information.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-12-03 08:29:13 -08:00
Srinivas Pandruvada
6dc93d6890 tools/power/x86/intel-speed-select: Check feature status
After change of enable/disable status of SST-CP, SST-TF and SST-BF
check if the hardware status change was successful. If not successful
even after retries, return failure.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2025-12-03 08:29:13 -08:00
Linus Torvalds
d348c22394 Power management updates for 6.19-rc1
- Introduce and document a QoS limit on CPU exit latency during wakeup
    from suspend-to-idle (Ulf Hansson)
 
  - Add support for building libcpupower statically (Zuo An)
 
  - Add support for sending netlink notifications to user space on energy
    model updates (Changwoo Mini, Peng Fan)
 
  - Minor improvements to the Rust OPP interface (Tamir Duberstein)
 
  - Fixes to scope-based pointers in the OPP library (Viresh Kumar)
 
  - Use residency threshold in polling state override decisions in the
    menu cpuidle governor (Aboorva Devarajan)
 
  - Add sanity check for exit latency and target residency in the cpufreq
    core (Rafael Wysocki)
 
  - Use this_cpu_ptr() where possible in the teo governor (Christian
    Loehle)
 
  - Rework the handling of tick wakeups in the teo cpuidle governor to
    increase the likelihood of stopping the scheduler tick in the cases
    when tick wakeups can be counted as non-timer ones (Rafael Wysocki)
 
  - Fix a reverse condition in the teo cpuidle governor and drop a
    misguided target residency check from it (Rafael Wysocki)
 
  - Clean up multiple minor defects in the teo cpuidle governor (Rafael
    Wysocki)
 
  - Update header inclusion to make it follow the Include What You Use
    principle (Andy Shevchenko)
 
  - Enable MSR-based RAPL PMU support in the intel_rapl power capping
    driver and arrange for using it on the Panther Lake and Wildcat Lake
    processors (Kuppuswamy Sathyanarayanan)
 
  - Add support for Nova Lake and Wildcat Lake processors to the
    intel_rapl power capping driver (Kaushlendra Kumar, Srinivas
    Pandruvada)
 
  - Add OPP and bandwidth support for Tegra186 (Aaron Kling)
 
  - Optimizations for parameter array handling in the amd-pstate cpufreq
    driver (Mario Limonciello)
 
  - Fix for mode changes with offline CPUs in the amd-pstate cpufreq
    driver (Gautham Shenoy)
 
  - Preserve freq_table_sorted across suspend/hibernate in the cpufreq
    core (Zihuan Zhang)
 
  - Adjust energy model rules for Intel hybrid platforms in the
    intel_pstate cpufreq driver and improve printing of debug messages
    in it (Rafael Wysocki)
 
  - Replace deprecated strcpy() in cpufreq_unregister_governor()
    (Thorsten Blum)
 
  - Fix duplicate hyperlink target errors in the intel_pstate cpufreq
    driver documentation and use :ref: directive for internal linking in
    it (Swaraj Gaikwad, Bagas Sanjaya)
 
  - Add Diamond Rapids OOB mode support to the intel_pstate cpufreq
    driver (Kuppuswamy Sathyanarayanan)
 
  - Use mutex guard for driver locking in the intel_pstate driver and
    eliminate some code duplication from it (Rafael Wysocki)
 
  - Replace udelay() with usleep_range() in ACPI cpufreq (Kaushlendra
    Kumar)
 
  - Minor improvements to various cpufreq drivers (Christian Marangi, Hal
    Feng, Jie Zhan, Marco Crivellari, Miaoqian Lin, and Shuhao Fu)
 
  - Replace snprintf() with scnprintf() in show_trace_dev_match()
    (Kaushlendra Kumar)
 
  - Fix memory allocation error handling in pm_vt_switch_required()
    (Malaya Kumar Rout)
 
  - Introduce CALL_PM_OP() macro and use it to simplify code in
    generic PM operations (Kaushlendra Kumar)
 
  - Add module param to backtrace all CPUs in the device power management
    watchdog (Sergey Senozhatsky)
 
  - Rework message printing in swsusp_save() (Rafael Wysocki)
 
  - Make it possible to change the number of hibernation compression
    threads (Xueqin Luo)
 
  - Clarify that only cgroup1 freezer uses PM freezer (Tejun Heo)
 
  - Add document on debugging shutdown hangs to PM documentation and
    correct a mistaken configuration option in it (Mario Limonciello)
 
  - Shut down wakeup source timer before removing the wakeup source from
    the list (Kaushlendra Kumar, Rafael Wysocki)
 
  - Introduce new PMSG_POWEROFF event for system shutdown handling with
    the help of PM device callbacks (Mario Limonciello)
 
  - Make pm_test delay interruptible by wakeup events (Riwen Lu)
 
  - Clean up kernel-doc comment style usage in the core hibernation
    code and remove unuseful comments from it (Sunday Adelodun, Rafael
    Wysocki)
 
  - Add support for handling wakeup events and aborting the suspend
    process while it is syncing file systems (Samuel Wu, Rafael Wysocki)
 
  - Add WQ_UNBOUND to pm_wq workqueue (Marco Crivellari)
 
  - Add runtime PM wrapper macros for ACQUIRE()/ACQUIRE_ERR() and use
    them in the PCI core and the ACPI TAD driver (Rafael Wysocki)
 
  - Improve runtime PM in the ACPI TAD driver (Rafael Wysocki)
 
  - Update pm_runtime_allow/forbid() documentation (Rafael Wysocki)
 
  - Fix typos in runtime.c comments (Malaya Kumar Rout)
 
  - Move governor.h from devfreq under include/linux/ and rename to
    devfreq-governor.h to allow devfreq governor definitions in out
    of drivers/devfreq/ (Dmitry Baryshkov)
 
  - Use min() to improve readability in tegra30-devfreq.c (Thorsten
    Blum)
 
  - Fix potential use-after-free issue of OPP handling in
    hisi_uncore_freq.c (Pengjie Zhang)
 
  - Fix typo in DFSO_DOWNDIFFERENTIAL macro name in
    governor_simpleondemand.c in devfreq (Riwen Lu)
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmkp0BYSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1Pc8H/2G5d0aD/ym1a8MDTpKqn7t3/rVMHa76
 YGfxXMBr1oY++r5GTJTKBxZBHmF89VH71kdyvsMidTAtHjR+iZAS1ajd2Q5VYjOF
 QNMld1qgPEzAZU8WSetDrBqMr89zls05Uubo4aCoNy6rFmgRaLHh3AmIKSS9aJuo
 C1eH8dRONME5I/rafkOUpFs1+/Agq1vePwPZmwVnZX9A3qI+UOhMRdU9A37kYkx9
 YwfQvR2fKTIPjZ6B9f/wGXPOvdrT37d4+dWT3EABOHMkxlpAPDMvmVzZsUaXSQMr
 0d9NGEjPGo33qciKJJpHqNOdDOhi90606WBBf7aaMF+GMhDX3PznOK4=
 =rzXO
 -----END PGP SIGNATURE-----

Merge tag 'pm-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management updates from Rafael Wysocki:
 "There are quite a few interesting things here, including new hardware
  support, new features, some bug fixes and documentation updates. In
  addition, there are a usual bunch of minor fixes and cleanups all
  over.

  In the new hardware support category, there are intel_pstate and
  intel_rapl driver updates to support new processors, Panther Lake,
  Wildcat Lake, Noval Lake, and Diamond Rapids in the OOB mode, OPP and
  bandwidth allocation support in the tegra186 cpufreq driver, and
  JH7110S SOC support in dt-platdev cpufreq.

  The new features are the PM QoS CPU latency limit for suspend-to-idle,
  the netlink support for the energy model management, support for
  terminating system suspend via a wakeup event during the sync of file
  systems, configurable number of hibernation compression threads, the
  runtime PM auto-cleanup macros, and the "poweroff" PM event that is
  expected to be used during system shutdown.

  Bugs are mostly fixed in cpuidle governors, but there are also fixes
  elsewhere, like in the amd-pstate cpufreq driver.

  Documentation updates include, but are not limited to, a new doc on
  debugging shutdown hangs, cross-referencing fixes and cleanups in the
  intel_pstate documentation, and updates of comments in the core
  hibernation code.

  Specifics:

   - Introduce and document a QoS limit on CPU exit latency during
     wakeup from suspend-to-idle (Ulf Hansson)

   - Add support for building libcpupower statically (Zuo An)

   - Add support for sending netlink notifications to user space on
     energy model updates (Changwoo Mini, Peng Fan)

   - Minor improvements to the Rust OPP interface (Tamir Duberstein)

   - Fixes to scope-based pointers in the OPP library (Viresh Kumar)

   - Use residency threshold in polling state override decisions in the
     menu cpuidle governor (Aboorva Devarajan)

   - Add sanity check for exit latency and target residency in the
     cpufreq core (Rafael Wysocki)

   - Use this_cpu_ptr() where possible in the teo governor (Christian
     Loehle)

   - Rework the handling of tick wakeups in the teo cpuidle governor to
     increase the likelihood of stopping the scheduler tick in the cases
     when tick wakeups can be counted as non-timer ones (Rafael Wysocki)

   - Fix a reverse condition in the teo cpuidle governor and drop a
     misguided target residency check from it (Rafael Wysocki)

   - Clean up multiple minor defects in the teo cpuidle governor (Rafael
     Wysocki)

   - Update header inclusion to make it follow the Include What You Use
     principle (Andy Shevchenko)

   - Enable MSR-based RAPL PMU support in the intel_rapl power capping
     driver and arrange for using it on the Panther Lake and Wildcat
     Lake processors (Kuppuswamy Sathyanarayanan)

   - Add support for Nova Lake and Wildcat Lake processors to the
     intel_rapl power capping driver (Kaushlendra Kumar, Srinivas
     Pandruvada)

   - Add OPP and bandwidth support for Tegra186 (Aaron Kling)

   - Optimizations for parameter array handling in the amd-pstate
     cpufreq driver (Mario Limonciello)

   - Fix for mode changes with offline CPUs in the amd-pstate cpufreq
     driver (Gautham Shenoy)

   - Preserve freq_table_sorted across suspend/hibernate in the cpufreq
     core (Zihuan Zhang)

   - Adjust energy model rules for Intel hybrid platforms in the
     intel_pstate cpufreq driver and improve printing of debug messages
     in it (Rafael Wysocki)

   - Replace deprecated strcpy() in cpufreq_unregister_governor()
     (Thorsten Blum)

   - Fix duplicate hyperlink target errors in the intel_pstate cpufreq
     driver documentation and use :ref: directive for internal linking
     in it (Swaraj Gaikwad, Bagas Sanjaya)

   - Add Diamond Rapids OOB mode support to the intel_pstate cpufreq
     driver (Kuppuswamy Sathyanarayanan)

   - Use mutex guard for driver locking in the intel_pstate driver and
     eliminate some code duplication from it (Rafael Wysocki)

   - Replace udelay() with usleep_range() in ACPI cpufreq (Kaushlendra
     Kumar)

   - Minor improvements to various cpufreq drivers (Christian Marangi,
     Hal Feng, Jie Zhan, Marco Crivellari, Miaoqian Lin, and Shuhao Fu)

   - Replace snprintf() with scnprintf() in show_trace_dev_match()
     (Kaushlendra Kumar)

   - Fix memory allocation error handling in pm_vt_switch_required()
     (Malaya Kumar Rout)

   - Introduce CALL_PM_OP() macro and use it to simplify code in generic
     PM operations (Kaushlendra Kumar)

   - Add module param to backtrace all CPUs in the device power
     management watchdog (Sergey Senozhatsky)

   - Rework message printing in swsusp_save() (Rafael Wysocki)

   - Make it possible to change the number of hibernation compression
     threads (Xueqin Luo)

   - Clarify that only cgroup1 freezer uses PM freezer (Tejun Heo)

   - Add document on debugging shutdown hangs to PM documentation and
     correct a mistaken configuration option in it (Mario Limonciello)

   - Shut down wakeup source timer before removing the wakeup source
     from the list (Kaushlendra Kumar, Rafael Wysocki)

   - Introduce new PMSG_POWEROFF event for system shutdown handling with
     the help of PM device callbacks (Mario Limonciello)

   - Make pm_test delay interruptible by wakeup events (Riwen Lu)

   - Clean up kernel-doc comment style usage in the core hibernation
     code and remove unuseful comments from it (Sunday Adelodun, Rafael
     Wysocki)

   - Add support for handling wakeup events and aborting the suspend
     process while it is syncing file systems (Samuel Wu, Rafael
     Wysocki)

   - Add WQ_UNBOUND to pm_wq workqueue (Marco Crivellari)

   - Add runtime PM wrapper macros for ACQUIRE()/ACQUIRE_ERR() and use
     them in the PCI core and the ACPI TAD driver (Rafael Wysocki)

   - Improve runtime PM in the ACPI TAD driver (Rafael Wysocki)

   - Update pm_runtime_allow/forbid() documentation (Rafael Wysocki)

   - Fix typos in runtime.c comments (Malaya Kumar Rout)

   - Move governor.h from devfreq under include/linux/ and rename to
     devfreq-governor.h to allow devfreq governor definitions in out of
     drivers/devfreq/ (Dmitry Baryshkov)

   - Use min() to improve readability in tegra30-devfreq.c (Thorsten
     Blum)

   - Fix potential use-after-free issue of OPP handling in
     hisi_uncore_freq.c (Pengjie Zhang)

   - Fix typo in DFSO_DOWNDIFFERENTIAL macro name in
     governor_simpleondemand.c in devfreq (Riwen Lu)"

* tag 'pm-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (96 commits)
  PM / devfreq: Fix typo in DFSO_DOWNDIFFERENTIAL macro name
  cpuidle: Warn instead of bailing out if target residency check fails
  cpuidle: Update header inclusion
  Documentation: power/cpuidle: Document the CPU system wakeup latency QoS
  cpuidle: Respect the CPU system wakeup QoS limit for cpuidle
  sched: idle: Respect the CPU system wakeup QoS limit for s2idle
  pmdomain: Respect the CPU system wakeup QoS limit for cpuidle
  pmdomain: Respect the CPU system wakeup QoS limit for s2idle
  PM: QoS: Introduce a CPU system wakeup QoS limit
  cpuidle: governors: teo: Add missing space to the description
  PM: hibernate: Extra cleanup of comments in swap handling code
  PM / devfreq: tegra30: use min to simplify actmon_cpu_to_emc_rate
  PM / devfreq: hisi: Fix potential UAF in OPP handling
  PM / devfreq: Move governor.h to a public header location
  powercap: intel_rapl: Enable MSR-based RAPL PMU support
  powercap: intel_rapl: Prepare read_raw() interface for atomic-context callers
  cpufreq: qcom-nvmem: fix compilation warning for qcom_cpufreq_ipq806x_match_list
  PM: sleep: Call pm_sleep_fs_sync() instead of ksys_sync_helper()
  PM: sleep: Add support for wakeup during filesystem sync
  cpufreq: ACPI: Replace udelay() with usleep_range()
  ...
2025-12-02 17:31:22 -08:00
Len Brown
9c0bad7508 tools/power turbostat: version 2025.12.02
Since release 2025.09.09:

Add LLC statistics columns:
    LLCkRPS = Last Level Cache Thousands of References Per Second
    LLC%hit = Last Level Cache Hit %
Recognize Wildcat Lake and Nova Lake platforms
Add MSR check for Android
Add APERF check for VMWARE
Add RAPL check for AWS
minor fixes

This patch:

White-space only, resulting from running Lindent
on everything except the tab-justified data-tables,
and using -l150 instead of -l80 to allow long lines.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00
Len Brown
1a23ba6a1b tools/power turbostat: Print wide names only for RAW 64-bit columns
Print a wide column header only for the case of a 64-bit RAW counter.

It turns out that wide column headers otherwise are more harm than good.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00
Len Brown
2ba8b24e9d tools/power turbostat: Print percentages in 8-columns
Added counters that are FORMAT_PERCENT
do not need to be 64-bits -- 32 is plenty.
This allows the output code to fit them,
and their header, into 8-columns.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00
Len Brown
8808292799 tools/power turbostat: Print "nan" for out of range percentages
Sometimes counters return junk.
For the cases where values > 100% is invalid, print "nan".

Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00
Len Brown
951845d51d tools/power turbostat: Validate APERF access for VMWARE
VMWARE correctly enumerates lack of APERF and MPERF in CPUID,
but turbostat didn't consult that before attempting to access them.

Since VMWARE allows access, but always returns 0, turbostat
got confusd into an infinite reset loop.

Head this off by listening to CPUID.6.APERF_MPERF
(and rename the existing variable to make this more clear)

Reported-by: David Arcari <darcari@redhat.com>
Tested-by: David Arcari <darcari@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00
Len Brown
68769a0b5a tools/power turbostat: Enhance perf probe
check_perf_access() will now check both IPC and LLC perf counters
if they are enabled.  If any fail, it now disables perf
and all perf counters.

Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00
Len Brown
19476a592b tools/power turbostat: Validate RAPL MSRs for AWS Nitro Hypervisor
Even though the platform->plat_rapl_msrs enumeration may be accurate,
a VM, such as AWS Nitro Hypervisor, may deny access to the underlying MSRs.

Probe if PKG_ENERGY is readable and non-zero.
If no, ignore all RAPL MSRs.

Reported-by: Emily Ehlert <ehemily@amazon.de>
Tested-by: Emily Ehlert <ehemily@amazon.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2025-12-02 16:11:14 -05:00