[PATCH 00/11] CPU frequency test improvements

Colin Ian King colin.king at canonical.com
Tue May 26 09:35:56 UTC 2015


On 21/05/15 10:34, Jeremy Kerr wrote:
> These changes rework the CPU frequency tests, mainly for compatiblity with
> non-x86 machines.
> 
> Patches 1-6 factor out the tests into smaller units, so that we can
> selectively enable or disable functionality that's specific to ACPI-based
> frequency control, and do a little rework to have a consistent 1 pass/fail
> per test run.
> 
> Patch 7 is a simple check for the consistency of frequency changes.
> 
> Patches 8-10 implement Linux perf support for the test benchmarks, so
> that we have meaningful results in the benchmark sets, across different
> platforms.
> 
> Patch 11 makes the tests a little more usable on large machines.
> 
> Questions / comments most welcome.
> 
> Cheers,

Thanks Jeremy,

cpufreq did require some attention, it has been rather crufty for a
while, so these patches are most welcome.

I ran the cpu freq changes through CoverityScan and it picked up two
potential issues, see the attached log.

I am a little concerned about using perf by default, can we add some
extra checks to see if perf is available and if not, fall back to the
older cruft bogo ops metrics, as some kernels may not have perf enabled.

Colin



> 
> 
> Jeremy
> 
> ---
> Jeremy Kerr (11):
>       cpu/cpufreq: Don't reparse cpu information
>       cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL
>       cpu/cpufreq: Add a separate cpufreq consistency test
>       cpu/cpufreq: Add test for duplicate entries in cpufreq tables
>       cpu/cpufreq: Do bios limit and claimed max checks as separate tests
>       cpu/cpufreq: Refactor CPU performance tests
>       cpu/cpufreq: Always check that cpufreq changes have taken
>       fwts: Use linux perf counters for cpu benchmarking
>       fwts: Use gettimeofday for cpu benchmark
>       fwts: scale cpu benchmark results to one second
>       cpu/cpufreq: Only run performance tests on master threads
> 
> 

-------------- next part --------------
New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1299399:    (DIVIDE_BY_ZERO)
/src/cpu/cpufreq/cpufreq.c: 529 in cpufreq_test_sw_any()
/src/cpu/cpufreq/cpufreq.c: 553 in cpufreq_test_sw_any()


________________________________________________________________________________________________________
*** CID 1299399:    (DIVIDE_BY_ZERO)
/src/cpu/cpufreq/cpufreq.c: 529 in cpufreq_test_sw_any()
523     				"Cannot get CPU performance.");
524     			return FWTS_ERROR;
525     		}
526     		high_perf = fwts_cpu_benchmark_best_result(&result);
527     
528     		performed_tests++;
>>>     CID 1299399:    (DIVIDE_BY_ZERO)
>>>     In expression "100 * performed_tests / n_tests", division by expression "n_tests" which may be zero has undefined behavior.
529     		fwts_progress(fw, 100 * performed_tests/n_tests);
530     		/*
531     		 * now set all the others to low again; sw_any will cause
532     		 * the core in question to now also get the low speed, while
533     		 * hardware max will keep the performance
534     		 */
/src/cpu/cpufreq/cpufreq.c: 553 in cpufreq_test_sw_any()
547     		    (high_perf - newhigh_perf > (high_perf - low_perf)/4) &&
548     		    (high_perf - low_perf > 20)) {
549     			cpu_set_lowest_frequency(fw, cpu);
550     			ok = false;
551     		}
552     		performed_tests++;
>>>     CID 1299399:    (DIVIDE_BY_ZERO)
>>>     In expression "100 * performed_tests / n_tests", division by expression "n_tests" which may be zero has undefined behavior.
553     		fwts_progress(fw, 100 * performed_tests/n_tests);
554     	}
555     
556     	if (!ok)
557     		fwts_failed(fw, LOG_LEVEL_MEDIUM,
558     			"CPUFreqCPUsSetToSW_ANY",


More information about the fwts-devel mailing list