[Intel-gfx] [PATCH igt 2/2] igt/perf_pmu: Replace hard-coded sleep before rc6 with a probe
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Tue Dec 5 12:05:14 UTC 2017
On 05/12/2017 10:56, Chris Wilson wrote:
> Instead of trying to sleep for 2 evaluations intervals and then assuming
> that rc6 is working, poll the rc6 residency instead.
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=103929
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
> tests/perf_pmu.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index e872f4e55..65bc734da 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -1008,6 +1008,20 @@ static unsigned long rc6_enable_us(void)
> return 2 * 160 * 1000;
> }
>
> +static bool wait_for_rc6(int fd)
> +{
> + struct timespec tv = {};
> + uint64_t start, now;
> +
> + start = pmu_read_single(fd);
> + do {
> + usleep(50);
Not needlessly fast?
> + now = pmu_read_single(fd);
> + } while (start == now && !igt_seconds_elapsed(&tv));
So up to one second wait.
> +
> + return start != now;
> +}
> +
> static void
> test_rc6(int gem_fd)
> {
> @@ -1019,7 +1033,7 @@ test_rc6(int gem_fd)
> fd = open_pmu(I915_PMU_RC6_RESIDENCY);
>
> gem_quiescent_gpu(gem_fd);
> - usleep(rc6_enable_us()); /* wait for the rc6 cycle counter to kick in */
> + igt_require(wait_for_rc6(fd));
Eliminate now unused rc6_enable_us() ?
>
> /* Go idle and check full RC6. */
> prev = pmu_read_single(fd);
>
With dead-code removed:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Regards,
Tvrtko
More information about the Intel-gfx
mailing list