Re: [RFC v4 2/2] selftest/cpuidle: Add support for cpuidle latency measurement

From: Doug Smythies
Date: Sun Apr 25 2021 - 16:49:46 EST


Hi Pratik,

On Mon, Apr 12, 2021 at 12:43 AM Pratik Rajesh Sampat
<psampat@xxxxxxxxxxxxx> wrote:
>
> The cpuidle latency selftest provides support to systematically extract,
> analyse and present IPI and timer based wakeup latencies for each CPU
> and each idle state available on the system.
>
> The selftest leverages test-cpuidle_latency module's debugfs interface
> to interact and extract latency information from the kernel.
>
> The selftest inserts the module if already not inserted, disables all
> the idle states and enables them one by one testing the following:
> 1. Keeping source CPU constant, iterate through all the CPUS measuring
> IPI latency for baseline (CPU is busy with cat /dev/random > /dev/null
> workload) and then when the CPU is allowed to be at rest
> 2. Iterating through all the CPUs, sending expected timer durations to
> be equivalent to the residency of the deepest idle state enabled
> and extracting the difference in time between the time of wakeup and
> the expected timer duration
>
> The timer based test produces run to run variance on some intel based
> systems that sport a mechansim "C-state pre-wake" which can
> pre-wake a CPU from an idle state when timers are armed. For systems and
> architectures that don't have this mechansim can leverage timer tests
> with the -i option.
>
> To run this test specifically:
> $ sudo make -C tools/testing/selftests TARGETS="cpuidle" run_tests
>
> There are a few optional arguments too that the script can take
> [-h <help>]
> [-i <run timer tests>]
> [-m <location of the module>]
> [-o <location of the output>]
> [-v <verbose> (run on all cpus)]
> Default Output location in: tools/testing/selftest/cpuidle/cpuidle.log
>
> To run the test without re-compiling:
> $ cd tools/testing/selftest/cpuidle/
> $ sudo ./cpuidle.sh
>
> Signed-off-by: Pratik Rajesh Sampat <psampat@xxxxxxxxxxxxx>

Reviewed-by: Doug Smythies <dsmythies@xxxxxxxxx>
...