diff options
author | Len Brown <len.brown@intel.com> | 2015-03-23 20:29:09 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2015-04-18 14:20:50 -0400 |
commit | fcd17211bd807533f6d4be20b1a4644e9191bfe2 (patch) | |
tree | e601894be257934aca8ce79e29b2b1a2532266f5 /tools | |
parent | 12bb43c6150525cd53af77a1a7b9ff2752944cbd (diff) |
tools/power turbostat: dump MSR_TURBO_RATIO_LIMIT2
and up to 18 cores of turbo ratio limit
when using the turbostat --debug option.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 141 |
1 files changed, 105 insertions, 36 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index b699a0eb57cb..f05a3f7b5d4c 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -65,8 +65,6 @@ unsigned int units = 1000000; /* MHz etc */ | |||
65 | unsigned int genuine_intel; | 65 | unsigned int genuine_intel; |
66 | unsigned int has_invariant_tsc; | 66 | unsigned int has_invariant_tsc; |
67 | unsigned int do_nhm_platform_info; | 67 | unsigned int do_nhm_platform_info; |
68 | unsigned int do_nhm_turbo_ratio_limit; | ||
69 | unsigned int do_ivt_turbo_ratio_limit; | ||
70 | unsigned int extra_msr_offset32; | 68 | unsigned int extra_msr_offset32; |
71 | unsigned int extra_msr_offset64; | 69 | unsigned int extra_msr_offset64; |
72 | unsigned int extra_delta_offset32; | 70 | unsigned int extra_delta_offset32; |
@@ -1078,14 +1076,12 @@ int slv_pkg_cstate_limits[8] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, PCLRSV, | |||
1078 | int amt_pkg_cstate_limits[8] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7}; | 1076 | int amt_pkg_cstate_limits[8] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7}; |
1079 | int phi_pkg_cstate_limits[8] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL}; | 1077 | int phi_pkg_cstate_limits[8] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL}; |
1080 | 1078 | ||
1081 | void dump_system_config_info(void) | 1079 | static void |
1080 | dump_nhm_platform_info(void) | ||
1082 | { | 1081 | { |
1083 | unsigned long long msr; | 1082 | unsigned long long msr; |
1084 | unsigned int ratio; | 1083 | unsigned int ratio; |
1085 | 1084 | ||
1086 | if (!do_nhm_platform_info) | ||
1087 | return; | ||
1088 | |||
1089 | get_msr(0, MSR_NHM_PLATFORM_INFO, &msr); | 1085 | get_msr(0, MSR_NHM_PLATFORM_INFO, &msr); |
1090 | 1086 | ||
1091 | fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr); | 1087 | fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr); |
@@ -1102,8 +1098,36 @@ void dump_system_config_info(void) | |||
1102 | fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", | 1098 | fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", |
1103 | msr, msr & 0x2 ? "EN" : "DIS"); | 1099 | msr, msr & 0x2 ? "EN" : "DIS"); |
1104 | 1100 | ||
1105 | if (!do_ivt_turbo_ratio_limit) | 1101 | return; |
1106 | goto print_nhm_turbo_ratio_limits; | 1102 | } |
1103 | |||
1104 | static void | ||
1105 | dump_hsw_turbo_ratio_limits(void) | ||
1106 | { | ||
1107 | unsigned long long msr; | ||
1108 | unsigned int ratio; | ||
1109 | |||
1110 | get_msr(0, MSR_TURBO_RATIO_LIMIT2, &msr); | ||
1111 | |||
1112 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", msr); | ||
1113 | |||
1114 | ratio = (msr >> 8) & 0xFF; | ||
1115 | if (ratio) | ||
1116 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 18 active cores\n", | ||
1117 | ratio, bclk, ratio * bclk); | ||
1118 | |||
1119 | ratio = (msr >> 0) & 0xFF; | ||
1120 | if (ratio) | ||
1121 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 17 active cores\n", | ||
1122 | ratio, bclk, ratio * bclk); | ||
1123 | return; | ||
1124 | } | ||
1125 | |||
1126 | static void | ||
1127 | dump_ivt_turbo_ratio_limits(void) | ||
1128 | { | ||
1129 | unsigned long long msr; | ||
1130 | unsigned int ratio; | ||
1107 | 1131 | ||
1108 | get_msr(0, MSR_TURBO_RATIO_LIMIT1, &msr); | 1132 | get_msr(0, MSR_TURBO_RATIO_LIMIT1, &msr); |
1109 | 1133 | ||
@@ -1148,26 +1172,14 @@ void dump_system_config_info(void) | |||
1148 | if (ratio) | 1172 | if (ratio) |
1149 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 9 active cores\n", | 1173 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 9 active cores\n", |
1150 | ratio, bclk, ratio * bclk); | 1174 | ratio, bclk, ratio * bclk); |
1175 | return; | ||
1176 | } | ||
1151 | 1177 | ||
1152 | print_nhm_turbo_ratio_limits: | 1178 | static void |
1153 | get_msr(0, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); | 1179 | dump_nhm_turbo_ratio_limits(void) |
1154 | 1180 | { | |
1155 | #define SNB_C1_AUTO_UNDEMOTE (1UL << 27) | 1181 | unsigned long long msr; |
1156 | #define SNB_C3_AUTO_UNDEMOTE (1UL << 28) | 1182 | unsigned int ratio; |
1157 | |||
1158 | fprintf(stderr, "cpu0: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx", msr); | ||
1159 | |||
1160 | fprintf(stderr, " (%s%s%s%s%slocked: pkg-cstate-limit=%d: %s)\n", | ||
1161 | (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", | ||
1162 | (msr & SNB_C1_AUTO_UNDEMOTE) ? "UNdemote-C1, " : "", | ||
1163 | (msr & NHM_C3_AUTO_DEMOTE) ? "demote-C3, " : "", | ||
1164 | (msr & NHM_C1_AUTO_DEMOTE) ? "demote-C1, " : "", | ||
1165 | (msr & (1 << 15)) ? "" : "UN", | ||
1166 | (unsigned int)msr & 7, | ||
1167 | pkg_cstate_limit_strings[pkg_cstate_limit]); | ||
1168 | |||
1169 | if (!do_nhm_turbo_ratio_limit) | ||
1170 | return; | ||
1171 | 1183 | ||
1172 | get_msr(0, MSR_TURBO_RATIO_LIMIT, &msr); | 1184 | get_msr(0, MSR_TURBO_RATIO_LIMIT, &msr); |
1173 | 1185 | ||
@@ -1212,7 +1224,30 @@ print_nhm_turbo_ratio_limits: | |||
1212 | if (ratio) | 1224 | if (ratio) |
1213 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 1 active cores\n", | 1225 | fprintf(stderr, "%d * %.0f = %.0f MHz max turbo 1 active cores\n", |
1214 | ratio, bclk, ratio * bclk); | 1226 | ratio, bclk, ratio * bclk); |
1227 | return; | ||
1228 | } | ||
1215 | 1229 | ||
1230 | static void | ||
1231 | dump_nhm_cst_cfg(void) | ||
1232 | { | ||
1233 | unsigned long long msr; | ||
1234 | |||
1235 | get_msr(0, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); | ||
1236 | |||
1237 | #define SNB_C1_AUTO_UNDEMOTE (1UL << 27) | ||
1238 | #define SNB_C3_AUTO_UNDEMOTE (1UL << 28) | ||
1239 | |||
1240 | fprintf(stderr, "cpu0: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx", msr); | ||
1241 | |||
1242 | fprintf(stderr, " (%s%s%s%s%slocked: pkg-cstate-limit=%d: %s)\n", | ||
1243 | (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", | ||
1244 | (msr & SNB_C1_AUTO_UNDEMOTE) ? "UNdemote-C1, " : "", | ||
1245 | (msr & NHM_C3_AUTO_DEMOTE) ? "demote-C3, " : "", | ||
1246 | (msr & NHM_C1_AUTO_DEMOTE) ? "demote-C1, " : "", | ||
1247 | (msr & (1 << 15)) ? "" : "UN", | ||
1248 | (unsigned int)msr & 7, | ||
1249 | pkg_cstate_limit_strings[pkg_cstate_limit]); | ||
1250 | return; | ||
1216 | } | 1251 | } |
1217 | 1252 | ||
1218 | void free_all_buffers(void) | 1253 | void free_all_buffers(void) |
@@ -1625,12 +1660,49 @@ int has_ivt_turbo_ratio_limit(unsigned int family, unsigned int model) | |||
1625 | 1660 | ||
1626 | switch (model) { | 1661 | switch (model) { |
1627 | case 0x3E: /* IVB Xeon */ | 1662 | case 0x3E: /* IVB Xeon */ |
1663 | case 0x3F: /* HSW Xeon */ | ||
1664 | return 1; | ||
1665 | default: | ||
1666 | return 0; | ||
1667 | } | ||
1668 | } | ||
1669 | int has_hsw_turbo_ratio_limit(unsigned int family, unsigned int model) | ||
1670 | { | ||
1671 | if (!genuine_intel) | ||
1672 | return 0; | ||
1673 | |||
1674 | if (family != 6) | ||
1675 | return 0; | ||
1676 | |||
1677 | switch (model) { | ||
1678 | case 0x3F: /* HSW Xeon */ | ||
1628 | return 1; | 1679 | return 1; |
1629 | default: | 1680 | default: |
1630 | return 0; | 1681 | return 0; |
1631 | } | 1682 | } |
1632 | } | 1683 | } |
1633 | 1684 | ||
1685 | static void | ||
1686 | dump_cstate_pstate_config_info(family, model) | ||
1687 | { | ||
1688 | if (!do_nhm_platform_info) | ||
1689 | return; | ||
1690 | |||
1691 | dump_nhm_platform_info(); | ||
1692 | |||
1693 | if (has_hsw_turbo_ratio_limit(family, model)) | ||
1694 | dump_hsw_turbo_ratio_limits(); | ||
1695 | |||
1696 | if (has_ivt_turbo_ratio_limit(family, model)) | ||
1697 | dump_ivt_turbo_ratio_limits(); | ||
1698 | |||
1699 | if (has_nhm_turbo_ratio_limit(family, model)) | ||
1700 | dump_nhm_turbo_ratio_limits(); | ||
1701 | |||
1702 | dump_nhm_cst_cfg(); | ||
1703 | } | ||
1704 | |||
1705 | |||
1634 | /* | 1706 | /* |
1635 | * print_epb() | 1707 | * print_epb() |
1636 | * Decode the ENERGY_PERF_BIAS MSR | 1708 | * Decode the ENERGY_PERF_BIAS MSR |
@@ -2238,7 +2310,7 @@ guess: | |||
2238 | 2310 | ||
2239 | return 0; | 2311 | return 0; |
2240 | } | 2312 | } |
2241 | void check_cpuid() | 2313 | void process_cpuid() |
2242 | { | 2314 | { |
2243 | unsigned int eax, ebx, ecx, edx, max_level; | 2315 | unsigned int eax, ebx, ecx, edx, max_level; |
2244 | unsigned int fms, family, model, stepping; | 2316 | unsigned int fms, family, model, stepping; |
@@ -2314,15 +2386,15 @@ void check_cpuid() | |||
2314 | do_slm_cstates = is_slm(family, model); | 2386 | do_slm_cstates = is_slm(family, model); |
2315 | bclk = discover_bclk(family, model); | 2387 | bclk = discover_bclk(family, model); |
2316 | 2388 | ||
2317 | do_nhm_turbo_ratio_limit = do_nhm_platform_info && has_nhm_turbo_ratio_limit(family, model); | ||
2318 | do_ivt_turbo_ratio_limit = has_ivt_turbo_ratio_limit(family, model); | ||
2319 | rapl_probe(family, model); | 2389 | rapl_probe(family, model); |
2320 | perf_limit_reasons_probe(family, model); | 2390 | perf_limit_reasons_probe(family, model); |
2321 | 2391 | ||
2392 | if (debug) | ||
2393 | dump_cstate_pstate_config_info(); | ||
2394 | |||
2322 | return; | 2395 | return; |
2323 | } | 2396 | } |
2324 | 2397 | ||
2325 | |||
2326 | void help() | 2398 | void help() |
2327 | { | 2399 | { |
2328 | fprintf(stderr, | 2400 | fprintf(stderr, |
@@ -2560,14 +2632,11 @@ void turbostat_init() | |||
2560 | { | 2632 | { |
2561 | check_dev_msr(); | 2633 | check_dev_msr(); |
2562 | check_permissions(); | 2634 | check_permissions(); |
2563 | check_cpuid(); | 2635 | process_cpuid(); |
2564 | 2636 | ||
2565 | setup_all_buffers(); | 2637 | setup_all_buffers(); |
2566 | 2638 | ||
2567 | if (debug) | 2639 | if (debug) |
2568 | dump_system_config_info(); | ||
2569 | |||
2570 | if (debug) | ||
2571 | for_all_cpus(print_epb, ODD_COUNTERS); | 2640 | for_all_cpus(print_epb, ODD_COUNTERS); |
2572 | 2641 | ||
2573 | if (debug) | 2642 | if (debug) |
@@ -2644,7 +2713,7 @@ int get_and_dump_counters(void) | |||
2644 | } | 2713 | } |
2645 | 2714 | ||
2646 | void print_version() { | 2715 | void print_version() { |
2647 | fprintf(stderr, "turbostat version 4.1 10-Feb, 2015" | 2716 | fprintf(stderr, "turbostat version 4.2 23 Mar, 2015" |
2648 | " - Len Brown <lenb@kernel.org>\n"); | 2717 | " - Len Brown <lenb@kernel.org>\n"); |
2649 | } | 2718 | } |
2650 | 2719 | ||