2015-07-22 08:21:33

by Shilpasri G Bhat

[permalink] [raw]
Subject: [PATCH] cpupower: Do not change the frequency of offline cpu

Check if the cpu is online before changing the frequency/governor of
the cpu.

Signed-off-by: Shilpasri G Bhat <[email protected]>
---
tools/power/cpupower/utils/cpufreq-set.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index f656e58..4e21357 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -17,6 +17,7 @@

#include "cpufreq.h"
#include "helpers/helpers.h"
+#include "helpers/sysfs.h"

#define NORM_FREQ_LEN 32

@@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv)
cpufreq_cpu_exists(cpu))
continue;

+ if (sysfs_is_cpu_online(cpu) != 1)
+ continue;
+
printf(_("Setting cpu: %d\n"), cpu);
ret = do_one_cpu(cpu, &new_pol, freq, policychange);
if (ret) {
--
1.9.3


2015-07-22 11:45:01

by Thomas Renninger

[permalink] [raw]
Subject: Re: [PATCH] cpupower: Do not change the frequency of offline cpu

On Wednesday, July 22, 2015 01:50:49 PM Shilpasri G Bhat wrote:
> Check if the cpu is online before changing the frequency/governor of
> the cpu.
>
> Signed-off-by: Shilpasri G Bhat <[email protected]>
> ---
> tools/power/cpupower/utils/cpufreq-set.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/power/cpupower/utils/cpufreq-set.c
> b/tools/power/cpupower/utils/cpufreq-set.c index f656e58..4e21357 100644
> --- a/tools/power/cpupower/utils/cpufreq-set.c
> +++ b/tools/power/cpupower/utils/cpufreq-set.c
> @@ -17,6 +17,7 @@
>
> #include "cpufreq.h"
> #include "helpers/helpers.h"
> +#include "helpers/sysfs.h"
>
> #define NORM_FREQ_LEN 32
>
> @@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv)
> cpufreq_cpu_exists(cpu))
> continue;
>
> + if (sysfs_is_cpu_online(cpu) != 1)
> + continue;
> +
> printf(_("Setting cpu: %d\n"), cpu);
> ret = do_one_cpu(cpu, &new_pol, freq, policychange);
> if (ret) {

Thanks for catching this one and sending a patch!

Acked-by: Thomas Renninger <[email protected]>

2015-07-23 05:14:03

by Gautham R Shenoy

[permalink] [raw]
Subject: Re: [PATCH] cpupower: Do not change the frequency of offline cpu

Hi Shilpa,

This looks good.

Reviewed-by: Gautham R. Shenoy <[email protected]>

On Wed, Jul 22, 2015 at 01:50:49PM +0530, Shilpasri G Bhat wrote:
> Check if the cpu is online before changing the frequency/governor of
> the cpu.
>
> Signed-off-by: Shilpasri G Bhat <[email protected]>
> ---
> tools/power/cpupower/utils/cpufreq-set.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
> index f656e58..4e21357 100644
> --- a/tools/power/cpupower/utils/cpufreq-set.c
> +++ b/tools/power/cpupower/utils/cpufreq-set.c
> @@ -17,6 +17,7 @@
>
> #include "cpufreq.h"
> #include "helpers/helpers.h"
> +#include "helpers/sysfs.h"
>
> #define NORM_FREQ_LEN 32
>
> @@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv)
> cpufreq_cpu_exists(cpu))
> continue;
>
> + if (sysfs_is_cpu_online(cpu) != 1)
> + continue;
> +
> printf(_("Setting cpu: %d\n"), cpu);
> ret = do_one_cpu(cpu, &new_pol, freq, policychange);
> if (ret) {
> --
> 1.9.3
>

2015-07-23 06:50:52

by Shilpasri G Bhat

[permalink] [raw]
Subject: [RESEND PATCH] cpupower: Do not change the frequency of offline cpu

Check if the cpu is online before changing the frequency/governor of
the cpu.

Reported-by: Pavaman Subramaniyam <[email protected]>
Signed-off-by: Shilpasri G Bhat <[email protected]>
Reviewed-by: Gautham R. Shenoy <[email protected]>
Acked-by: Thomas Renninger <[email protected]>
---

Included Reported-by tag

tools/power/cpupower/utils/cpufreq-set.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index f656e58..4e21357 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -17,6 +17,7 @@

#include "cpufreq.h"
#include "helpers/helpers.h"
+#include "helpers/sysfs.h"

#define NORM_FREQ_LEN 32

@@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv)
cpufreq_cpu_exists(cpu))
continue;

+ if (sysfs_is_cpu_online(cpu) != 1)
+ continue;
+
printf(_("Setting cpu: %d\n"), cpu);
ret = do_one_cpu(cpu, &new_pol, freq, policychange);
if (ret) {
--
1.9.3

2015-07-23 20:31:53

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [RESEND PATCH] cpupower: Do not change the frequency of offline cpu

On Thursday, July 23, 2015 12:20:27 PM Shilpasri G Bhat wrote:
> Check if the cpu is online before changing the frequency/governor of
> the cpu.
>
> Reported-by: Pavaman Subramaniyam <[email protected]>
> Signed-off-by: Shilpasri G Bhat <[email protected]>
> Reviewed-by: Gautham R. Shenoy <[email protected]>
> Acked-by: Thomas Renninger <[email protected]>

Queued up for 4.3, thanks!

Rafael