Skip to content

Commit c33ed06

Browse files
committed
drm/i915: Break i915_spin_request() if we see an interrupt
If an interrupt has been posted, and we were spinning on the active seqno waiting for it to advance but it did not, then we can expect that it will not see its advance in the immediate future and should call into the irq-seqno barrier. We can stop spinning at this point, and leave the difficulty of handling the coherency to the caller. Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Mika Kuoppala <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2246bea commit c33ed06

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/gpu/drm/i915/i915_gem_request.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,8 @@ static bool busywait_stop(unsigned long timeout, unsigned int cpu)
963963
bool __i915_spin_request(const struct drm_i915_gem_request *req,
964964
int state, unsigned long timeout_us)
965965
{
966-
unsigned int cpu;
966+
struct intel_engine_cs *engine = req->engine;
967+
unsigned int irq, cpu;
967968

968969
/* When waiting for high frequency requests, e.g. during synchronous
969970
* rendering split between the CPU and GPU, the finite amount of time
@@ -975,11 +976,20 @@ bool __i915_spin_request(const struct drm_i915_gem_request *req,
975976
* takes to sleep on a request, on the order of a microsecond.
976977
*/
977978

979+
irq = atomic_read(&engine->irq_count);
978980
timeout_us += local_clock_us(&cpu);
979981
do {
980982
if (__i915_gem_request_completed(req))
981983
return true;
982984

985+
/* Seqno are meant to be ordered *before* the interrupt. If
986+
* we see an interrupt without a corresponding seqno advance,
987+
* assume we won't see one in the near future but require
988+
* the engine->seqno_barrier() to fixup coherency.
989+
*/
990+
if (atomic_read(&engine->irq_count) != irq)
991+
break;
992+
983993
if (signal_pending_state(state, current))
984994
break;
985995

0 commit comments

Comments
 (0)