[PATCH 2/2] cpufreq: fix the CPUFreqSW_ALL and CPUFreqSW_ANY failed LP#1076694

Colin Ian King colin.king at canonical.com
Tue Nov 20 10:53:13 UTC 2012


On 20/11/12 10:10, Ivan Hu wrote:
> The tests will set frequency to 0 that causes test fail, modify the
> get_performance_repeat fuction to avoid the test fail.

I think we've been bitten by a change in functionality in the way 
setting the lowest frequency works, or this is a bug from the original 
code from the linux firmware kit where this code was derived.

>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>   src/cpu/cpufreq/cpufreq.c |   21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 98a5a9a..7136e7d 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -172,9 +172,7 @@ static unsigned long get_performance(const int cpu)
>   	return loopcount;
>   }
>
> -
> -static unsigned long get_performance_repeat(fwts_framework *fw,
> -	int cpu, unsigned long Hz, int count, int type)
> +static unsigned long get_performance_repeat(int cpu, int count, int type)
>   {
>   	int i;
>
> @@ -182,7 +180,6 @@ static unsigned long get_performance_repeat(fwts_framework *fw,
>   	unsigned long long cumulative = 0;
>   	unsigned long retval;
>
> -	set_HZ(fw, cpu, Hz);

Yes, this is redundant (and wrong). Well spotted. This bug has been here 
since day #1 of this test.

>   	for (i = 0; i < count; i++) {
>   		unsigned long temp;
>   		temp = get_performance(cpu);
> @@ -468,11 +465,11 @@ static void do_sw_all_test(fwts_framework *fw)
>   	closedir(dir);
>
>   	/* All CPUs at the lowest frequency */
> -	lowperf = 100 * get_performance_repeat(fw, first_cpu_index,
> -						0, 5, GET_PERFORMANCE_MIN) / top_speed;
> +	lowperf = 100 * get_performance_repeat(first_cpu_index,
> +						5, GET_PERFORMANCE_MIN) / top_speed;
>   	highest_speed(fw, first_cpu_index);
> -	highperf = 100 * get_performance_repeat(fw, first_cpu_index,
> -						0, 5, GET_PERFORMANCE_MAX) / top_speed;
> +	highperf = 100 * get_performance_repeat(first_cpu_index,
> +						5, GET_PERFORMANCE_MAX) / top_speed;
>
>   	if (lowperf >= highperf)
>   		fwts_failed(fw, LOG_LEVEL_MEDIUM,
> @@ -515,8 +512,8 @@ static void do_sw_any_test(fwts_framework *fw)
>   	rewinddir(dir);
>
>   	/* All CPUs at the lowest frequency */
> -	lowperf = 100 * get_performance_repeat(fw, first_cpu_index,
> -						0, 5, GET_PERFORMANCE_MIN) / top_speed;
> +	lowperf = 100 * get_performance_repeat(first_cpu_index,
> +						5, GET_PERFORMANCE_MIN) / top_speed;
>
>   	highest_speed(fw, first_cpu_index);
>
> @@ -530,8 +527,8 @@ static void do_sw_any_test(fwts_framework *fw)
>   	}
>   	closedir(dir);
>
> -	highperf = 100 * get_performance_repeat(fw, first_cpu_index,
> -						0, 5, GET_PERFORMANCE_MAX) / top_speed;
> +	highperf = 100 * get_performance_repeat(first_cpu_index,
> +						5, GET_PERFORMANCE_MAX) / top_speed;
>
>   	if (lowperf >= highperf)
>   		fwts_failed(fw, LOG_LEVEL_MEDIUM,
>

Thanks Ivan.

Acked-by: Colin Ian King <colin.king at canonical.com>




More information about the fwts-devel mailing list