Skip to contentSkip to conversation

cpupowerutils: bench - Fix cpu online check

PATCH In review Abhishek Goel 2 participants 4 messages Nov 7, 2017 – Nov 15, 2017 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpupowerutils: bench - Fix cpu online check

cpupower_is_cpu_online was incorrectly checking for 0. This patch fixes this by checking for 1 when the cpu is online.

---
v2: Commit message rephrased.

---
 tools/power/cpupower/bench/system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/bench/system.c +1 -1
index c25a74a..2bb3eef 100644
@@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu)
 
 	dprintf("set %s as cpufreq governor\n", governor);
 
-	if (cpupower_is_cpu_online(cpu) != 0) {
+	if (cpupower_is_cpu_online(cpu) != 1) {
 		perror("cpufreq_cpu_exists");
 		fprintf(stderr, "error: cpu %u does not exist\n", cpu);
 		return -1;
Signature · 1 line
2.9.3
author
#1 lore raw

Hi,

Can you please have a look at this also?

Thanks and Regards,
Abhishek Goel
System Engineer
IBM India Pvt. Ltd.

Quoted 23 lines · Abhishek Goel

cpupower_is_cpu_online was incorrectly checking for 0. This patch fixes this by checking for 1 when the cpu is online.

---
v2: Commit message rephrased.

---
  tools/power/cpupower/bench/system.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/bench/system.c +1 -1
index c25a74a..2bb3eef 100644
@@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu)
 
  	dprintf("set %s as cpufreq governor\n", governor);
 
-	if (cpupower_is_cpu_online(cpu) != 0) {
+	if (cpupower_is_cpu_online(cpu) != 1) {
  		perror("cpufreq_cpu_exists");
  		fprintf(stderr, "error: cpu %u does not exist\n", cpu);
  		return -1;
#2 lore raw
Quoted 9 lines · Abhishek

Hi,

Can you please have a look at this also?

Thanks and Regards,
Abhishek Goel
System Engineer
IBM India Pvt. Ltd.

Same comment on top posting.

Quoted 17 lines · Abhishek Goel
Quoted 16 lines

cpupower_is_cpu_online was incorrectly checking for 0. This patch fixes this by checking for 1 when the cpu is online.

---
v2: Commit message rephrased.
---
  tools/power/cpupower/bench/system.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/bench/system.c +0 -0
index c25a74a..2bb3eef 100644
@@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu)
 
Quoted 8 lines

tools/power/cpupower/bench/system.c int set_cpufreq_governor(char *governor, unsigned int cpu) · line 67

Quoted 7 lines
tools/power/cpupower/bench/system.c +1 -1
       dprintf("set %s as cpufreq governor\n", governor);
 
-    if (cpupower_is_cpu_online(cpu) != 0) {
+    if (cpupower_is_cpu_online(cpu) != 1) {
           perror("cpufreq_cpu_exists");
           fprintf(stderr, "error: cpu %u does not exist\n", cpu);
           return -1;

Ths patch looks good to me. I still need it in my Inbox. Please send it to me directly.

thanks,
-- Shuah

#3 lore raw
In reply to Abhishek Goel
Quoted 16 lines · Abhishek Goel

cpupower_is_cpu_online was incorrectly checking for 0. This patch fixes this by checking for 1 when the cpu is online.

---
v2: Commit message rephrased.

---
 tools/power/cpupower/bench/system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/bench/system.c +0 -0
index c25a74a..2bb3eef 100644

tools/power/cpupower/bench/system.c int set_cpufreq_governor(char *governor, unsigned int cpu) · line 67

Quoted 8 lines
tools/power/cpupower/bench/system.c +1 -1
@@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu)
 
 	dprintf("set %s as cpufreq governor\n", governor);
 
-	if (cpupower_is_cpu_online(cpu) != 0) {
+	if (cpupower_is_cpu_online(cpu) != 1) {
 		perror("cpufreq_cpu_exists");
 		fprintf(stderr, "error: cpu %u does not exist\n", cpu);
 		return -1;

Thanks. I will queue this up for 4.15-rc2

-- Shuah