aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-08-24 17:10:02 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-08-24 17:10:02 -0400
commit82bb70c599d81e6b2535f887b02e1719cc4856ac (patch)
tree8287bf6923c0f3b09d0e298f240229037ccc68d4
parent2e5e8fd1ff9d802ab74df1ceaa5243da30491a45 (diff)
parentbd6906ed3d7a00d55c9bd368a640ef83bb487d1d (diff)
Merge branch 'turbostat' of https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux into pm-tools
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)
-rw-r--r--arch/x86/include/asm/msr-index.h6
-rw-r--r--tools/power/x86/turbostat/turbostat.85
-rw-r--r--tools/power/x86/turbostat/turbostat.c100
3 files changed, 94 insertions, 17 deletions
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 9ebc3d009373..6deb8e3b71a7 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -170,6 +170,12 @@
170#define MSR_PP1_ENERGY_STATUS 0x00000641 170#define MSR_PP1_ENERGY_STATUS 0x00000641
171#define MSR_PP1_POLICY 0x00000642 171#define MSR_PP1_POLICY 0x00000642
172 172
173#define MSR_CONFIG_TDP_NOMINAL 0x00000648
174#define MSR_CONFIG_TDP_LEVEL_1 0x00000649
175#define MSR_CONFIG_TDP_LEVEL_2 0x0000064A
176#define MSR_CONFIG_TDP_CONTROL 0x0000064B
177#define MSR_TURBO_ACTIVATION_RATIO 0x0000064C
178
173#define MSR_PKG_WEIGHTED_CORE_C0_RES 0x00000658 179#define MSR_PKG_WEIGHTED_CORE_C0_RES 0x00000658
174#define MSR_PKG_ANY_CORE_C0_RES 0x00000659 180#define MSR_PKG_ANY_CORE_C0_RES 0x00000659
175#define MSR_PKG_ANY_GFXE_C0_RES 0x0000065A 181#define MSR_PKG_ANY_GFXE_C0_RES 0x0000065A
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index 05b8fc38dc8b..622db685b4f9 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -251,11 +251,6 @@ Although it is not guaranteed by the architecture, turbostat assumes
251that they count at TSC rate, which is true on all processors tested to date. 251that they count at TSC rate, which is true on all processors tested to date.
252 252
253.SH REFERENCES 253.SH REFERENCES
254"Intel® Turbo Boost Technology
255in Intel® Core™ Microarchitecture (Nehalem) Based Processors"
256http://download.intel.com/design/processor/applnots/320354.pdf
257
258"Intel® 64 and IA-32 Architectures Software Developer's Manual
259Volume 3B: System Programming Guide" 254Volume 3B: System Programming Guide"
260http://www.intel.com/products/processor/manuals/ 255http://www.intel.com/products/processor/manuals/
261 256
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 323b65edfc97..9655cb49c7cb 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -372,7 +372,7 @@ void print_header(void)
372 if (do_rapl & RAPL_GFX) 372 if (do_rapl & RAPL_GFX)
373 outp += sprintf(outp, " GFX_J"); 373 outp += sprintf(outp, " GFX_J");
374 if (do_rapl & RAPL_DRAM) 374 if (do_rapl & RAPL_DRAM)
375 outp += sprintf(outp, " RAM_W"); 375 outp += sprintf(outp, " RAM_J");
376 if (do_rapl & RAPL_PKG_PERF_STATUS) 376 if (do_rapl & RAPL_PKG_PERF_STATUS)
377 outp += sprintf(outp, " PKG_%%"); 377 outp += sprintf(outp, " PKG_%%");
378 if (do_rapl & RAPL_DRAM_PERF_STATUS) 378 if (do_rapl & RAPL_DRAM_PERF_STATUS)
@@ -1157,7 +1157,7 @@ dump_nhm_platform_info(void)
1157 1157
1158 get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); 1158 get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr);
1159 1159
1160 fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr); 1160 fprintf(stderr, "cpu%d: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr);
1161 1161
1162 ratio = (msr >> 40) & 0xFF; 1162 ratio = (msr >> 40) & 0xFF;
1163 fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency frequency\n", 1163 fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency frequency\n",
@@ -1168,8 +1168,8 @@ dump_nhm_platform_info(void)
1168 ratio, bclk, ratio * bclk); 1168 ratio, bclk, ratio * bclk);
1169 1169
1170 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr); 1170 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr);
1171 fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", 1171 fprintf(stderr, "cpu%d: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n",
1172 msr, msr & 0x2 ? "EN" : "DIS"); 1172 base_cpu, msr, msr & 0x2 ? "EN" : "DIS");
1173 1173
1174 return; 1174 return;
1175} 1175}
@@ -1182,7 +1182,7 @@ dump_hsw_turbo_ratio_limits(void)
1182 1182
1183 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); 1183 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr);
1184 1184
1185 fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", msr); 1185 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", base_cpu, msr);
1186 1186
1187 ratio = (msr >> 8) & 0xFF; 1187 ratio = (msr >> 8) & 0xFF;
1188 if (ratio) 1188 if (ratio)
@@ -1204,7 +1204,7 @@ dump_ivt_turbo_ratio_limits(void)
1204 1204
1205 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); 1205 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr);
1206 1206
1207 fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", msr); 1207 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, msr);
1208 1208
1209 ratio = (msr >> 56) & 0xFF; 1209 ratio = (msr >> 56) & 0xFF;
1210 if (ratio) 1210 if (ratio)
@@ -1256,7 +1256,7 @@ dump_nhm_turbo_ratio_limits(void)
1256 1256
1257 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr); 1257 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr);
1258 1258
1259 fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", msr); 1259 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", base_cpu, msr);
1260 1260
1261 ratio = (msr >> 56) & 0xFF; 1261 ratio = (msr >> 56) & 0xFF;
1262 if (ratio) 1262 if (ratio)
@@ -1312,8 +1312,8 @@ dump_knl_turbo_ratio_limits(void)
1312 1312
1313 get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr); 1313 get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr);
1314 1314
1315 fprintf(stderr, "cpu0: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n", 1315 fprintf(stderr, "cpu%d: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n",
1316 msr); 1316 base_cpu, msr);
1317 1317
1318 /** 1318 /**
1319 * Turbo encoding in KNL is as follows: 1319 * Turbo encoding in KNL is as follows:
@@ -1371,7 +1371,7 @@ dump_nhm_cst_cfg(void)
1371#define SNB_C1_AUTO_UNDEMOTE (1UL << 27) 1371#define SNB_C1_AUTO_UNDEMOTE (1UL << 27)
1372#define SNB_C3_AUTO_UNDEMOTE (1UL << 28) 1372#define SNB_C3_AUTO_UNDEMOTE (1UL << 28)
1373 1373
1374 fprintf(stderr, "cpu0: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx", msr); 1374 fprintf(stderr, "cpu%d: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx", base_cpu, msr);
1375 1375
1376 fprintf(stderr, " (%s%s%s%s%slocked: pkg-cstate-limit=%d: %s)\n", 1376 fprintf(stderr, " (%s%s%s%s%slocked: pkg-cstate-limit=%d: %s)\n",
1377 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", 1377 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "",
@@ -1384,6 +1384,49 @@ dump_nhm_cst_cfg(void)
1384 return; 1384 return;
1385} 1385}
1386 1386
1387static void
1388dump_config_tdp(void)
1389{
1390 unsigned long long msr;
1391
1392 get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr);
1393 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr);
1394 fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xEF);
1395
1396 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr);
1397 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr);
1398 if (msr) {
1399 fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0xEFFF);
1400 fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0xEFFF);
1401 fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xEF);
1402 fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0xEFFF);
1403 }
1404 fprintf(stderr, ")\n");
1405
1406 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr);
1407 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr);
1408 if (msr) {
1409 fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0xEFFF);
1410 fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0xEFFF);
1411 fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xEF);
1412 fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0xEFFF);
1413 }
1414 fprintf(stderr, ")\n");
1415
1416 get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr);
1417 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr);
1418 if ((msr) & 0x3)
1419 fprintf(stderr, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3);
1420 fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1);
1421 fprintf(stderr, ")\n");
1422
1423 get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr);
1424 fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr);
1425 fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xEF);
1426 fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1);
1427 fprintf(stderr, ")\n");
1428}
1429
1387void free_all_buffers(void) 1430void free_all_buffers(void)
1388{ 1431{
1389 CPU_FREE(cpu_present_set); 1432 CPU_FREE(cpu_present_set);
@@ -1873,6 +1916,36 @@ int has_knl_turbo_ratio_limit(unsigned int family, unsigned int model)
1873 return 0; 1916 return 0;
1874 } 1917 }
1875} 1918}
1919int has_config_tdp(unsigned int family, unsigned int model)
1920{
1921 if (!genuine_intel)
1922 return 0;
1923
1924 if (family != 6)
1925 return 0;
1926
1927 switch (model) {
1928 case 0x3A: /* IVB */
1929 case 0x3E: /* IVB Xeon */
1930
1931 case 0x3C: /* HSW */
1932 case 0x3F: /* HSX */
1933 case 0x45: /* HSW */
1934 case 0x46: /* HSW */
1935 case 0x3D: /* BDW */
1936 case 0x47: /* BDW */
1937 case 0x4F: /* BDX */
1938 case 0x56: /* BDX-DE */
1939 case 0x4E: /* SKL */
1940 case 0x5E: /* SKL */
1941
1942 case 0x57: /* Knights Landing */
1943 return 1;
1944 default:
1945 return 0;
1946 }
1947}
1948
1876static void 1949static void
1877dump_cstate_pstate_config_info(family, model) 1950dump_cstate_pstate_config_info(family, model)
1878{ 1951{
@@ -1893,6 +1966,9 @@ dump_cstate_pstate_config_info(family, model)
1893 if (has_knl_turbo_ratio_limit(family, model)) 1966 if (has_knl_turbo_ratio_limit(family, model))
1894 dump_knl_turbo_ratio_limits(); 1967 dump_knl_turbo_ratio_limits();
1895 1968
1969 if (has_config_tdp(family, model))
1970 dump_config_tdp();
1971
1896 dump_nhm_cst_cfg(); 1972 dump_nhm_cst_cfg();
1897} 1973}
1898 1974
@@ -3014,7 +3090,7 @@ int get_and_dump_counters(void)
3014} 3090}
3015 3091
3016void print_version() { 3092void print_version() {
3017 fprintf(stderr, "turbostat version 4.7 27-May, 2015" 3093 fprintf(stderr, "turbostat version 4.7 17-June, 2015"
3018 " - Len Brown <lenb@kernel.org>\n"); 3094 " - Len Brown <lenb@kernel.org>\n");
3019} 3095}
3020 3096
@@ -3042,7 +3118,7 @@ void cmdline(int argc, char **argv)
3042 3118
3043 progname = argv[0]; 3119 progname = argv[0];
3044 3120
3045 while ((opt = getopt_long_only(argc, argv, "C:c:Ddhi:JM:m:PpST:v", 3121 while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:JM:m:PpST:v",
3046 long_options, &option_index)) != -1) { 3122 long_options, &option_index)) != -1) {
3047 switch (opt) { 3123 switch (opt) {
3048 case 'C': 3124 case 'C':