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 03/10] drm/i915: Assume exclusive access to objects inside resume
Date: Mon, 19 Aug 2019 17:44:41 +0100	[thread overview]
Message-ID: <20190819164448.22132-3-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20190819164448.22132-1-chris@chris-wilson.co.uk>

Inside gtt_restore_mappings() we currently take the obj->resv->lock, but
in the future we need to avoid taking this fs-reclaim tainted lock as we
need to extend the coverage of the vm->mutex. Take advantage of the
single-threaded nature of the early resume phase, and do a single
wbinvd() to flush all the GTT objects en masse.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 5413c2ff51a2..e48df11a19fb 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3274,6 +3274,7 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt)
 static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
 {
 	struct i915_vma *vma, *vn;
+	bool flush = false;
 
 	intel_gt_check_and_clear_faults(ggtt->vm.gt);
 
@@ -3298,10 +3299,9 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
 		WARN_ON(i915_vma_bind(vma,
 				      obj ? obj->cache_level : 0,
 				      PIN_UPDATE));
-		if (obj) {
-			i915_gem_object_lock(obj);
-			WARN_ON(i915_gem_object_set_to_gtt_domain(obj, false));
-			i915_gem_object_unlock(obj);
+		if (obj) { /* only used during resume => exclusive access */
+			flush |= fetch_and_zero(&obj->write_domain);
+			obj->read_domains |= I915_GEM_DOMAIN_GTT;
 		}
 
 lock:
@@ -3312,6 +3312,9 @@ static void ggtt_restore_mappings(struct i915_ggtt *ggtt)
 	ggtt->invalidate(ggtt);
 
 	mutex_unlock(&ggtt->vm.mutex);
+
+	if (flush)
+		wbinvd_on_all_cpus();
 }
 
 void i915_gem_restore_gtt_mappings(struct drm_i915_private *i915)
-- 
2.23.0.rc1

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

  parent reply	other threads:[~2019-08-19 16:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 16:44 [PATCH 01/10] drm/i915: Use 0 for the unordered context Chris Wilson
2019-08-19 16:44 ` [PATCH 02/10] drm/i915: Generalise the clflush dma-worker Chris Wilson
2019-08-19 18:16   ` Matthew Auld
2019-08-19 18:32     ` Chris Wilson
2019-08-19 16:44 ` Chris Wilson [this message]
2019-08-19 19:57   ` [PATCH 03/10] drm/i915: Assume exclusive access to objects inside resume Matthew Auld
2019-08-19 16:44 ` [PATCH 04/10] drm/i915: Replace PIN_NONFAULT with calls to PIN_NOEVICT Chris Wilson
2019-08-19 16:44 ` [PATCH 05/10] drm/i915: Track ggtt fence reservations under its own mutex Chris Wilson
2019-08-19 16:44 ` [PATCH 06/10] drm/i915: Only track bound elements of the GTT Chris Wilson
2019-08-19 16:44 ` [PATCH 07/10] drm/i915: Pull obj->userfault tracking under the ggtt->mutex Chris Wilson
2019-08-19 16:44 ` [PATCH 08/10] drm/i915: Replace i915_vma_put_fence() Chris Wilson
2019-08-19 16:44 ` [PATCH 09/10] drm/i915: Make shrink/unshrink be atomic Chris Wilson
2019-08-19 16:44 ` [PATCH 10/10] drm/i915: Be defensive when starting vma activity Chris Wilson
2019-08-19 17:00 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915: Use 0 for the unordered context Patchwork
2019-08-19 17:23 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-08-19 17:29   ` Chris Wilson
2019-08-19 17:36 ` [PATCH 01/10] " Matthew Auld

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=20190819164448.22132-3-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.