summaryrefslogtreecommitdiff
path: root/tools/power/x86
AgeCommit message (Collapse)Author
2026-04-25Merge tag 'power-utilities-2026.04.25' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux Pull power utility updates from Len Brown: "x86_energy_perf_policy: - Initial SoC Slider support turbostat: - Display HT siblings in cpu# order - Add Module-ID column - Print Core-ID and APIC-ID in hex - Fix misc bugs" * tag 'power-utilities-2026.04.25' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: tools/power x86_energy_perf_policy: Version 2026.04.25 tools/power x86_energy_perf_policy.8: Document SoC Slider Options tools/power x86_energy_perf_policy: Enhances SoC Slider related checks tools/power turbostat: v2026.04.21 tools/power turbostat: Process HT siblings in CPU order tools/power turbostat: Show module_id column tools/power turbostat: Print core_id and apic_id in hex tools/power turbostat: Cleanup print helper functions tools/power turbostat: Fix --cpu-set 1 regression on HT systems tools/power turbostat: Fix --cpu-set 0 regression on HT systems tools/power turbostat: Fix unrecognized option '-P' tools/power turbostat: Fix AMD RAPL regression on big systems tools/power/x86: Add SOC slider and platform profile support
2026-04-25Merge branches 'turbostat' and 'x86_energy_perf_policy' into power-utilitiesLen Brown
2026-04-25tools/power x86_energy_perf_policy: Version 2026.04.25Len Brown
Since v2025.11.22: Initial SoC Slider support SoC Slider is an SoC-wide power/performance policy setting. On SoC Slider systems, EPP plays a diminished role. Whitespace cleanup via: indent -npro -kr -i8 -ts8 -sob -l160 -ss -ncs -cp1 No functional changes Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-25tools/power x86_energy_perf_policy.8: Document SoC Slider OptionsLen Brown
x86_energy_perf_policy accesses the SoC Slider via standard user/kernel APIs to the processor_thermal_soc_slider driver. Machines that support SoC Slider largely use it instead of EPP, which may continue to exist in a diminished role, or vanish entirely. Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-25tools/power x86_energy_perf_policy: Enhances SoC Slider related checksLen Brown
When processor_thermal_soc_slider is loaded, its slider and offset modparams are visible. Check that the driver actually registered the profile named "SoC Slider" before reading or writing these modparams. n.b. This utility allows writing the Slider and Offset modparams even if the driver policy is not "balanced". Currently the processor_thermal_soc_slider consults those modparams only in "balanced" mode. Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: v2026.04.21Len Brown
Since v2026.02.14 Display HT siblings in cpu# order. Add Module-ID column. Print Core-ID and APIC-ID in hex. Fix misc bugs. Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: Process HT siblings in CPU orderLen Brown
On large systems with HT sibling cpu#'s more than 32 apart, HT siblings were processed and displayed in reverse order. This was due to how set_thread_siblings() parsed the sibling-bit-mask. Update set_thread_siblings to instead parse the sibling-list, like other cpu lists, and to thus order HT siblings by ascending CPU number, no matter the size of the system. Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: Show module_id columnLen Brown
Get the "module_id" from the Linux topology "cluster_id". If the there is more than one id, show it by default. Module joins Die etc. in the "topology" group. Display in hex, as it is usually based mask of the APIC-id Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: Print core_id and apic_id in hexLen Brown
The core_id is based on a mask of the apic_id. Print them both in hex, rather than decimal, to make this relationship visibly clear. Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: Cleanup print helper functionsArtem Bityutskiy
Make printer helper functions more readable by factoring out a local 'sep' variable. Remove the redundant parentheses around sprintf() calls. Remove an unnecessary cast to "unsigned int" by using the '%08llx' instead of '%08x'. No functional changes. [lenb: fix typos, simplify] Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: Fix --cpu-set 1 regression on HT systemsLen Brown
When the "--cpu-set" option limits turbostat to run on a higher numbered HT sibling, it exits upon dividing by zero. This is because the HT support handles higher numbered siblings at the same time as lower numbered siblings. But when that lower number sibling is dis-allowed, the higher numbered sibling is never processed. The result is a time delta of 0, which results in a divide by 0 for any of the "per-second" metrics. Enhance the HT enumeration code to record all siblings (up to SMT4). Consult this complete HT sibling list to determine when to process an HT sibling, and when to skip it. Fixes: a2b4d0f8bf07 ("tools/power turbostat: Favor cpu# over core#") Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-22tools/power turbostat: Fix --cpu-set 0 regression on HT systemsLen Brown
"turbostat --cpu-set 0" appears to hang if cpu0 has an HT sibling. This is because the initialization code recognizes that it does not have to open perf files for the HT sibling, but the HT support in the collection code sees the HT sibling and tries to read from an uninitialized file descriptor, 0 (standard input). Access HT siblings only when they are in the allowed set. Fixes: a2b4d0f8bf07 ("tools/power turbostat: Favor cpu# over core#") Signed-off-by: Len Brown <len.brown@intel.com> Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2026-04-22tools/power turbostat: Fix unrecognized option '-P'David Arcari
The '-P' short option (shorthand for --no-perf) is not present in the optstring of the second call to getopt_long_only(). This results in the "unrecognized option" error when the tool reaches the main parsing loop. Add 'P' to the second getopt_long_only() call to ensure it is consistently recognized. Fixes: a0e86c90b83c ("tools/power turbostat: Add --no-perf option") Signed-off-by: David Arcari <darcari@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-21tools/power turbostat: Fix AMD RAPL regression on big systemsLen Brown
turbostat.c:8688: rapl_perf_init: Assertion `next_domain < num_domains' failed. The initial fix for this regression was incomplete, as it did not handle multi-package systems with sparse core ids. Fixes: ef0e60083f76 ("tools/power turbostat: Fix AMD RAPL regression") Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-20Merge tag 'platform-drivers-x86-v7.1-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: "asus-wmi: - Retain battery charge threshold during boot which avoids unsolicited change to 100%. Return -ENODATA when the limit is not yet known - Improve screenpad power/brightness handling consistency - Fix screenpad brightness range barco-p50-gpio: - Normalize gpio_get return values bitland-mifs-wmi: - Add driver for Bitland laptops (supports platform profile, hwmon, kbd backlight, gpu mode, hotkeys, and fan boost) dell_rbu: - Fix using uninitialized value in sysfs write function dell-wmi-sysman: - Respect destination length when constructing enum strings hp-wmi: - Propagate fan setting apply failures and log an error - Fix sysfs write vs work handler cancel_delayed_work_sync() deadlock - Correct keepalive schedule_delayed_work() to mod_delayed_work() - Fix u8 underflows in GPU delta calculation - Use mutex to protect fan pwm/mode - Ignore kbd backlight and FnLock key events that are handled by FW - Fix fan table parsing (use correct field) - Add support for Omen 14-fb0xxx, 16-n0xxx, 16-wf1xxx, and Omen MAX 16-ak0xxxx input: trackpoint & thinkpad_acpi: - Enable doubletap by default and add sysfs enable/disable int3472: - Add support for GPIO type 0x02 (IR flood LED) intel-speed-select: (updated to v1.26) - Avoid using current base frequency as maximum - Fix CPU extended family ID decoding - Fix exit code - Improve error reporting intel/vsec: - Refactor to support ACPI-enumerated PMT endpoints. pcengines-apuv2: - Attach software node to the gpiochip uniwill: - Refactor hwmon to smaller parts to accomodate HW diversity - Support USB-C power/performance priority switch through sysfs - Add another XMG Fusion 15 (L19) DMI vendor - Enable fine-grained features to device lineup mapping wmi: - Perform output size check within WMI core to allow simpler WMI drivers misc: - acpi_driver -> platform driver conversions (a large number of changes from Rafael J. Wysocki) - cleanups / refactoring / improvements" * tag 'platform-drivers-x86-v7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (106 commits) platform/x86: hp-wmi: Add support for Omen 16-wf1xxx (8C77) platform/x86: hp-wmi: Add support for Omen 16-n0xxx (8A44) platform/x86: hp-wmi: Add support for OMEN MAX 16-ak0xxx (8D87) platform/x86: hp-wmi: fix fan table parsing platform/x86: hp-wmi: add Omen 14-fb0xxx (board 8C58) support platform/wmi: Replace .no_notify_data with .min_event_size platform/wmi: Extend wmidev_query_block() to reject undersized data platform/wmi: Extend wmidev_invoke_method() to reject undersized data platform/wmi: Prepare to reject undersized unmarshalling results platform/wmi: Convert drivers to use wmidev_invoke_procedure() platform/wmi: Add wmidev_invoke_procedure() platform/x86: int3472: Add support for GPIO type 0x02 (IR flood LED) platform/x86: int3472: Parameterize LED con_id in registration platform/x86: int3472: Rename pled to led in LED registration code platform/x86: int3472: Use local variable for LED struct access platform/x86: thinkpad_acpi: remove obsolete TODO comment platform/x86: dell-wmi-sysman: bound enumeration string aggregation platform/x86: hp-wmi: Ignore backlight and FnLock events platform/x86: uniwill-laptop: Fix signedness bug platform/x86: dell_rbu: avoid uninit value usage in packet_size_write() ...
2026-04-15tools/power/x86: Add SOC slider and platform profile supportKaushlendra Kumar
Add support for reading and writing SOC slider parameters and platform profile via sysfs in x86_energy_perf_policy. New command-line options: --soc-slider-balance <value> --soc-slider-offset <value> --platform-profile <name> These options allow control of the processor thermal SOC slider balance and offset through the processor_thermal_soc_slider module, as well as the platform profile class interface. When no update flags are set, the tool now also prints the current SOC slider and platform profile values alongside existing MSR output. Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-10tools/power turbostat: Allow execution to continue after perf_l2_init() failureDavid Arcari
Currently, if perf_l2_init() fails turbostat exits after issuing the following error (which was encountered on AlderLake): turbostat: perf_l2_init(cpu0, 0x0, 0xff24) REFS: Invalid argument This occurs because perf_l2_init() calls err(). However, the code has been written in such a manner that it is able to perform cleanup and continue. Therefore, this issue can be addressed by changing the appropriate calls to err() to warnx(). Additionally, correct the PMU type arguments passed to the warning strings in the ecore and lcore blocks so the logs accurately reflect the failing counter type. Signed-off-by: David Arcari <darcari@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-04-05tools/power/x86/intel-speed-select: v1.26 releaseSrinivas Pandruvada
This version includes the following changes: - Setting current base frequency as maximum for SST-BF with kernel QOS changes - Harmonize extended family decoded with the rest of the kernel - Minor changes for error codes and messages Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-04-05tools/power/x86/intel-speed-select: Fix output when running on unsupported ↵Zhang Rui
CLX platforms When running intel-speed-select on unsupported CLX platforms, it prints intel-speed-select: Invalid CPU model (85) : Success Because this is not a system error and errno is not set. Replace err() with exit(). Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-04-05tools/power/x86/intel-speed-select: Print Version info when Incompatible API ↵Zhang Rui
version is detected When running an old version intel-speed-select tool on newer platforms, even with "intel-speed-select -v", the tool only complains about "Incompatible API version", without giving the current version info. Print Version info whenever Incompatible API version is detected. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-04-05tools/power/x86/intel-speed-select: Fix some program return valueZhang Rui
When running the "intel-speed-select -h" command, it returns 1. 0 when using a version that is API incompatible. 2. 1 when using a version that is API compatible. And this is confusing. Fix the program to return 0 for "-h" parameter, and return 1 whenever "Incompatible API versions" is detected. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-04-05tools/power/x86/intel-speed-select: Fix cpu extended family ID decodingZhang Rui
When decode and use CPU extended family ID in intel-speed-select, there are several potential issues, 1. Mask with 0x0f to get CPU extended family ID is bogus because CPU extended family ID takes 8 bits (bit 27:20). 2. Use CPU extended family ID fields without checking CPU family ID is risky. Because Intel SDM says, "The Extended Family ID needs to be examined only when the Family ID is 0FH." 3. Saving cpu family ID and cpu extended family ID separately doesn't align with Linux kernel. And it may bring extra complexity when making family specific changes in the future. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-04-05tools/power/x86/intel-speed-select: Avoid current base freq as maximumSrinivas Pandruvada
SST-PP level change results in online/offline of CPUs with -o option. The Linux intel-pstate driver internally stores the current HWP_REQ MSR value during offline and restores them during online. It is possible that during SST-PP level change, the new HWP_CAP limits can be updated. So, when a CPU is online, the HWP_REQ MSR should be updated to new values based on HWP_CAP values. This is particularly problematic when either turbo is disabled or the current HWP_REQ value (stored before online) is less than the base frequency from the updated HWP_CAP MSR guaranteed value. If the HWP_REQ MSR is not updated, then the performance will be limited to the value before perf level change. Hence the tool updates cpufreq scaling_max_freq to the newer base_frequency value in this case. This step is not required when HWP interrupts are enabled, as the perf level change should result in a new interrupt with HWP_GUARANTEED_PERF_CHANGE_STATUS and the intel_pstate driver will update to new limits. But the tool needs to handle the case when HWP interrupts are not enabled but there is no way for the tool to know that HWP interrupts are enabled or not. So, it has to still update the scaling_max_freq. With the QOS changes in the kernel, user space writes to scaling_max_freq are treated as hard limits. So, when base frequency is increased with SST-BF enabled, the cpufreq subsystem will still not allow setting to the SST-BF high priority core frequency. So, the HWP_REQ MSR will still be capped to the user-set scaling_max_freq after SST-PP level change. To address this, instead of setting scaling_max_freq to the current HWP_CAP highest frequency, set it to the maximum integer value to set the QOS limit as unconstrained. In this case, the actual HWP_REQ maximum frequency will still be capped to HWP_CAP highest performance by the intel-pstate driver. So, it will not result in invalid HWP_REQ values. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2026-03-18tools/power turbostat: Fix delimiter bug in print functionsArtem Bityutskiy
Commands that add counters, such as 'turbostat --show C1,C1+' display merged columns without a delimiter. This is caused by the bad syntax: '(*printed++ ? delim : "")', shared by print_name()/print_hex_value()/print_decimal_value()/print_float_value() Use '((*printed)++ ? delim : "")' to correctly increment the value at *printed. [lenb: fix code and commit message typo, re-word] Fixes: 56dbb878507b ("tools/power turbostat: Refactor added column header printing") Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-17tools/power turbostat: Fix --show/--hide for individual cpuidle countersArtem Bityutskiy
Problem: individual swidle counter names (C1, C1+, C1-, etc.) cannot be selected via --show/--hide due to two bugs in probe_cpuidle_counts(): 1. The function returns immediately when BIC_cpuidle is not enabled, without checking deferred_add_index. 2. The deferred name check runs against name_buf before the trailing newline is stripped, so is_deferred_add("C1\n") never matches "C1". Fix: 1. Relax the early return to pass through when deferred names are queued. 2. Strip the trailing newline from name_buf before performing deferred name checks. 3. Check each suffixed variant (C1+, C1, C1-) individually so that e.g. "--show C1+" enables only the requested metric. In addition, introduce a helper function to avoid repeating the condition (readability cleanup). Fixes: ec4acd3166d8 ("tools/power turbostat: disable "cpuidle" invocation counters, by default") Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-17tools/power turbostat: Fix incorrect format variableArtem Bityutskiy
In the perf thread, core, and package counter loops, an incorrect 'mp->format' variable is used instead of 'pp->format'. [lenb: edit commit message] Fixes: 696d15cbd8c2 ("tools/power turbostat: Refactor floating point printout code") Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-17tools/power turbostat: Consistently use print_float_value()Artem Bityutskiy
Fix the PMT thread code to use print_float_value(), to be consistent with the PMT core and package code. [lenb: commit message] Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-17tools/power/turbostat: Fix microcode patch level output for AMD/HygonSerhii Pievniev
turbostat always used the same logic to read the microcode patch level, which is correct for Intel but not for AMD/Hygon. While Intel stores the patch level in the upper 32 bits of MSR, AMD stores it in the lower 32 bits, which causes turbostat to report the microcode version as 0x0 on AMD/Hygon. Fix by shifting right by 32 for non-AMD/Hygon, preserving the existing behavior for Intel and unknown vendors. Fixes: 3e4048466c39 ("tools/power turbostat: Add --no-msr option") Signed-off-by: Serhii Pievniev <spevnev16@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-17tools/power turbostat: Eliminate unnecessary data structure allocationZhang Rui
Linux core_id's are a per-package namespace, not a per-node namespace. Rename topo.cores_per_node to topo.cores_per_pkg to reflect this. Eliminate topo.nodes_per_pkg from the sizing for core data structures, since it has no role except to unnecessarily bloat the allocation. Validated on multiple Intel platforms (ICX/SPR/SRF/EMR/GNR/CWF) with various CPU online/offline configurations and SMT enabled/disabled scenarios. No functional changes. [lenb: commit message] Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-17tools/power turbostat: Fix swidle header vs data displayLen Brown
I changed my mind about displaying swidle statistics, which are "added counters". Recently I reverted the column headers to 8-columns, but kept print_decimal_value() padding out to 16-columns for all 64-bit counters. Simplify by keeping print_decimial_value() at %lld -- which will often fit into 8-columns, and live with the fact that it can overflow and shift the other columns, which continue to tab-delimited. This is a better compromise than inserting a bunch of space characters that most users don't like. Fixes: 1a23ba6a1ba2 ("tools/power turbostat: Print wide names only for RAW 64-bit columns") Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-03-10tools/power turbostat: Fix illegal memory access when SMT is present and ↵Zhang Rui
disabled When SMT is present and disabled, turbostat may under-size the thread_data array. This can corrupt results or cause turbostat to exit with a segmentation fault. [lenb: commit message] Fixes: a2b4d0f8bf07 ("tools/power turbostat: Favor cpu# over core#") Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2026-02-18Merge tag 'turbostat-2026.02.14-AMD-RAPL-fix' of ↵Linus Torvalds
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-17tools/power turbostat: Fix AMD RAPL regressionLen Brown
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 070e92361eec ("tools/power turbostat: Enhance HT enumeration") commit ddf60e38ca04 ("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-17Merge tag 'turbostat-2026.02.14' of ↵Linus Torvalds
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-13tools/power turbostat: version 2026.02.14Len Brown
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-13tools/power turbostat: Fix and document --header_iterationsLen Brown
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-13tools/power turbostat: Use strtoul() for iteration parsingKaushlendra Kumar
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-13tools/power turbostat: Favor cpu# over core#Len Brown
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-13tools/power turbostat: Expunge logical_cpu_idLen Brown
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-13tools/power turbostat: Enhance HT enumerationLen Brown
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-13tools/power turbostat: Simplify global core_id calculationLen Brown
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-13tools/power turbostat: Unify even/odd/average counter referencingLen Brown
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-13tools/power turbostat: Allocate average counters dynamicallyLen Brown
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-13tools/power turbostat: Delete core_data.core_idLen Brown
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-13tools/power turbostat: Rename physical_core_id to core_idLen Brown
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-13tools/power turbostat: Cleanup package_idLen Brown
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-13tools/power turbostat: Cleanup internal use of "base_cpu"Len Brown
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-13tools/power turbostat: Add L2 cache statisticsLen Brown
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-04tools/power turbostat: Remove redundant newlines from err(3) stringsLen Brown
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-04tools/power turbostat: Allow more use of is_hybrid flagLen Brown
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>