[Intel-gfx] [PATCH v2] drm/i915/selftests: Measure dispatch latency
Chris Wilson
chris at chris-wilson.co.uk
Mon May 18 15:17:15 UTC 2020
Quoting Chris Wilson (2020-05-18 16:14:43)
> Quoting Mika Kuoppala (2020-05-18 16:07:47)
> > Chris Wilson <chris at chris-wilson.co.uk> writes:
> > > + cs = emit_timestamp_store(cs, ce, offset + i * sizeof(u32));
> >
> > Is the dual writes here so that when you kick the semaphore, you get the
> > latest no matter which side you were on?
>
> We wait on the first write in the CPU before releasing the semaphore. It
> was easier to copy the code, but now it can be an emit_store_dw() to
> make it clearer that we are not using it as timestamp -- and avoid the
> infinite wait if we hit CS_TIMESTAMP == 0.
diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index c6dff5145a3c..887171ff21a0 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1779,7 +1779,7 @@ static int measure_busy_dispatch(struct intel_context *ce)
return PTR_ERR(cs);
}
- cs = emit_timestamp_store(cs, ce, offset + i * sizeof(u32));
+ cs = emit_store_dw(cs, offset + i * sizeof(u32), -1);
cs = emit_semaphore_poll_until(cs, offset, i);
cs = emit_timestamp_store(cs, ce, offset + i * sizeof(u32));
@@ -1802,8 +1802,10 @@ static int measure_busy_dispatch(struct intel_context *ce)
wait_for(READ_ONCE(sema[i - 1]), 500);
semaphore_set(sema, i - 1);
- for (i = 1; i <= COUNT; i++)
+ for (i = 1; i <= COUNT; i++) {
+ GEM_BUG_ON(sema[i] == -1);
elapsed[i - 1] = (sema[i] - elapsed[i]) << COUNT;
+ }
More information about the Intel-gfx
mailing list