2019-09-03 15:40:19

by Prarit Bhargava

[permalink] [raw]
Subject: [PATCH 0/8] tools-power-x86-intel-speed-select: Fixes and updates for output

Some general fixes and updates for intel-speed-select. Fixes include some
typos as well as an off-by-one cpu count reporting error. Updates for the
output are

- switching to MHz as a standard
- reporting CPU frequencies instead of ratios as a standard
- viewing a human-readable CPU list.
- avoiding reporting "0|1" as success|fail as these can be confusing for a
user.

Signed-off-by: Prarit Bhargava <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: David Arcari <[email protected]>
Cc: [email protected]

Prarit Bhargava (8):
tools/power/x86/intel-speed-select: Fix package typo
tools/power/x86/intel-speed-select: Fix help option typo
tools/power/x86/intel-speed-select: Fix cpu-count output
tools/power/x86/intel-speed-select: Simplify output for turbo-freq and
base-freq
tools/power/x86/intel-speed-select: Switch output to MHz
tools/power/x86/intel-speed-select: Change turbo ratio output to
maximum turbo frequency
tools/power/x86/intel-speed-select: Output human readable CPU list
tools/power/x86/intel-speed-select: Output success/failed for command
output

.../x86/intel-speed-select/isst-config.c | 4 +-
.../x86/intel-speed-select/isst-display.c | 116 ++++++++++++------
2 files changed, 83 insertions(+), 37 deletions(-)

--
2.21.0


2019-09-03 15:40:37

by Prarit Bhargava

[permalink] [raw]
Subject: [PATCH 7/8] 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]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: David Arcari <[email protected]>
Cc: [email protected]
---
.../x86/intel-speed-select/isst-display.c | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)

diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c
index cfeee0beb78d..890a01bfee4b 100644
--- a/tools/power/x86/intel-speed-select/isst-display.c
+++ b/tools/power/x86/intel-speed-select/isst-display.c
@@ -8,6 +8,33 @@

#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,
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);
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(value, sizeof(value), "%d",
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);
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(value, sizeof(value), "%d", ctdp_level->tdp_ratio);
format_and_print(outf, base_level + 4, header, value);
--
2.21.0

2019-09-04 20:07:43

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 0/8] tools-power-x86-intel-speed-select: Fixes and updates for output

On Tue, 2019-09-03 at 11:37 -0400, Prarit Bhargava wrote:
> Some general fixes and updates for intel-speed-select. Fixes include
> some
> typos as well as an off-by-one cpu count reporting error. Updates
> for the
> output are
>
> - switching to MHz as a standard
> - reporting CPU frequencies instead of ratios as a standard
> - viewing a human-readable CPU list.
> - avoiding reporting "0|1" as success|fail as these can be confusing
> for a
> user.
Series looks fine, except 8/8.
So please submit v2. Better to resubmit as a series as v2, unless Andy
has other preference.

Thanks,
Srinivas

>
> Signed-off-by: Prarit Bhargava <[email protected]>
> Cc: Srinivas Pandruvada <[email protected]>
> Cc: David Arcari <[email protected]>
> Cc: [email protected]
>
> Prarit Bhargava (8):
> tools/power/x86/intel-speed-select: Fix package typo
> tools/power/x86/intel-speed-select: Fix help option typo
> tools/power/x86/intel-speed-select: Fix cpu-count output
> tools/power/x86/intel-speed-select: Simplify output for turbo-freq
> and
> base-freq
> tools/power/x86/intel-speed-select: Switch output to MHz
> tools/power/x86/intel-speed-select: Change turbo ratio output to
> maximum turbo frequency
> tools/power/x86/intel-speed-select: Output human readable CPU list
> tools/power/x86/intel-speed-select: Output success/failed for
> command
> output
>
> .../x86/intel-speed-select/isst-config.c | 4 +-
> .../x86/intel-speed-select/isst-display.c | 116 ++++++++++++--
> ----
> 2 files changed, 83 insertions(+), 37 deletions(-)
>

2019-09-04 20:57:29

by Prarit Bhargava

[permalink] [raw]
Subject: Re: [PATCH 0/8] tools-power-x86-intel-speed-select: Fixes and updates for output



On 9/4/19 4:06 PM, Srinivas Pandruvada wrote:
> On Tue, 2019-09-03 at 11:37 -0400, Prarit Bhargava wrote:
>> Some general fixes and updates for intel-speed-select. Fixes include
>> some
>> typos as well as an off-by-one cpu count reporting error. Updates
>> for the
>> output are
>>
>> - switching to MHz as a standard
>> - reporting CPU frequencies instead of ratios as a standard
>> - viewing a human-readable CPU list.
>> - avoiding reporting "0|1" as success|fail as these can be confusing
>> for a
>> user.
> Series looks fine, except 8/8.
> So please submit v2. Better to resubmit as a series as v2, unless Andy
> has other preference.

Thanks Srinivas.

I have an additional patch. It looks like there's a memory leak. Sorry for the
cut-and-paste but if okay I'll submit this as part of v2. Reworking the code
this way makes it easier to introduce CascadeLake-N support too.

diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/
intel-speed-select/isst-config.c
index 78f0cebda1da..59753b3917bb 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -603,6 +603,10 @@ static int isst_fill_platform_info(void)

close(fd);

+ if (isst_platform_info.api_version > supported_api_ver) {
+ printf("Incompatible API versions; Upgrade of tool is required\n");
+ return -1;
+ }
return 0;
}

@@ -1528,6 +1532,7 @@ static void cmdline(int argc, char **argv)
{
int opt;
int option_index = 0;
+ int ret;

static struct option long_options[] = {
{ "cpu", required_argument, 0, 'c' },
@@ -1589,13 +1594,14 @@ static void cmdline(int argc, char **argv)
set_max_cpu_num();
set_cpu_present_cpu_mask();
set_cpu_target_cpu_mask();
- isst_fill_platform_info();
- if (isst_platform_info.api_version > supported_api_ver) {
- printf("Incompatible API versions; Upgrade of tool is required\n");
- exit(0);
- }
+ ret = isst_fill_platform_info();
+ if (ret)
+ goto out;

process_command(argc, argv);
+out:
+ free_cpu_set(present_cpumask);
+ free_cpu_set(target_cpumask);
}

int main(int argc, char **argv)

P.
>
> Thanks,
> Srinivas
>
>>
>> Signed-off-by: Prarit Bhargava <[email protected]>
>> Cc: Srinivas Pandruvada <[email protected]>
>> Cc: David Arcari <[email protected]>
>> Cc: [email protected]
>>
>> Prarit Bhargava (8):
>> tools/power/x86/intel-speed-select: Fix package typo
>> tools/power/x86/intel-speed-select: Fix help option typo
>> tools/power/x86/intel-speed-select: Fix cpu-count output
>> tools/power/x86/intel-speed-select: Simplify output for turbo-freq
>> and
>> base-freq
>> tools/power/x86/intel-speed-select: Switch output to MHz
>> tools/power/x86/intel-speed-select: Change turbo ratio output to
>> maximum turbo frequency
>> tools/power/x86/intel-speed-select: Output human readable CPU list
>> tools/power/x86/intel-speed-select: Output success/failed for
>> command
>> output
>>
>> .../x86/intel-speed-select/isst-config.c | 4 +-
>> .../x86/intel-speed-select/isst-display.c | 116 ++++++++++++--
>> ----
>> 2 files changed, 83 insertions(+), 37 deletions(-)
>>
>

2019-09-04 21:01:23

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH 0/8] tools-power-x86-intel-speed-select: Fixes and updates for output


On Wed, 2019-09-04 at 16:55 -0400, Prarit Bhargava wrote:
>
> On 9/4/19 4:06 PM, Srinivas Pandruvada wrote:
> > On Tue, 2019-09-03 at 11:37 -0400, Prarit Bhargava wrote:
> > > Some general fixes and updates for intel-speed-select. Fixes
> > > include
> > > some
> > > typos as well as an off-by-one cpu count reporting
> > > error. Updates
> > > for the
> > > output are
> > >
> > > - switching to MHz as a standard
> > > - reporting CPU frequencies instead of ratios as a standard
> > > - viewing a human-readable CPU list.
> > > - avoiding reporting "0|1" as success|fail as these can be
> > > confusing
> > > for a
> > > user.
> >
> > Series looks fine, except 8/8.
> > So please submit v2. Better to resubmit as a series as v2, unless
> > Andy
> > has other preference.
>
> Thanks Srinivas.
>
> I have an additional patch. It looks like there's a memory
> leak. Sorry for the
> cut-and-paste but if okay I'll submit this as part of v2. Reworking
> the code
> this way makes it easier to introduce CascadeLake-N support too.
>
Looks good to me.

> diff --git a/tools/power/x86/intel-speed-select/isst-config.c
> b/tools/power/x86/
> intel-speed-select/isst-config.c
> index 78f0cebda1da..59753b3917bb 100644
> --- a/tools/power/x86/intel-speed-select/isst-config.c
> +++ b/tools/power/x86/intel-speed-select/isst-config.c
> @@ -603,6 +603,10 @@ static int isst_fill_platform_info(void)
>
> close(fd);
>
> + if (isst_platform_info.api_version > supported_api_ver) {
> + printf("Incompatible API versions; Upgrade of tool is
> required\n");
> + return -1;
> + }
> return 0;
> }
>
> @@ -1528,6 +1532,7 @@ static void cmdline(int argc, char **argv)
> {
> int opt;
> int option_index = 0;
> + int ret;
>
> static struct option long_options[] = {
> { "cpu", required_argument, 0, 'c' },
> @@ -1589,13 +1594,14 @@ static void cmdline(int argc, char **argv)
> set_max_cpu_num();
> set_cpu_present_cpu_mask();
> set_cpu_target_cpu_mask();
> - isst_fill_platform_info();
> - if (isst_platform_info.api_version > supported_api_ver) {
> - printf("Incompatible API versions; Upgrade of tool is
> required\n");
> - exit(0);
> - }
> + ret = isst_fill_platform_info();
> + if (ret)
> + goto out;
>
> process_command(argc, argv);
> +out:
> + free_cpu_set(present_cpumask);
> + free_cpu_set(target_cpumask);
> }
>
> int main(int argc, char **argv)
>
> P.
> >
> > Thanks,
> > Srinivas
> >
> > >
> > > Signed-off-by: Prarit Bhargava <[email protected]>
> > > Cc: Srinivas Pandruvada <[email protected]>
> > > Cc: David Arcari <[email protected]>
> > > Cc: [email protected]
> > >
> > > Prarit Bhargava (8):
> > > tools/power/x86/intel-speed-select: Fix package typo
> > > tools/power/x86/intel-speed-select: Fix help option typo
> > > tools/power/x86/intel-speed-select: Fix cpu-count output
> > > tools/power/x86/intel-speed-select: Simplify output for turbo-
> > > freq
> > > and
> > > base-freq
> > > tools/power/x86/intel-speed-select: Switch output to MHz
> > > tools/power/x86/intel-speed-select: Change turbo ratio output
> > > to
> > > maximum turbo frequency
> > > tools/power/x86/intel-speed-select: Output human readable CPU
> > > list
> > > tools/power/x86/intel-speed-select: Output success/failed for
> > > command
> > > output
> > >
> > > .../x86/intel-speed-select/isst-config.c | 4 +-
> > > .../x86/intel-speed-select/isst-display.c | 116
> > > ++++++++++++--
> > > ----
> > > 2 files changed, 83 insertions(+), 37 deletions(-)
> > >