aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power/x86 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-09-26tools/power turbosat: update version numberLen Brown1-1/+1
Signed-off-by: Len Brown <len.brown@intel.com>
2015-09-26tools/power turbostat: SKL: Adjust for TSC difference from base frequencyLen Brown1-2/+20
On a Skylake with 1500MHz base frequency, the TSC runs at 1512MHz. This is because the TSC is no longer in the n*100 MHz BCLK domain, but is now in the m*24MHz crystal clock domain. (24 MHz * 63 = 1512 MHz) This adds error to several calculations in turbostat, unless the TSC sample sizes are adjusted for this difference. Note that calculations in the time domain are immune from this issue, as the timing sub-system has already calibrated the TSC against a known wall clock. AVG_MHz = APERF_delta/measurement_interval need no adjustment. APERF_delta is in the BCLK domain, and measurement_interval is in the time domain. TSC_MHz = TSC_delta/measurement_interval needs no adjustment -- as we really do want to report the actual measured TSC delta here, and measurement_interval is in the accurate time domain. %Busy = MPERF_delta/TSC_delta needs adjustment to use TSC_BCLK_DOMAIN_delta. TSC_BCLK_DOMAIN_delta = TSC_delta * base_hz / tsc_hz Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/measurement_interval need adjustment as above. No other metrics in turbostat need to be adjusted. Before: CPU Avg_MHz %Busy Bzy_MHz TSC_MHz - 550 24.84 2216 1512 0 2191 98.73 2219 1514 2 0 0.01 2130 1512 1 9 0.43 2016 1512 3 2 0.08 2016 1512 After: CPU Avg_MHz %Busy Bzy_MHz TSC_MHz - 550 25.05 2198 1512 0 2190 99.62 2199 1512 2 0 0.01 2152 1512 1 9 0.46 2000 1512 3 2 0.10 2000 1512 Note that in this example, the "Before" Bzy_MHz was reported as exceeding the 2200 max turbo rate. Also, even a pinned spin loop would not be reported as over 99% busy. Signed-off-by: Len Brown <len.brown@intel.com>
2015-09-26tools/power turbostat: KNL workaround for %Busy and Avg_MHzHubert Chrzaniuk1-0/+13
KNL increments APERF and MPERF every 1024 clocks. This is compliant with the architecture specification, which requires that only the ratio of APERF/MPERF need be valid. However, turbostat takes advantage of the fact that these two MSRs increment every un-halted clock at the actual and base frequency: AVG_MHz = APERF_delta/measurement_interval %Busy = MPERF_delta/TSC_delta This quirk is needed for these calculations to also work on KNL, which would otherwise show a value 1024x smaller than expected. Signed-off-by: Hubert Chrzaniuk <hubert.chrzaniuk@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-09-26tools/power turbostat: IVB Xeon: fix --debug regressionLen Brown1-2/+0
Staring in Linux-4.3-rc1, commit 6fb3143b561c ("tools/power turbostat: dump CONFIG_TDP") touches MSR 0x648, which is not supported on IVB-Xeon. This results in "turbostat --debug" exiting on those systems: turbostat: /dev/cpu/2/msr offset 0x648 read failed: Input/output error Remove IVB-Xeon from the list of machines supporting with that MSR. Signed-off-by: Len Brown <len.brown@intel.com>
2015-08-24Merge branch 'turbostat' of https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux into pm-toolsRafael J. Wysocki2-17/+88
Pull turbostat changes for v4.3 from Len Brown. * 'turbostat' of https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: tools/power turbostat: fix typo on DRAM column in Joules-mode tools/power turbostat: fix parameter passing for forked command tools/power turbostat: dump CONFIG_TDP tools/power turbostat: cpu0 is no longer hard-coded, so update output tools/power turbostat: update turbostat(8)
2015-07-24tools/power turbostat: fix typo on DRAM column in Joules-modeLen Brown1-1/+1
< RAM_W > RAM_J Reported-by: Hubert Chrzaniuk <hubert.chrzaniuk@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-07-15tools/power turbostat: fix parameter passing for forked commandLen Brown1-1/+1
turbostat supports forked command when sampling cpu state. However, the forked command is not allowed to be executed with options, otherwise turbostat might regard these options as invalid turbostat options. For example: ./turbostat stress -c 4 -t 10 ./turbostat: unrecognized option '-t' Reported-by: Chen Yu <yu.c.chen@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-06-17tools/power turbostat: dump CONFIG_TDPLen Brown1-1/+77
Config TDP is a feature that allows parts to be configured for different thermal limits after they have left the factory. This can have an effect on the operation of the part, particularly in determiniing... Max Non-turbo Ratio Turbo Activation Ratio Signed-off-by: Len Brown <len.brown@intel.com>
2015-06-17tools/power turbostat: cpu0 is no longer hard-coded, so update outputLen Brown1-9/+9
The --debug option reads a number of per-package MSRs. Previously we explicitly read them on cpu0, but recently turbostat changed to read them on the current "base_cpu". Update the print-out to reflect base_cpu, rather than the hard-coded cpu0. Signed-off-by: Len Brown <len.brown@intel.com>
2015-06-07x86/uapi: Do not export <asm/msr-index.h> as part of the user API headersBorislav Petkov1-1/+1
This header containing all MSRs and respective bit definitions got exported to userspace in conjunction with the big UAPI shuffle. But, it doesn't belong in the UAPI headers because userspace can do its own MSR defines and exporting them from the kernel blocks us from doing cleanups/renames in that header. Which is ridiculous - it is not kernel's job to export such a header and keep MSRs list and their names stable. Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: H. Peter Anvin <hpa@zytor.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: David Howells <dhowells@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1433436928-31903-19-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-06-03tools/power turbostat: update turbostat(8)Len Brown1-5/+0
Remove reference to the original Nehalem Turbo white paper, since it has moved, and these mechanisms have now long since been documented in the Software Developer's Manual. Reported-by: Jeremie Lagraviere <jeremie@simula.no> Signed-off-by: Len Brown <len.brown@intel.com>
2015-05-27tools/power turbostat: update version number to 4.7Len Brown1-1/+1
Signed-off-by: Len Brown <len.brown@intel.com>
2015-05-27tools/power turbostat: allow running without cpu0Prarit Bhargava1-15/+31
Linux-3.7 added CONFIG_BOOTPARAM_HOTPLUG_CPU0, allowing systems to offline cpu0. But when cpu0 is offline, turbostat will not run: # turbostat ls turbostat: no /dev/cpu/0/msr This patch replaces the hard-coded use of cpu0 in turbostat with the current cpu, allowing it to run without a cpu0. Fewer cross-calls may also be needed due to use of current cpu, though this hard-coding was used only for the --debug preamble. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-05-27tools/power turbostat: correctly decode of ENERGY_PERFORMANCE_BIASLen Brown1-1/+1
When EPB is 0xF, turbosat was incorrectly describing it as "custom" instead of calling it "powersave": < cpu0: MSR_IA32_ENERGY_PERF_BIAS: 0x0000000f (custom) > cpu0: MSR_IA32_ENERGY_PERF_BIAS: 0x0000000f (powersave) Signed-off-by: Len Brown <len.brown@intel.com>
2015-05-27tools/power turbostat: enable turbostat to support Knights Landing (KNL)Dasaratharaman Chandramouli1-4/+101
Changes mainly to account for minor differences in Knights Landing(KNL): 1. KNL supports C1 and C6 core states. 2. KNL supports PC2, PC3 and PC6 package states. 3. KNL has a different encoding of the TURBO_RATIO_LIMIT MSR Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-05-27tools/power turbostat: correctly display more than 2 threads/coreDasaratharaman Chandramouli1-20/+51
Without this update, turbostat displays only 2 threads per core. Some processors, such as Xeon Phi, have more. Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: correct dumped pkg-cstate-limit valueLen Brown1-9/+8
HSW expanded MSR_PKG_CST_CONFIG_CONTROL.Package-C-State-Limit, from bits[2:0] used by previous implementations, to [3:0]. The value 1000b is unlimited, and is used by BDW and SKL too. Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: calculate TSC frequency from CPUID(0x15) on SKLLen Brown1-1/+38
turbostat --debug ... CPUID(0x15): eax_crystal: 2 ebx_tsc: 100 ecx_crystal_hz: 0 TSC: 1200 MHz (24000000 Hz * 100 / 2 / 1000000) Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: correct DRAM RAPL units on recent Xeon processorsAndrey Semin1-3/+25
While not yet documented in the Software Developer's Manual, the data-sheet for modern Xeon states that DRAM RAPL ENERGY units are fixed at 15.3 uJ, rather than being discovered via MSR. Before this patch, DRAM energy on these products is over-stated by turbostat because the RAPL units are 4x larger. ref: "Xeon E5-2600 v3/E5-1600 v3 Datasheet Volume 2" http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/xeon-e5-v3-datasheet-vol-2.pdf Signed-off-by: Andrey Semin <andrey.semin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: Initial Skylake supportLen Brown1-13/+111
Skylake adds some additional residency counters. Skylake supports a different mix of RAPL registers from any previous product. In most other ways, Skylake is like Broadwell. Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in MakefileThomas D1-1/+5
Since commit ee0778a30153 ("tools/power: turbostat: make Makefile a bit more capable") turbostat's Makefile is using [...] BUILD_OUTPUT := $(PWD) [...] which obviously causes trouble when building "turbostat" with make -C /usr/src/linux/tools/power/x86/turbostat ARCH=x86 turbostat because GNU make does not update nor guarantee that $PWD is set. This patch changes the Makefile to use $CURDIR instead, which GNU make guarantees to set and update (i.e. when using "make -C ...") and also adds support for the O= option (see "make help" in your root of your kernel source tree for more details). Link: https://bugs.gentoo.org/show_bug.cgi?id=533918 Fixes: ee0778a30153 ("tools/power: turbostat: make Makefile a bit more capable") Signed-off-by: Thomas D. <whissi@whissi.de> Cc: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: modprobe msr, if neededLen Brown1-2/+3
Some distros (Ubuntu) ship the msr driver as a module. If turbosat is run as root on those systems, and discovers that there is no /dev/cpu/cpu0/msr, it will now "modprobe msr" for the user. If not root, the modprobe attempt will fail, and turbostat will exit as before: turbostat: no /dev/cpu/0/msr, Try "# modprobe msr" : No such file or directory Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: dump MSR_TURBO_RATIO_LIMIT2Len Brown1-36/+105
and up to 18 cores of turbo ratio limit when using the turbostat --debug option. Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-18tools/power turbostat: use new MSR_TURBO_RATIO_LIMIT namesLen Brown1-4/+4
s/MSR_NHM_TURBO_RATIO_LIMIT/MSR_TURBO_RATIO_LIMIT/ s/MSR_IVT_TURBO_RATIO_LIMIT/MSR_TURBO_RATIO_LIMIT1/ syntax only -- use the documented strings describing these registers. Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-13tools/power turbostat: label base frequencyLen Brown1-2/+2
syntax only. The cool kids are now using the phrase "base frequency", where in the past we used "max non-turbo frequency" or "TSC frequency". This distinction becomes important when a processor has a TSC that runs at a different speed than the "base frequency". Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-13tools/power turbostat: update PERF_LIMIT_REASONS decodingLen Brown1-26/+26
cosmetic only. order the decoding of MSR_PERF_LIMIT_REASONS bits from MSB to LSB -- which you notice when more than 1 bit is set and you are, say, comparing the output to the documentation... Signed-off-by: Len Brown <len.brown@intel.com>
2015-04-13tools/power turbostat: simplify default outputLen Brown2-70/+98
Casual turbostat users generally just want to know MHz. So by default, just print enough information to make sense of MHz. All the other configuration data and columns for C-states and temperature etc, are printed with the --debug option. Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-10tools/power turbostat: support additional Broadwell modelLen Brown1-1/+4
Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-10tools/power turbostat: update parameters, documentationLen Brown2-87/+136
Long format options added, though the short ones should still work. eg. the new "--Counter 0x10" is the same as the old "-C 0x10" Note this Incompatibility: Old: -v displayed verbose debug output New: -v and --version simpaly display version Additional parameters: -d and --debug display verbose debug output -h and --help display a help message Updated turbosat.8 man page accordingly. Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-09tools/power turbostat: Skip printing disabled package C-statesLen Brown1-72/+116
Replaced previously open-coded Package C-state Limit decoding with table-driven decoding. In doing so, updated to match January 2015 "Intel(R) 64 and IA-23 Architectures Software Developer's Manual". In the past, turbostat would print package C-state residency columns for all package states supported by the model's architecture, even though a particular SKU may not support them, or they may be disabled by the BIOS. Now turbostat will skip printing colunns if MSRs indicate that they are not enabled. eg. many SKUs don't support PC7, and so that column will no longer be printed. Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-09tools/power turbostat: relax dependency on APERF_MSRLen Brown2-45/+68
While turbostat is significantly less useful on systems with no APERF_MSR, it seems more friendly to run on such systems and report what we can, rather than refusing to run. Update man page to reflect recent changes. Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-09tools/power turbostat: relax dependency on invariant TSCLen Brown1-39/+75
Turbostat can be useful on systems that do not support invariant TSC, so allow it to run on those systgems. All arithmetic in turbostat using the TSC value is per-processsor, so it does not depend on the TSC values being in sync acrosss processors. Turbostat uses gettimeofday() for the measurement interval rather than using the TSC directly, so that key metric is also immune from variable TSC. Turbostat prints a TSC sanity check column: TSC_MHz = TSC_delta/interval If this column is constant and is close to the processor base frequency, then the TSC is behaving properly. The other key turbostat columns are calculated this way: Avg_Mhz = APERF_delta/interval %Busy = MPERF_delta/TSC_delta Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/interval Tested on Core2 and Core2-Xeon, and so this patch includes a few other changes to remove the assumption that target systems are Nehalem and newer. Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-09tools/power turbostat: decode MSR_*_PERF_LIMIT_REASONSLen Brown1-0/+126
The Processor generation code-named Haswell added MSR_{CORE | GFX | RING}_PERF_LIMIT_REASONS to explain when and how the processor limits frequency. turbostat -v will now decode these bits. Each MSR has an "Active" set of bits which describe current conditions, and a "Logged" set of bits, which describe what has happened since last cleared. Turbostat currently doesn't clear the log bits. Signed-off-by: Len Brown <len.brown@intel.com>
2015-02-09tools/power turbostat: relax dependency on root permissionLen Brown1-12/+41
For turbostat to run as non-root, it needs to permissions: 1. read access to /dev/cpu/*/msr via standard user/group/world file permissions 2. CAP_SYS_RAWIO eg. # setcap cap_sys_rawio=ep turbostat Yes, running as root still works. Signed-off-by: Len Brown <len.brown@intel.com>
2014-08-15tools/power turbostat: tweak whitespace in output formatLen Brown1-40/+40
turbostat -S output was off by 1 space before this patch. Signed-off-by: Len Brown <len.brown@intel.com>
2014-05-07tools / power: turbostat: Drop temperature checksJean Delvare1-2/+2
The Intel 64 and IA-32 Architectures Software Developer's Manual says that TjMax is stored in bits 23:16 of MSR_TEMPERATURE TARGET (0x1a2). That's 8 bits, not 7, so it must be masked with 0xFF rather than 0x7F. The manual has no mention of which values should be considered valid, which kind of implies that they all are. Arbitrarily discarding values outside a specific range is wrong. The upper range check had to be fixed recently (commit 144b44b1) and the lower range check is just as wrong. See bug #75071: https://bugzilla.kernel.org/show_bug.cgi?id=75071 There are many Xeon processor series with TjMax of 70, 71 or 80 degrees Celsius, way below the arbitrary 85 degrees Celsius limit. There may be other (past or future) models with even lower limits. So drop this arbitrary check. The only value that would be clearly invalid is 0. Everything else should be accepted. After these changes, turbostat is aligned with what the coretemp driver does. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Len Brown <len.brown@intel.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-05tools/power turbostat: Run on BroadwellLen Brown1-1/+11
Signed-off-by: Len Brown <len.brown@intel.com>
2014-03-05tools/power turbostat: simplify output, add Avg_MHzLen Brown2-205/+150
Use 8 columns for each number ouput. We don't fit into 80 columns on most machines, so keep the format simple. Print frequency in MHz instead of GHz. We've got 8 columns now, so use them to show low frequency in a more natural unit. Many users didn't understand what %c0 meant, so re-name it to be %Busy. Add Avg_MHz column, which is the frequency that many users expect to see -- the total number of cycles executed over the measurement interval. People found the previous GHz to be confusing, since it was the speed only over the non-idle interval. That measurement has been re-named Bzy_MHz. Suggested-by: Dirk J. Brandewie Signed-off-by: Len Brown <len.brown@intel.com>
2014-02-01tools/power turbostat: introduce -s to dump countersAndy Shevchenko1-33/+65
The new option allows just run turbostat and get dump of counter values. It's useful when we have something more than one program to test. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2014-02-01tools/power turbostat: remove unused command line optionAndy Shevchenko1-3/+3
The -s is not used, let's remove it, and update quick help accordingly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Add option to report joules consumed per sampleDirk Brandewie1-25/+66
Add "-J" option to report energy consumed in joules per sample. This option also adds the sample time to the reported values. Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: run on HSXLen Brown1-11/+31
Haswell Xeon has slightly different RAPL support than client HSW, which prevented the previous version of turbostat from running on HSX. Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Add a .gitignore to ignore the compiled turbostat binaryJosh Triplett1-0/+1
Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Clean up error handling; disambiguate error messages; use err and errxJosh Triplett1-69/+38
Most of turbostat's error handling consists of printing an error (often including an errno) and exiting. Since perror doesn't support a format string, those error messages are often ambiguous, such as just showing a file path, which doesn't uniquely identify which call failed. turbostat already uses _GNU_SOURCE, so switch to the err and errx functions from err.h, which take a format string. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Factor out common function to open file and exit on failureJosh Triplett1-15/+16
Several different functions in turbostat contain the same pattern of opening a file and exiting on failure. Factor out a common fopen_or_die function for that. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Add a helper to parse a single int out of a fileJosh Triplett1-57/+24
Many different chunks of code in turbostat open a file, parse a single int out of it, and close it. Factor that out into a common function. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Check return value of fscanfJosh Triplett1-4/+16
Some systems declare fscanf with the warn_unused_result attribute. On such systems, turbostat generates the following warnings: turbostat.c: In function 'get_core_id': turbostat.c:1203:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] turbostat.c: In function 'get_physical_package_id': turbostat.c:1186:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] turbostat.c: In function 'cpu_is_first_core_in_package': turbostat.c:1169:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] turbostat.c: In function 'cpu_is_first_sibling_in_core': turbostat.c:1148:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] Fix these by checking the return value of those four calls to fscanf. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Use GCC's CPUID functions to support PICJosh Triplett1-5/+6
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> Cc: stable@vger.kernel.org Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Don't attempt to printf an off_t with %zxJosh Triplett1-1/+1
turbostat uses the format %zx to print an off_t. However, %zx wants a size_t, not an off_t. On 32-bit targets, those refer to different types, potentially even with different sizes. Use %llx and a cast instead, since printf does not have a length modifier for off_t. Without this patch, when compiling for a 32-bit target: turbostat.c: In function 'get_msr': turbostat.c:231:3: warning: format '%zx' expects argument of type 'size_t', but argument 4 has type 'off_t' [-Wformat] Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Len Brown <len.brown@intel.com>
2014-01-18turbostat: Don't put unprocessed uapi headers in the include pathJosh Triplett2-2/+2
turbostat's Makefile puts arch/x86/include/uapi/ in the include path, so that it can include <asm/msr.h> from it. It isn't in general safe to include even uapi headers directly from the kernel tree without processing them through scripts/headers_install.sh, but asm/msr.h happens to work. However, that include path can break with some versions of system headers, by overriding some system headers with the unprocessed versions directly from the kernel source. For instance: In file included from /build/x86-generic/usr/include/bits/sigcontext.h:28:0, from /build/x86-generic/usr/include/signal.h:339, from /build/x86-generic/usr/include/sys/wait.h:31, from turbostat.c:27: ../../../../arch/x86/include/uapi/asm/sigcontext.h:4:28: fatal error: linux/compiler.h: No such file or directory This occurs because the system bits/sigcontext.h on that build system includes <asm/sigcontext.h>, and asm/sigcontext.h in the kernel source includes <linux/compiler.h>, which scripts/headers_install.sh would have filtered out. Since turbostat really only wants a single header, just include that one header rather than putting an entire directory of kernel headers on the include path. In the process, switch from msr.h to msr-index.h, since turbostat just wants the MSR numbers. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Cc: stable@vger.kernel.org Signed-off-by: Len Brown <len.brown@intel.com>