[PATCH 1/2] cpufreq: fix the CPUFreqCPUsSetToSW_ANY failed LP#1076694

Ivan Hu ivan.hu at canonical.com
Tue Nov 20 10:10:24 UTC 2012


The bug LP#1076694 first failed "CPUFreqCPUsSetToSW_ANY: Test 1, Processors
are set to SW_ANY." This is due to when doing check_sw_any fuction,
we assume that high_perf > newhigh_perf, but if the newhigh_perf > high_perf
will accidentally make "high_perf - newhigh_perf > (high_perf - low_perf)/4"
to be true. So add high_perf > newhig_perf to avoid it.

Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
 src/cpu/cpufreq/cpufreq.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index 9efe4f0..98a5a9a 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -589,7 +589,8 @@ static void check_sw_any(fwts_framework *fw)
 			if (i != j)
 				lowest_speed(fw, j);
 		newhigh_perf = get_performance(i);
-		if (high_perf - newhigh_perf > (high_perf - low_perf)/4 &&
+		if ((high_perf > newhigh_perf) &&
+		    (high_perf - newhigh_perf > (high_perf - low_perf)/4) &&
 		    (once == 0) && (high_perf - low_perf > 20)) {
 			fwts_failed(fw, LOG_LEVEL_MEDIUM,
 				"CPUFreqCPUsSetToSW_ANY",
-- 
1.7.10.4




More information about the fwts-devel mailing list