[igt-dev] [i-g-t] Fixing the latency of hrtimer

Lionel Landwerlin lionel.g.landwerlin at intel.com
Thu Aug 27 08:31:15 UTC 2020


Looking at the check :

igt_assert(kernel_ns <= (test_duration_ns / 100ull));

It seems to be some sanity check that we're not spending more than 
1/100th of the time awake in the kernel.
The right thing would be to adjust that value by the number of expected 
wakeups.

5000000 (default hrtimer) -> 1/100th
2000000 -> 1/250th

I would update the check to this :

/* We expect the kernel time to not exceed 1/100th of the total test 
duration at the default hrtimer of 200Hz/every5ms. Scale that by the 
provided hrtimer if applicable. */
uint64_t max_expected_kernel_ns;

if (set_kernel_hrtimer)
    max_expected_kernel_ns = kernel_hrtimer * (test_duration_ns / 100) / 
(5 * 1000 * 1000);
else
    max_expected_kernel_ns = test_duration_ns / 100;

igt_assert(kernel_ns <= max_expected_kernel_ns);

Cheers,

-Lionel

On 27/08/2020 11:06, Sowmya Kaparthi wrote:
> The blocking/polling parameterized tests were introduced to test
> different hrtimer configurations.These tests check how many times the
> process wakes up to read the reports with different hrtimer values (=
> duration of test / hrtimer value). A user is more likely to choose a
> larger hrtimer value than the default 5ms to avoid wake up too frequently.
>
> Cc: Landwerlin, Lionel G <lionel.g.landwerlin at intel.com>
> Signed-off-by: Sowmya Kaparthi <sowmyax.kaparthi at intel.com>
> ---
>   tests/i915/perf.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/i915/perf.c b/tests/i915/perf.c
> index a894fd38..5fd1193f 100644
> --- a/tests/i915/perf.c
> +++ b/tests/i915/perf.c
> @@ -4995,7 +4995,7 @@ igt_main
>   			      40 * 1000 * 1000 /* default 40ms hrtimer */);
>   		test_blocking(500 * 1000 /* 500us oa period */,
>   			      true /* set_kernel_hrtimer */,
> -			      2 * 1000 * 1000 /* default 2ms hrtimer */);
> +			      10 * 1000 * 1000 /* default 10ms hrtimer */);
>   	}
>   
>   	igt_describe("Test polled read with default hrtimer frequency");
> @@ -5014,7 +5014,7 @@ igt_main
>   			     40 * 1000 * 1000 /* default 40ms hrtimer */);
>   		test_polling(500 * 1000 /* 500us oa period */,
>   			     true /* set_kernel_hrtimer */,
> -			     2 * 1000 * 1000 /* default 2ms hrtimer */);
> +			     10 * 1000 * 1000 /* default 10ms hrtimer */);
>   	}
>   
>   	igt_describe("Test polled read with buffer size smaller than available data");




More information about the igt-dev mailing list