Skip to content

Commit 7566616

Browse files
jonathan-domanjwrdegoede
authored andcommitted
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>
1 parent 81c9379 commit 7566616

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

tools/power/x86/intel-speed-select/isst-config.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -545,20 +545,23 @@ static void set_cpu_present_cpu_mask(void)
545545
}
546546
}
547547

548-
int get_core_count(int pkg_id, int die_id)
548+
int get_max_punit_core_id(int pkg_id, int die_id)
549549
{
550-
int cnt = 0;
550+
int max_id = 0;
551+
int i;
551552

552-
if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE) {
553-
int i;
553+
for (i = 0; i < topo_max_cpus; ++i)
554+
{
555+
if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
556+
continue;
554557

555-
for (i = 0; i < sizeof(long long) * 8; ++i) {
556-
if (core_mask[pkg_id][die_id] & (1ULL << i))
557-
cnt++;
558-
}
558+
if (cpu_map[i].pkg_id == pkg_id &&
559+
cpu_map[i].die_id == die_id &&
560+
cpu_map[i].punit_cpu_core > max_id)
561+
max_id = cpu_map[i].punit_cpu_core;
559562
}
560563

561-
return cnt;
564+
return max_id;
562565
}
563566

564567
int get_cpu_count(int pkg_id, int die_id)

tools/power/x86/intel-speed-select/isst-core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ int isst_get_pbf_info(int cpu, int level, struct isst_pbf_info *pbf_info)
396396
{
397397
struct isst_pkg_ctdp_level_info ctdp_level;
398398
struct isst_pkg_ctdp pkg_dev;
399-
int i, ret, core_cnt, max;
399+
int i, ret, max_punit_core, max_mask_index;
400400
unsigned int req, resp;
401401

402402
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)
421421

422422
pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask);
423423

424-
core_cnt = get_core_count(get_physical_package_id(cpu), get_physical_die_id(cpu));
425-
max = core_cnt > 32 ? 2 : 1;
424+
max_punit_core = get_max_punit_core_id(get_physical_package_id(cpu), get_physical_die_id(cpu));
425+
max_mask_index = max_punit_core > 32 ? 2 : 1;
426426

427-
for (i = 0; i < max; ++i) {
427+
for (i = 0; i < max_mask_index; ++i) {
428428
unsigned long long mask;
429429
int count;
430430

tools/power/x86/intel-speed-select/isst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ struct isst_pkg_ctdp {
170170

171171
extern int get_topo_max_cpus(void);
172172
extern int get_cpu_count(int pkg_id, int die_id);
173-
extern int get_core_count(int pkg_id, int die_id);
173+
extern int get_max_punit_core_id(int pkg_id, int die_id);
174174

175175
/* Common interfaces */
176176
FILE *get_output_file(void);

0 commit comments

Comments
 (0)