summaryrefslogtreecommitdiff
path: root/tools/power/x86
AgeCommit message (Collapse)Author
7 daysMerge tag 'power-utilities-2026.10.31' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux Pull x86 power utilities updates from Len Brown: "Turbostat: - Fix --cpu option to work more than once - Fix --Joules option to work with --show power - Remove hard-coded 8192-CPU limit - Decode Uncore Frequency Agent Types - Dump RDT (Resource Director Technology) config - Dump RP (Resource Priority) config - Recognize Rugged Panther Lake - Fix PMT mmap size, bounds check, and mask computation - Misc cleanups and minor fixes x86_energy_perf_policy: - Harden input parsing and bounds checks - Fix optarg keyword matching - Rewrite MSR device path discovery - Misc cleanups and minor fixes" * tag 'power-utilities-2026.10.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (42 commits) tools/power x86_energy_perf_policy: Version 2026.10.31 tools/power turbostat: Version 2026.10.31 tools/power turbostat: Fix PMT mmap size and bounds check tools/power turbostat: Fix undefined behavior in pmt_gen_value_mask() tools/power turbostat: Fix --Joules when used with --show power MAINTAINERS: Add x86_energy_perf_policy x86_energy_perf_policy: Simplify write_sysfs() return type x86_energy_perf_policy: Use calloc to initialize string buffer x86_energy_perf_policy: Cleanup: Constify read only parameters x86_energy_perf_policy: Cleanup: Drop unused signal.h x86_energy_perf_policy: Document MSRHEADER x86_energy_perf_policy: Cleanup: Check fseek() in VM path x86_energy_perf_policy: Cleanup: Define BCLK_MHZ x86_energy_perf_policy: Cleanup: Define HWP_WINDOW_MAX_USEC x86_energy_perf_policy: Bound package iteration x86_energy_perf_policy: Harden against potential ratio overflow x86_energy_perf_policy: Fix optarg keyword matching x86_energy_perf_policy: Cleanup: Use snprintf() for platform-profile x86_energy_perf_policy: Harden with strtol() x86_energy_perf_policy: Harden update_cpufreq_scaling_freq() ...
7 daysMerge branches 'turbostat' and 'x86_energy_perf_policy' into utilitiesLen Brown
7 daystools/power x86_energy_perf_policy: Version 2026.10.31Len Brown
Since 2026.04.25: Harden input parsing and bounds checks. Fix optarg keyword matching. Rewrite MSR device path discovery. Misc cleanups and minor fixes. Signed-off-by: Len Brown <len.brown@intel.com>
7 daystools/power turbostat: Version 2026.10.31Len Brown
Since version 2026.09.28: Fix --cpu option to work more than once. Fix --Joules option to work with --show power. Remove hard-coded 8192-CPU limit. Decode Uncore Frequency Agent Types. Dump RDT (Resource Director Technology) config. Dump RP (Resource Priority) config. Recognize Rugged Panther Lake. Fix PMT mmap size, bounds check, and mask computation. Misc cleanups and minor fixes. Signed-off-by: Len Brown <len.brown@intel.com>
7 daystools/power turbostat: Fix PMT mmap size and bounds checkKaushlendra Kumar
Remove assert(offset == 0), to allow non-zero PMT offsets. Fix the pmt_mmio_open() mapping to round-up (offset + size). Fix the offset bounds check to disallow running past the end of the region. [lenb: commit message re-write] Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
7 daystools/power turbostat: Fix undefined behavior in pmt_gen_value_mask()Kaushlendra Kumar
The function uses plain int literal '1' for bit shifting, which causes undefined behavior when msb >= 31. This is because shifting a 32-bit int by 32 or more bits is undefined behavior in C. Fix by using 1ULL (unsigned long long) instead of 1 to ensure 64-bit arithmetic on all platforms. Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
7 daystools/power turbostat: Fix --Joules when used with --show powerLen Brown
The "--Joules" option displays energy in Joules, replacing the same metrics displayed as power in Watts. But when used with --show power, it deletes the power metrics without replacing them with their energy counterparts: $ sudo ./turbostat -q --list --show power --Joules CoreTmp,PkgTmp,RAM_J,PKG_%,RAM_% Fix it thus: $ sudo ./turbostat -q --list --show power --Joules CoreTmp,PkgTmp,Pkg_J,Cor_J,GFX_J,RAM_J,PKG_%,RAM_%,Sys_J Signed-off-by: Len Brown <len.brown@intel.com>
10 daysMerge tag 'platform-drivers-x86-v7.4-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 Pull x86 platform driver updates from Ilpo Järvinen: "The usual updates for laptop quirks from HP, ASUS, Acer, Dell etc: - new model names and recent CPU support - more special button / function key handling - battery and hardware monitoring quirks Tool updates to intel-speed-select WMI now supports non-x86 architectures Miscellaneous cleanups / refactoring / improvements" * tag 'platform-drivers-x86-v7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (237 commits) platform/x86: asus-wmi: name the TUF keyboard RGB state and speed codes platform/x86: asus-wmi: fix TUF keyboard power state shutdown naming platform/x86: asus-wmi: rename TUF RGB state DEVID to _CMD platform/x86: asus-armoury: add power limits quirk for GU605CM platform/x86: asus-armoury: add power limits quirk for G533QS platform/x86: asus-armoury: add power limits quirk for GA402NV platform/x86: asus-armoury: add power limits quirk for FA608UP platform/x86: asus-armoury: add power limits quirk for FA608UH platform/x86: asus-armoury: add power limits quirk for FA608PM platform/x86: asus-armoury: add power limits quirk for G713QR platform/x86: ibm_rtl: Fix potential OOB read at signature search platform/x86: acer-wmi: Add support for Acer Nitro AN16-41 platform/x86: acer-wmi: Cycle platform profile on mode key 0x4 platform/x86: hp-wmi: Disable hwmon attributes when no fans are usable platform/x86: gpd pocket fan: Cancel work before releasing GPIOs platform/x86: asus-armoury: Add XBOX ROG Ally X 20 Tunables platform/x86: msi-wmi: Ignore WMI events for keys also handled by atkbd platform/x86: msi-wmi: Sort scancodes numerically platform: arm64: Add a driver for the EC found on ASUS Glymur machines MAINTAINERS: Add myself as a LENOVO drivers co-maintainer ...
11 daysx86_energy_perf_policy: Simplify write_sysfs() return typeLen Brown
Simplify error check in write_sysfs(). Suggested-by: Amarjeet <amarjeet@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Use calloc to initialize string bufferLen Brown
strstr was being run on a potentially unterminated buffer. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Cleanup: Constify read only parametersLen Brown
Add const qualifiers to the parameters of parse_optarg_string(), platform_profile_name_is(), print_hwp_request(), and print_hwp_request_pkg() which are read-only. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Cleanup: Drop unused signal.hLen Brown
Remove unused #include <signal.h> Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Document MSRHEADERLen Brown
Add comment documenting MSRHEADER Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Cleanup: Check fseek() in VM pathLen Brown
Add return value validation for fseek() and ensure consistent resource cleanup on all error paths in err_on_hypervisor(). Fixes: 0936cdfbb527 ("tools/power x86_energy_perf_policy: Input/output error in a VM") Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Cleanup: Define BCLK_MHZLen Brown
Replace the hardcoded value 100 with a named symbolic constant BCLK_MHZ in ratio_2_sysfs_khz() to document the assumed bus clock frequency. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Cleanup: Define HWP_WINDOW_MAX_USECLen Brown
Define HWP_WINDOW_MAX_USEC Doing so pointed out that it should be unsigned, so change associated code that touches it to use unsigned. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Bound package iterationLen Brown
Add explicit bounds checking against MAX_PACKAGES in for_packages() to prevent potential out-of-bounds bit shift operations. Also, use consistent shift idiom: (1ULL << pkg_num) Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Harden against potential ratio overflowLen Brown
Prevent integer overflow in ratio_2_msr_perf() by using 64-bit arithmetic for the intermediate multiplication calculation. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Fix optarg keyword matchingLen Brown
Replace strncmp() with strcmp() for exact string matching in parse_optarg_string(). Exact keyword matching is safer and clearer. This prevents accidental matches with longer strings like "performance-foo". Fixes: 4beec1d75196 ("tools/power x86_energy_perf_policy: support HWP.EPP") Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Cleanup: Use snprintf() for platform-profileLen Brown
Better hygiene to use snprintf() instead of strcpy(). Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Harden with strtol()Len Brown
Replace atoi() with strtol() and proper error checking when parsing the --hwp-use-pkg command-line argument value, and other spots. Add explicit check that value is in valid range [0, 1]. Update associated error message strings. parse_optarg_string() now returns long, as returned from strtol(). Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Harden update_cpufreq_scaling_freq()Len Brown
Protect update_cpufreq_scaling_freq() from buffer overflow if somehow it was called with a huge CPU number. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
11 daysx86_energy_perf_policy: Rewrite Linux/Android MSR path discoveryLen Brown
First check that the Linux MSR driver path exists, modprobe if no. If still no, then check that the Android MSR driver path exists. Read or Write permissions are handled at run-time in the get_msr()/put_msr() error paths. Create set_msr_path() helper. Return -1 for all fatal errors. Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
12 daystools/power turbostat: Add rugged Panther Lake supportKuppuswamy Sathyanarayanan
Add CPU model for rugged Panther Lake to the platform and perf model tables. It uses the same cores as Panther Lake, so use the same settings. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Co-developed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
12 daystools/power turbostat: Fix comment typoHemanth Selam
Spell "instead" properly in comment. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
12 daystools/power turbostat: Rename cpu_subset to cpuset_cmdlineLen Brown
The cpu_set supporting "--cpu" on the cmdline is special. Unlike all other cpu_sets, it is allocated, re-used, and never freed. Add a comment noting this and name it "cpuset_cmdline" to clarify its use. No functional change. Signed-off-by: Len Brown <len.brown@intel.com>
12 daystools/power turbostat: Allow multiple --cpu on cmdlineLen Brown
If --cpu is on the cmdline more than once, previous invocations are forgotten (and their cpu_set is leaked). Allow multiple invocations of --cpu on the cmdline. OR them together, reusing the same cpu_set. Signed-off-by: Len Brown <len.brown@intel.com>
12 daystools/power turbostat: Cleanup: Use one cpu_setsize for all purposesLen Brown
Use a single cpu_setsize to describe every cpu_set_t. Size it based on the maximum possible cpu number. No functional change. Signed-off-by: Len Brown <len.brown@intel.com>
12 daystools/power turbostat: Dump RP-Enable MSRsLen Brown
To reduce verbosity, put the Enable MSRs on the same output line as the CPUID info that shows they exist. Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Dump RDT CPUID.0xF,0x10,0x27,0x28 SupportLen Brown
If Asymmetric RDT is supported, dump it on every CPU. Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Dump RDT CPUID.7 SupportLen Brown
Show both Symmetric and Asymmetric RDT bits. Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: pmt: Improve sscanf() hygieneLen Brown
Explicitly check sscanf() return values for number of matches, and handle EOF (-1). Defensive programming -- not an issue actively seen by users. Fixes: 4265a86582ea ("tools/power turbostat: Add PMT directory iterator helper") Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: bool force_loadLen Brown
It is confusing to increment what is effectively a bool value. Define force_load as bool, and access it accordingly. Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Fix typo: MHz, not MhzLen Brown
The SI symbol for megahertz capitalizes both the SI prefix ('M') and the unit symbol ('Hz'). Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: consistently use warn/err, not perrorLen Brown
Acknowledge that get_msr() always errs out on failure by returning void and deleting checks for its return value. Replace all perror() with warn(). Replace all perror()/exit() with err(). No functional change, unless you count the uniform return value of -1 on calloc failure. Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup add_counter declarationLen Brown
Declaration and definition parameter name mismatch was confusing. Some params can be 'const'. No functional change. Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup counter sets debug codeLen Brown
When the debug "--Dump" option is used to dump counter values, also dump the counter sets. Update that counter counter-set debug code to pass code review. Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: Unify comparisons to max_cpu_numLen Brown
Unify the syntax of loops over all CPUs for consistency, since we just fixed two off-by-one bugs. No functional change. Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: Remove useless assert()Len Brown
No functional change. Assisted-by: Claude:claude-haiku-4-5 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: Delete duplicate table entryLen Brown
No functional change. Assisted-by: Claude:claude-haiku-4-5 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: Remove hard-coded 8192 CPU limitLen Brown
The --cpu cmdline option was parsed before topology_probe() set max_cpu_num, and so it used a hard-coded CPU limit of 8192. Probe max_cpu_num earlier and allocate the set for --cpu using the same size as all other CPU sets, large enough to hold max possible (but not bigger). No functional change, unless you count fixing some error paths. Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Rename: Differentiate counter and CPU setsLen Brown
Sets of Built-In-Counters (BICs) are implemented using cpu_set_t. Since cpu_set_t is also used for sets of CPUs, invent the name "bic_set_t" to make it more clear which is which. typedef is discouraged by kernel coding checkers, but is appropriate here -- and better than #define. No functional change. Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Cleanup: Delete unused flagsLen Brown
No functional change. Assisted-by: Claude:claude-haiku-4-5 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-19tools/power turbostat: Decode Uncore Frequency Agent TypesLen Brown
Newer platforms export Uncore Frequency agent_types: $ cat /sys/devices/system/cpu/intel_uncore_frequency/uncore03/agent_types memory Update the previous system configuration header lines: Uncore Frequency package0 domain4 cluster1: 800 - 2100 MHz (800 - 2100 MHz) 2100 MHz With (more concise) lines that include this (agent type) description: pkg0: UMHz4.1(memory): 800 - 2100 MHz (800 - 2100 MHz) 2100 MHz The actual measurement column header is unchanged: UMHz4.1 Signed-off-by: Len Brown <len.brown@intel.com>
2026-10-13tools/power/x86/intel-speed-select: v1.27 releaseSrinivas Pandruvada
This version includes the following changes: - Increase wait time after SST PP level switch - Cleanup of temporary files and minor cleanup Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-10-13tools/power/x86/intel-speed-select: Increase wait time after SST PP level switchSrinivas Pandruvada
After an Intel Speed Select Performance Profile (SST PP) level switch, hardware takes time to update the HWP CAPABILITIES register. The current 2 ms wait time is insufficient on some platforms, leading to stale capability readings. Increase the wait time to 10 ms. Because level switching is an infrequent operation done only during configuration and not in a fast path, the slight delay has negligible impact. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-10-13tools/power/x86/intel-speed-select: Clean all the produced filesJiri Slaby (SUSE)
1) The commit 7d440da009b6 ("tools/power/x86/intel-speed-select: HFI support") added the thermal.h link, but did not remove it up on cleanup. Do so. 2) .*.cmd files were never deleted, so were left dangling. Clean them up too. 3) The "*.d" pattern was updated: a) the backslash was superfluous, b) it was made more explicit by specifying ".o" in ".*.o.d". [ span: Capitalize first letter after : ] Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-10-13tools/power/x86/intel-speed-select: Fix signed shift UB in BIT() macroLiu Jing
The BIT() macro is defined as `(1 << (x))` with a signed integer 1. When x >= 31, this causes signed integer overflow which is undefined behavior in C. This macro is used with BIT(31) in isst-core.c and isst-core-mbox.c. Fix it by using `1U` instead of `1` to perform an unsigned shift, matching the kernel's own BIT() definition which uses unsigned. [ span: Change header ] Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-10-13tools/power/x86/intel-speed-select: Correct macro name in debug outputEthan Nelson-Moore
A call to debug_printf() in isst-core-mbox.c incorrectly refers to CONFIG_TDP_GET_TURBO_LIMIT instead of CONFIG_TDP_GET_TURBO_LIMIT_RATIOS. Correct it. Discovered while searching for CONFIG_* symbols referenced in code but not defined. [ span: Capitalize first letter after : ] Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2026-10-03turbostat 2026.09.28Len Brown
Signed-off-by: Len Brown <len.brown@intel.com>