aboutsummaryrefslogtreecommitdiff
path: root/tools/power
AgeCommit message (Collapse)AuthorFilesLines
2024-09-24Merge tag 'linux-cpupower-6.12-rc1-fixes' of ↵Linus Torvalds3-4/+3
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux Pull cpupower updates from Shuah Khan "The 'raw_pylibcpupower.i' file was being removed by "make mrproper". That was because '*.i', '.s' and '*.o' files are generated during kernel compile and removed when the repo is cleaned by mrproper. Rename it to use .swg extension instead to avoid the problem. A second patch removes references to it from .gitignore" * tag 'linux-cpupower-6.12-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux: pm: cpupower: Clean up bindings gitignore pm: cpupower: rename raw_pylibcpupower.i
2024-09-23pm: cpupower: Clean up bindings gitignoreJohn B. Wyatt IV1-2/+1
Add SPDX identifier to the gitignore. Remove the comment and .i file since the file it references was removed in another patch. This patch depends on Min-Hua Chen's 'pm: cpupower: rename raw_pylibcpupower.i'. Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-09-13pm: cpupower: rename raw_pylibcpupower.iMin-Hua Chen2-2/+2
The raw_pylibcpupower.i is removed unexpectedly after 'make mrproper' We can reproduce the error by performing the following steps: cd linux-next make mrproper cd tools/power/cpupower/bindings/python make We will get an error message: make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'. Stop. The root cause: The *.i files are already used for pre-processor output files and the kernel removes all the *.i files by 'make mrproper'. That explains why the raw_pylibcpupower.i is removed by 'make mrproper'. To fix it, Follow John's suggestion to rename raw_pylibcpupower.i to raw_pylibcpupower.swg. See: https://www.swig.org/Doc4.2/SWIG.html Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com> Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com> Tested-by: John B. Wyatt IV <jwyatt@redhat.com> Tested-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-09-10Merge tag 'linux-cpupower-6.12-rc1-2' of ↵Rafael J. Wysocki6-0/+397
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux Merge the second round of cpupower utility updates for 6.12-rc1 from Shuah Khan: "This cpupower second update for Linux 6.12-rc1 consists of a fix and a new feature. -- adds missing powercap_set_enabled() stub function -- adds SWIG bindings files for libcpupower SWIG is a tool packaged in Fedora and other distros that can generate bindings from C and C++ code for several languages including Python, Perl, and Go. These bindings allows users to easily write scripts that use and extend libcpupower's functionality. Currently, only Python is provided in the makefile, but additional languages may be added if there is demand. Note that while SWIG itself is GPL v3+ licensed; the resulting output, the bindings code, is permissively licensed + the license of the .o files. Please see the following for more details. - https://swig.org/legal.html. - https://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup" * tag 'linux-cpupower-6.12-rc1-2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux: pm:cpupower: Add error warning when SWIG is not installed MAINTAINERS: Add Maintainers for SWIG Python bindings pm:cpupower: Include test_raw_pylibcpupower.py pm:cpupower: Add SWIG bindings files for libcpupower pm:cpupower: Add missing powercap_set_enabled() stub function
2024-09-06pm:cpupower: Add error warning when SWIG is not installedJohn B. Wyatt IV1-9/+11
Add error message to better explain to the user when SWIG and python-config is missing from the path. Makefile was cleaned up and unneeded elements were removed. Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-09-05pm:cpupower: Include test_raw_pylibcpupower.pyJohn B. Wyatt IV1-0/+42
This script demonstrates how to make use of, and tests, the bindings. In the future, this script could become part of a larger test suite to test the bindings and libcpupower. Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-09-05pm:cpupower: Add SWIG bindings files for libcpupowerJohn B. Wyatt IV4-0/+345
SWIG is a tool packaged in Fedora and other distros that can generate bindings from C and C++ code for several languages including Python, Perl, and Go. These bindings allows users to easily write scripts that use and extend libcpupower's functionality. Currently, only Python is provided in the makefile, but additional languages may be added if there is demand. Added suggestions from Shuah Khan for the README and license discussion. Note that while SWIG itself is GPL v3+ licensed; the resulting output, the bindings code, is permissively licensed + the license of the .o files. Please see https://swig.org/legal.html and [1] for more details. [1] https://lore.kernel.org/linux-pm/Zqv9BOjxLAgyNP5B@hatbackup/ Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-09-05pm:cpupower: Add missing powercap_set_enabled() stub functionJohn B. Wyatt IV1-0/+8
There was a symbol listed in the powercap.h file that was not implemented. Implement it with a stub return of 0. Programs like SWIG require that functions that are defined in the headers be implemented. Fixes: c2294c1496b7 ("cpupower: Introduce powercap intel-rapl library and powercap-info command") Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-09-05Merge tag 'linux-cpupower-6.12-rc1' of ↵Rafael J. Wysocki3-0/+14
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux Merge a cpupower utility update for 6.12 from Shuah Khan: "This cpupower update for Linux 6.12-rc1 consists of an enhancement to cpuidle tool to display the residency value of cpuidle states. This addition provides a clearer and more detailed view of idle state information when using cpuidle-info." * tag 'linux-cpupower-6.12-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux: tools/cpupower: display residency value in idle-info
2024-09-04pm-graph: Update directory handling and installation process in MakefileAmit Vadhavana1-38/+73
- Standardize directory variables to support more flexible installations. - Add copyright and licensing information to the Makefile. - Introduce ".PHONY" declarations to ensure that specific targets are always executed, regardless of the presence of files with matching names. - Add a help target to provide usage instructions. Signed-off-by: Amit Vadhavana <av2082000@gmail.com> Acked-by: Todd Brandt <todd.e.brandt@linux.intel.com> Link: https://patch.msgid.link/Update directory handling and installation process in Makefile [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-09-04pm-graph: Make git ignore sleepgraph.py artifactsYo-Jung (Leo) Lin1-0/+3
By default, sleepgraph.py creates suspend-{date}-{time} directories to store artifacts, or suspend-{date}-{time}-xN if the --multi option is used. Ignore those directories by adding a .gitignore file. Signed-off-by: Yo-Jung (Leo) Lin <0xff07@gmail.com> Acked-by: Todd Brandt <todd.e.brandt@linux.intel.com> Link: https://patch.msgid.link/20240825095353.7578-1-0xff07@gmail.com [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-08-09tools/cpupower: display residency value in idle-infoAboorva Devarajan3-0/+14
Update cpuidle tool to display the residency value of cpuidle states. This addition provides a clearer and more detailed view of idle state information when using cpuidle-info. -------------------------------- Before Patch: -------------------------------- $ cpupower idle-info CPUidle driver: intel_idle CPUidle governor: menu analyzing CPU 28: Number of idle states: 3 Available idle states: POLL C1 C1E POLL: Flags/Description: CPUIDLE CORE POLL IDLE Latency: 0 Usage: 7448 Duration: 207170 C1: Flags/Description: MWAIT 0x00 Latency: 2 Usage: 7023 Duration: 3736853 C1E: Flags/Description: MWAIT 0x01 Latency: 10 Usage: 18468 Duration: 11396212 -------------------------------- After Patch: -------------------------------- $ cpupower idle-info CPUidle driver: intel_idle CPUidle governor: menu analyzing CPU 12: Number of idle states: 3 Available idle states: POLL C1 C1E POLL: Flags/Description: CPUIDLE CORE POLL IDLE Latency: 0 Residency: 0 Usage: 1950 Duration: 38458 C1: Flags/Description: MWAIT 0x00 Latency: 2 Residency: 2 Usage: 10688 Duration: 7133020 C1E: Flags/Description: MWAIT 0x01 Latency: 10 Residency: 20 Usage: 22356 Duration: 15687259 -------------------------------- Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-07-28Merge tag 'v6.11-merge' of ↵Linus Torvalds3-495/+1939
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux Pull turbostat updates from Len Brown: - Enable turbostat extensions to add both perf and PMT (Intel Platform Monitoring Technology) counters via the cmdline - Demonstrate PMT access with built-in support for Meteor Lake's Die C6 counter * tag 'v6.11-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: tools/power turbostat: version 2024.07.26 tools/power turbostat: Include umask=%x in perf counter's config tools/power turbostat: Document PMT in turbostat.8 tools/power turbostat: Add MTL's PMT DC6 builtin counter tools/power turbostat: Add early support for PMT counters tools/power turbostat: Add selftests for added perf counters tools/power turbostat: Add selftests for SMI, APERF and MPERF counters tools/power turbostat: Move verbose counter messages to level 2 tools/power turbostat: Move debug prints from stdout to stderr tools/power turbostat: Fix typo in turbostat.8 tools/power turbostat: Add perf added counter example to turbostat.8 tools/power turbostat: Fix formatting in turbostat.8 tools/power turbostat: Extend --add option with perf counters tools/power turbostat: Group SMI counter with APERF and MPERF tools/power turbostat: Add ZERO_ARRAY for zero initializing builtin array tools/power turbostat: Replace enum rapl_source and cstate_source with counter_source tools/power turbostat: Remove anonymous union from rapl_counter_info_t tools/power/turbostat: Switch to new Intel CPU model defines
2024-07-26tools/power turbostat: version 2024.07.26Len Brown1-53/+52
Release 2024.07.26: Enable turbostat extensions to add both perf and PMT (Intel Platform Monitoring Technology) counters from the cmdline. Demonstrate PMT access with built-in support for Meteor Lake's Die%c6 counter. This commit: Clean up white-space nits introduced since version 2024.05.10 Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-26tools/power turbostat: Include umask=%x in perf counter's configPatryk Wlazlyn1-10/+50
Some counters, like cpu/cache-misses/, expose and require umask=%x parameter alongside event=%x in the sysfs perf counter's event file. This change make sure we parse and use it when opening user added counters. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-26tools/power turbostat: Document PMT in turbostat.8Patryk Wlazlyn1-0/+65
Add a general description of the user interface for adding PMT counters with the new --add pmt,... option. Provide a complete example for requesting two counters. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-26tools/power turbostat: Add MTL's PMT DC6 builtin counterPatryk Wlazlyn1-1/+69
Provide a definition for metadata that allows reading DC6 residency counter via PMT and exposes it as a builtin counter. Note that this residency counter is updated and read via entirely different mechanisms vs the MSR-based residency counters. On MTL processors, there are times when Die%c6 will report above 100%. This is still useful, but don't expect 3 digits of precision... Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-26tools/power turbostat: Add early support for PMT countersPatryk Wlazlyn1-2/+766
Allows users to read Intel PMT (Platform Monitoring Technology) counters, providing interface similar to one used to add MSR and perf counters. Because PMT is exposed as a raw MMIO range, without metadata, user has to supply the necessary information to find and correctly display the requested counter. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-26tools/power turbostat: Move verbose counter messages to level 2Patryk Wlazlyn1-13/+11
Printing information about the source and value during initialization and reading of the counter for each cpu, while useful when debugging, results in too verbose output. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-26tools/power turbostat: Move debug prints from stdout to stderrPatryk Wlazlyn1-8/+9
This leaves the stdout cleaner, having only counter data. It makes it easier for programs to parse the output of turbostat, for example selftests. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-17Merge tag 'platform-drivers-x86-v6.11-1' of ↵Linus Torvalds2-1/+7
git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 Pull x86 platform driver updates from Ilpo Järvinen: - amd/pmf: Report system state changes using existing input events - asus-wmi: Zenbook 2023 camera LED disable support and fix TUF laptop keyboard RGB LED sysfs interface - dell-pc: Fan modes / platform profile support - hp-wmi: Fix platform profile switching on Omen/Victus laptops - intel/ISST: Use only TPMI interface when TPMI and legacy interfaces are available - intel/pmc: LTR restore support to pair with LTR ignore - intel/tpmi: Performance Limit Reasons (PLR) and APIC <-> Punit CPU numbering mapping support - WMI: driver override support and docs improvements - lenovo-yoga-c630: Support for EC (platform/arm64) - platform/arm64: Fix build with COMPILE_TEST (broke after addition of C630) - tools: Intel Speed Select Turbo Ratio Limit fix - Miscellaneous cleanups / refactoring / improvements * tag 'platform-drivers-x86-v6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (65 commits) platform/x86: asus-wmi: fix TUF laptop RGB variant platform/x86/intel/tpmi/plr: Fix output in plr_print_bits() Docs/admin-guide: Remove pmf leftover reference from the index platform/x86: ideapad-laptop: use cleanup.h platform/x86: hp-wmi: Fix implementation of the platform_profile_omen_get function platform: arm64: EC_LENOVO_YOGA_C630 should depend on ARCH_QCOM platform: arm64: EC_ACER_ASPIRE1 should depend on ARCH_QCOM platform/x86/amd/pmf: Remove update system state document platform/x86/amd/pmf: Use existing input event codes to update system states platform/x86: hp-wmi: Fix platform profile option switch bug on Omen and Victus laptops platform/x86:intel/pmc: Add support to undo ltr_ignore platform/x86:intel/pmc: Use the Elvis operator platform/x86:intel/pmc: Use DEFINE_SHOW_STORE_ATTRIBUTE macro platform/x86:intel/pmc: Remove unneeded min_t check platform/x86:intel/pmc: Add support to show ltr_ignore value platform/x86:intel/pmc: Move pmc assignment closer to first usage platform/x86:intel/pmc: Convert index variables to be unsigned platform/x86:intel/pmc: Simplify mutex usage with cleanup helpers platform/x86:intel/pmc: Use the return value of pmc_core_send_msg tools/power/x86/intel-speed-select: v1.20 release ...
2024-07-15Merge branches 'pm-opp' and 'pm-tools'Rafael J. Wysocki7-572/+769
Merge OPP (operating performance points) and tooling updates for 6.11-rc1: - Fix missing cleanup on error in _opp_attach_genpd() (Viresh Kumar). - Introduce an OF helper function to inform if required-opps is used and drop a redundant in-parameter to _set_opp_level() (Ulf Hansson). - Update pm-graph to v5.12 which includes fixes and major code revamp for python3.12 (Todd Brandt). - Address several assorted issues in the cpupower utility (Roman Storozhenko). * pm-opp: OPP: Introduce an OF helper function to inform if required-opps is used OPP: Drop a redundant in-parameter to _set_opp_level() OPP: Fix missing cleanup on error in _opp_attach_genpd() * pm-tools: cpupower: fix lib default installation path cpupower: Disable direct build of the 'bench' subproject cpupower: Change the var type of the 'monitor' subcommand display mode cpupower: Remove absent 'v' parameter from monitor man page cpupower: Improve cpupower build process description cpupower: Add 'help' target to the main Makefile cpupower: Replace a dead reference link with working ones pm-graph: v5.12, code revamp for python3.12 pm-graph: v5.12, fixes
2024-07-09tools/power turbostat: Fix typo in turbostat.8Patryk Wlazlyn1-1/+1
"After" was missing an "r", nothing to see here. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-09tools/power turbostat: Add perf added counter example to turbostat.8Patryk Wlazlyn1-0/+18
We had few lines about the feature, but without any complete examples. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-09tools/power turbostat: Fix formatting in turbostat.8Patryk Wlazlyn1-4/+4
We had an extra "+" at the beginning of some lines that look like a poorly formated patch. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-09tools/power turbostat: Extend --add option with perf countersPatryk Wlazlyn3-11/+557
User can now read perf counters using "--add perf/<device>/<event>". Other details work similarly to how --add works with MSRs. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-09tools/power turbostat: Group SMI counter with APERF and MPERFPatryk Wlazlyn1-355/+280
These three counters now are treated similar to other perf counters groups. This simplifies and gets rid of a lot of special cases for APERF and MPERF. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-07-08Merge tag 'linux-cpupower-6.11-rc1-2' of ↵Rafael J. Wysocki2-9/+6
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux into pm-tools Merge more cpupower utility changes for 6.11-rc1 from Shuah Khan: "This cpupower second update for Linux 6.11-rc1 consists of -- fix to install cpupower library in standard librray intall location - /usr/lib -- disable direct build of cpupower bench as it can only be built from the cpupower main makefile." * tag 'linux-cpupower-6.11-rc1-2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux: cpupower: fix lib default installation path cpupower: Disable direct build of the 'bench' subproject
2024-07-07tools/power/x86/intel-speed-select: v1.20 releaseSrinivas Pandruvada1-1/+1
This version addresses one issue: - Fix updating TRL MSR after SST-TF is disabled in auto mode. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2024-07-07tools/power/x86/intel-speed-select: Set TRL MSR in 100 MHz unitsSrinivas Pandruvada1-0/+6
When SST-TF is disabled in auto mode, the performance is getting limited. This is caused by wrong programming of Turbo Ratio Limit (TRL) MSR. This MSR always accepts the frequency ratio in 100 MHz unit. When the TPMI is sending TRL in 1 MHz unit, change to 100 MHz, before updating TRL MSR. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2024-07-02cpupower: fix lib default installation pathRoman Storozhenko1-9/+1
Invocation the tool built with the default settings fails: $ cpupower cpupower: error while loading shared libraries: libcpupower.so.1: cannot open shared object file: No such file or directory The issue is that Makefile puts the library to "/usr/lib64" dir for a 64 bit machine. This is wrong. According to the "File hierarchy standard specification: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf "/usr/lib<qual>" dirs are intended for alternative-format libraries (e.g., "/usr/lib32" for 32-bit libraries on a 64-bit machine (optional)). The utility is built for the current machine and doesn't handle 'CROSS_COMPILE' and 'ARCH' env variables. It also doesn't change bit depth. So the result is always the same - binary for x86_64 architecture. Therefore the library should be put in the '/usr/lib' dir regardless of the build options. This is the case for all the distros that comply with the 'File Hierarchy Standard 3.0" by Linux Foundation. Most of the distros comply with it. For example, one can check this by examining the "/usr/lb64" dir on debian-based distros and find that it contains only "/usr/lib64/ld-linux-x86-64.so.2". And examine that "/usr/lib" contains both 32 and 64 bit code: find /usr/lib -name "*.so*" -type f | xargs file | grep 32-bit find /usr/lib -name "*.so*" -type f | xargs file | grep 64-bit Fix the issue by changing library destination dir to "/usr/lib". Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-28cpupower: Disable direct build of the 'bench' subprojectRoman Storozhenko1-0/+5
Execution of the 'make' command in the 'bench' subfolder causes the following error: $ make O=cpupower/build/ DESTDIR=cpupower/install/ -j8 " CC " cpupower/build//main.o " CC " cpupower/build//parse.o /bin/sh: 1: " CC "cpupower/build//system.o CC : not found make: *** [Makefile:21: cpupower/build//main.o] Error 127 make: *** Waiting for unfinished jobs.... /bin/sh: 1: CC : not found /bin/sh: 1: CC : not found make: *** [Makefile:21: cpupower/build//parse.o] Error 127 make: *** [Makefile:21: cpupower/build//system.o] Error 127 The makefile uses variables defined in the main project makefile and it is not intended to run standalone. The reason is that 'bench' subproject depends on the 'libcpupower' library, see the 'compile-bench' target in the main makefile. Add a check that prevents standalone execution of the 'bench' makefile. Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-28tools/power turbostat: Add ZERO_ARRAY for zero initializing builtin arrayPatryk Wlazlyn1-3/+5
It makes it harder to shoot yourself in the foot, by using additional __must_be_array() check. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-06-28tools/power turbostat: Replace enum rapl_source and cstate_source with ↵Patryk Wlazlyn1-20/+19
counter_source Reuse the enum. It means the same thing in both cases. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-06-28tools/power turbostat: Remove anonymous union from rapl_counter_info_tPatryk Wlazlyn1-9/+3
fd_perf field used to be part of the union, but later moved out of it, because we test it with fd_perf != -1 to determine if any perf counter is opened, making the union unused. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-06-27tools/power turbostat: Add local build_bug.h header for snapshot targetPatryk Wlazlyn2-2/+6
Fixes compilation errors for Makefile snapshot target described in: commit 231ce08b662a ("tools/power turbostat: Add "snapshot:" Makefile target") Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-06-27tools/power/turbostat: Switch to new Intel CPU model definesTony Luck1-70/+95
New CPU #defines encode vendor and family as well as model. N.B. Copied VFM_*() defines here from <asm/cpu_device_id.h> to avoid an application picking a second internal kernel header file. Signed-off-by: Tony Luck <tony.luck@intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-06-27tools/power turbostat: Fix unc freq columns not showing with '-q' or '-l'Adam Hawley1-8/+8
Commit 78464d7681f7 ("tools/power turbostat: Add columns for clustered uncore frequency") introduced 'probe_intel_uncore_frequency_cluster()' in a way which prevents printing uncore frequency columns if either of the '-q' or '-l' options are used. Systems which do not have multiple uncore frequencies per package are unaffected by this regression. Fix the function so that uncore frequency columns are shown when either the '-l' or '-q' option is used by checking if 'quiet' is true after adding counters for the uncore frequency columns. Fixes: 78464d7681f7 ("tools/power turbostat: Add columns for clustered uncore frequency") Signed-off-by: Adam Hawley <adam.james.hawley@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2024-06-27tools/power turbostat: option '-n' is ambiguousDavid Arcari1-1/+1
In some cases specifying the '-n' command line argument will cause turbostat to fail. For instance 'turbostat -n 1' works fine; however, 'turbostat -n 1 -d' will fail. This is the result of the first call to getopt_long_only() where "MP" is specified as the optstring. This can be easily fixed by changing the optstring from "MP" to "MPn:" to remove ambiguity between the arguments. tools/power turbostat: option '-n' is ambiguous; possibilities: '-num_iterations' '-no-msr' '-no-perf' 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>
2024-06-27Merge tag 'linux-cpupower-6.11-rc1' of ↵Rafael J. Wysocki4-20/+192
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux Merge cpupower utility updates for 6.11 from Shuah Khan: "This cpupower update for Linux 6.11-rc1 consists of cleanups to man pages, README files, and enhancements to add help to Makefile." * tag 'linux-cpupower-6.11-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux: cpupower: Change the var type of the 'monitor' subcommand display mode cpupower: Remove absent 'v' parameter from monitor man page cpupower: Improve cpupower build process description cpupower: Add 'help' target to the main Makefile cpupower: Replace a dead reference link with working ones
2024-06-20cpupower: Change the var type of the 'monitor' subcommand display modeRoman Storozhenko1-1/+1
There is a type 'enum operation_mode_e' contains the display modes of the 'monitor' subcommand. This type isn't used though, instead the variable 'mode' is of a simple 'int' type. Change 'mode' variable type from 'int' to 'enum operation_mode_e' in order to improve compiler type checking. Built and tested this with different monitor cmdline params. Everything works as expected, that is nothing changed and no regressions encountered. Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-20cpupower: Remove absent 'v' parameter from monitor man pageRoman Storozhenko1-5/+0
Remove not supported '-v' parameter from the cpupower's 'monitor' command description. There is a '-v' parameter described in cpupower's 'monitor' command man page. It isn't supported at the moment, and perhaps has never been supported. When I run the monitor with this parameter I get the following: $ sudo LD_LIBRARY_PATH=lib64/ bin/cpupower monitor -v monitor: invalid option -- 'v' invalid or unknown argument $ sudo LD_LIBRARY_PATH=lib64/ bin/cpupower monitor -V monitor: invalid option -- 'V' invalid or unknown argument Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-18cpupower: Improve cpupower build process descriptionRoman Storozhenko1-10/+150
Enhance cpupower build process description with the information on building and installing the utility to the user defined directories as well as with the information on the way of running the utility from the custom defined installation directory. Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-18cpupower: Add 'help' target to the main MakefileRoman Storozhenko1-1/+36
Make "cpupower" building process more user friendly by adding 'help' target to the main makefile. This target describes various build and cleaning options available to the user. Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-18cpupower: Replace a dead reference link with working onesRoman Storozhenko1-3/+5
Replace a dead reference link to a turbo boost technology description with a reference to a root page of the technology on the Intel site, and add another one, describing power management technology, which includes short description of the turbo boost. Signed-off-by: Roman Storozhenko <romeusmeister@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-06-07pm-graph: v5.12, code revamp for python3.12Todd Brandt2-508/+508
sleepgraph/bootgraph function correctly in python3.12 but include a slew of deprecation warnings for unsupported regexes. This patch fixes up all the strings in the code so that it comforms with python3.12 standards. Signed-off-by: Todd Brandt <todd.e.brandt@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-06-07pm-graph: v5.12, fixesTodd Brandt1-37/+65
- fix S3 suspend fail double run by using fp.flush to /sys/power/state - when running turbostat print the return value - handle case where html files have binary data - max issues in summary-issues is now 100 (in case there are thousands) - add backup to dmidecode, use /sys/class/dmi/id/ in case /dev/mem fails - update summary page to use full mode (disk-platform instead of disk) Signed-off-by: Todd Brandt <todd.e.brandt@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-05-28tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUsDhananjay Ugwekar1-3/+23
Update cpupower's P-State frequency calculation and reporting with AMD Family 1Ah+ processors, when using the acpi-cpufreq driver. This is due to a change in the PStateDef MSR layout in AMD Family 1Ah+. Tested on 4th and 5th Gen AMD EPYC system Signed-off-by: Ananth Narayan <Ananth.Narayan@amd.com> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-05-19Merge tag 'turbostat-for-Linux-6.10-merge-window' of ↵Linus Torvalds3-301/+899
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux Pull turbostat updates from Len Brown: - Survive sparse die id's seen in Linux-6.9 - Handle clustered-uncore topology in new/upcoming hardware - For non-root use, add ability to see software C-state counters - Enable reading core and package hardware cstate via perf, and prefer perf over the MSR driver access for these counters * tag 'turbostat-for-Linux-6.10-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: tools/power turbostat: version 2024.05.10 tools/power turbostat: Ignore pkg_cstate_limit when it is not available tools/power turbostat: Fix order of strings in pkg_cstate_limit_strings tools/power turbostat: Read Package-cstates via perf tools/power turbostat: Read Core-cstates via perf tools/power turbostat: Avoid possible memory corruption due to sparse topology IDs tools/power turbostat: Add columns for clustered uncore frequency tools/power turbostat: Enable non-privileged users to read sysfs counters tools/power turbostat: Replace _Static_assert with BUILD_BUG_ON tools/power turbostat: Add ARL-H support tools/power turbostat: Enhance ARL/LNL support tools/power turbostat: Survive sparse die_id tools/power turbostat: Remember global max_die_id tools/power turbostat: Harden probe_intel_uncore_frequency() tools/power turbostat: Add "snapshot:" Makefile target
2024-05-16Merge tag 'platform-drivers-x86-v6.10-1' of ↵Linus Torvalds6-15/+56
git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 Pull x86 platform driver updates from Hans de Goede: - New drivers/platform/arm64 directory for arm64 embedded-controller drivers - New drivers: - Acer Aspire 1 embedded controllers (for arm64 models) - ACPI quickstart PNP0C32 buttons - Dell All-In-One backlight support (dell-uart-backlight) - Lenovo WMI camera buttons - Lenovo Yoga Tablet 2 Pro 1380F/L fast charging - MeeGoPad ANX7428 Type-C Cross Switch (power sequencing only) - MSI WMI sensors (fan speed sensors only for now) - Asus WMI: - 2024 ROG Mini-LED support - MCU powersave support - Vivobook GPU MUX support - Misc. other improvements - Ideapad laptop: - Export FnLock LED as LED class device - Switch platform profiles using thermal management key - Intel drivers: - IFS: various improvements - PMC: Lunar Lake support - SDSI: various improvements - TPMI/ISST: various improvements - tools: intel-speed-select: various improvements - MS Surface drivers: - Fan profile switching support - Surface Pro thermal sensors support - ThinkPad ACPI: - Reworked hotkey support to use sparse keymaps - Add support for new trackpoint-doubletap, Fn+N and Fn+G hotkeys - WMI core: - New WMI driver development guide - x86 Android tablets: - Lenovo Yoga Tablet 2 Pro 1380F/L support - Xiaomi MiPad 2 status LED and bezel touch buttons backlight support - Miscellaneous cleanups / fixes / improvements * tag 'platform-drivers-x86-v6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (128 commits) platform/x86: Add new MeeGoPad ANX7428 Type-C Cross Switch driver devm-helpers: Fix a misspelled cancellation in the comments tools arch x86: Add dell-uart-backlight-emulator platform/x86: Add new Dell UART backlight driver platform/x86: x86-android-tablets: Create LED device for Xiaomi Pad 2 bottom bezel touch buttons platform/x86: x86-android-tablets: Xiaomi pad2 RGB LED fwnode updates platform/x86: x86-android-tablets: Pass struct device to init() platform/x86/amd: pmc: Add new ACPI ID AMDI000B platform/x86/amd: pmf: Add new ACPI ID AMDI0105 platform/x86: p2sb: Don't init until unassigned resources have been assigned platform/surface: aggregator: Log critical errors during SAM probing platform/x86: ISST: Support SST-BF and SST-TF per level platform/x86/fujitsu-laptop: Replace sprintf() with sysfs_emit() tools/power/x86/intel-speed-select: v1.19 release tools/power/x86/intel-speed-select: Display CPU as None for -1 tools/power/x86/intel-speed-select: SST BF/TF support per level tools/power/x86/intel-speed-select: Increase number of CPUs displayed tools/power/x86/intel-speed-select: Present all TRL levels for turbo-freq tools/power/x86/intel-speed-select: Fix display for unsupported levels tools/power/x86/intel-speed-select: Support multiple dies ...