mirror of https://gitee.com/openkylin/linux.git
tools/power turbostat: consolidate duplicate model numbers
Often a new processor gets a new model number, but from a turbostat point of view, it is the same as a previous model. Support duplicates with 1-line updates, rather than error-prone scattering of model #'s. Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
445640a563
commit
f5a4c76ad7
|
@ -3137,13 +3137,8 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
|
|||
bclk = discover_bclk(family, model);
|
||||
|
||||
switch (model) {
|
||||
case INTEL_FAM6_NEHALEM_EP: /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */
|
||||
case INTEL_FAM6_NEHALEM: /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */
|
||||
case 0x1F: /* Core i7 and i5 Processor - Nehalem */
|
||||
case INTEL_FAM6_WESTMERE: /* Westmere Client - Clarkdale, Arrandale */
|
||||
case INTEL_FAM6_WESTMERE_EP: /* Westmere EP - Gulftown */
|
||||
case INTEL_FAM6_NEHALEM_EX: /* Nehalem-EX Xeon - Beckton */
|
||||
case INTEL_FAM6_WESTMERE_EX: /* Westmere-EX Xeon - Eagleton */
|
||||
pkg_cstate_limits = nhm_pkg_cstate_limits;
|
||||
break;
|
||||
case INTEL_FAM6_SANDYBRIDGE: /* SNB */
|
||||
|
@ -3155,16 +3150,11 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
|
|||
break;
|
||||
case INTEL_FAM6_HASWELL_CORE: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_X: /* HSX */
|
||||
case INTEL_FAM6_HASWELL_ULT: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_GT3E: /* HSW */
|
||||
case INTEL_FAM6_BROADWELL_CORE: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_X: /* BDX */
|
||||
case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */
|
||||
pkg_cstate_limits = hsw_pkg_cstate_limits;
|
||||
has_misc_feature_control = 1;
|
||||
|
@ -3183,7 +3173,6 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
|
|||
no_MSR_MISC_PWR_MGMT = 1;
|
||||
break;
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* PHI */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
pkg_cstate_limits = phi_pkg_cstate_limits;
|
||||
break;
|
||||
case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
|
||||
|
@ -3244,7 +3233,6 @@ int is_bdx(unsigned int family, unsigned int model)
|
|||
|
||||
switch (model) {
|
||||
case INTEL_FAM6_BROADWELL_X:
|
||||
case INTEL_FAM6_BROADWELL_XEON_D:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -3270,9 +3258,7 @@ int has_turbo_ratio_limit(unsigned int family, unsigned int model)
|
|||
switch (model) {
|
||||
/* Nehalem compatible, but do not include turbo-ratio limit support */
|
||||
case INTEL_FAM6_NEHALEM_EX: /* Nehalem-EX Xeon - Beckton */
|
||||
case INTEL_FAM6_WESTMERE_EX: /* Westmere-EX Xeon - Eagleton */
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* PHI - Knights Landing (different MSR definition) */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
|
@ -3327,7 +3313,6 @@ int has_knl_turbo_ratio_limit(unsigned int family, unsigned int model)
|
|||
|
||||
switch (model) {
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* Knights Landing */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -3361,21 +3346,15 @@ int has_config_tdp(unsigned int family, unsigned int model)
|
|||
case INTEL_FAM6_IVYBRIDGE: /* IVB */
|
||||
case INTEL_FAM6_HASWELL_CORE: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_X: /* HSX */
|
||||
case INTEL_FAM6_HASWELL_ULT: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_GT3E: /* HSW */
|
||||
case INTEL_FAM6_BROADWELL_CORE: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_X: /* BDX */
|
||||
case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */
|
||||
case INTEL_FAM6_SKYLAKE_X: /* SKX */
|
||||
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* Knights Landing */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -3768,9 +3747,7 @@ rapl_dram_energy_units_probe(int model, double rapl_energy_units)
|
|||
switch (model) {
|
||||
case INTEL_FAM6_HASWELL_X: /* HSX */
|
||||
case INTEL_FAM6_BROADWELL_X: /* BDX */
|
||||
case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
return (rapl_dram_energy_units = 15.3 / 1000000);
|
||||
default:
|
||||
return (rapl_energy_units);
|
||||
|
@ -3799,7 +3776,6 @@ void rapl_probe(unsigned int family, unsigned int model)
|
|||
case INTEL_FAM6_SANDYBRIDGE:
|
||||
case INTEL_FAM6_IVYBRIDGE:
|
||||
case INTEL_FAM6_HASWELL_CORE: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_ULT: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_GT3E: /* HSW */
|
||||
case INTEL_FAM6_BROADWELL_CORE: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
|
||||
|
@ -3823,9 +3799,6 @@ void rapl_probe(unsigned int family, unsigned int model)
|
|||
BIC_PRESENT(BIC_PkgWatt);
|
||||
break;
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */
|
||||
do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
|
||||
BIC_PRESENT(BIC_PKG__);
|
||||
|
@ -3844,10 +3817,8 @@ void rapl_probe(unsigned int family, unsigned int model)
|
|||
break;
|
||||
case INTEL_FAM6_HASWELL_X: /* HSX */
|
||||
case INTEL_FAM6_BROADWELL_X: /* BDX */
|
||||
case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */
|
||||
case INTEL_FAM6_SKYLAKE_X: /* SKX */
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
|
||||
BIC_PRESENT(BIC_PKG__);
|
||||
BIC_PRESENT(BIC_RAM__);
|
||||
|
@ -3940,7 +3911,6 @@ void perf_limit_reasons_probe(unsigned int family, unsigned int model)
|
|||
|
||||
switch (model) {
|
||||
case INTEL_FAM6_HASWELL_CORE: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_ULT: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_GT3E: /* HSW */
|
||||
do_gfx_perf_limit_reasons = 1;
|
||||
case INTEL_FAM6_HASWELL_X: /* HSX */
|
||||
|
@ -4152,16 +4122,11 @@ int has_snb_msrs(unsigned int family, unsigned int model)
|
|||
case INTEL_FAM6_IVYBRIDGE_X: /* IVB Xeon */
|
||||
case INTEL_FAM6_HASWELL_CORE: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_X: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_ULT: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_GT3E: /* HSW */
|
||||
case INTEL_FAM6_BROADWELL_CORE: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
|
||||
case INTEL_FAM6_BROADWELL_X: /* BDX */
|
||||
case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */
|
||||
case INTEL_FAM6_SKYLAKE_X: /* SKX */
|
||||
case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
|
||||
|
@ -4190,12 +4155,9 @@ int has_hsw_msrs(unsigned int family, unsigned int model)
|
|||
return 0;
|
||||
|
||||
switch (model) {
|
||||
case INTEL_FAM6_HASWELL_ULT: /* HSW */
|
||||
case INTEL_FAM6_HASWELL_CORE:
|
||||
case INTEL_FAM6_BROADWELL_CORE: /* BDW */
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */
|
||||
case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
|
||||
case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
|
||||
|
@ -4219,9 +4181,6 @@ int has_skl_msrs(unsigned int family, unsigned int model)
|
|||
|
||||
switch (model) {
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */
|
||||
return 1;
|
||||
}
|
||||
|
@ -4246,7 +4205,6 @@ int is_knl(unsigned int family, unsigned int model)
|
|||
return 0;
|
||||
switch (model) {
|
||||
case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -4460,6 +4418,42 @@ void decode_c6_demotion_policy_msr(void)
|
|||
base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS");
|
||||
}
|
||||
|
||||
/*
|
||||
* When models are the same, for the purpose of turbostat, reuse
|
||||
*/
|
||||
unsigned int intel_model_duplicates(unsigned int model)
|
||||
{
|
||||
|
||||
switch(model) {
|
||||
case INTEL_FAM6_NEHALEM_EP: /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */
|
||||
case INTEL_FAM6_NEHALEM: /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */
|
||||
case 0x1F: /* Core i7 and i5 Processor - Nehalem */
|
||||
case INTEL_FAM6_WESTMERE: /* Westmere Client - Clarkdale, Arrandale */
|
||||
case INTEL_FAM6_WESTMERE_EP: /* Westmere EP - Gulftown */
|
||||
return INTEL_FAM6_NEHALEM;
|
||||
|
||||
case INTEL_FAM6_NEHALEM_EX: /* Nehalem-EX Xeon - Beckton */
|
||||
case INTEL_FAM6_WESTMERE_EX: /* Westmere-EX Xeon - Eagleton */
|
||||
return INTEL_FAM6_NEHALEM_EX;
|
||||
|
||||
case INTEL_FAM6_XEON_PHI_KNM:
|
||||
return INTEL_FAM6_XEON_PHI_KNL;
|
||||
|
||||
case INTEL_FAM6_HASWELL_ULT:
|
||||
return INTEL_FAM6_HASWELL_CORE;
|
||||
|
||||
case INTEL_FAM6_BROADWELL_X:
|
||||
case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */
|
||||
return INTEL_FAM6_BROADWELL_X;
|
||||
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE:
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP:
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE:
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP:
|
||||
return INTEL_FAM6_SKYLAKE_MOBILE;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
void process_cpuid()
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
@ -4513,6 +4507,8 @@ void process_cpuid()
|
|||
edx_flags & (1 << 28) ? "HT" : "-",
|
||||
edx_flags & (1 << 29) ? "TM" : "-");
|
||||
}
|
||||
if (genuine_intel)
|
||||
model = intel_model_duplicates(model);
|
||||
|
||||
if (!(edx_flags & (1 << 5)))
|
||||
errx(1, "CPUID: no MSR");
|
||||
|
@ -4604,9 +4600,6 @@ void process_cpuid()
|
|||
if (crystal_hz == 0)
|
||||
switch(model) {
|
||||
case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
|
||||
case INTEL_FAM6_SKYLAKE_DESKTOP: /* SKL */
|
||||
case INTEL_FAM6_KABYLAKE_MOBILE: /* KBL */
|
||||
case INTEL_FAM6_KABYLAKE_DESKTOP: /* KBL */
|
||||
crystal_hz = 24000000; /* 24.0 MHz */
|
||||
break;
|
||||
case INTEL_FAM6_ATOM_GOLDMONT_X: /* DNV */
|
||||
|
|
Loading…
Reference in New Issue