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 <prarit@redhat.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: David Arcari <darcari@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Prarit Bhargava 2019-09-05 08:03:09 -04:00 committed by Andy Shevchenko
parent 76c2ef35f7
commit 49aed155ec
1 changed files with 39 additions and 0 deletions

View File

@ -8,6 +8,33 @@
#define DISP_FREQ_MULTIPLIER 100 #define DISP_FREQ_MULTIPLIER 100
static void printcpulist(int str_len, char *str, int mask_size,
cpu_set_t *cpu_mask)
{
int i, first, curr_index, index;
if (!CPU_COUNT_S(mask_size, cpu_mask)) {
snprintf(str, str_len, "none");
return;
}
curr_index = 0;
first = 1;
for (i = 0; i < get_topo_max_cpus(); ++i) {
if (!CPU_ISSET_S(i, mask_size, cpu_mask))
continue;
if (!first) {
index = snprintf(&str[curr_index],
str_len - curr_index, ",");
curr_index += index;
}
index = snprintf(&str[curr_index], str_len - curr_index, "%d",
i);
curr_index += index;
first = 0;
}
}
static void printcpumask(int str_len, char *str, int mask_size, static void printcpumask(int str_len, char *str, int mask_size,
cpu_set_t *cpu_mask) cpu_set_t *cpu_mask)
{ {
@ -166,6 +193,12 @@ static void _isst_pbf_display_information(int cpu, FILE *outf, int level,
pbf_info->core_cpumask); pbf_info->core_cpumask);
format_and_print(outf, disp_level + 1, header, value); format_and_print(outf, disp_level + 1, header, value);
snprintf(header, sizeof(header), "high-priority-cpu-list");
printcpulist(sizeof(value), value,
pbf_info->core_cpumask_size,
pbf_info->core_cpumask);
format_and_print(outf, disp_level + 1, header, value);
snprintf(header, sizeof(header), "low-priority-base-frequency(MHz)"); snprintf(header, sizeof(header), "low-priority-base-frequency(MHz)");
snprintf(value, sizeof(value), "%d", snprintf(value, sizeof(value), "%d",
pbf_info->p1_low * DISP_FREQ_MULTIPLIER); pbf_info->p1_low * DISP_FREQ_MULTIPLIER);
@ -287,6 +320,12 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
ctdp_level->core_cpumask); ctdp_level->core_cpumask);
format_and_print(outf, base_level + 4, header, value); format_and_print(outf, base_level + 4, header, value);
snprintf(header, sizeof(header), "enable-cpu-list");
printcpulist(sizeof(value), value,
ctdp_level->core_cpumask_size,
ctdp_level->core_cpumask);
format_and_print(outf, base_level + 4, header, value);
snprintf(header, sizeof(header), "thermal-design-power-ratio"); snprintf(header, sizeof(header), "thermal-design-power-ratio");
snprintf(value, sizeof(value), "%d", ctdp_level->tdp_ratio); snprintf(value, sizeof(value), "%d", ctdp_level->tdp_ratio);
format_and_print(outf, base_level + 4, header, value); format_and_print(outf, base_level + 4, header, value);