aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2021-01-08 20:40:22 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2021-01-08 21:35:54 +0000
commit0399d0e33a649a77c81a8bd2b2c5831608a489b6 (patch)
tree68c48b6f07c3f7c7c873508ea3ca7e542aca9530
parentdrm/i915/selftests: Skip unstable timing measurements (diff)
downloadlinux-dev-0399d0e33a649a77c81a8bd2b2c5831608a489b6.tar.xz
linux-dev-0399d0e33a649a77c81a8bd2b2c5831608a489b6.zip
drm/i915/selftests: Rearrange ktime_get to reduce latency against CS
In our tests where we measure the elapsed time on both the CPU and CS using a udelay, our CS results match the udelay much more accurately than the ktime (even when using ktime_get_fast_ns). With preemption disabled, we can go one step lower than ktime and use local_clock. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2919 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Andi Shyti <andi.shyti@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210108204026.20682-3-chris@chris-wilson.co.uk
-rw-r--r--drivers/gpu/drm/i915/gt/selftest_engine_pm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/gt/selftest_engine_pm.c b/drivers/gpu/drm/i915/gt/selftest_engine_pm.c
index ca080445695e..c3d965279fc3 100644
--- a/drivers/gpu/drm/i915/gt/selftest_engine_pm.c
+++ b/drivers/gpu/drm/i915/gt/selftest_engine_pm.c
@@ -112,11 +112,11 @@ static int __measure_timestamps(struct intel_context *ce,
/* Run the request for a 100us, sampling timestamps before/after */
preempt_disable();
- *dt = ktime_get_raw_fast_ns();
+ *dt = local_clock();
write_semaphore(&sema[2], 0);
udelay(100);
+ *dt = local_clock() - *dt;
write_semaphore(&sema[2], 1);
- *dt = ktime_get_raw_fast_ns() - *dt;
preempt_enable();
if (i915_request_wait(rq, 0, HZ / 2) < 0) {