aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power
Commit message (Collapse)AuthorAgeFilesLines
* turbostat: Use GCC's CPUID functions to support PICJosh Triplett2014-04-021-5/+6
| | | | | | | | | | | | | | | | | | | | | commit 2b92865e648ce04a39fda4f903784a5d01ecb0dc upstream. turbostat uses inline assembly to call cpuid. On 32-bit x86, on systems that have certain security features enabled by default that make -fPIC the default, this causes a build error: turbostat.c: In function ‘check_cpuid’: turbostat.c:1906:2: error: PIC register clobbered by ‘ebx’ in ‘asm’ asm("cpuid" : "=a" (fms), "=c" (ecx), "=d" (edx) : "a" (1) : "ebx"); ^ GCC provides a header cpuid.h, containing a __get_cpuid function that works with both PIC and non-PIC. (On PIC, it saves and restores ebx around the cpuid instruction.) Use that instead. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* cpupower: Fix segfault due to incorrect getopt_long arugmentsJosh Boyer2014-02-151-3/+3
| | | | | | | | | | | | | | | | | | | commit f447ef4a56dee4b68a91460bcdfe06b5011085f2 upstream. If a user calls 'cpupower set --perf-bias 15', the process will end with a SIGSEGV in libc because cpupower-set passes a NULL optarg to the atoi call. This is because the getopt_long structure currently has all of the options as having an optional_argument when they really have a required argument. We change the structure to use required_argument to match the short options and it resolves the issue. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1000439 Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Thomas Renninger <trenn@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* kbuild: Fix gcc -x syntaxJean Delvare2012-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | commit b1e0d8b70fa31821ebca3965f2ef8619d7c5e316 upstream. The correct syntax for gcc -x is "gcc -x assembler", not "gcc -xassembler". Even though the latter happens to work, the former is what is documented in the manual page and thus what gcc wrappers such as icecream do expect. This isn't a cosmetic change. The missing space prevents icecream from recognizing compilation tasks it can't handle, leading to silent kernel miscompilations. Besides me, credits go to Michael Matz and Dirk Mueller for investigating the miscompilation issue and tracking it down to this incorrect -x parameter syntax. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: Bernhard Walle <bernhard@bwalle.de> Cc: Michal Marek <mmarek@suse.cz> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Michal Marek <mmarek@suse.cz> [bwh: Backported to 3.2: drop unneeded change to arch/x86/Makefile] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* Merge branches 'acpi', 'idle', 'mrst-pmu' and 'pm-tools' into nextLen Brown2011-11-061-13/+15
|\
| * tools/power turbostat: less verbose debuggingLen Brown2011-07-031-13/+15
| | | | | | | | | | | | dump only the counters which are active Signed-off-by: Len Brown <len.brown@intel.com>
* | cpupower: use man(1) when calling "cpupower help subcommand"Dominik Brodowski2011-08-1911-228/+86
| | | | | | | | | | | | | | Instead of printing something non-formatted to stdout, call man(1) to show the man page for the proper subcommand. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: make NLS truly optionalDominik Brodowski2011-08-192-0/+10
| | | | | | | | | | | | | | | | Loosely based on a patch for cpufrequtils, submittted by Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com> and signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: fix Makefile typoDave Jones2011-08-191-2/+2
| | | | | | | | | | Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: Make monitor command -c/--cpu awareThomas Renninger2011-08-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows for example: cpupower -c 2-4,6 monitor -m Mperf |Mperf PKG |CORE|CPU | C0 | Cx | Freq 0| 8| 4| 2.42| 97.58| 1353 0| 16| 2| 14.38| 85.62| 1928 0| 24| 6| 1.76| 98.24| 1442 1| 16| 3| 15.53| 84.47| 1650 CPUs always get resorted for package, core then cpu id if it could get read out (or however you name these topology levels...). Still this is a nice way to keep the overview if a test binary is bound to a specific CPU or if one wants to show all CPUs inside a package or similar. Still missing: Do not measure not available cores to reduce the overhead and achieve better results. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: Better detect offlined CPUsThomas Renninger2011-08-155-4/+66
| | | | | | | | | | | | | | | | | | | | | | | | Before, checking for offlined CPUs was done dirty and it was checked whether topology parsing returned -1 values. But this is a valid case on a Xen (and possibly other) kernels. Do proper online/offline checking, also take CONFIG_HOTPLUG_CPU option into account (no /sys/devices/../cpuX/online file). Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: Do not show an empty Idle_Stats monitor if no idle driver is availableThomas Renninger2011-08-151-1/+1
| | | | | | | | | | | | | | | | | | By taking error values of: sysfs_get_idlestate_count(..); into account. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: mperf monitor - Use TSC to calculate max frequency if possibleThomas Renninger2011-08-152-48/+131
| | | | | | | | | | | | | | | | | | Which makes the implementation independent from cpufreq drivers. Therefore this would also work on a Xen kernel where the hypervisor is doing frequency switching and idle entering. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: avoid using symlinksAmerigo Wang2011-08-153-6/+4
| | | | | | | | | | | | | | Reference the source directly, don't create symlinks. Signed-off-by: WANG Cong <amwang@redhat.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | Merge branch 'tools-release' of ↵Linus Torvalds2011-08-022-26/+25
|\ \ | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6 * 'tools-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6: tools/power turbostat: fit output into 80 columns on snb-ep tools/power x86_energy_perf_policy: fix print of uninitialized string
| * | tools/power turbostat: fit output into 80 columns on snb-epLen Brown2011-08-021-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce columns for package number to 1. If you can afford more than 9 packages, you can also afford a terminal with more than 80 columns:-) Also shave a column also off the package C-states Signed-off-by: Len Brown <len.brown@intel.com>
| * | tools/power x86_energy_perf_policy: fix print of uninitialized stringLen Brown2011-07-151-3/+2
| |/ | | | | | | | | | | | | Looks like I was going to stick the brand string in the verbose ouput, but didn't get around to it. Signed-off-by: Len Brown <len.brown@intel.com>
* | cpupower: Do detect IDA (opportunistic processor performance) via cpuidThomas Renninger2011-07-294-41/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IA32-Intel Devel guide Volume 3A - 14.3.2.1 ------------------------------------------- ... Opportunistic processor performance operation can be disabled by setting bit 38 of IA32_MISC_ENABLES. This mechanism is intended for BIOS only. If IA32_MISC_ENABLES[38] is set, CPUID.06H:EAX[1] will return 0. Better detect things via cpuid, this cleans up the code a bit and the MSR parts were not working correctly anyway. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: lenb@kernel.org CC: linux@dominikbrodowski.net CC: cpufreq@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: Show Intel turbo ratio support via ./cpupower frequency-infoThomas Renninger2011-07-294-17/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the last piece missing from turbostat (if called with -v). It shows on Intel machines supporting Turbo Boost how many cores have to be active/idle to enter which boost mode (frequency). Whether the HW really enters these boost modes can be verified via ./cpupower monitor. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: lenb@kernel.org CC: linux@dominikbrodowski.net CC: cpufreq@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: increase MAX_LINE_LENRoman Vasiyarov2011-07-291-1/+1
| | | | | | | | | | | | | | | | larger sysfs data (>255 bytes) was truncated and thus used improperly [linux@dominikbrodowski.net: adapted to cpupowerutils] Signed-off-by: Roman Vasiyarov <rvasiyarov@gmail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupower: Rename package from cpupowerutils to cpupowerThomas Renninger2011-07-291-6/+6
| | | | | | | | | | Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: Rename: libcpufreq->libcpupowerThomas Renninger2011-07-293-18/+17
| | | | | | | | | | | | [linux@dominikbrodowski.net: fix .gitignore] Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: use kernel version-derived version stringDominik Brodowski2011-07-292-7/+41
| | | | | | | | | | | | | | | | | | | | As cpupowerutils is intended to be included into the kernel sources, use the kernel versioning instead of a custom version. The script utils/version-gen.sh is largely based on the script already found in tools/perf/util/PERF-VERSION-GEN . Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: utils - ConfigStyle bugfixesDominik Brodowski2011-07-296-108/+122
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: helpers - ConfigStyle bugfixesDominik Brodowski2011-07-299-86/+100
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: idle_monitor - ConfigStyle bugfixesDominik Brodowski2011-07-296-115/+128
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: lib - ConfigStyle bugfixesDominik Brodowski2011-07-294-172/+209
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: bench - ConfigStyle bugfixesDominik Brodowski2011-07-298-58/+75
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: do not update po files on each and every compileDominik Brodowski2011-07-291-7/+16
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: remove ccdv, use kernel quiet/verbose mechanismDominik Brodowski2011-07-294-411/+24
| | | | | | | | | | | | | | Use the quiet/verbose mechanism found in kernel tools, without relying on the special tool "ccdv" Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils: use COPYING, CREDITS from top-level directoryDominik Brodowski2011-07-292-358/+0
| | | | | | | | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | cpupowerutils - cpufrequtils extended with quite some featuresDominik Brodowski2011-07-2972-0/+14417
|/ | | | | | | | | | | | | | | | | | | | | CPU power consumption vs performance tuning is no longer limited to CPU frequency switching anymore: deep sleep states, traditional dynamic frequency scaling and hidden turbo/boost frequencies are tied close together and depend on each other. The first two exist on different architectures like PPC, Itanium and ARM, the latter (so far) only on X86. On X86 the APU (CPU+GPU) will only run most efficiently if CPU and GPU has proper power management in place. Users and Developers want to have *one* tool to get an overview what their system supports and to monitor and debug CPU power management in detail. The tool should compile and work on as many architectures as possible. Once this tool stabilizes a bit, it is intended to replace the Intel-specific tools in tools/power/x86 Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* Merge branch 'master' into for-nextJiri Kosina2011-04-261-1/+1
|\ | | | | | | | | Fast-forwarded to current state of Linus' tree as there are patches to be applied for files that didn't exist on the old branch.
| * Fix common misspellingsLucas De Marchi2011-03-311-1/+1
| | | | | | | | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* | treewide: remove extra semicolonsJustin P. Mattock2011-04-101-1/+1
|/ | | | | Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* tools: turbostat: style updatesLen Brown2011-02-101-100/+96
| | | | | | | | | | | Follow kernel coding style traditions more closely. Delete typedef, re-name "per cpu counters" to simply be counters etc. This patch changes no functionality. Suggested-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
* tools: turbostat: fix bitwise and operandThomas Renninger2011-02-101-2/+2
| | | | | | | | bug could cause false positive on indicating presence of invarient TSC or APERF support. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
* Merge branches 'turbostat' and 'x86_energy_perf_policy' into toolsLen Brown2011-01-113-0/+437
|\
| * tools: create power/x86/x86_energy_perf_policyLen Brown2011-01-113-0/+437
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSR_IA32_ENERGY_PERF_BIAS first became available on Westmere Xeon. It is implemented in all Sandy Bridge processors -- mobile, desktop and server. It is expected to become increasingly important in subsequent generations. x86_energy_perf_policy is a user-space utility to set the hardware energy vs performance policy hint in the processor. Most systems would benefit from "x86_energy_perf_policy normal" at system startup, as the hardware default is maximum performance at the expense of energy efficiency. See x86_energy_perf_policy.8 man page for more information. Background: Linux-2.6.36 added "epb" to /proc/cpuinfo to indicate if an x86 processor supports MSR_IA32_ENERGY_PERF_BIAS, without actually modifying the MSR. In March, 2010, Venkatesh Pallipadi proposed a small driver that programmed MSR_IA32_ENERGY_PERF_BIAS, based on the cpufreq governor in use. It also offered a boot-time cmdline option to override. http://lkml.org/lkml/2010/3/4/457 But hiding the hardware policy behind the governor choice was deemed "kinda icky". In June, 2010, I proposed a generic user/kernel API to generalize the power/performance policy trade-off. "RFC: /sys/power/policy_preference" http://lkml.org/lkml/2010/6/16/399 That is my preference for implementing this capability, but I received no support on the list. So in September, 2010, I sent x86_energy_perf_policy.c to LKML, a user-space utility that scribbles directly to the MSR. http://lkml.org/lkml/2010/9/28/246 Here is that same utility, after responding to some review feedback, to live in tools/power/, where it is easily found. Signed-off-by: Len Brown <len.brown@intel.com>
* tools: create power/x86/turbostatLen Brown2011-01-113-0/+1228
turbostat is a Linux tool to observe proper operation of Intel(R) Turbo Boost Technology. turbostat displays the actual processor frequency on x86 processors that include APERF and MPERF MSRs. Note that turbostat is of limited utility on Linux kernels 2.6.29 and older, as acpi_cpufreq cleared APERF/MPERF up through that release. On Intel Core i3/i5/i7 (Nehalem) and newer processors, turbostat also displays residency in idle power saving states, which are necessary for diagnosing any cpuidle issues that may have an effect on turbo-mode. See the turbostat.8 man page for example usage. Signed-off-by: Len Brown <len.brown@intel.com>