Skip to content

Commit 6fb3143

Browse files
committed
tools/power turbostat: dump CONFIG_TDP
Config TDP is a feature that allows parts to be configured for different thermal limits after they have left the factory. This can have an effect on the operation of the part, particularly in determiniing... Max Non-turbo Ratio Turbo Activation Ratio Signed-off-by: Len Brown <len.brown@intel.com>
1 parent bfae205 commit 6fb3143

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

arch/x86/include/uapi/asm/msr-index.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@
169169
#define MSR_PP1_ENERGY_STATUS 0x00000641
170170
#define MSR_PP1_POLICY 0x00000642
171171

172+
#define MSR_CONFIG_TDP_NOMINAL 0x00000648
173+
#define MSR_CONFIG_TDP_LEVEL_1 0x00000649
174+
#define MSR_CONFIG_TDP_LEVEL_2 0x0000064A
175+
#define MSR_CONFIG_TDP_CONTROL 0x0000064B
176+
#define MSR_TURBO_ACTIVATION_RATIO 0x0000064C
177+
172178
#define MSR_PKG_WEIGHTED_CORE_C0_RES 0x00000658
173179
#define MSR_PKG_ANY_CORE_C0_RES 0x00000659
174180
#define MSR_PKG_ANY_GFXE_C0_RES 0x0000065A

tools/power/x86/turbostat/turbostat.c

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,49 @@ dump_nhm_cst_cfg(void)
13841384
return;
13851385
}
13861386

1387+
static void
1388+
dump_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+
13871430
void free_all_buffers(void)
13881431
{
13891432
CPU_FREE(cpu_present_set);
@@ -1873,6 +1916,36 @@ int has_knl_turbo_ratio_limit(unsigned int family, unsigned int model)
18731916
return 0;
18741917
}
18751918
}
1919+
int 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+
18761949
static void
18771950
dump_cstate_pstate_config_info(family, model)
18781951
{
@@ -1893,6 +1966,9 @@ dump_cstate_pstate_config_info(family, model)
18931966
if (has_knl_turbo_ratio_limit(family, model))
18941967
dump_knl_turbo_ratio_limits();
18951968

1969+
if (has_config_tdp(family, model))
1970+
dump_config_tdp();
1971+
18961972
dump_nhm_cst_cfg();
18971973
}
18981974

@@ -3014,7 +3090,7 @@ int get_and_dump_counters(void)
30143090
}
30153091

30163092
void print_version() {
3017-
fprintf(stderr, "turbostat version 4.7 27-May, 2015"
3093+
fprintf(stderr, "turbostat version 4.7 17-June, 2015"
30183094
" - Len Brown <lenb@kernel.org>\n");
30193095
}
30203096

0 commit comments

Comments
 (0)