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 1/4] drm/i915: Refine placement of gt.reset_lockmap
Date: Thu, 13 Jun 2019 07:20:18 +0100	[thread overview]
Message-ID: <20190613062021.27094-1-chris@chris-wilson.co.uk> (raw)

If we pull the lockmap into reset_prepare/reset_finish, it will
naturally cover i915_gem_set_wedged() as well as i915_reset(). And with
another tweak, we can pull __i915_gem_unset_wedged() underneath the
lockmap covering the mutexes used there.

As a bonus, it should hide the ugliness of the i915_reset exit path ;)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_reset.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index 6368b37f26d1..952e11b4b5c5 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -723,6 +723,8 @@ static void reset_prepare(struct drm_i915_private *i915)
 	enum intel_engine_id id;
 
 	intel_gt_pm_get(i915);
+	lock_map_acquire(&i915->gt.reset_lockmap);
+
 	for_each_engine(engine, i915, id)
 		reset_prepare_engine(engine);
 
@@ -773,6 +775,8 @@ static void reset_finish(struct drm_i915_private *i915)
 		reset_finish_engine(engine);
 		intel_engine_signal_breadcrumbs(engine);
 	}
+
+	lock_map_release(&i915->gt.reset_lockmap);
 	intel_gt_pm_put(i915);
 }
 
@@ -978,17 +982,17 @@ void i915_reset(struct drm_i915_private *i915,
 
 	might_sleep();
 	GEM_BUG_ON(!test_bit(I915_RESET_BACKOFF, &error->flags));
-	lock_map_acquire(&i915->gt.reset_lockmap);
+
+	reset_prepare(i915);
 
 	/* Clear any previous failed attempts at recovery. Time to try again. */
 	if (!__i915_gem_unset_wedged(i915))
-		goto unlock;
+		goto finish;
 
 	if (reason)
 		dev_notice(i915->drm.dev, "Resetting chip for %s\n", reason);
 	error->reset_count++;
 
-	reset_prepare(i915);
 
 	if (!intel_has_gpu_reset(i915)) {
 		if (i915_modparams.reset)
@@ -1030,8 +1034,6 @@ void i915_reset(struct drm_i915_private *i915,
 
 finish:
 	reset_finish(i915);
-unlock:
-	lock_map_release(&i915->gt.reset_lockmap);
 	return;
 
 taint:
-- 
2.20.1

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

             reply	other threads:[~2019-06-13  6:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13  6:20 Chris Wilson [this message]
2019-06-13  6:20 ` [PATCH 2/4] drm/i915: Avoid tainting i915_gem_park() with wakeref.lock Chris Wilson
2019-06-13  6:20 ` [PATCH 3/4] drm/i915: Move fence register tracking from i915->mm to ggtt Chris Wilson
2019-06-13  6:20 ` [PATCH 4/4] drm/i915: Track ggtt fence reservations under its own mutex Chris Wilson
2019-06-13  6:47 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915: Refine placement of gt.reset_lockmap Patchwork
2019-06-13  7:10 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-06-13  7:15   ` Chris Wilson
2019-06-13  7:19     ` Chris Wilson

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=20190613062021.27094-1-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.