Skip to contentSkip to conversation

cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq

PATCH RESEND In review Laura Abbott 3 participants 3 messages Oct 19, 2016 – Oct 24, 2016 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq

When converting to a shared library in ac5a181d065d ("cpupower: Add cpuidle parts into library"), cpu_freq_cpu_exists was converted to cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and -ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success. Check for the correct return value in cpufreq-set.

See https://bugzilla.redhat.com/show_bug.cgi?id=1374212

Fixes ac5a181d065d ("cpupower: Add cpuidle parts into library")

---
v2: Drop another redundant cpupower_is_cpu_online

Resend because I've heard nothing about this patch and it's still broken as far as I can tell.

---
 tools/power/cpupower/utils/cpufreq-set.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
tools/power/cpupower/utils/cpufreq-set.c +2 -5
index b4bf769..1eef0ae 100644
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
 			struct cpufreq_affected_cpus *cpus;
 
 			if (!bitmask_isbitset(cpus_chosen, cpu) ||
-			    cpupower_is_cpu_online(cpu))
+			    cpupower_is_cpu_online(cpu) != 1)
 				continue;
 
 			cpus = cpufreq_get_related_cpus(cpu);
@@ -316,10 +316,7 @@ int cmd_freq_set(int argc, char **argv)
 	     cpu <= bitmask_last(cpus_chosen); cpu++) {
 
 		if (!bitmask_isbitset(cpus_chosen, cpu) ||
-		    cpupower_is_cpu_online(cpu))
-			continue;
-
-		if (cpupower_is_cpu_online(cpu) != 1)
+		    cpupower_is_cpu_online(cpu) != 1)
 			continue;
 
 		printf(_("Setting cpu: %d\n"), cpu);
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Laura Abbott

When converting to a shared library in ac5a181d065d ("cpupower: Add cpuidle parts into library"), cpu_freq_cpu_exists was converted to cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and -ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success. Check for the correct return value in cpufreq-set.

Quoted 7 lines

See https://bugzilla.redhat.com/show_bug.cgi?id=1374212

Fixes ac5a181d065d ("cpupower: Add cpuidle parts into library")

---
v2: Drop another redundant cpupower_is_cpu_online

#2 lore raw
Quoted 9 lines · Shilpasri G Bhat
Quoted 8 lines · Laura Abbott

When converting to a shared library in ac5a181d065d ("cpupower: Add cpuidle parts into library"), cpu_freq_cpu_exists was converted to cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and -ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success. Check for the correct return value in cpufreq-set.

See https://bugzilla.redhat.com/show_bug.cgi?id=1374212

Quoted 7 lines
Quoted 5 lines
Fixes ac5a181d065d ("cpupower: Add cpuidle parts into library")

---
v2: Drop another redundant cpupower_is_cpu_online

I wanted to go through all recently sent patches and adjust rebase them to my lates changes.
But I guess the fact that I push this from day to day because of other stuff should not hold off such important fixes.

I collect and review all others as well the next day(s)..

Thomas