diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-10 18:01:21 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-10 18:01:21 -0500 |
commit | 89ba7d8c22acb43e318ca1c82e25c8b75ef7a7b2 (patch) | |
tree | 6cac4a7b00d76d56c299d77fc0b0e9d5809d9de5 /tools | |
parent | 57ab3b08725163bfe385aaeea6837f9b1213af3d (diff) | |
parent | 759d2a932b82009a7039ef5567e7dcba153ce123 (diff) |
Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux into pm-tools
Pull turbostat changes for v4.4 from Len Brown.
* 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
tools/power turbostat: bugfix: print MAX_NON_TURBO_RATIO
tools/power turbostat: simplify Bzy_MHz calculation
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index bde0ef1a63df..d8e4b20b6d54 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -75,6 +75,7 @@ unsigned int aperf_mperf_multiplier = 1; | |||
75 | int do_smi; | 75 | int do_smi; |
76 | double bclk; | 76 | double bclk; |
77 | double base_hz; | 77 | double base_hz; |
78 | unsigned int has_base_hz; | ||
78 | double tsc_tweak = 1.0; | 79 | double tsc_tweak = 1.0; |
79 | unsigned int show_pkg; | 80 | unsigned int show_pkg; |
80 | unsigned int show_core; | 81 | unsigned int show_core; |
@@ -96,6 +97,7 @@ unsigned int do_ring_perf_limit_reasons; | |||
96 | unsigned int crystal_hz; | 97 | unsigned int crystal_hz; |
97 | unsigned long long tsc_hz; | 98 | unsigned long long tsc_hz; |
98 | int base_cpu; | 99 | int base_cpu; |
100 | double discover_bclk(unsigned int family, unsigned int model); | ||
99 | 101 | ||
100 | #define RAPL_PKG (1 << 0) | 102 | #define RAPL_PKG (1 << 0) |
101 | /* 0x610 MSR_PKG_POWER_LIMIT */ | 103 | /* 0x610 MSR_PKG_POWER_LIMIT */ |
@@ -511,9 +513,13 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
511 | } | 513 | } |
512 | 514 | ||
513 | /* Bzy_MHz */ | 515 | /* Bzy_MHz */ |
514 | if (has_aperf) | 516 | if (has_aperf) { |
515 | outp += sprintf(outp, "%8.0f", | 517 | if (has_base_hz) |
516 | 1.0 * t->tsc * tsc_tweak / units * t->aperf / t->mperf / interval_float); | 518 | outp += sprintf(outp, "%8.0f", base_hz / units * t->aperf / t->mperf); |
519 | else | ||
520 | outp += sprintf(outp, "%8.0f", | ||
521 | 1.0 * t->tsc / units * t->aperf / t->mperf / interval_float); | ||
522 | } | ||
517 | 523 | ||
518 | /* TSC_MHz */ | 524 | /* TSC_MHz */ |
519 | outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); | 525 | outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); |
@@ -1158,12 +1164,6 @@ int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, | |||
1158 | static void | 1164 | static void |
1159 | calculate_tsc_tweak() | 1165 | calculate_tsc_tweak() |
1160 | { | 1166 | { |
1161 | unsigned long long msr; | ||
1162 | unsigned int base_ratio; | ||
1163 | |||
1164 | get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); | ||
1165 | base_ratio = (msr >> 8) & 0xFF; | ||
1166 | base_hz = base_ratio * bclk * 1000000; | ||
1167 | tsc_tweak = base_hz / tsc_hz; | 1167 | tsc_tweak = base_hz / tsc_hz; |
1168 | } | 1168 | } |
1169 | 1169 | ||
@@ -1440,7 +1440,7 @@ dump_config_tdp(void) | |||
1440 | 1440 | ||
1441 | get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); | 1441 | get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); |
1442 | fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); | 1442 | fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); |
1443 | fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xEF); | 1443 | fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0x7F); |
1444 | fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1); | 1444 | fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1); |
1445 | fprintf(stderr, ")\n"); | 1445 | fprintf(stderr, ")\n"); |
1446 | } | 1446 | } |
@@ -1821,6 +1821,7 @@ void check_permissions() | |||
1821 | int probe_nhm_msrs(unsigned int family, unsigned int model) | 1821 | int probe_nhm_msrs(unsigned int family, unsigned int model) |
1822 | { | 1822 | { |
1823 | unsigned long long msr; | 1823 | unsigned long long msr; |
1824 | unsigned int base_ratio; | ||
1824 | int *pkg_cstate_limits; | 1825 | int *pkg_cstate_limits; |
1825 | 1826 | ||
1826 | if (!genuine_intel) | 1827 | if (!genuine_intel) |
@@ -1829,6 +1830,8 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) | |||
1829 | if (family != 6) | 1830 | if (family != 6) |
1830 | return 0; | 1831 | return 0; |
1831 | 1832 | ||
1833 | bclk = discover_bclk(family, model); | ||
1834 | |||
1832 | switch (model) { | 1835 | switch (model) { |
1833 | case 0x1A: /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */ | 1836 | case 0x1A: /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */ |
1834 | case 0x1E: /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */ | 1837 | case 0x1E: /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */ |
@@ -1871,9 +1874,13 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) | |||
1871 | return 0; | 1874 | return 0; |
1872 | } | 1875 | } |
1873 | get_msr(base_cpu, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); | 1876 | get_msr(base_cpu, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); |
1874 | |||
1875 | pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; | 1877 | pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; |
1876 | 1878 | ||
1879 | get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); | ||
1880 | base_ratio = (msr >> 8) & 0xFF; | ||
1881 | |||
1882 | base_hz = base_ratio * bclk * 1000000; | ||
1883 | has_base_hz = 1; | ||
1877 | return 1; | 1884 | return 1; |
1878 | } | 1885 | } |
1879 | int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model) | 1886 | int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model) |
@@ -2780,7 +2787,6 @@ void process_cpuid() | |||
2780 | do_skl_residency = has_skl_msrs(family, model); | 2787 | do_skl_residency = has_skl_msrs(family, model); |
2781 | do_slm_cstates = is_slm(family, model); | 2788 | do_slm_cstates = is_slm(family, model); |
2782 | do_knl_cstates = is_knl(family, model); | 2789 | do_knl_cstates = is_knl(family, model); |
2783 | bclk = discover_bclk(family, model); | ||
2784 | 2790 | ||
2785 | rapl_probe(family, model); | 2791 | rapl_probe(family, model); |
2786 | perf_limit_reasons_probe(family, model); | 2792 | perf_limit_reasons_probe(family, model); |