All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
@ 2017-02-12 21:53 Chris Wilson
  2017-02-12 21:53 ` [PATCH 2/2] drm/i915: Remove completed fences after a wait Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-02-12 21:53 UTC (permalink / raw)
  To: intel-gfx
  Cc: Chris Wilson, Matthew Auld, Joonas Lahtinen, # v4 . 10-rc1+, stable

The i915_gem_object_wait_fence() uses an incoming timeout=0 to query
whether the current fence is busy or idle, without waiting. This can be
used by the wait-ioctl to implement a busy query.

Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
Testcase: igt/gem_wait/basic-busy-write-all
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b8d869d7937d..cf8132c49600 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -440,7 +440,7 @@ i915_gem_object_wait_reservation(struct reservation_object *resv,
 			timeout = i915_gem_object_wait_fence(shared[i],
 							     flags, timeout,
 							     rps);
-			if (timeout <= 0)
+			if (timeout < 0)
 				break;
 
 			dma_fence_put(shared[i]);
@@ -453,7 +453,7 @@ i915_gem_object_wait_reservation(struct reservation_object *resv,
 		excl = reservation_object_get_excl_rcu(resv);
 	}
 
-	if (excl && timeout > 0)
+	if (excl && timeout >= 0)
 		timeout = i915_gem_object_wait_fence(excl, flags, timeout, rps);
 
 	dma_fence_put(excl);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/i915: Remove completed fences after a wait
  2017-02-12 21:53 [PATCH 1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Chris Wilson
@ 2017-02-12 21:53 ` Chris Wilson
  2017-02-17 13:47   ` Matthew Auld
  2017-02-12 22:22 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Patchwork
  2017-02-14  9:40 ` [PATCH 1/2] " Chris Wilson
  2 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2017-02-12 21:53 UTC (permalink / raw)
  To: intel-gfx

If we wait up on the full (i.e. all shared fences, or upon an exclusive fence)
reservation object successfully, we know that all fences beneath it have
been signaled, so long as no new fences were added whilst we slept. If the
reservation_object remains the same, as detected by its seqcount, we can
then reap all the fences upon completion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index cf8132c49600..e55a60c1afce 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -424,7 +424,9 @@ i915_gem_object_wait_reservation(struct reservation_object *resv,
 				 long timeout,
 				 struct intel_rps_client *rps)
 {
+	unsigned int seq = __read_seqcount_begin(&resv->seq);
 	struct dma_fence *excl;
+	bool prune_fences = false;
 
 	if (flags & I915_WAIT_ALL) {
 		struct dma_fence **shared;
@@ -449,15 +451,26 @@ i915_gem_object_wait_reservation(struct reservation_object *resv,
 		for (; i < count; i++)
 			dma_fence_put(shared[i]);
 		kfree(shared);
+
+		prune_fences = timeout >= 0;
 	} else {
 		excl = reservation_object_get_excl_rcu(resv);
 	}
 
-	if (excl && timeout >= 0)
+	if (excl && timeout >= 0) {
 		timeout = i915_gem_object_wait_fence(excl, flags, timeout, rps);
+		prune_fences = timeout >= 0;
+	}
 
 	dma_fence_put(excl);
 
+	if (prune_fences && !__read_seqcount_retry(&resv->seq, seq)) {
+		reservation_object_lock(resv, NULL);
+		if (!__read_seqcount_retry(&resv->seq, seq))
+			reservation_object_add_excl_fence(resv, NULL);
+		reservation_object_unlock(resv);
+	}
+
 	return timeout;
 }
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
  2017-02-12 21:53 [PATCH 1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Chris Wilson
  2017-02-12 21:53 ` [PATCH 2/2] drm/i915: Remove completed fences after a wait Chris Wilson
@ 2017-02-12 22:22 ` Patchwork
  2017-02-14  9:40 ` [PATCH 1/2] " Chris Wilson
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-02-12 22:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
URL   : https://patchwork.freedesktop.org/series/19523/
State : success

== Summary ==

Series 19523v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/19523/revisions/1/mbox/

fi-bdw-5557u     total:252  pass:241  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:252  pass:213  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:252  pass:233  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:252  pass:225  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:252  pass:221  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:252  pass:202  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:252  pass:235  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:252  pass:230  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:252  pass:224  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:252  pass:223  dwarn:0   dfail:0   fail:0   skip:29 

f48164e93e75dbbe0bb9dac254779eeea08c0657 drm-tip: 2017y-02m-12d-11h-10m-28s UTC integration manifest
386ebb9 drm/i915: Remove completed fences after a wait
1663af8 drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3785/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
  2017-02-12 21:53 [PATCH 1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Chris Wilson
  2017-02-12 21:53 ` [PATCH 2/2] drm/i915: Remove completed fences after a wait Chris Wilson
  2017-02-12 22:22 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Patchwork
@ 2017-02-14  9:40 ` Chris Wilson
  2 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-02-14  9:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Matthew Auld, Joonas Lahtinen, # v4 . 10-rc1+, stable

On Sun, Feb 12, 2017 at 09:53:43PM +0000, Chris Wilson wrote:
> The i915_gem_object_wait_fence() uses an incoming timeout=0 to query
> whether the current fence is busy or idle, without waiting. This can be
> used by the wait-ioctl to implement a busy query.
> 
> Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
> Testcase: igt/gem_wait/basic-busy-write-all
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> Cc: stable@vger.kernel.org

Pushed this patch with Joonas' IRC r-b. Thanks,
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/i915: Remove completed fences after a wait
  2017-02-12 21:53 ` [PATCH 2/2] drm/i915: Remove completed fences after a wait Chris Wilson
@ 2017-02-17 13:47   ` Matthew Auld
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Auld @ 2017-02-17 13:47 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Intel Graphics Development

On 12 February 2017 at 21:53, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> If we wait up on the full (i.e. all shared fences, or upon an exclusive fence)
s/up on/upon

> reservation object successfully, we know that all fences beneath it have
> been signaled, so long as no new fences were added whilst we slept. If the
> reservation_object remains the same, as detected by its seqcount, we can
> then reap all the fences upon completion.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-17 13:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-12 21:53 [PATCH 1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Chris Wilson
2017-02-12 21:53 ` [PATCH 2/2] drm/i915: Remove completed fences after a wait Chris Wilson
2017-02-17 13:47   ` Matthew Auld
2017-02-12 22:22 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence() Patchwork
2017-02-14  9:40 ` [PATCH 1/2] " Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.