Skip to content

Commit 49aed15

Browse files
praritandy-shev
authored andcommitted
tools/power/x86/intel-speed-select: Output human readable CPU list
The intel-speed-select tool currently only outputs a hexidecimal CPU mask, which requires translation for use with kernel parameters such as isolcpus. Along with the CPU mask, output a human readable CPU list. Signed-off-by: Prarit Bhargava <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Cc: Srinivas Pandruvada <[email protected]> Cc: David Arcari <[email protected]> Cc: [email protected] Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 76c2ef3 commit 49aed15

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,33 @@
88

99
#define DISP_FREQ_MULTIPLIER 100
1010

11+
static void printcpulist(int str_len, char *str, int mask_size,
12+
cpu_set_t *cpu_mask)
13+
{
14+
int i, first, curr_index, index;
15+
16+
if (!CPU_COUNT_S(mask_size, cpu_mask)) {
17+
snprintf(str, str_len, "none");
18+
return;
19+
}
20+
21+
curr_index = 0;
22+
first = 1;
23+
for (i = 0; i < get_topo_max_cpus(); ++i) {
24+
if (!CPU_ISSET_S(i, mask_size, cpu_mask))
25+
continue;
26+
if (!first) {
27+
index = snprintf(&str[curr_index],
28+
str_len - curr_index, ",");
29+
curr_index += index;
30+
}
31+
index = snprintf(&str[curr_index], str_len - curr_index, "%d",
32+
i);
33+
curr_index += index;
34+
first = 0;
35+
}
36+
}
37+
1138
static void printcpumask(int str_len, char *str, int mask_size,
1239
cpu_set_t *cpu_mask)
1340
{
@@ -166,6 +193,12 @@ static void _isst_pbf_display_information(int cpu, FILE *outf, int level,
166193
pbf_info->core_cpumask);
167194
format_and_print(outf, disp_level + 1, header, value);
168195

196+
snprintf(header, sizeof(header), "high-priority-cpu-list");
197+
printcpulist(sizeof(value), value,
198+
pbf_info->core_cpumask_size,
199+
pbf_info->core_cpumask);
200+
format_and_print(outf, disp_level + 1, header, value);
201+
169202
snprintf(header, sizeof(header), "low-priority-base-frequency(MHz)");
170203
snprintf(value, sizeof(value), "%d",
171204
pbf_info->p1_low * DISP_FREQ_MULTIPLIER);
@@ -287,6 +320,12 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
287320
ctdp_level->core_cpumask);
288321
format_and_print(outf, base_level + 4, header, value);
289322

323+
snprintf(header, sizeof(header), "enable-cpu-list");
324+
printcpulist(sizeof(value), value,
325+
ctdp_level->core_cpumask_size,
326+
ctdp_level->core_cpumask);
327+
format_and_print(outf, base_level + 4, header, value);
328+
290329
snprintf(header, sizeof(header), "thermal-design-power-ratio");
291330
snprintf(value, sizeof(value), "%d", ctdp_level->tdp_ratio);
292331
format_and_print(outf, base_level + 4, header, value);

0 commit comments

Comments
 (0)