Commit 8c382f9e authored by Zhang Rui's avatar Zhang Rui

tools/power/turbostat: Use fine grained IRTL output

It is pointless to dump the IRTL register for a package cstate that is
not supported by the platform.

Print IRTL only for states that are available in
platform->supported_cstates.

Delete has_c8910_msrs() CPU model check.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Reviewed-by: default avatarLen Brown <len.brown@intel.com>
parent cd7a2b6a
...@@ -229,7 +229,6 @@ unsigned int has_epb; ...@@ -229,7 +229,6 @@ unsigned int has_epb;
unsigned int has_turbo; unsigned int has_turbo;
unsigned int is_hybrid; unsigned int is_hybrid;
unsigned int do_irtl_snb; unsigned int do_irtl_snb;
unsigned int do_irtl_hsw;
unsigned int units = 1000000; /* MHz etc */ unsigned int units = 1000000; /* MHz etc */
unsigned int genuine_intel; unsigned int genuine_intel;
unsigned int authentic_amd; unsigned int authentic_amd;
...@@ -3269,39 +3268,47 @@ void print_irtl(void) ...@@ -3269,39 +3268,47 @@ void print_irtl(void)
{ {
unsigned long long msr; unsigned long long msr;
get_msr(base_cpu, MSR_PKGC3_IRTL, &msr); if (platform->supported_cstates & PC3) {
fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr); get_msr(base_cpu, MSR_PKGC3_IRTL, &msr);
fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr);
(msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 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) if (platform->supported_cstates & PC6) {
return; 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_PKGC8_IRTL, &msr); if (platform->supported_cstates & PC7) {
fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr); get_msr(base_cpu, MSR_PKGC7_IRTL, &msr);
fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr);
(msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 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); if (platform->supported_cstates & PC8) {
fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr); get_msr(base_cpu, MSR_PKGC8_IRTL, &msr);
fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr);
(msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); 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); if (platform->supported_cstates & PC9) {
fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr); get_msr(base_cpu, MSR_PKGC9_IRTL, &msr);
fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr);
(msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
(msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
}
if (platform->supported_cstates & PC10) {
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) void free_fd_percpu(void)
...@@ -5145,39 +5152,6 @@ int has_snb_msrs(unsigned int family, unsigned int model) ...@@ -5145,39 +5152,6 @@ int has_snb_msrs(unsigned int family, unsigned int model)
return 0; return 0;
} }
/*
* HSW ULT added support for C8/C9/C10 MSRs:
*
* MSR_PKG_C8_RESIDENCY 0x00000630
* MSR_PKG_C9_RESIDENCY 0x00000631
* MSR_PKG_C10_RESIDENCY 0x00000632
*
* MSR_PKGC8_IRTL 0x00000633
* MSR_PKGC9_IRTL 0x00000634
* MSR_PKGC10_IRTL 0x00000635
*
*/
int has_c8910_msrs(unsigned int family, unsigned int model)
{
if (!genuine_intel)
return 0;
if (family != 6)
return 0;
switch (model) {
case INTEL_FAM6_HASWELL_L: /* HSW */
case INTEL_FAM6_BROADWELL: /* BDW */
case INTEL_FAM6_SKYLAKE_L: /* SKL */
case INTEL_FAM6_CANNONLAKE_L: /* CNL */
case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
case INTEL_FAM6_ATOM_TREMONT: /* EHL */
return 1;
}
return 0;
}
/* /*
* SKL adds support for additional MSRS: * SKL adds support for additional MSRS:
* *
...@@ -5757,7 +5731,6 @@ void process_cpuid() ...@@ -5757,7 +5731,6 @@ void process_cpuid()
if (is_dnv(family, model)) { if (is_dnv(family, model)) {
use_c1_residency_msr = 1; use_c1_residency_msr = 1;
} }
do_irtl_hsw = has_c8910_msrs(family, model);
if (has_skl_msrs(family, model)) { if (has_skl_msrs(family, model)) {
BIC_PRESENT(BIC_Totl_c0); BIC_PRESENT(BIC_Totl_c0);
BIC_PRESENT(BIC_Any_c0); BIC_PRESENT(BIC_Any_c0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment