All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 09/19] drm/i915: Assert all signalers we depended on did indeed signal
Date: Tue,  2 Jan 2018 15:12:25 +0000	[thread overview]
Message-ID: <20180102151235.3949-9-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20180102151235.3949-1-chris@chris-wilson.co.uk>

Back up our comment that all signalers should have been signaled before
we ourselves were retired with an assert to that effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_request.c | 9 ++++++++-
 drivers/gpu/drm/i915/i915_gem_request.h | 6 ++++++
 drivers/gpu/drm/i915/intel_lrc.c        | 9 ++-------
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
index b5213a926ced..a24c6a87953c 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/i915_gem_request.c
@@ -161,12 +161,16 @@ i915_priotree_fini(struct drm_i915_private *i915, struct i915_priotree *pt)
 
 	GEM_BUG_ON(!list_empty(&pt->link));
 
-	/* Everyone we depended upon (the fences we wait to be signaled)
+	/*
+	 * Everyone we depended upon (the fences we wait to be signaled)
 	 * should retire before us and remove themselves from our list.
 	 * However, retirement is run independently on each timeline and
 	 * so we may be called out-of-order.
 	 */
 	list_for_each_entry_safe(dep, next, &pt->signalers_list, signal_link) {
+		GEM_BUG_ON(!i915_gem_request_completed(priotree_to_request(dep->signaler)));
+		GEM_BUG_ON(!list_empty(&dep->dfs_link));
+
 		list_del(&dep->wait_link);
 		if (dep->flags & I915_DEPENDENCY_ALLOC)
 			i915_dependency_free(i915, dep);
@@ -174,6 +178,9 @@ i915_priotree_fini(struct drm_i915_private *i915, struct i915_priotree *pt)
 
 	/* Remove ourselves from everyone who depends upon us */
 	list_for_each_entry_safe(dep, next, &pt->waiters_list, wait_link) {
+		GEM_BUG_ON(dep->signaler != pt);
+		GEM_BUG_ON(!list_empty(&dep->dfs_link));
+
 		list_del(&dep->signal_link);
 		if (dep->flags & I915_DEPENDENCY_ALLOC)
 			i915_dependency_free(i915, dep);
diff --git a/drivers/gpu/drm/i915/i915_gem_request.h b/drivers/gpu/drm/i915/i915_gem_request.h
index 04ee289d6cab..5753ab3aaff5 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.h
+++ b/drivers/gpu/drm/i915/i915_gem_request.h
@@ -227,6 +227,12 @@ to_request(struct dma_fence *fence)
 	return container_of(fence, struct drm_i915_gem_request, fence);
 }
 
+static inline struct drm_i915_gem_request *
+priotree_to_request(struct i915_priotree *pt)
+{
+	return container_of(pt, struct drm_i915_gem_request, priotree);
+}
+
 static inline struct drm_i915_gem_request *
 i915_gem_request_get(struct drm_i915_gem_request *req)
 {
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 739c33b07c59..007aec9d95c9 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -973,15 +973,10 @@ static void execlists_submit_request(struct drm_i915_gem_request *request)
 	spin_unlock_irqrestore(&engine->timeline->lock, flags);
 }
 
-static struct drm_i915_gem_request *pt_to_request(struct i915_priotree *pt)
-{
-	return container_of(pt, struct drm_i915_gem_request, priotree);
-}
-
 static struct intel_engine_cs *
 pt_lock_engine(struct i915_priotree *pt, struct intel_engine_cs *locked)
 {
-	struct intel_engine_cs *engine = pt_to_request(pt)->engine;
+	struct intel_engine_cs *engine = priotree_to_request(pt)->engine;
 
 	GEM_BUG_ON(!locked);
 
@@ -1037,7 +1032,7 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
 		 * engines.
 		 */
 		list_for_each_entry(p, &pt->signalers_list, signal_link) {
-			if (i915_gem_request_completed(pt_to_request(p->signaler)))
+			if (i915_gem_request_completed(priotree_to_request(p->signaler)))
 				continue;
 
 			GEM_BUG_ON(p->signaler->priority < pt->priority);
-- 
2.15.1

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

  parent reply	other threads:[~2018-01-02 15:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-02 15:12 [PATCH 01/19] drm/i915: Delete defunct i915_gem_request_assign() Chris Wilson
2018-01-02 15:12 ` [PATCH 02/19] drm/i915: Only defer freeing of fence callback when also using the timer Chris Wilson
2018-01-02 15:12 ` [PATCH 03/19] drm/i915/fence: Separate timeout mechanism for awaiting on dma-fences Chris Wilson
2018-01-02 15:12 ` [PATCH 04/19] drm/i915: Use our singlethreaded wq for freeing objects Chris Wilson
2018-01-02 15:12 ` [PATCH 05/19] drm/i915: Only attempt to scan the requested number of shrinker slabs Chris Wilson
2018-01-02 15:12 ` [PATCH 06/19] drm/i915: Move i915_gem_retire_work_handler Chris Wilson
2018-01-02 15:12 ` [PATCH 07/19] drm/i915: Shrink the GEM kmem_caches upon idling Chris Wilson
2018-01-02 15:12 ` [PATCH 08/19] drm/i915: Shrink the request kmem_cache on allocation error Chris Wilson
2018-01-02 15:12 ` Chris Wilson [this message]
2018-01-03 11:40   ` [PATCH 09/19] drm/i915: Assert all signalers we depended on did indeed signal Michał Winiarski
2018-01-03 12:24     ` Chris Wilson
2018-01-02 15:12 ` [PATCH 10/19] drm/i915/execlists: Assert there are no simple cycles in the dependencies Chris Wilson
2018-01-03 11:13   ` Michał Winiarski
2018-01-02 15:12 ` [PATCH 11/19] drm/i915/execlists: Reduce list_for_each_safe+list_safe_reset_next Chris Wilson
2018-01-03 11:12   ` Michał Winiarski
2018-01-02 15:12 ` [PATCH 12/19] drm/i915: Drop request reference for the signaler thread Chris Wilson
2018-01-02 15:12 ` [PATCH 13/19] drm/i915: Reduce spinlock hold time during notify_ring() interrupt Chris Wilson
2018-01-02 15:12 ` [PATCH 14/19] drm/i915: Reconstruct active state on starting busy-stats Chris Wilson
2018-01-08 14:18   ` Tvrtko Ursulin
2018-01-08 14:29     ` Chris Wilson
2018-01-08 14:44       ` Tvrtko Ursulin
2018-01-08 14:52         ` Chris Wilson
2018-01-02 15:12 ` [PATCH 15/19] drm/i915: Hold rpm wakeref for modifying the global seqno Chris Wilson
2018-01-03 10:58   ` Michał Winiarski
2018-01-02 15:12 ` [PATCH 16/19] drm/i915/execlists: Clear context-switch interrupt earlier in the reset Chris Wilson
2018-01-03 10:23   ` Michał Winiarski
2018-01-02 15:12 ` [PATCH 17/19] drm/i915/execlists: Record elsp offset during engine setup Chris Wilson
2018-01-03 10:00   ` Michał Winiarski
2018-01-02 15:12 ` [PATCH 18/19] drm/i915/execlists: Tidy enabling execlists Chris Wilson
2018-01-03  9:55   ` Michał Winiarski
2018-01-03 11:12     ` Chris Wilson
2018-01-02 15:12 ` [PATCH 19/19] drm/i915/execlists: Repeat CSB mmio until it returns a sensible result Chris Wilson
2018-01-02 15:37 ` ✓ Fi.CI.BAT: success for series starting with [01/19] drm/i915: Delete defunct i915_gem_request_assign() Patchwork
2018-01-02 16:24 ` ✓ Fi.CI.IGT: " Patchwork
2018-01-02 19:01 ` [PATCH 01/19] " Rodrigo Vivi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180102151235.3949-9-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.