Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/power turbostat: Cleanup internal use of "base_cpu"

Disambiguate the uses "base_cpu":

master_cpu: lowest permitted cpu#, read global MSRs here
package_data.first_cpu: lowest permitted cpu# in that package
core_data.first_cpu: lowest permitted cpu# in the core
current_cpu: where I'm running now

No functional change.

Signed-off-by: Len Brown <len.brown@intel.com>

Len Brown 54ca69f3 dd23bfe4

+100 -100
+100 -100
tools/power/x86/turbostat/turbostat.c
··· 534 534 double rapl_joule_counter_range; 535 535 unsigned int crystal_hz; 536 536 unsigned long long tsc_hz; 537 - int base_cpu; 537 + int master_cpu; 538 538 unsigned int has_hwp; /* IA32_PM_ENABLE, IA32_HWP_CAPABILITIES */ 539 539 /* IA32_HWP_REQUEST, IA32_HWP_STATUS */ 540 540 unsigned int has_hwp_notify; /* IA32_HWP_INTERRUPT */ ··· 626 626 unsigned int i; 627 627 double freq; 628 628 629 - if (get_msr(base_cpu, MSR_FSB_FREQ, &msr)) 629 + if (get_msr(master_cpu, MSR_FSB_FREQ, &msr)) 630 630 fprintf(outf, "SLM BCLK: unknown\n"); 631 631 632 632 i = msr & 0xf; ··· 2136 2136 } *thread_even, *thread_odd; 2137 2137 2138 2138 struct core_data { 2139 - int base_cpu; 2139 + int first_cpu; 2140 2140 unsigned long long c3; 2141 2141 unsigned long long c6; 2142 2142 unsigned long long c7; ··· 2151 2151 } *core_even, *core_odd; 2152 2152 2153 2153 struct pkg_data { 2154 - int base_cpu; 2154 + int first_cpu; 2155 2155 unsigned long long pc2; 2156 2156 unsigned long long pc3; 2157 2157 unsigned long long pc6; ··· 2486 2486 2487 2487 int is_cpu_first_thread_in_core(struct thread_data *t, struct core_data *c) 2488 2488 { 2489 - return ((int)t->cpu_id == c->base_cpu || c->base_cpu < 0); 2489 + return ((int)t->cpu_id == c->first_cpu || c->first_cpu < 0); 2490 2490 } 2491 2491 2492 2492 int is_cpu_first_core_in_package(struct thread_data *t, struct pkg_data *p) 2493 2493 { 2494 - return ((int)t->cpu_id == p->base_cpu || p->base_cpu < 0); 2494 + return ((int)t->cpu_id == p->first_cpu || p->first_cpu < 0); 2495 2495 } 2496 2496 2497 2497 int is_cpu_first_thread_in_package(struct thread_data *t, struct core_data *c, struct pkg_data *p) ··· 5455 5455 return; 5456 5456 } 5457 5457 5458 - get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); 5458 + get_msr(master_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); 5459 5459 pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; 5460 5460 } 5461 5461 ··· 5467 5467 if (!platform->has_nhm_msrs || no_msr) 5468 5468 return; 5469 5469 5470 - get_msr(base_cpu, MSR_PLATFORM_INFO, &msr); 5470 + get_msr(master_cpu, MSR_PLATFORM_INFO, &msr); 5471 5471 5472 - fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr); 5472 + fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", master_cpu, msr); 5473 5473 5474 5474 ratio = (msr >> 40) & 0xFF; 5475 5475 fprintf(outf, "%d * %.1f = %.1f MHz max efficiency frequency\n", ratio, bclk, ratio * bclk); ··· 5485 5485 if (!platform->has_nhm_msrs || no_msr) 5486 5486 return; 5487 5487 5488 - get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr); 5489 - fprintf(outf, "cpu%d: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", base_cpu, msr, msr & 0x2 ? "EN" : "DIS"); 5488 + get_msr(master_cpu, MSR_IA32_POWER_CTL, &msr); 5489 + fprintf(outf, "cpu%d: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", master_cpu, msr, msr & 0x2 ? "EN" : "DIS"); 5490 5490 5491 5491 /* C-state Pre-wake Disable (CSTATE_PREWAKE_DISABLE) */ 5492 5492 if (platform->has_cst_prewake_bit) ··· 5500 5500 unsigned long long msr; 5501 5501 unsigned int ratio; 5502 5502 5503 - get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); 5503 + get_msr(master_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); 5504 5504 5505 - fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", base_cpu, msr); 5505 + fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", master_cpu, msr); 5506 5506 5507 5507 ratio = (msr >> 8) & 0xFF; 5508 5508 if (ratio) ··· 5519 5519 unsigned long long msr; 5520 5520 unsigned int ratio; 5521 5521 5522 - get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); 5522 + get_msr(master_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); 5523 5523 5524 - fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, msr); 5524 + fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", master_cpu, msr); 5525 5525 5526 5526 ratio = (msr >> 56) & 0xFF; 5527 5527 if (ratio) ··· 5562 5562 unsigned long long msr, core_counts; 5563 5563 int shift; 5564 5564 5565 - get_msr(base_cpu, trl_msr_offset, &msr); 5565 + get_msr(master_cpu, trl_msr_offset, &msr); 5566 5566 fprintf(outf, "cpu%d: MSR_%sTURBO_RATIO_LIMIT: 0x%08llx\n", 5567 - base_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); 5567 + master_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); 5568 5568 5569 5569 if (platform->trl_msrs & TRL_CORECOUNT) { 5570 - get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &core_counts); 5571 - fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, core_counts); 5570 + get_msr(master_cpu, MSR_TURBO_RATIO_LIMIT1, &core_counts); 5571 + fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", master_cpu, core_counts); 5572 5572 } else { 5573 5573 core_counts = 0x0807060504030201; 5574 5574 } ··· 5590 5590 unsigned long long msr; 5591 5591 unsigned int ratio; 5592 5592 5593 - get_msr(base_cpu, MSR_ATOM_CORE_RATIOS, &msr); 5594 - fprintf(outf, "cpu%d: MSR_ATOM_CORE_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF); 5593 + get_msr(master_cpu, MSR_ATOM_CORE_RATIOS, &msr); 5594 + fprintf(outf, "cpu%d: MSR_ATOM_CORE_RATIOS: 0x%08llx\n", master_cpu, msr & 0xFFFFFFFF); 5595 5595 5596 5596 ratio = (msr >> 0) & 0x3F; 5597 5597 if (ratio) ··· 5605 5605 if (ratio) 5606 5606 fprintf(outf, "%d * %.1f = %.1f MHz base frequency\n", ratio, bclk, ratio * bclk); 5607 5607 5608 - get_msr(base_cpu, MSR_ATOM_CORE_TURBO_RATIOS, &msr); 5609 - fprintf(outf, "cpu%d: MSR_ATOM_CORE_TURBO_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF); 5608 + get_msr(master_cpu, MSR_ATOM_CORE_TURBO_RATIOS, &msr); 5609 + fprintf(outf, "cpu%d: MSR_ATOM_CORE_TURBO_RATIOS: 0x%08llx\n", master_cpu, msr & 0xFFFFFFFF); 5610 5610 5611 5611 ratio = (msr >> 24) & 0x3F; 5612 5612 if (ratio) ··· 5635 5635 unsigned int cores[buckets_no]; 5636 5636 unsigned int ratio[buckets_no]; 5637 5637 5638 - get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr); 5638 + get_msr(master_cpu, MSR_TURBO_RATIO_LIMIT, &msr); 5639 5639 5640 - fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", base_cpu, msr); 5640 + fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", master_cpu, msr); 5641 5641 5642 5642 /* 5643 5643 * Turbo encoding in KNL is as follows: ··· 5687 5687 if (!platform->has_nhm_msrs || no_msr) 5688 5688 return; 5689 5689 5690 - get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); 5690 + get_msr(master_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); 5691 5691 5692 - fprintf(outf, "cpu%d: MSR_PKG_CST_CONFIG_CONTROL: 0x%08llx", base_cpu, msr); 5692 + fprintf(outf, "cpu%d: MSR_PKG_CST_CONFIG_CONTROL: 0x%08llx", master_cpu, msr); 5693 5693 5694 5694 fprintf(outf, " (%s%s%s%s%slocked, pkg-cstate-limit=%d (%s)", 5695 5695 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", ··· 5712 5712 { 5713 5713 unsigned long long msr; 5714 5714 5715 - get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr); 5716 - fprintf(outf, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr); 5715 + get_msr(master_cpu, MSR_CONFIG_TDP_NOMINAL, &msr); 5716 + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", master_cpu, msr); 5717 5717 fprintf(outf, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF); 5718 5718 5719 - get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr); 5720 - fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr); 5719 + get_msr(master_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr); 5720 + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", master_cpu, msr); 5721 5721 if (msr) { 5722 5722 fprintf(outf, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0x7FFF); 5723 5723 fprintf(outf, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0x7FFF); ··· 5726 5726 } 5727 5727 fprintf(outf, ")\n"); 5728 5728 5729 - get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr); 5730 - fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr); 5729 + get_msr(master_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr); 5730 + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", master_cpu, msr); 5731 5731 if (msr) { 5732 5732 fprintf(outf, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0x7FFF); 5733 5733 fprintf(outf, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0x7FFF); ··· 5736 5736 } 5737 5737 fprintf(outf, ")\n"); 5738 5738 5739 - get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr); 5740 - fprintf(outf, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr); 5739 + get_msr(master_cpu, MSR_CONFIG_TDP_CONTROL, &msr); 5740 + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", master_cpu, msr); 5741 5741 if ((msr) & 0x3) 5742 5742 fprintf(outf, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3); 5743 5743 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); 5744 5744 fprintf(outf, ")\n"); 5745 5745 5746 - get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); 5747 - fprintf(outf, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); 5746 + get_msr(master_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); 5747 + fprintf(outf, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", master_cpu, msr); 5748 5748 fprintf(outf, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF); 5749 5749 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); 5750 5750 fprintf(outf, ")\n"); ··· 5760 5760 return; 5761 5761 5762 5762 if (platform->supported_cstates & PC3) { 5763 - get_msr(base_cpu, MSR_PKGC3_IRTL, &msr); 5764 - fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr); 5763 + get_msr(master_cpu, MSR_PKGC3_IRTL, &msr); 5764 + fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", master_cpu, msr); 5765 5765 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 5766 5766 } 5767 5767 5768 5768 if (platform->supported_cstates & PC6) { 5769 - get_msr(base_cpu, MSR_PKGC6_IRTL, &msr); 5770 - fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", base_cpu, msr); 5769 + get_msr(master_cpu, MSR_PKGC6_IRTL, &msr); 5770 + fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", master_cpu, msr); 5771 5771 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 5772 5772 } 5773 5773 5774 5774 if (platform->supported_cstates & PC7) { 5775 - get_msr(base_cpu, MSR_PKGC7_IRTL, &msr); 5776 - fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr); 5775 + get_msr(master_cpu, MSR_PKGC7_IRTL, &msr); 5776 + fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", master_cpu, msr); 5777 5777 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 5778 5778 } 5779 5779 5780 5780 if (platform->supported_cstates & PC8) { 5781 - get_msr(base_cpu, MSR_PKGC8_IRTL, &msr); 5782 - fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr); 5781 + get_msr(master_cpu, MSR_PKGC8_IRTL, &msr); 5782 + fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", master_cpu, msr); 5783 5783 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 5784 5784 } 5785 5785 5786 5786 if (platform->supported_cstates & PC9) { 5787 - get_msr(base_cpu, MSR_PKGC9_IRTL, &msr); 5788 - fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr); 5787 + get_msr(master_cpu, MSR_PKGC9_IRTL, &msr); 5788 + fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", master_cpu, msr); 5789 5789 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 5790 5790 } 5791 5791 5792 5792 if (platform->supported_cstates & PC10) { 5793 - get_msr(base_cpu, MSR_PKGC10_IRTL, &msr); 5794 - fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr); 5793 + get_msr(master_cpu, MSR_PKGC10_IRTL, &msr); 5794 + fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", master_cpu, msr); 5795 5795 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 5796 5796 } 5797 5797 } ··· 6370 6370 void set_max_cpu_num(void) 6371 6371 { 6372 6372 FILE *filep; 6373 - int base_cpu; 6373 + int current_cpu; 6374 6374 unsigned long dummy; 6375 6375 char pathname[64]; 6376 6376 6377 - base_cpu = sched_getcpu(); 6378 - if (base_cpu < 0) 6377 + current_cpu = sched_getcpu(); 6378 + if (current_cpu < 0) 6379 6379 err(1, "cannot find calling cpu ID"); 6380 - sprintf(pathname, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings", base_cpu); 6380 + sprintf(pathname, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings", current_cpu); 6381 6381 6382 6382 filep = fopen_or_die(pathname, "r"); 6383 6383 topo.max_cpu_num = 0; ··· 6940 6940 struct stat sb; 6941 6941 char pathname[32]; 6942 6942 6943 - sprintf(pathname, "/dev/msr%d", base_cpu); 6943 + sprintf(pathname, "/dev/msr%d", master_cpu); 6944 6944 return !stat(pathname, &sb); 6945 6945 } 6946 6946 ··· 6949 6949 struct stat sb; 6950 6950 char pathname[32]; 6951 6951 6952 - sprintf(pathname, "/dev/cpu/%d/msr", base_cpu); 6952 + sprintf(pathname, "/dev/cpu/%d/msr", master_cpu); 6953 6953 return !stat(pathname, &sb); 6954 6954 } 6955 6955 ··· 7026 7026 failed += check_for_cap_sys_rawio(); 7027 7027 7028 7028 /* test file permissions */ 7029 - sprintf(pathname, use_android_msr_path ? "/dev/msr%d" : "/dev/cpu/%d/msr", base_cpu); 7029 + sprintf(pathname, use_android_msr_path ? "/dev/msr%d" : "/dev/cpu/%d/msr", master_cpu); 7030 7030 if (euidaccess(pathname, R_OK)) { 7031 7031 failed++; 7032 7032 } ··· 7055 7055 else 7056 7056 return; 7057 7057 7058 - get_msr(base_cpu, MSR_PLATFORM_INFO, &msr); 7058 + get_msr(master_cpu, MSR_PLATFORM_INFO, &msr); 7059 7059 base_ratio = (msr >> 8) & 0xFF; 7060 7060 7061 7061 base_hz = base_ratio * bclk * 1000000; ··· 7402 7402 7403 7403 for (state = 0; state < 10; ++state) { 7404 7404 7405 - sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", base_cpu, state); 7405 + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", master_cpu, state); 7406 7406 input = fopen(path, "r"); 7407 7407 if (input == NULL) 7408 7408 continue; ··· 7418 7418 7419 7419 remove_underbar(name_buf); 7420 7420 7421 - sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc", base_cpu, state); 7421 + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc", master_cpu, state); 7422 7422 input = fopen(path, "r"); 7423 7423 if (input == NULL) 7424 7424 continue; 7425 7425 if (!fgets(desc, sizeof(desc), input)) 7426 7426 err(1, "%s: failed to read file", path); 7427 7427 7428 - fprintf(outf, "cpu%d: %s: %s", base_cpu, name_buf, desc); 7428 + fprintf(outf, "cpu%d: %s: %s", master_cpu, name_buf, desc); 7429 7429 fclose(input); 7430 7430 } 7431 7431 } ··· 7438 7438 FILE *input; 7439 7439 int turbo; 7440 7440 7441 - sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_driver", base_cpu); 7441 + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_driver", master_cpu); 7442 7442 input = fopen(path, "r"); 7443 7443 if (input == NULL) { 7444 7444 fprintf(outf, "NSFOD %s\n", path); ··· 7448 7448 err(1, "%s: failed to read file", path); 7449 7449 fclose(input); 7450 7450 7451 - sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", base_cpu); 7451 + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", master_cpu); 7452 7452 input = fopen(path, "r"); 7453 7453 if (input == NULL) { 7454 7454 fprintf(outf, "NSFOD %s\n", path); ··· 7458 7458 err(1, "%s: failed to read file", path); 7459 7459 fclose(input); 7460 7460 7461 - fprintf(outf, "cpu%d: cpufreq driver: %s", base_cpu, driver_buf); 7462 - fprintf(outf, "cpu%d: cpufreq governor: %s", base_cpu, governor_buf); 7461 + fprintf(outf, "cpu%d: cpufreq driver: %s", master_cpu, driver_buf); 7462 + fprintf(outf, "cpu%d: cpufreq governor: %s", master_cpu, governor_buf); 7463 7463 7464 7464 sprintf(path, "/sys/devices/system/cpu/cpufreq/boost"); 7465 7465 input = fopen(path, "r"); ··· 7721 7721 unsigned long long msr; 7722 7722 7723 7723 if (valid_rapl_msrs & RAPL_PKG_POWER_INFO) 7724 - if (!get_msr(base_cpu, MSR_PKG_POWER_INFO, &msr)) 7724 + if (!get_msr(master_cpu, MSR_PKG_POWER_INFO, &msr)) 7725 7725 return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; 7726 7726 return get_quirk_tdp(); 7727 7727 } ··· 7760 7760 CLR_BIC(BIC_RAM__, &bic_enabled); 7761 7761 7762 7762 /* units on package 0, verify later other packages match */ 7763 - if (get_msr(base_cpu, MSR_RAPL_POWER_UNIT, &msr)) 7763 + if (get_msr(master_cpu, MSR_RAPL_POWER_UNIT, &msr)) 7764 7764 return; 7765 7765 7766 7766 rapl_power_units = 1.0 / (1 << (msr & 0xF)); ··· 7808 7808 if (!valid_rapl_msrs || no_msr) 7809 7809 return; 7810 7810 7811 - if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr)) 7811 + if (get_msr(master_cpu, MSR_RAPL_PWR_UNIT, &msr)) 7812 7812 return; 7813 7813 7814 7814 rapl_time_units = ldexp(1.0, -(msr >> 16 & 0xf)); ··· 8119 8119 if (offset < 0) 8120 8120 return; 8121 8121 8122 - ret = get_msr(base_cpu, offset, &msr_value); 8122 + ret = get_msr(master_cpu, offset, &msr_value); 8123 8123 if (ret) { 8124 8124 if (debug) 8125 8125 fprintf(outf, "Can not read RAPL_PKG_ENERGY MSR(0x%llx)\n", (unsigned long long)offset); ··· 8204 8204 if (!platform->has_nhm_msrs || no_msr) 8205 8205 goto guess; 8206 8206 8207 - if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr)) 8207 + if (get_msr(master_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr)) 8208 8208 goto guess; 8209 8209 8210 8210 tcc_default = (msr >> 16) & 0xFF; ··· 8213 8213 int bits = platform->tcc_offset_bits; 8214 8214 unsigned long long enabled = 0; 8215 8215 8216 - if (bits && !get_msr(base_cpu, MSR_PLATFORM_INFO, &enabled)) 8216 + if (bits && !get_msr(master_cpu, MSR_PLATFORM_INFO, &enabled)) 8217 8217 enabled = (enabled >> 30) & 1; 8218 8218 8219 8219 if (bits && enabled) { ··· 8351 8351 if (quiet) 8352 8352 return; 8353 8353 8354 - if (!get_msr(base_cpu, MSR_IA32_FEAT_CTL, &msr)) 8354 + if (!get_msr(master_cpu, MSR_IA32_FEAT_CTL, &msr)) 8355 8355 fprintf(outf, "cpu%d: MSR_IA32_FEATURE_CONTROL: 0x%08llx (%sLocked %s)\n", 8356 - base_cpu, msr, msr & FEAT_CTL_LOCKED ? "" : "UN-", msr & (1 << 18) ? "SGX" : ""); 8356 + master_cpu, msr, msr & FEAT_CTL_LOCKED ? "" : "UN-", msr & (1 << 18) ? "SGX" : ""); 8357 8357 } 8358 8358 8359 8359 void decode_misc_enable_msr(void) ··· 8366 8366 if (!genuine_intel) 8367 8367 return; 8368 8368 8369 - if (!get_msr(base_cpu, MSR_IA32_MISC_ENABLE, &msr)) 8369 + if (!get_msr(master_cpu, MSR_IA32_MISC_ENABLE, &msr)) 8370 8370 fprintf(outf, "cpu%d: MSR_IA32_MISC_ENABLE: 0x%08llx (%sTCC %sEIST %sMWAIT %sPREFETCH %sTURBO)\n", 8371 - base_cpu, msr, 8371 + master_cpu, msr, 8372 8372 msr & MSR_IA32_MISC_ENABLE_TM1 ? "" : "No-", 8373 8373 msr & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP ? "" : "No-", 8374 8374 msr & MSR_IA32_MISC_ENABLE_MWAIT ? "" : "No-", ··· 8385 8385 if (!platform->has_msr_misc_feature_control) 8386 8386 return; 8387 8387 8388 - if (!get_msr(base_cpu, MSR_MISC_FEATURE_CONTROL, &msr)) 8388 + if (!get_msr(master_cpu, MSR_MISC_FEATURE_CONTROL, &msr)) 8389 8389 fprintf(outf, 8390 8390 "cpu%d: MSR_MISC_FEATURE_CONTROL: 0x%08llx (%sL2-Prefetch %sL2-Prefetch-pair %sL1-Prefetch %sL1-IP-Prefetch)\n", 8391 - base_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "", 8391 + master_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "", 8392 8392 msr & (2 << 0) ? "No-" : "", msr & (3 << 0) ? "No-" : ""); 8393 8393 } 8394 8394 ··· 8409 8409 if (!platform->has_msr_misc_pwr_mgmt) 8410 8410 return; 8411 8411 8412 - if (!get_msr(base_cpu, MSR_MISC_PWR_MGMT, &msr)) 8412 + if (!get_msr(master_cpu, MSR_MISC_PWR_MGMT, &msr)) 8413 8413 fprintf(outf, "cpu%d: MSR_MISC_PWR_MGMT: 0x%08llx (%sable-EIST_Coordination %sable-EPB %sable-OOB)\n", 8414 - base_cpu, msr, msr & (1 << 0) ? "DIS" : "EN", msr & (1 << 1) ? "EN" : "DIS", msr & (1 << 8) ? "EN" : "DIS"); 8414 + master_cpu, msr, msr & (1 << 0) ? "DIS" : "EN", msr & (1 << 1) ? "EN" : "DIS", msr & (1 << 8) ? "EN" : "DIS"); 8415 8415 } 8416 8416 8417 8417 /* ··· 8430 8430 if (!platform->has_msr_c6_demotion_policy_config) 8431 8431 return; 8432 8432 8433 - if (!get_msr(base_cpu, MSR_CC6_DEMOTION_POLICY_CONFIG, &msr)) 8433 + if (!get_msr(master_cpu, MSR_CC6_DEMOTION_POLICY_CONFIG, &msr)) 8434 8434 fprintf(outf, "cpu%d: MSR_CC6_DEMOTION_POLICY_CONFIG: 0x%08llx (%sable-CC6-Demotion)\n", 8435 - base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); 8435 + master_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); 8436 8436 8437 - if (!get_msr(base_cpu, MSR_MC6_DEMOTION_POLICY_CONFIG, &msr)) 8437 + if (!get_msr(master_cpu, MSR_MC6_DEMOTION_POLICY_CONFIG, &msr)) 8438 8438 fprintf(outf, "cpu%d: MSR_MC6_DEMOTION_POLICY_CONFIG: 0x%08llx (%sable-MC6-Demotion)\n", 8439 - base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); 8439 + master_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); 8440 8440 } 8441 8441 8442 8442 void print_dev_latency(void) ··· 8471 8471 if (no_perf) 8472 8472 return 0; 8473 8473 8474 - fd = open_perf_counter(base_cpu, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS, -1, 0); 8474 + fd = open_perf_counter(master_cpu, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS, -1, 0); 8475 8475 if (fd != -1) 8476 8476 close(fd); 8477 8477 ··· 8701 8701 8702 8702 domain_visited[next_domain] = 1; 8703 8703 8704 - if ((cai->flags & RAPL_COUNTER_FLAG_PLATFORM_COUNTER) && (cpu != base_cpu)) 8704 + if ((cai->flags & RAPL_COUNTER_FLAG_PLATFORM_COUNTER) && (cpu != master_cpu)) 8705 8705 continue; 8706 8706 8707 8707 struct rapl_counter_info_t *rci = &rapl_counter_info_perdomain[next_domain]; ··· 9348 9348 if (no_perf) 9349 9349 return 0; 9350 9350 9351 - fd = open_perf_counter(base_cpu, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES, -1, PERF_FORMAT_GROUP); 9351 + fd = open_perf_counter(master_cpu, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES, -1, PERF_FORMAT_GROUP); 9352 9352 if (fd != -1) 9353 9353 close(fd); 9354 9354 ··· 9710 9710 9711 9711 for (i = 0; i < num_cores; i++) { 9712 9712 (*c)[i].core_id = -1; 9713 - (*c)[i].base_cpu = -1; 9713 + (*c)[i].first_cpu = -1; 9714 9714 } 9715 9715 9716 9716 *p = calloc(topo.num_packages, sizeof(struct pkg_data)); ··· 9719 9719 9720 9720 for (i = 0; i < topo.num_packages; i++) { 9721 9721 (*p)[i].package_id = i; 9722 - (*p)[i].base_cpu = -1; 9722 + (*p)[i].first_cpu = -1; 9723 9723 } 9724 9724 9725 9725 return; ··· 9753 9753 t->cpu_id = cpu_id; 9754 9754 if (!cpu_is_not_allowed(cpu_id)) { 9755 9755 9756 - if (c->base_cpu < 0) 9757 - c->base_cpu = t->cpu_id; 9758 - if (pkg_base[pkg_id].base_cpu < 0) 9759 - pkg_base[pkg_id].base_cpu = t->cpu_id; 9756 + if (c->first_cpu < 0) 9757 + c->first_cpu = t->cpu_id; 9758 + if (pkg_base[pkg_id].first_cpu < 0) 9759 + pkg_base[pkg_id].first_cpu = t->cpu_id; 9760 9760 } 9761 9761 9762 9762 c->core_id = core_id; ··· 9803 9803 int update_topo(PER_THREAD_PARAMS) 9804 9804 { 9805 9805 topo.allowed_cpus++; 9806 - if ((int)t->cpu_id == c->base_cpu) 9806 + if ((int)t->cpu_id == c->first_cpu) 9807 9807 topo.allowed_cores++; 9808 - if ((int)t->cpu_id == p->base_cpu) 9808 + if ((int)t->cpu_id == p->first_cpu) 9809 9809 topo.allowed_packages++; 9810 9810 9811 9811 return 0; ··· 9831 9831 topology_update(); 9832 9832 } 9833 9833 9834 - void set_base_cpu(void) 9834 + void set_master_cpu(void) 9835 9835 { 9836 9836 int i; 9837 9837 9838 9838 for (i = 0; i < topo.max_cpu_num + 1; ++i) { 9839 9839 if (cpu_is_not_allowed(i)) 9840 9840 continue; 9841 - base_cpu = i; 9841 + master_cpu = i; 9842 9842 if (debug > 1) 9843 - fprintf(outf, "base_cpu = %d\n", base_cpu); 9843 + fprintf(outf, "master_cpu = %d\n", master_cpu); 9844 9844 return; 9845 9845 } 9846 9846 err(-ENODEV, "No valid cpus found"); ··· 10416 10416 void turbostat_init() 10417 10417 { 10418 10418 setup_all_buffers(true); 10419 - set_base_cpu(); 10419 + set_master_cpu(); 10420 10420 check_msr_access(); 10421 10421 check_perf_access(); 10422 10422 process_cpuid(); ··· 10434 10434 for_all_cpus(get_cpu_type, ODD_COUNTERS); 10435 10435 for_all_cpus(get_cpu_type, EVEN_COUNTERS); 10436 10436 10437 - if (BIC_IS_ENABLED(BIC_IPC) && has_aperf_access && get_instr_count_fd(base_cpu) != -1) 10437 + if (BIC_IS_ENABLED(BIC_IPC) && has_aperf_access && get_instr_count_fd(master_cpu) != -1) 10438 10438 BIC_PRESENT(BIC_IPC); 10439 10439 10440 10440 /* ··· 11251 11251 11252 11252 for (state = 10; state >= 0; --state) { 11253 11253 11254 - sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", base_cpu, state); 11254 + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", master_cpu, state); 11255 11255 input = fopen(path, "r"); 11256 11256 if (input == NULL) 11257 11257 continue; ··· 11300 11300 11301 11301 for (state = 10; state >= 0; --state) { 11302 11302 11303 - sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", base_cpu, state); 11303 + sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", master_cpu, state); 11304 11304 input = fopen(path, "r"); 11305 11305 if (input == NULL) 11306 11306 continue;