aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHubert Chrzaniuk <hubert.chrzaniuk@intel.com>2016-02-10 08:55:22 -0500
committerLen Brown <len.brown@intel.com>2016-03-13 03:55:38 -0400
commitcbf97abaf3689652bcddc0741dc49629d1838142 (patch)
treec085bc92795c8807a5923542490ecb19c3f21c7d /tools
parent121b48bb77187cf2ed3053e147d2e6c1e864083c (diff)
tools/power turbostat: Intel Xeon x200: fix turbo-ratio decoding
Following changes have been made: - changed MSR_NHM_TURBO_RATIO_LIMIT to MSR_TURBO_RATIO_LIMIT in debug print for consistency with Developer Manual - updated definition of bitfields in MSR_TURBO_RATIO_LIMIT and appropriate parsing code - added x200 to list of architectures that do not support Nahlem compatible definition of MSR_TURBO_RATIO_LIMIT register (x200 has the register but bits definition is custom) - fixed typo in code that parses MSR_TURBO_RATIO_LIMIT (logical instead of bitwise operator) - changed MSR_TURBO_RATIO_LIMIT parsing algorithm so the print out had the same order as implementations for other platforms Signed-off-by: Hubert Chrzaniuk <hubert.chrzaniuk@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/power/x86/turbostat/turbostat.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 652d08df5d12..4e5386d04709 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -1328,21 +1328,23 @@ dump_nhm_turbo_ratio_limits(void)
1328static void 1328static void
1329dump_knl_turbo_ratio_limits(void) 1329dump_knl_turbo_ratio_limits(void)
1330{ 1330{
1331 int cores; 1331 const unsigned int buckets_no = 7;
1332 unsigned int ratio; 1332
1333 unsigned long long msr; 1333 unsigned long long msr;
1334 int delta_cores; 1334 int delta_cores, delta_ratio;
1335 int delta_ratio; 1335 int i, b_nr;
1336 int i; 1336 unsigned int cores[buckets_no];
1337 unsigned int ratio[buckets_no];
1337 1338
1338 get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr); 1339 get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr);
1339 1340
1340 fprintf(stderr, "cpu%d: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n", 1341 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n",
1341 base_cpu, msr); 1342 base_cpu, msr);
1342 1343
1343 /** 1344 /**
1344 * Turbo encoding in KNL is as follows: 1345 * Turbo encoding in KNL is as follows:
1345 * [7:0] -- Base value of number of active cores of bucket 1. 1346 * [0] -- Reserved
1347 * [7:1] -- Base value of number of active cores of bucket 1.
1346 * [15:8] -- Base value of freq ratio of bucket 1. 1348 * [15:8] -- Base value of freq ratio of bucket 1.
1347 * [20:16] -- +ve delta of number of active cores of bucket 2. 1349 * [20:16] -- +ve delta of number of active cores of bucket 2.
1348 * i.e. active cores of bucket 2 = 1350 * i.e. active cores of bucket 2 =
@@ -1361,29 +1363,25 @@ dump_knl_turbo_ratio_limits(void)
1361 * [60:56]-- +ve delta of number of active cores of bucket 7. 1363 * [60:56]-- +ve delta of number of active cores of bucket 7.
1362 * [63:61]-- -ve delta of freq ratio of bucket 7. 1364 * [63:61]-- -ve delta of freq ratio of bucket 7.
1363 */ 1365 */
1364 cores = msr & 0xFF; 1366
1365 ratio = (msr >> 8) && 0xFF; 1367 b_nr = 0;
1366 if (ratio > 0) 1368 cores[b_nr] = (msr & 0xFF) >> 1;
1367 fprintf(stderr, 1369 ratio[b_nr] = (msr >> 8) & 0xFF;
1368 "%d * %.0f = %.0f MHz max turbo %d active cores\n", 1370
1369 ratio, bclk, ratio * bclk, cores); 1371 for (i = 16; i < 64; i += 8) {
1370
1371 for (i = 16; i < 64; i = i + 8) {
1372 delta_cores = (msr >> i) & 0x1F; 1372 delta_cores = (msr >> i) & 0x1F;
1373 delta_ratio = (msr >> (i + 5)) && 0x7; 1373 delta_ratio = (msr >> (i + 5)) & 0x7;
1374 if (!delta_cores || !delta_ratio) 1374
1375 return; 1375 cores[b_nr + 1] = cores[b_nr] + delta_cores;
1376 cores = cores + delta_cores; 1376 ratio[b_nr + 1] = ratio[b_nr] - delta_ratio;
1377 ratio = ratio - delta_ratio; 1377 b_nr++;
1378 1378 }
1379 /** -ve ratios will make successive ratio calculations 1379
1380 * negative. Hence return instead of carrying on. 1380 for (i = buckets_no - 1; i >= 0; i--)
1381 */ 1381 if (i > 0 ? ratio[i] != ratio[i - 1] : 1)
1382 if (ratio > 0)
1383 fprintf(stderr, 1382 fprintf(stderr,
1384 "%d * %.0f = %.0f MHz max turbo %d active cores\n", 1383 "%d * %.0f = %.0f MHz max turbo %d active cores\n",
1385 ratio, bclk, ratio * bclk, cores); 1384 ratio[i], bclk, ratio[i] * bclk, cores[i]);
1386 }
1387} 1385}
1388 1386
1389static void 1387static void
@@ -1896,6 +1894,7 @@ int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model)
1896 /* Nehalem compatible, but do not include turbo-ratio limit support */ 1894 /* Nehalem compatible, but do not include turbo-ratio limit support */
1897 case 0x2E: /* Nehalem-EX Xeon - Beckton */ 1895 case 0x2E: /* Nehalem-EX Xeon - Beckton */
1898 case 0x2F: /* Westmere-EX Xeon - Eagleton */ 1896 case 0x2F: /* Westmere-EX Xeon - Eagleton */
1897 case 0x57: /* PHI - Knights Landing (different MSR definition) */
1899 return 0; 1898 return 0;
1900 default: 1899 default:
1901 return 1; 1900 return 1;