aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-18 16:34:11 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-18 16:34:11 -0500
commit10baf04e95fbf7eb6089410220a547211dd2ffa7 (patch)
tree912204612987a3ce2ec0ed214d47911040d79cc1 /tools/power
parentfdbe0946d4c35d4cc784cfe0a5322708cfb7ade8 (diff)
parentca62cf59ceef10ff2ebca0e7f764507186870270 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (35 commits) PM idle: remove global declaration of pm_idle unicore32 idle: delete stray pm_idle comment openrisc idle: delete pm_idle mn10300 idle: delete pm_idle microblaze idle: delete pm_idle m32r idle: delete pm_idle, and other dead idle code ia64 idle: delete pm_idle cris idle: delete idle and pm_idle ARM64 idle: delete pm_idle ARM idle: delete pm_idle blackfin idle: delete pm_idle sparc idle: rename pm_idle to sparc_idle sh idle: rename global pm_idle to static sh_idle x86 idle: rename global pm_idle to static x86_idle APM idle: register apm_cpu_idle via cpuidle tools/power turbostat: display SMI count by default intel_idle: export both C1 and C1E cpuidle: remove vestage definition of cpuidle_state_usage.driver_data x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok flag x86 idle: remove mwait_idle() and "idle=mwait" cmdline param ... Conflicts: arch/x86/kernel/process.c (with PM / tracing commit 43720bd) drivers/acpi/processor_idle.c (with ACPICA commit 4f84291)
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.836
-rw-r--r--tools/power/x86/turbostat/turbostat.c48
2 files changed, 54 insertions, 30 deletions
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index 0d7dc2cfefb5..b4ddb748356c 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -31,8 +31,6 @@ The \fB-S\fP option limits output to a 1-line System Summary for each interval.
31.PP 31.PP
32The \fB-v\fP option increases verbosity. 32The \fB-v\fP option increases verbosity.
33.PP 33.PP
34The \fB-s\fP option prints the SMI counter, equivalent to "-c 0x34"
35.PP
36The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter. 34The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter.
37.PP 35.PP
38The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter. 36The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter.
@@ -186,26 +184,24 @@ This is a weighted average, where the weight is %c0. ie. it is the total number
186un-halted cycles elapsed per time divided by the number of CPUs. 184un-halted cycles elapsed per time divided by the number of CPUs.
187.SH SMI COUNTING EXAMPLE 185.SH SMI COUNTING EXAMPLE
188On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter. 186On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter.
189Using the -m option, you can display how many SMIs have fired since reset, or if there 187This counter is shown by default under the "SMI" column.
190are SMIs during the measurement interval, you can display the delta using the -d option.
191.nf 188.nf
192[root@x980 ~]# turbostat -m 0x34 189[root@x980 ~]# turbostat
193cor CPU %c0 GHz TSC MSR 0x034 %c1 %c3 %c6 %pc3 %pc6 190cor CPU %c0 GHz TSC SMI %c1 %c3 %c6 CTMP %pc3 %pc6
194 1.41 1.82 3.38 0x00000000 8.92 37.82 51.85 17.37 0.55 191 0.11 1.91 3.38 0 1.84 0.26 97.79 29 0.82 83.87
195 0 0 3.73 2.03 3.38 0x00000055 1.72 48.25 46.31 17.38 0.55 192 0 0 0.40 1.63 3.38 0 10.27 0.12 89.20 20 0.82 83.88
196 0 6 0.14 1.63 3.38 0x00000056 5.30 193 0 6 0.06 1.63 3.38 0 10.61
197 1 2 2.51 1.80 3.38 0x00000056 15.65 29.33 52.52 194 1 2 0.37 2.63 3.38 0 0.02 0.10 99.51 22
198 1 8 0.10 1.65 3.38 0x00000056 18.05 195 1 8 0.01 1.62 3.38 0 0.39
199 2 4 1.16 1.68 3.38 0x00000056 5.87 24.47 68.50 196 2 4 0.07 1.62 3.38 0 0.04 0.07 99.82 23
200 2 10 0.10 1.63 3.38 0x00000056 6.93 197 2 10 0.02 1.62 3.38 0 0.09
201 8 1 3.84 1.91 3.38 0x00000056 1.36 50.65 44.16 198 8 1 0.23 1.64 3.38 0 0.10 1.07 98.60 24
202 8 7 0.08 1.64 3.38 0x00000056 5.12 199 8 7 0.02 1.64 3.38 0 0.31
203 9 3 1.82 1.73 3.38 0x00000056 7.59 24.21 66.38 200 9 3 0.03 1.62 3.38 0 0.03 0.05 99.89 29
204 9 9 0.09 1.68 3.38 0x00000056 9.32 201 9 9 0.02 1.62 3.38 0 0.05
205 10 5 1.66 1.65 3.38 0x00000056 15.10 50.00 33.23 202 10 5 0.07 1.62 3.38 0 0.08 0.12 99.73 27
206 10 11 1.72 1.65 3.38 0x00000056 15.05 203 10 11 0.03 1.62 3.38 0 0.13
207^C 204^C
208[root@x980 ~]#
209.fi 205.fi
210.SH NOTES 206.SH NOTES
211 207
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index ce6d46038f74..6f3214ed4444 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -58,6 +58,7 @@ unsigned int extra_msr_offset32;
58unsigned int extra_msr_offset64; 58unsigned int extra_msr_offset64;
59unsigned int extra_delta_offset32; 59unsigned int extra_delta_offset32;
60unsigned int extra_delta_offset64; 60unsigned int extra_delta_offset64;
61int do_smi;
61double bclk; 62double bclk;
62unsigned int show_pkg; 63unsigned int show_pkg;
63unsigned int show_core; 64unsigned int show_core;
@@ -99,6 +100,7 @@ struct thread_data {
99 unsigned long long extra_delta64; 100 unsigned long long extra_delta64;
100 unsigned long long extra_msr32; 101 unsigned long long extra_msr32;
101 unsigned long long extra_delta32; 102 unsigned long long extra_delta32;
103 unsigned int smi_count;
102 unsigned int cpu_id; 104 unsigned int cpu_id;
103 unsigned int flags; 105 unsigned int flags;
104#define CPU_IS_FIRST_THREAD_IN_CORE 0x2 106#define CPU_IS_FIRST_THREAD_IN_CORE 0x2
@@ -248,6 +250,8 @@ void print_header(void)
248 if (has_aperf) 250 if (has_aperf)
249 outp += sprintf(outp, " GHz"); 251 outp += sprintf(outp, " GHz");
250 outp += sprintf(outp, " TSC"); 252 outp += sprintf(outp, " TSC");
253 if (do_smi)
254 outp += sprintf(outp, " SMI");
251 if (extra_delta_offset32) 255 if (extra_delta_offset32)
252 outp += sprintf(outp, " count 0x%03X", extra_delta_offset32); 256 outp += sprintf(outp, " count 0x%03X", extra_delta_offset32);
253 if (extra_delta_offset64) 257 if (extra_delta_offset64)
@@ -314,6 +318,8 @@ int dump_counters(struct thread_data *t, struct core_data *c,
314 extra_msr_offset32, t->extra_msr32); 318 extra_msr_offset32, t->extra_msr32);
315 fprintf(stderr, "msr0x%x: %016llX\n", 319 fprintf(stderr, "msr0x%x: %016llX\n",
316 extra_msr_offset64, t->extra_msr64); 320 extra_msr_offset64, t->extra_msr64);
321 if (do_smi)
322 fprintf(stderr, "SMI: %08X\n", t->smi_count);
317 } 323 }
318 324
319 if (c) { 325 if (c) {
@@ -352,6 +358,7 @@ int dump_counters(struct thread_data *t, struct core_data *c,
352 * RAM_W: %5.2 358 * RAM_W: %5.2
353 * GHz: "GHz" 3 columns %3.2 359 * GHz: "GHz" 3 columns %3.2
354 * TSC: "TSC" 3 columns %3.2 360 * TSC: "TSC" 3 columns %3.2
361 * SMI: "SMI" 4 columns %4d
355 * percentage " %pc3" %6.2 362 * percentage " %pc3" %6.2
356 * Perf Status percentage: %5.2 363 * Perf Status percentage: %5.2
357 * "CTMP" 4 columns %4d 364 * "CTMP" 4 columns %4d
@@ -431,6 +438,10 @@ int format_counters(struct thread_data *t, struct core_data *c,
431 /* TSC */ 438 /* TSC */
432 outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float); 439 outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float);
433 440
441 /* SMI */
442 if (do_smi)
443 outp += sprintf(outp, "%4d", t->smi_count);
444
434 /* delta */ 445 /* delta */
435 if (extra_delta_offset32) 446 if (extra_delta_offset32)
436 outp += sprintf(outp, " %11llu", t->extra_delta32); 447 outp += sprintf(outp, " %11llu", t->extra_delta32);
@@ -645,6 +656,9 @@ delta_thread(struct thread_data *new, struct thread_data *old,
645 */ 656 */
646 old->extra_msr32 = new->extra_msr32; 657 old->extra_msr32 = new->extra_msr32;
647 old->extra_msr64 = new->extra_msr64; 658 old->extra_msr64 = new->extra_msr64;
659
660 if (do_smi)
661 old->smi_count = new->smi_count - old->smi_count;
648} 662}
649 663
650int delta_cpu(struct thread_data *t, struct core_data *c, 664int delta_cpu(struct thread_data *t, struct core_data *c,
@@ -672,6 +686,7 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data
672 t->mperf = 0; 686 t->mperf = 0;
673 t->c1 = 0; 687 t->c1 = 0;
674 688
689 t->smi_count = 0;
675 t->extra_delta32 = 0; 690 t->extra_delta32 = 0;
676 t->extra_delta64 = 0; 691 t->extra_delta64 = 0;
677 692
@@ -802,6 +817,11 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
802 return -4; 817 return -4;
803 } 818 }
804 819
820 if (do_smi) {
821 if (get_msr(cpu, MSR_SMI_COUNT, &msr))
822 return -5;
823 t->smi_count = msr & 0xFFFFFFFF;
824 }
805 if (extra_delta_offset32) { 825 if (extra_delta_offset32) {
806 if (get_msr(cpu, extra_delta_offset32, &msr)) 826 if (get_msr(cpu, extra_delta_offset32, &msr))
807 return -5; 827 return -5;
@@ -908,8 +928,7 @@ void print_verbose_header(void)
908 928
909 get_msr(0, MSR_NHM_PLATFORM_INFO, &msr); 929 get_msr(0, MSR_NHM_PLATFORM_INFO, &msr);
910 930
911 if (verbose) 931 fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr);
912 fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr);
913 932
914 ratio = (msr >> 40) & 0xFF; 933 ratio = (msr >> 40) & 0xFF;
915 fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency\n", 934 fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency\n",
@@ -919,13 +938,16 @@ void print_verbose_header(void)
919 fprintf(stderr, "%d * %.0f = %.0f MHz TSC frequency\n", 938 fprintf(stderr, "%d * %.0f = %.0f MHz TSC frequency\n",
920 ratio, bclk, ratio * bclk); 939 ratio, bclk, ratio * bclk);
921 940
941 get_msr(0, MSR_IA32_POWER_CTL, &msr);
942 fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E: %sabled)\n",
943 msr, msr & 0x2 ? "EN" : "DIS");
944
922 if (!do_ivt_turbo_ratio_limit) 945 if (!do_ivt_turbo_ratio_limit)
923 goto print_nhm_turbo_ratio_limits; 946 goto print_nhm_turbo_ratio_limits;
924 947
925 get_msr(0, MSR_IVT_TURBO_RATIO_LIMIT, &msr); 948 get_msr(0, MSR_IVT_TURBO_RATIO_LIMIT, &msr);
926 949
927 if (verbose) 950 fprintf(stderr, "cpu0: MSR_IVT_TURBO_RATIO_LIMIT: 0x%08llx\n", msr);
928 fprintf(stderr, "cpu0: MSR_IVT_TURBO_RATIO_LIMIT: 0x%08llx\n", msr);
929 951
930 ratio = (msr >> 56) & 0xFF; 952 ratio = (msr >> 56) & 0xFF;
931 if (ratio) 953 if (ratio)
@@ -1016,8 +1038,7 @@ print_nhm_turbo_ratio_limits:
1016 1038
1017 get_msr(0, MSR_NHM_TURBO_RATIO_LIMIT, &msr); 1039 get_msr(0, MSR_NHM_TURBO_RATIO_LIMIT, &msr);
1018 1040
1019 if (verbose) 1041 fprintf(stderr, "cpu0: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n", msr);
1020 fprintf(stderr, "cpu0: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n", msr);
1021 1042
1022 ratio = (msr >> 56) & 0xFF; 1043 ratio = (msr >> 56) & 0xFF;
1023 if (ratio) 1044 if (ratio)
@@ -1397,6 +1418,9 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)
1397 case 0x2D: /* SNB Xeon */ 1418 case 0x2D: /* SNB Xeon */
1398 case 0x3A: /* IVB */ 1419 case 0x3A: /* IVB */
1399 case 0x3E: /* IVB Xeon */ 1420 case 0x3E: /* IVB Xeon */
1421 case 0x3C: /* HSW */
1422 case 0x3F: /* HSW */
1423 case 0x45: /* HSW */
1400 return 1; 1424 return 1;
1401 case 0x2E: /* Nehalem-EX Xeon - Beckton */ 1425 case 0x2E: /* Nehalem-EX Xeon - Beckton */
1402 case 0x2F: /* Westmere-EX Xeon - Eagleton */ 1426 case 0x2F: /* Westmere-EX Xeon - Eagleton */
@@ -1488,6 +1512,9 @@ void rapl_probe(unsigned int family, unsigned int model)
1488 switch (model) { 1512 switch (model) {
1489 case 0x2A: 1513 case 0x2A:
1490 case 0x3A: 1514 case 0x3A:
1515 case 0x3C: /* HSW */
1516 case 0x3F: /* HSW */
1517 case 0x45: /* HSW */
1491 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX; 1518 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX;
1492 break; 1519 break;
1493 case 0x2D: 1520 case 0x2D:
@@ -1724,6 +1751,9 @@ int is_snb(unsigned int family, unsigned int model)
1724 case 0x2D: 1751 case 0x2D:
1725 case 0x3A: /* IVB */ 1752 case 0x3A: /* IVB */
1726 case 0x3E: /* IVB Xeon */ 1753 case 0x3E: /* IVB Xeon */
1754 case 0x3C: /* HSW */
1755 case 0x3F: /* HSW */
1756 case 0x45: /* HSW */
1727 return 1; 1757 return 1;
1728 } 1758 }
1729 return 0; 1759 return 0;
@@ -1883,6 +1913,7 @@ void check_cpuid()
1883 1913
1884 do_nehalem_platform_info = genuine_intel && has_invariant_tsc; 1914 do_nehalem_platform_info = genuine_intel && has_invariant_tsc;
1885 do_nhm_cstates = genuine_intel; /* all Intel w/ non-stop TSC have NHM counters */ 1915 do_nhm_cstates = genuine_intel; /* all Intel w/ non-stop TSC have NHM counters */
1916 do_smi = do_nhm_cstates;
1886 do_snb_cstates = is_snb(family, model); 1917 do_snb_cstates = is_snb(family, model);
1887 bclk = discover_bclk(family, model); 1918 bclk = discover_bclk(family, model);
1888 1919
@@ -2219,9 +2250,6 @@ void cmdline(int argc, char **argv)
2219 case 'c': 2250 case 'c':
2220 sscanf(optarg, "%x", &extra_delta_offset32); 2251 sscanf(optarg, "%x", &extra_delta_offset32);
2221 break; 2252 break;
2222 case 's':
2223 extra_delta_offset32 = 0x34; /* SMI counter */
2224 break;
2225 case 'C': 2253 case 'C':
2226 sscanf(optarg, "%x", &extra_delta_offset64); 2254 sscanf(optarg, "%x", &extra_delta_offset64);
2227 break; 2255 break;
@@ -2248,7 +2276,7 @@ int main(int argc, char **argv)
2248 cmdline(argc, argv); 2276 cmdline(argc, argv);
2249 2277
2250 if (verbose) 2278 if (verbose)
2251 fprintf(stderr, "turbostat v3.0 November 23, 2012" 2279 fprintf(stderr, "turbostat v3.2 February 11, 2013"
2252 " - Len Brown <lenb@kernel.org>\n"); 2280 " - Len Brown <lenb@kernel.org>\n");
2253 2281
2254 turbostat_init(); 2282 turbostat_init();