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 cpupower utility for POWER. 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 POWER system:

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 POWER box:

root@ubuntu:~# cpupower info
Subcommand not supported on POWER

Same result for set subcommand.
This patch does not affect results on a intel box.

Signed-off-by: Abhishek Goel <huntbag@linux.vnet.ibm.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Abhishek Goel 2019-10-17 00:56:39 -05:00 committed by Shuah Khan
parent 7e5705c635
commit d80a4ac208
2 changed files with 18 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <sys/utsname.h>
#include "helpers/helpers.h"
#include "helpers/sysfs.h"
@ -30,6 +31,7 @@ int cmd_info(int argc, char **argv)
extern char *optarg;
extern int optind, opterr, optopt;
unsigned int cpu;
struct utsname uts;
union {
struct {
@ -39,6 +41,13 @@ int cmd_info(int argc, char **argv)
} params = {};
int ret = 0;
ret = uname(&uts);
if (!ret && (!strcmp(uts.machine, "ppc64le") ||
!strcmp(uts.machine, "ppc64"))) {
fprintf(stderr, _("Subcommand not supported on POWER.\n"));
return ret;
}
setlocale(LC_ALL, "");
textdomain(PACKAGE);

View File

@ -10,6 +10,7 @@
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <sys/utsname.h>
#include "helpers/helpers.h"
#include "helpers/sysfs.h"
@ -31,6 +32,7 @@ int cmd_set(int argc, char **argv)
extern char *optarg;
extern int optind, opterr, optopt;
unsigned int cpu;
struct utsname uts;
union {
struct {
@ -41,6 +43,13 @@ int cmd_set(int argc, char **argv)
int perf_bias = 0;
int ret = 0;
ret = uname(&uts);
if (!ret && (!strcmp(uts.machine, "ppc64le") ||
!strcmp(uts.machine, "ppc64"))) {
fprintf(stderr, _("Subcommand not supported on POWER.\n"));
return ret;
}
setlocale(LC_ALL, "");
textdomain(PACKAGE);