tools/power/x86/intel-speed-select: Fix missing base-freq core IDs

The reported base-freq high-priority-cpu-list was potentially omitting
some cpus, due to incorrectly using a logical core count to constrain
the size of a physical punit core ID mask. We may need to read both high
and low PBF CORE_MASK values regardless of the logical core count.

Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Jonathan Doman
2020-09-30 15:26:36 -07:00
committed by Hans de Goede
parent 81c93798ef
commit 7566616fb9
3 changed files with 17 additions and 14 deletions

View File

@@ -545,20 +545,23 @@ static void set_cpu_present_cpu_mask(void)
} }
} }
int get_core_count(int pkg_id, int die_id) int get_max_punit_core_id(int pkg_id, int die_id)
{ {
int cnt = 0; int max_id = 0;
int i;
if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE) { for (i = 0; i < topo_max_cpus; ++i)
int i; {
if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
continue;
for (i = 0; i < sizeof(long long) * 8; ++i) { if (cpu_map[i].pkg_id == pkg_id &&
if (core_mask[pkg_id][die_id] & (1ULL << i)) cpu_map[i].die_id == die_id &&
cnt++; cpu_map[i].punit_cpu_core > max_id)
} max_id = cpu_map[i].punit_cpu_core;
} }
return cnt; return max_id;
} }
int get_cpu_count(int pkg_id, int die_id) int get_cpu_count(int pkg_id, int die_id)

View File

@@ -396,7 +396,7 @@ int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info)
{ {
struct isst_pkg_ctdp_level_info ctdp_level; struct isst_pkg_ctdp_level_info ctdp_level;
struct isst_pkg_ctdp pkg_dev; struct isst_pkg_ctdp pkg_dev;
int i, ret, core_cnt, max; int i, ret, max_punit_core, max_mask_index;
unsigned int req, resp; unsigned int req, resp;
ret = isst_get_ctdp_levels(cpu, &pkg_dev); ret = isst_get_ctdp_levels(cpu, &pkg_dev);
@@ -421,10 +421,10 @@ int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info)
pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask); pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask);
core_cnt = get_core_count(get_physical_package_id(cpu), get_physical_die_id(cpu)); max_punit_core = get_max_punit_core_id(get_physical_package_id(cpu), get_physical_die_id(cpu));
max = core_cnt > 32 ? 2 : 1; max_mask_index = max_punit_core > 32 ? 2 : 1;
for (i = 0; i < max; ++i) { for (i = 0; i < max_mask_index; ++i) {
unsigned long long mask; unsigned long long mask;
int count; int count;

View File

@@ -170,7 +170,7 @@ struct isst_pkg_ctdp {
extern int get_topo_max_cpus(void); extern int get_topo_max_cpus(void);
extern int get_cpu_count(int pkg_id, int die_id); extern int get_cpu_count(int pkg_id, int die_id);
extern int get_core_count(int pkg_id, int die_id); extern int get_max_punit_core_id(int pkg_id, int die_id);
/* Common interfaces */ /* Common interfaces */
FILE *get_output_file(void); FILE *get_output_file(void);