Skip to contentSkip to conversation

cpupower : Handle set and info subcommands correctly

PATCH Superseded Abhishek Goel 2 participants 5 messages Sep 13, 2019 – Oct 14, 2019 CPU power monitoring

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpupower : Handle set and info subcommands correctly

Cpupower tool has set and info options which are being used only by x86 machines. This patch removes support for these two subcommands from generic cpupower utility. Thus, these two subcommands will now be available only for intel.
This removes the ambiguous error message while using set option in case of using non-intel systems.

Without this patch on a non-intel box:

root@ubuntu:~# cpupower info
System does not support Intel's performance bias setting
root@ubuntu:~# cpupower set -b 10
Error setting perf-bias value on CPU

With this patch on a non-intel box:

root@ubuntu:~# cpupower info
Supported commands are:
        frequency-info
        frequency-set
        idle-info
        idle-set
        monitor
        help

Same result for set subcommand.

This patch does not affect results on a intel box.

---

changes from v1:
Instead of bailing out early in set and info commands, in V2, we are cutting out support for these two commands for non-intel systems.

 tools/power/cpupower/utils/cpupower.c | 2 ++
 1 file changed, 2 insertions(+)
tools/power/cpupower/utils/cpupower.c +2 -0
index 8e3d08042825..babb9ab3afb1 100644
@@ -52,8 +52,10 @@ static struct cmd_struct commands[] = {
 	{ "frequency-set",	cmd_freq_set,	1	},
 	{ "idle-info",		cmd_idle_info,	0	},
 	{ "idle-set",		cmd_idle_set,	1	},
+#if defined(__x86_64__) || defined(__i386__)
 	{ "set",		cmd_set,	1	},
 	{ "info",		cmd_info,	0	},
+#endif
 	{ "monitor",		cmd_monitor,	0	},
 	{ "help",		cmd_help,	0	},
 	/*	{ "bench",	cmd_bench,	1	}, */
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 30 lines · Abhishek Goel

Cpupower tool has set and info options which are being used only by x86 machines. This patch removes support for these two subcommands from generic cpupower utility. Thus, these two subcommands will now be available only for intel.
This removes the ambiguous error message while using set option in case of using non-intel systems.

Without this patch on a non-intel box:

root@ubuntu:~# cpupower info
System does not support Intel's performance bias setting
root@ubuntu:~# cpupower set -b 10
Error setting perf-bias value on CPU

With this patch on a non-intel box:

root@ubuntu:~# cpupower info
Supported commands are:
         frequency-info
         frequency-set
         idle-info
         idle-set
         monitor
         help

Same result for set subcommand.

This patch does not affect results on a intel box.

Quoted 8 lines

---

changes from v1:
Instead of bailing out early in set and info commands, in V2, we are cutting out support for these two commands for non-intel systems.

thanks. I will get this in for 5.4-rc3 veru likely. Definitely in 5.4

-- Shuah

maintainer
#2 lore raw

Hi Abhishek,

Quoted 35 lines · shuah
Quoted 34 lines · Abhishek Goel

Cpupower tool has set and info options which are being used only by x86 machines. This patch removes support for these two subcommands from generic cpupower utility. Thus, these two subcommands will now be available only for intel.
This removes the ambiguous error message while using set option in case of using non-intel systems.

Without this patch on a non-intel box:

root@ubuntu:~# cpupower info
System does not support Intel's performance bias setting
root@ubuntu:~# cpupower set -b 10
Error setting perf-bias value on CPU

With this patch on a non-intel box:

root@ubuntu:~# cpupower info
Supported commands are:
         frequency-info
         frequency-set
         idle-info
         idle-set
         monitor
         help

Same result for set subcommand.

This patch does not affect results on a intel box.

---

Quoted 7 lines
Quoted 4 lines

changes from v1:
    Instead of bailing out early in set and info commands, in V2, we are cutting out support for these two commands for non-intel systems.

thanks. I will get this in for 5.4-rc3 veru likely. Definitely in 5.4

Okay I almost applied this and decided it needs improvements.

I don't like using #if defined(__x86_64__) || defined(__i386__)

tools/power/cpupower/utils/cpupower.c main() already does this dynamically using uname(). Please use the same logic do this, instead of adding compile time code.

thanks,
-- Shuah

author
#3 lore raw

Hi Shuah,

Quoted 48 lines · shuah

Hi Abhishek,

Quoted 35 lines · shuah
Quoted 34 lines · Abhishek Goel

Cpupower tool has set and info options which are being used only by x86 machines. This patch removes support for these two subcommands from generic cpupower utility. Thus, these two subcommands will now be available only for intel.
This removes the ambiguous error message while using set option in case of using non-intel systems.

Without this patch on a non-intel box:

root@ubuntu:~# cpupower info
System does not support Intel's performance bias setting
root@ubuntu:~# cpupower set -b 10
Error setting perf-bias value on CPU

With this patch on a non-intel box:

root@ubuntu:~# cpupower info
Supported commands are:
         frequency-info
         frequency-set
         idle-info
         idle-set
         monitor
         help

Same result for set subcommand.

This patch does not affect results on a intel box.

---

Quoted 7 lines
Quoted 4 lines

changes from v1:
    Instead of bailing out early in set and info commands, in V2, we are cutting out support for these two commands for non-intel systems.

thanks. I will get this in for 5.4-rc3 veru likely. Definitely in 5.4

Okay I almost applied this and decided it needs improvements.

Quoted 8 lines

I don't like using #if defined(__x86_64__) || defined(__i386__)

tools/power/cpupower/utils/cpupower.c main() already does this dynamically using uname(). Please use the same logic do this, instead of adding compile time code.

thanks,
-- Shuah

Do you want the decision to be taken in cpupower-set and cpupower-info file as was done in v1 but using uname() by identifying the architecture there itself?

Thanks,
--Abhishek

maintainer
#4 lore raw
Quoted 58 lines · Abhishek

Hi Shuah,

Quoted 54 lines · shuah

Hi Abhishek,

Quoted 35 lines · shuah
Quoted 34 lines · Abhishek Goel

Cpupower tool has set and info options which are being used only by x86 machines. This patch removes support for these two subcommands from generic cpupower utility. Thus, these two subcommands will now be available only for intel.
This removes the ambiguous error message while using set option in case of using non-intel systems.

Without this patch on a non-intel box:

root@ubuntu:~# cpupower info
System does not support Intel's performance bias setting
root@ubuntu:~# cpupower set -b 10
Error setting perf-bias value on CPU

With this patch on a non-intel box:

root@ubuntu:~# cpupower info
Supported commands are:
         frequency-info
         frequency-set
         idle-info
         idle-set
         monitor
         help

Same result for set subcommand.

This patch does not affect results on a intel box.

---

Quoted 7 lines
Quoted 4 lines

changes from v1:
    Instead of bailing out early in set and info commands, in V2, we are cutting out support for these two commands for non-intel systems.

thanks. I will get this in for 5.4-rc3 veru likely. Definitely in 5.4

Okay I almost applied this and decided it needs improvements.

I don't like using #if defined(__x86_64__) || defined(__i386__)

tools/power/cpupower/utils/cpupower.c main() already does this dynamically using uname(). Please use the same logic do this, instead of adding compile time code.

Quoted 7 lines
Quoted 2 lines

thanks,
-- Shuah

Do you want the decision to be taken in cpupower-set and cpupower-info file as was done in v1 but using uname() by identifying the architecture there itself?

As I recall my objection to the v1 was that it is making the call very early and bails out. Ideally, I would like to see the change as part of set/info handling and then print out appropriate message.

thanks,
-- Shuah