From: Rafael J. Wysocki Date: Fri, 8 Apr 2016 19:46:56 +0000 (+0200) Subject: Merge branches 'pm-core', 'powercap' and 'pm-tools' X-Git-Tag: v4.6-rc3~13^2 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Flinux.git;a=commitdiff_plain;h=73659be769a4f0ac26a6b3fc6699754adba36485 Merge branches 'pm-core', 'powercap' and 'pm-tools' * pm-core: PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs PM / runtime: Document steps for device removal * powercap: powercap: intel_rapl: Add missing Haswell model * pm-tools: tools/power turbostat: work around RC6 counter wrap tools/power turbostat: initial KBL support tools/power turbostat: initial SKX support tools/power turbostat: decode BXT TSC frequency via CPUID tools/power turbostat: initial BXT support tools/power turbostat: print IRTL MSRs tools/power turbostat: SGX state should print only if --debug --- 73659be769a4f0ac26a6b3fc6699754adba36485 diff --cc tools/power/x86/turbostat/turbostat.c index 20a257a12ea5,20a257a12ea5,0dac7e05a6ac,d2ae87d148ed..acbf7ff2ee6e --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@@@@ -187,8 -187,8 -172,6 -189,8 +189,8 @@@@@ struct pkg_data unsigned long long pkg_any_core_c0; unsigned long long pkg_any_gfxe_c0; unsigned long long pkg_both_core_gfxe_c0; -- unsigned long long gfx_rc6_ms; +++ long long gfx_rc6_ms; + unsigned int gfx_mhz; unsigned int package_id; unsigned int energy_pkg; /* MSR_PKG_ENERGY_STATUS */ unsigned int energy_dram; /* MSR_DRAM_ENERGY_STATUS */ @@@@@ -620,14 -620,14 -575,6 -622,20 +622,20 @@@@@ int format_counters(struct thread_data if (do_ptm) outp += sprintf(outp, "%8d", p->pkg_temp_c); + /* GFXrc6 */ -- if (do_gfx_rc6_ms) -- outp += sprintf(outp, "%8.2f", 100.0 * p->gfx_rc6_ms / 1000.0 / interval_float); +++ if (do_gfx_rc6_ms) { +++ if (p->gfx_rc6_ms == -1) { /* detect counter reset */ +++ outp += sprintf(outp, " ***.**"); +++ } else { +++ outp += sprintf(outp, "%8.2f", +++ p->gfx_rc6_ms / 10.0 / interval_float); +++ } +++ } + + /* GFXMHz */ + if (do_gfx_mhz) + outp += sprintf(outp, "%8d", p->gfx_mhz); + /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */ if (do_skl_residency) { outp += sprintf(outp, "%8.2f", 100.0 * p->pkg_wtd_core_c0/t->tsc); @@@@@ -766,9 -766,9 -704,6 -774,14 +774,14 @@@@@ delta_package(struct pkg_data *new, str old->pc10 = new->pc10 - old->pc10; old->pkg_temp_c = new->pkg_temp_c; -- old->gfx_rc6_ms = new->gfx_rc6_ms - old->gfx_rc6_ms; +++ /* flag an error when rc6 counter resets/wraps */ +++ if (old->gfx_rc6_ms > new->gfx_rc6_ms) +++ old->gfx_rc6_ms = -1; +++ else +++ old->gfx_rc6_ms = new->gfx_rc6_ms - old->gfx_rc6_ms; +++ + old->gfx_mhz = new->gfx_mhz; + DELTA_WRAP32(new->energy_pkg, old->energy_pkg); DELTA_WRAP32(new->energy_cores, old->energy_cores); DELTA_WRAP32(new->energy_gfx, old->energy_gfx); @@@@@ -1543,52 -1543,52 -1408,41 -1557,93 +1557,93 @@@@@ dump_config_tdp(void unsigned long long msr; get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr); - fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr); - fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xEF); + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr); + fprintf(outf, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF); get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr); - fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr); + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr); if (msr) { - fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0xEFFF); - fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0xEFFF); - fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xEF); - fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0xEFFF); + fprintf(outf, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0x7FFF); + fprintf(outf, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0x7FFF); + fprintf(outf, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF); + fprintf(outf, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0x7FFF); } - fprintf(stderr, ")\n"); + fprintf(outf, ")\n"); get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr); - fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr); + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr); if (msr) { - fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0xEFFF); - fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0xEFFF); - fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xEF); - fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0xEFFF); + fprintf(outf, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0x7FFF); + fprintf(outf, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0x7FFF); + fprintf(outf, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF); + fprintf(outf, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0x7FFF); } - fprintf(stderr, ")\n"); + fprintf(outf, ")\n"); get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr); - fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr); + fprintf(outf, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr); if ((msr) & 0x3) - fprintf(stderr, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3); - fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1); - fprintf(stderr, ")\n"); - + fprintf(outf, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3); + fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); + fprintf(outf, ")\n"); + get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); - fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); - fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0x7F); - fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1); - fprintf(stderr, ")\n"); + fprintf(outf, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); + fprintf(outf, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF); + fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); + fprintf(outf, ")\n"); + } +++ +++ unsigned int irtl_time_units[] = {1, 32, 1024, 32768, 1048576, 33554432, 0, 0 }; +++ +++ void print_irtl(void) +++ { +++ unsigned long long msr; +++ +++ get_msr(base_cpu, MSR_PKGC3_IRTL, &msr); +++ fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr); +++ fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", +++ (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); +++ +++ get_msr(base_cpu, MSR_PKGC6_IRTL, &msr); +++ fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", base_cpu, msr); +++ fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", +++ (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); +++ +++ get_msr(base_cpu, MSR_PKGC7_IRTL, &msr); +++ fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr); +++ fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", +++ (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); +++ +++ if (!do_irtl_hsw) +++ return; +++ +++ get_msr(base_cpu, MSR_PKGC8_IRTL, &msr); +++ fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr); +++ fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", +++ (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); +++ +++ get_msr(base_cpu, MSR_PKGC9_IRTL, &msr); +++ fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr); +++ fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", +++ (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); +++ +++ get_msr(base_cpu, MSR_PKGC10_IRTL, &msr); +++ fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr); +++ fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", +++ (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); +++ +++ } + void free_fd_percpu(void) + { + int i; + + for (i = 0; i < topo.max_cpu_num; ++i) { + if (fd_percpu[i] != 0) + close(fd_percpu[i]); + } + + free(fd_percpu); } void free_all_buffers(void) @@@@@ -2257,7 -2257,7 -1970,7 -2321,7 +2321,7 @@@@@ int has_config_tdp(unsigned int family } static void - dump_cstate_pstate_config_info(family, model) -dump_cstate_pstate_config_info(int family, int model) ++dump_cstate_pstate_config_info(unsigned int family, unsigned int model) { if (!do_nhm_platform_info) return; @@@@@ -2520,7 -2520,7 -2142,7 -2584,7 +2584,7 @@@@@ int print_perf_limit(struct thread_dat #define RAPL_POWER_GRANULARITY 0x7FFF /* 15 bit power granularity */ #define RAPL_TIME_GRANULARITY 0x3F /* 6 bit time granularity */ - double get_tdp(model) -double get_tdp(int model) ++double get_tdp(unsigned int model) { unsigned long long msr; @@@@@ -2634,7 -2634,7 -2256,7 -2704,7 +2704,7 @@@@@ void rapl_probe(unsigned int family, un return; } - void perf_limit_reasons_probe(family, model) -void perf_limit_reasons_probe(int family, int model) ++void perf_limit_reasons_probe(unsigned int family, unsigned int model) { if (!genuine_intel) return; @@@@@ -3172,36 -3172,36 -2733,13 -3256,36 +3256,36 @@@@@ void process_cpuid( has_epb = ecx & (1 << 3); if (debug) - fprintf(stderr, "CPUID(6): %sAPERF, %sDTS, %sPTM, %sEPB\n", - has_aperf ? "" : "No ", - do_dts ? "" : "No ", - do_ptm ? "" : "No ", - has_epb ? "" : "No "); + fprintf(outf, "CPUID(6): %sAPERF, %sDTS, %sPTM, %sHWP, " + "%sHWPnotify, %sHWPwindow, %sHWPepp, %sHWPpkg, %sEPB\n", + has_aperf ? "" : "No-", + do_dts ? "" : "No-", + do_ptm ? "" : "No-", + has_hwp ? "" : "No-", + has_hwp_notify ? "" : "No-", + has_hwp_activity_window ? "" : "No-", + has_hwp_epp ? "" : "No-", + has_hwp_pkg ? "" : "No-", + has_epb ? "" : "No-"); + + if (debug) + decode_misc_enable_msr(); + -- if (max_level >= 0x7) { +++ if (max_level >= 0x7 && debug) { + int has_sgx; + + ecx = 0; + + __cpuid_count(0x7, 0, eax, ebx, ecx, edx); + + has_sgx = ebx & (1 << 2); + fprintf(outf, "CPUID(7): %sSGX\n", has_sgx ? "" : "No-"); + + if (has_sgx) + decode_feature_control_msr(); + } - if (max_level > 0x15) { + if (max_level >= 0x15) { unsigned int eax_crystal; unsigned int ebx_tsc; @@@@@ -3629,7 -3629,7 -3125,7 -3726,7 +3726,7 @@@@@ int get_and_dump_counters(void } void print_version() { -- fprintf(outf, "turbostat version 4.11 27 Feb 2016" - fprintf(stderr, "turbostat version 4.8 26-Sep, 2015" +++ fprintf(outf, "turbostat version 4.12 5 Apr 2016" " - Len Brown \n"); }