aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-09-27 09:25:22 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-09-27 09:25:22 -0400
commita9062dcec3697db5bdf064311ad097c469fd87ec (patch)
treebbb2ad3454d85ae38ea5efaa16418ce7650e3400 /tools
parent9ffecb10283508260936b96022d4ee43a7798b4c (diff)
parentaf71b980c0d20586cc331b617c47094a8ec7e1db (diff)
Merge branch 'turbostat' of https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux into pm-tools
Pull turbostat updates for v4.3 from Len Brown. * 'turbostat' of https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: tools/power turbosat: update version number tools/power turbostat: SKL: Adjust for TSC difference from base frequency tools/power turbostat: KNL workaround for %Busy and Avg_MHz tools/power turbostat: IVB Xeon: fix --debug regression
Diffstat (limited to 'tools')
-rw-r--r--tools/power/x86/turbostat/turbostat.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 9655cb49c7cb..bde0ef1a63df 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -71,8 +71,11 @@ unsigned int extra_msr_offset32;
71unsigned int extra_msr_offset64; 71unsigned int extra_msr_offset64;
72unsigned int extra_delta_offset32; 72unsigned int extra_delta_offset32;
73unsigned int extra_delta_offset64; 73unsigned int extra_delta_offset64;
74unsigned int aperf_mperf_multiplier = 1;
74int do_smi; 75int do_smi;
75double bclk; 76double bclk;
77double base_hz;
78double tsc_tweak = 1.0;
76unsigned int show_pkg; 79unsigned int show_pkg;
77unsigned int show_core; 80unsigned int show_core;
78unsigned int show_cpu; 81unsigned int show_cpu;
@@ -502,7 +505,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
502 /* %Busy */ 505 /* %Busy */
503 if (has_aperf) { 506 if (has_aperf) {
504 if (!skip_c0) 507 if (!skip_c0)
505 outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc); 508 outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc/tsc_tweak);
506 else 509 else
507 outp += sprintf(outp, "********"); 510 outp += sprintf(outp, "********");
508 } 511 }
@@ -510,7 +513,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
510 /* Bzy_MHz */ 513 /* Bzy_MHz */
511 if (has_aperf) 514 if (has_aperf)
512 outp += sprintf(outp, "%8.0f", 515 outp += sprintf(outp, "%8.0f",
513 1.0 * t->tsc / units * t->aperf / t->mperf / interval_float); 516 1.0 * t->tsc * tsc_tweak / units * t->aperf / t->mperf / interval_float);
514 517
515 /* TSC_MHz */ 518 /* TSC_MHz */
516 outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); 519 outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float);
@@ -984,6 +987,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
984 return -3; 987 return -3;
985 if (get_msr(cpu, MSR_IA32_MPERF, &t->mperf)) 988 if (get_msr(cpu, MSR_IA32_MPERF, &t->mperf))
986 return -4; 989 return -4;
990 t->aperf = t->aperf * aperf_mperf_multiplier;
991 t->mperf = t->mperf * aperf_mperf_multiplier;
987 } 992 }
988 993
989 if (do_smi) { 994 if (do_smi) {
@@ -1149,6 +1154,19 @@ int slv_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, PCLRSV,
1149int amt_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV}; 1154int amt_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
1150int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV}; 1155int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
1151 1156
1157
1158static void
1159calculate_tsc_tweak()
1160{
1161 unsigned long long msr;
1162 unsigned int base_ratio;
1163
1164 get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr);
1165 base_ratio = (msr >> 8) & 0xFF;
1166 base_hz = base_ratio * bclk * 1000000;
1167 tsc_tweak = base_hz / tsc_hz;
1168}
1169
1152static void 1170static void
1153dump_nhm_platform_info(void) 1171dump_nhm_platform_info(void)
1154{ 1172{
@@ -1926,8 +1944,6 @@ int has_config_tdp(unsigned int family, unsigned int model)
1926 1944
1927 switch (model) { 1945 switch (model) {
1928 case 0x3A: /* IVB */ 1946 case 0x3A: /* IVB */
1929 case 0x3E: /* IVB Xeon */
1930
1931 case 0x3C: /* HSW */ 1947 case 0x3C: /* HSW */
1932 case 0x3F: /* HSX */ 1948 case 0x3F: /* HSX */
1933 case 0x45: /* HSW */ 1949 case 0x45: /* HSW */
@@ -2543,6 +2559,13 @@ int is_knl(unsigned int family, unsigned int model)
2543 return 0; 2559 return 0;
2544} 2560}
2545 2561
2562unsigned int get_aperf_mperf_multiplier(unsigned int family, unsigned int model)
2563{
2564 if (is_knl(family, model))
2565 return 1024;
2566 return 1;
2567}
2568
2546#define SLM_BCLK_FREQS 5 2569#define SLM_BCLK_FREQS 5
2547double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0}; 2570double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0};
2548 2571
@@ -2744,6 +2767,9 @@ void process_cpuid()
2744 } 2767 }
2745 } 2768 }
2746 2769
2770 if (has_aperf)
2771 aperf_mperf_multiplier = get_aperf_mperf_multiplier(family, model);
2772
2747 do_nhm_platform_info = do_nhm_cstates = do_smi = probe_nhm_msrs(family, model); 2773 do_nhm_platform_info = do_nhm_cstates = do_smi = probe_nhm_msrs(family, model);
2748 do_snb_cstates = has_snb_msrs(family, model); 2774 do_snb_cstates = has_snb_msrs(family, model);
2749 do_pc2 = do_snb_cstates && (pkg_cstate_limit >= PCL__2); 2775 do_pc2 = do_snb_cstates && (pkg_cstate_limit >= PCL__2);
@@ -2762,6 +2788,9 @@ void process_cpuid()
2762 if (debug) 2788 if (debug)
2763 dump_cstate_pstate_config_info(); 2789 dump_cstate_pstate_config_info();
2764 2790
2791 if (has_skl_msrs(family, model))
2792 calculate_tsc_tweak();
2793
2765 return; 2794 return;
2766} 2795}
2767 2796
@@ -3090,7 +3119,7 @@ int get_and_dump_counters(void)
3090} 3119}
3091 3120
3092void print_version() { 3121void print_version() {
3093 fprintf(stderr, "turbostat version 4.7 17-June, 2015" 3122 fprintf(stderr, "turbostat version 4.8 26-Sep, 2015"
3094 " - Len Brown <lenb@kernel.org>\n"); 3123 " - Len Brown <lenb@kernel.org>\n");
3095} 3124}
3096 3125