aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-09 14:03:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-09 14:03:48 -0400
commit40bca9dbab4dd6d5a78beccdbbb1c7218136b562 (patch)
tree188150cd56bef23a3baba97120b2759b23461064 /tools
parent9ef11ceb0d380d4c9b43083fd920049aa05d3f8d (diff)
parent73659be769a4f0ac26a6b3fc6699754adba36485 (diff)
Merge tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki: "Fixes for some issues discovered after recent changes and for some that have just been found lately regardless of those changes (intel_pstate, intel_idle, PM core, mailbox/pcc, turbostat) plus support for some new CPU models (intel_idle, Intel RAPL driver, turbostat) and documentation updates (intel_pstate, PM core). Specifics: - intel_pstate fixes for two issues exposed by the recent switch over from using timers and for one issue introduced during the 4.4 cycle plus new comments describing data structures used by the driver (Rafael Wysocki, Srinivas Pandruvada). - intel_idle fixes related to CPU offline/online (Richard Cochran). - intel_idle support (new CPU IDs and state definitions mostly) for Skylake-X and Kabylake processors (Len Brown). - PCC mailbox driver fix for an out-of-bounds memory access that may cause the kernel to panic() (Shanker Donthineni). - New (missing) CPU ID for one apparently overlooked Haswell model in the Intel RAPL power capping driver (Srinivas Pandruvada). - Fix for the PM core's wakeup IRQs framework to make it work after wakeup settings reconfiguration from sysfs (Grygorii Strashko). - Runtime PM documentation update to make it describe what needs to be done during device removal more precisely (Krzysztof Kozlowski). - Stale comment removal cleanup in the cpufreq-dt driver (Viresh Kumar). - turbostat utility fixes and support for Broxton, Skylake-X and Kabylake processors (Len Brown)" * tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (28 commits) PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs tools/power turbostat: work around RC6 counter wrap tools/power turbostat: initial KBL support tools/power turbostat: initial SKX support tools/power turbostat: decode BXT TSC frequency via CPUID tools/power turbostat: initial BXT support tools/power turbostat: print IRTL MSRs tools/power turbostat: SGX state should print only if --debug intel_idle: Add KBL support intel_idle: Add SKX support intel_idle: Clean up all registered devices on exit. intel_idle: Propagate hot plug errors. intel_idle: Don't overreact to a cpuidle registration failure. intel_idle: Setup the timer broadcast only on successful driver load. intel_idle: Avoid a double free of the per-CPU data. intel_idle: Fix dangling registration on error path. intel_idle: Fix deallocation order on the driver exit path. intel_idle: Remove redundant initialization calls. intel_idle: Fix a helper function's return value. intel_idle: remove useless return from void function. ...
Diffstat (limited to 'tools')
-rw-r--r--tools/power/x86/turbostat/turbostat.c117
1 files changed, 107 insertions, 10 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 20a257a12ea5..acbf7ff2ee6e 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -66,6 +66,8 @@ unsigned int do_slm_cstates;
66unsigned int use_c1_residency_msr; 66unsigned int use_c1_residency_msr;
67unsigned int has_aperf; 67unsigned int has_aperf;
68unsigned int has_epb; 68unsigned int has_epb;
69unsigned int do_irtl_snb;
70unsigned int do_irtl_hsw;
69unsigned int units = 1000000; /* MHz etc */ 71unsigned int units = 1000000; /* MHz etc */
70unsigned int genuine_intel; 72unsigned int genuine_intel;
71unsigned int has_invariant_tsc; 73unsigned int has_invariant_tsc;
@@ -187,7 +189,7 @@ struct pkg_data {
187 unsigned long long pkg_any_core_c0; 189 unsigned long long pkg_any_core_c0;
188 unsigned long long pkg_any_gfxe_c0; 190 unsigned long long pkg_any_gfxe_c0;
189 unsigned long long pkg_both_core_gfxe_c0; 191 unsigned long long pkg_both_core_gfxe_c0;
190 unsigned long long gfx_rc6_ms; 192 long long gfx_rc6_ms;
191 unsigned int gfx_mhz; 193 unsigned int gfx_mhz;
192 unsigned int package_id; 194 unsigned int package_id;
193 unsigned int energy_pkg; /* MSR_PKG_ENERGY_STATUS */ 195 unsigned int energy_pkg; /* MSR_PKG_ENERGY_STATUS */
@@ -621,8 +623,14 @@ int format_counters(struct thread_data *t, struct core_data *c,
621 outp += sprintf(outp, "%8d", p->pkg_temp_c); 623 outp += sprintf(outp, "%8d", p->pkg_temp_c);
622 624
623 /* GFXrc6 */ 625 /* GFXrc6 */
624 if (do_gfx_rc6_ms) 626 if (do_gfx_rc6_ms) {
625 outp += sprintf(outp, "%8.2f", 100.0 * p->gfx_rc6_ms / 1000.0 / interval_float); 627 if (p->gfx_rc6_ms == -1) { /* detect counter reset */
628 outp += sprintf(outp, " ***.**");
629 } else {
630 outp += sprintf(outp, "%8.2f",
631 p->gfx_rc6_ms / 10.0 / interval_float);
632 }
633 }
626 634
627 /* GFXMHz */ 635 /* GFXMHz */
628 if (do_gfx_mhz) 636 if (do_gfx_mhz)
@@ -766,7 +774,12 @@ delta_package(struct pkg_data *new, struct pkg_data *old)
766 old->pc10 = new->pc10 - old->pc10; 774 old->pc10 = new->pc10 - old->pc10;
767 old->pkg_temp_c = new->pkg_temp_c; 775 old->pkg_temp_c = new->pkg_temp_c;
768 776
769 old->gfx_rc6_ms = new->gfx_rc6_ms - old->gfx_rc6_ms; 777 /* flag an error when rc6 counter resets/wraps */
778 if (old->gfx_rc6_ms > new->gfx_rc6_ms)
779 old->gfx_rc6_ms = -1;
780 else
781 old->gfx_rc6_ms = new->gfx_rc6_ms - old->gfx_rc6_ms;
782
770 old->gfx_mhz = new->gfx_mhz; 783 old->gfx_mhz = new->gfx_mhz;
771 784
772 DELTA_WRAP32(new->energy_pkg, old->energy_pkg); 785 DELTA_WRAP32(new->energy_pkg, old->energy_pkg);
@@ -1296,6 +1309,7 @@ int hsw_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL__3, PCL__6, PCL__7, PCL_7S,
1296int slv_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV}; 1309int slv_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
1297int 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}; 1310int 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};
1298int 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}; 1311int 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};
1312int bxt_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
1299 1313
1300 1314
1301static void 1315static void
@@ -1579,6 +1593,47 @@ dump_config_tdp(void)
1579 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); 1593 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1);
1580 fprintf(outf, ")\n"); 1594 fprintf(outf, ")\n");
1581} 1595}
1596
1597unsigned int irtl_time_units[] = {1, 32, 1024, 32768, 1048576, 33554432, 0, 0 };
1598
1599void print_irtl(void)
1600{
1601 unsigned long long msr;
1602
1603 get_msr(base_cpu, MSR_PKGC3_IRTL, &msr);
1604 fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr);
1605 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
1606 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
1607
1608 get_msr(base_cpu, MSR_PKGC6_IRTL, &msr);
1609 fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", base_cpu, msr);
1610 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
1611 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
1612
1613 get_msr(base_cpu, MSR_PKGC7_IRTL, &msr);
1614 fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr);
1615 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
1616 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
1617
1618 if (!do_irtl_hsw)
1619 return;
1620
1621 get_msr(base_cpu, MSR_PKGC8_IRTL, &msr);
1622 fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr);
1623 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
1624 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
1625
1626 get_msr(base_cpu, MSR_PKGC9_IRTL, &msr);
1627 fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr);
1628 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
1629 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
1630
1631 get_msr(base_cpu, MSR_PKGC10_IRTL, &msr);
1632 fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr);
1633 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
1634 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
1635
1636}
1582void free_fd_percpu(void) 1637void free_fd_percpu(void)
1583{ 1638{
1584 int i; 1639 int i;
@@ -2144,6 +2199,9 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
2144 case 0x56: /* BDX-DE */ 2199 case 0x56: /* BDX-DE */
2145 case 0x4E: /* SKL */ 2200 case 0x4E: /* SKL */
2146 case 0x5E: /* SKL */ 2201 case 0x5E: /* SKL */
2202 case 0x8E: /* KBL */
2203 case 0x9E: /* KBL */
2204 case 0x55: /* SKX */
2147 pkg_cstate_limits = hsw_pkg_cstate_limits; 2205 pkg_cstate_limits = hsw_pkg_cstate_limits;
2148 break; 2206 break;
2149 case 0x37: /* BYT */ 2207 case 0x37: /* BYT */
@@ -2156,6 +2214,9 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
2156 case 0x57: /* PHI */ 2214 case 0x57: /* PHI */
2157 pkg_cstate_limits = phi_pkg_cstate_limits; 2215 pkg_cstate_limits = phi_pkg_cstate_limits;
2158 break; 2216 break;
2217 case 0x5C: /* BXT */
2218 pkg_cstate_limits = bxt_pkg_cstate_limits;
2219 break;
2159 default: 2220 default:
2160 return 0; 2221 return 0;
2161 } 2222 }
@@ -2248,6 +2309,9 @@ int has_config_tdp(unsigned int family, unsigned int model)
2248 case 0x56: /* BDX-DE */ 2309 case 0x56: /* BDX-DE */
2249 case 0x4E: /* SKL */ 2310 case 0x4E: /* SKL */
2250 case 0x5E: /* SKL */ 2311 case 0x5E: /* SKL */
2312 case 0x8E: /* KBL */
2313 case 0x9E: /* KBL */
2314 case 0x55: /* SKX */
2251 2315
2252 case 0x57: /* Knights Landing */ 2316 case 0x57: /* Knights Landing */
2253 return 1; 2317 return 1;
@@ -2585,13 +2649,19 @@ void rapl_probe(unsigned int family, unsigned int model)
2585 case 0x47: /* BDW */ 2649 case 0x47: /* BDW */
2586 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO; 2650 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO;
2587 break; 2651 break;
2652 case 0x5C: /* BXT */
2653 do_rapl = RAPL_PKG | RAPL_PKG_POWER_INFO;
2654 break;
2588 case 0x4E: /* SKL */ 2655 case 0x4E: /* SKL */
2589 case 0x5E: /* SKL */ 2656 case 0x5E: /* SKL */
2657 case 0x8E: /* KBL */
2658 case 0x9E: /* KBL */
2590 do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO; 2659 do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
2591 break; 2660 break;
2592 case 0x3F: /* HSX */ 2661 case 0x3F: /* HSX */
2593 case 0x4F: /* BDX */ 2662 case 0x4F: /* BDX */
2594 case 0x56: /* BDX-DE */ 2663 case 0x56: /* BDX-DE */
2664 case 0x55: /* SKX */
2595 case 0x57: /* KNL */ 2665 case 0x57: /* KNL */
2596 do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO; 2666 do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
2597 break; 2667 break;
@@ -2871,6 +2941,10 @@ int has_snb_msrs(unsigned int family, unsigned int model)
2871 case 0x56: /* BDX-DE */ 2941 case 0x56: /* BDX-DE */
2872 case 0x4E: /* SKL */ 2942 case 0x4E: /* SKL */
2873 case 0x5E: /* SKL */ 2943 case 0x5E: /* SKL */
2944 case 0x8E: /* KBL */
2945 case 0x9E: /* KBL */
2946 case 0x55: /* SKX */
2947 case 0x5C: /* BXT */
2874 return 1; 2948 return 1;
2875 } 2949 }
2876 return 0; 2950 return 0;
@@ -2879,9 +2953,14 @@ int has_snb_msrs(unsigned int family, unsigned int model)
2879/* 2953/*
2880 * HSW adds support for additional MSRs: 2954 * HSW adds support for additional MSRs:
2881 * 2955 *
2882 * MSR_PKG_C8_RESIDENCY 0x00000630 2956 * MSR_PKG_C8_RESIDENCY 0x00000630
2883 * MSR_PKG_C9_RESIDENCY 0x00000631 2957 * MSR_PKG_C9_RESIDENCY 0x00000631
2884 * MSR_PKG_C10_RESIDENCY 0x00000632 2958 * MSR_PKG_C10_RESIDENCY 0x00000632
2959 *
2960 * MSR_PKGC8_IRTL 0x00000633
2961 * MSR_PKGC9_IRTL 0x00000634
2962 * MSR_PKGC10_IRTL 0x00000635
2963 *
2885 */ 2964 */
2886int has_hsw_msrs(unsigned int family, unsigned int model) 2965int has_hsw_msrs(unsigned int family, unsigned int model)
2887{ 2966{
@@ -2893,6 +2972,9 @@ int has_hsw_msrs(unsigned int family, unsigned int model)
2893 case 0x3D: /* BDW */ 2972 case 0x3D: /* BDW */
2894 case 0x4E: /* SKL */ 2973 case 0x4E: /* SKL */
2895 case 0x5E: /* SKL */ 2974 case 0x5E: /* SKL */
2975 case 0x8E: /* KBL */
2976 case 0x9E: /* KBL */
2977 case 0x5C: /* BXT */
2896 return 1; 2978 return 1;
2897 } 2979 }
2898 return 0; 2980 return 0;
@@ -2914,6 +2996,8 @@ int has_skl_msrs(unsigned int family, unsigned int model)
2914 switch (model) { 2996 switch (model) {
2915 case 0x4E: /* SKL */ 2997 case 0x4E: /* SKL */
2916 case 0x5E: /* SKL */ 2998 case 0x5E: /* SKL */
2999 case 0x8E: /* KBL */
3000 case 0x9E: /* KBL */
2917 return 1; 3001 return 1;
2918 } 3002 }
2919 return 0; 3003 return 0;
@@ -3187,7 +3271,7 @@ void process_cpuid()
3187 if (debug) 3271 if (debug)
3188 decode_misc_enable_msr(); 3272 decode_misc_enable_msr();
3189 3273
3190 if (max_level >= 0x7) { 3274 if (max_level >= 0x7 && debug) {
3191 int has_sgx; 3275 int has_sgx;
3192 3276
3193 ecx = 0; 3277 ecx = 0;
@@ -3221,7 +3305,15 @@ void process_cpuid()
3221 switch(model) { 3305 switch(model) {
3222 case 0x4E: /* SKL */ 3306 case 0x4E: /* SKL */
3223 case 0x5E: /* SKL */ 3307 case 0x5E: /* SKL */
3224 crystal_hz = 24000000; /* 24 MHz */ 3308 case 0x8E: /* KBL */
3309 case 0x9E: /* KBL */
3310 crystal_hz = 24000000; /* 24.0 MHz */
3311 break;
3312 case 0x55: /* SKX */
3313 crystal_hz = 25000000; /* 25.0 MHz */
3314 break;
3315 case 0x5C: /* BXT */
3316 crystal_hz = 19200000; /* 19.2 MHz */
3225 break; 3317 break;
3226 default: 3318 default:
3227 crystal_hz = 0; 3319 crystal_hz = 0;
@@ -3254,11 +3346,13 @@ void process_cpuid()
3254 3346
3255 do_nhm_platform_info = do_nhm_cstates = do_smi = probe_nhm_msrs(family, model); 3347 do_nhm_platform_info = do_nhm_cstates = do_smi = probe_nhm_msrs(family, model);
3256 do_snb_cstates = has_snb_msrs(family, model); 3348 do_snb_cstates = has_snb_msrs(family, model);
3349 do_irtl_snb = has_snb_msrs(family, model);
3257 do_pc2 = do_snb_cstates && (pkg_cstate_limit >= PCL__2); 3350 do_pc2 = do_snb_cstates && (pkg_cstate_limit >= PCL__2);
3258 do_pc3 = (pkg_cstate_limit >= PCL__3); 3351 do_pc3 = (pkg_cstate_limit >= PCL__3);
3259 do_pc6 = (pkg_cstate_limit >= PCL__6); 3352 do_pc6 = (pkg_cstate_limit >= PCL__6);
3260 do_pc7 = do_snb_cstates && (pkg_cstate_limit >= PCL__7); 3353 do_pc7 = do_snb_cstates && (pkg_cstate_limit >= PCL__7);
3261 do_c8_c9_c10 = has_hsw_msrs(family, model); 3354 do_c8_c9_c10 = has_hsw_msrs(family, model);
3355 do_irtl_hsw = has_hsw_msrs(family, model);
3262 do_skl_residency = has_skl_msrs(family, model); 3356 do_skl_residency = has_skl_msrs(family, model);
3263 do_slm_cstates = is_slm(family, model); 3357 do_slm_cstates = is_slm(family, model);
3264 do_knl_cstates = is_knl(family, model); 3358 do_knl_cstates = is_knl(family, model);
@@ -3564,6 +3658,9 @@ void turbostat_init()
3564 3658
3565 if (debug) 3659 if (debug)
3566 for_all_cpus(print_thermal, ODD_COUNTERS); 3660 for_all_cpus(print_thermal, ODD_COUNTERS);
3661
3662 if (debug && do_irtl_snb)
3663 print_irtl();
3567} 3664}
3568 3665
3569int fork_it(char **argv) 3666int fork_it(char **argv)
@@ -3629,7 +3726,7 @@ int get_and_dump_counters(void)
3629} 3726}
3630 3727
3631void print_version() { 3728void print_version() {
3632 fprintf(outf, "turbostat version 4.11 27 Feb 2016" 3729 fprintf(outf, "turbostat version 4.12 5 Apr 2016"
3633 " - Len Brown <lenb@kernel.org>\n"); 3730 " - Len Brown <lenb@kernel.org>\n");
3634} 3731}
3635 3732