Re: [PATCH] cpupower : Handle set and info subcommands for powerpc

From: Abhishek
Date: Thu Sep 12 2019 - 05:43:59 EST


Hi Shuah,

Thanks for the review. Few comments below.


On 09/11/2019 03:41 PM, shuah wrote:
On 9/11/19 3:54 AM, Abhishek Goel wrote:
Cpupower tool has set and info options which are not being used by
POWER machines. For powerpc, we will return directly for these two
subcommands. This removes the ambiguous error message while using set
option in case of power systems.

What is the error message you see? Please include it in the commit log.


Sure. Will include it in next version.


Signed-off-by: Abhishek Goel <huntbag@xxxxxxxxxxxxxxxxxx>
---
 tools/power/cpupower/utils/cpupower-info.c | 5 +++++
 tools/power/cpupower/utils/cpupower-set.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c
index 4c9d342b70ff..674b707a76af 100644
--- a/tools/power/cpupower/utils/cpupower-info.c
+++ b/tools/power/cpupower/utils/cpupower-info.c
@@ -39,6 +39,11 @@ int cmd_info(int argc, char **argv)
ÂÂÂÂÂ } params = {};
ÂÂÂÂÂ int ret = 0;
 + #ifdef __powerpc__
+ÂÂÂ printf(_("Cannot read info as system does not support performance bias setting\n"));
+ÂÂÂ return 0;
+ÂÂÂ #endif
+


We see something like this for "cpupower info" --->
"System does not support Intel's performance bias setting"

I am not in favor of bailing out this early with this ifdef switch.
I would rather see this checked somehow(?) when the ambiguous error
happens.

Since these two options are not being used by any other architecture
except x86, I suggest these options should not even be shown for
other architecture. So we can do something like this in cpupower.c :

static struct cmd_struct commands[] = {
ÂÂÂÂÂÂÂÂ .............
+#if defined (__x86_64__) || defined (__i386__)
ÂÂÂ ÂÂÂ { "set",ÂÂÂ ÂÂÂ cmd_set,ÂÂÂ ÂÂÂ 1ÂÂÂ },
ÂÂÂ ÂÂÂ { "info",ÂÂÂ ÂÂÂ cmd_info,ÂÂÂ ÂÂÂ 0ÂÂÂ },
+#endif
ÂÂÂ ÂÂÂ ..............

Is this Okay?


ÂÂÂÂÂ setlocale(LC_ALL, "");
ÂÂÂÂÂ textdomain(PACKAGE);
 diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index 3cd95c6cb974..c95b29278780 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -41,6 +41,11 @@ int cmd_set(int argc, char **argv)
ÂÂÂÂÂ int perf_bias = 0;
ÂÂÂÂÂ int ret = 0;
 + #ifdef __powerpc__
+ÂÂÂ printf(_("System does not support performance bias setting\n"));
+ÂÂÂ return 0;
+ÂÂÂ #endif
+

Same here.


For "cpupower set -b 10", we get something like :
"Error setting perf-bias value on CPU"


ÂÂÂÂÂ setlocale(LC_ALL, "");
ÂÂÂÂÂ textdomain(PACKAGE);


thanks,
-- Shuah

Thanks,
-- Abhishek