All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Yokoyama@freedesktop.org
Subject: [PATCH 04/17] drm/i915: Stop needlessly acquiring wakeref for debugfs/drop_caches_set
Date: Wed, 13 Mar 2019 13:39:21 +0000	[thread overview]
Message-ID: <20190313133934.30312-4-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20190313133934.30312-1-chris@chris-wilson.co.uk>

We only need to acquire a wakeref for ourselves for a few operations, as
most either already acquire their own wakeref or imply a wakeref. In
particular, it is i915_gem_set_wedged() that needed us to present it
with a wakeref, which is incongruous with its "use anywhere" ability.

Suggested-by: Yokoyama, Caz <caz.yokoyama@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Yokoyama, Caz <caz.yokoyama@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++--------
 drivers/gpu/drm/i915/i915_reset.c   |  4 +++-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 6a90558de213..08683dca7775 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3888,12 +3888,9 @@ static int
 i915_drop_caches_set(void *data, u64 val)
 {
 	struct drm_i915_private *i915 = data;
-	intel_wakeref_t wakeref;
-	int ret = 0;
 
 	DRM_DEBUG("Dropping caches: 0x%08llx [0x%08llx]\n",
 		  val, val & DROP_ALL);
-	wakeref = intel_runtime_pm_get(i915);
 
 	if (val & DROP_RESET_ACTIVE &&
 	    wait_for(intel_engines_are_idle(i915), I915_IDLE_ENGINES_TIMEOUT))
@@ -3902,9 +3899,11 @@ i915_drop_caches_set(void *data, u64 val)
 	/* No need to check and wait for gpu resets, only libdrm auto-restarts
 	 * on ioctls on -EAGAIN. */
 	if (val & (DROP_ACTIVE | DROP_RETIRE | DROP_RESET_SEQNO)) {
+		int ret;
+
 		ret = mutex_lock_interruptible(&i915->drm.struct_mutex);
 		if (ret)
-			goto out;
+			return ret;
 
 		if (val & DROP_ACTIVE)
 			ret = i915_gem_wait_for_idle(i915,
@@ -3943,10 +3942,7 @@ i915_drop_caches_set(void *data, u64 val)
 	if (val & DROP_FREED)
 		i915_gem_drain_freed_objects(i915);
 
-out:
-	intel_runtime_pm_put(i915, wakeref);
-
-	return ret;
+	return 0;
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops,
diff --git a/drivers/gpu/drm/i915/i915_reset.c b/drivers/gpu/drm/i915/i915_reset.c
index 3c08e08837d0..955c22b8dfc7 100644
--- a/drivers/gpu/drm/i915/i915_reset.c
+++ b/drivers/gpu/drm/i915/i915_reset.c
@@ -861,9 +861,11 @@ static void __i915_gem_set_wedged(struct drm_i915_private *i915)
 void i915_gem_set_wedged(struct drm_i915_private *i915)
 {
 	struct i915_gpu_error *error = &i915->gpu_error;
+	intel_wakeref_t wakeref;
 
 	mutex_lock(&error->wedge_mutex);
-	__i915_gem_set_wedged(i915);
+	with_intel_runtime_pm(i915, wakeref)
+		__i915_gem_set_wedged(i915);
 	mutex_unlock(&error->wedge_mutex);
 }
 
-- 
2.20.1

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

  parent reply	other threads:[~2019-03-13 13:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 13:39 [PATCH 01/17] drm/i915: Hold a ref to the ring while retiring Chris Wilson
2019-03-13 13:39 ` [PATCH 02/17] drm/i915: Lock the gem_context->active_list while dropping the link Chris Wilson
2019-03-13 13:39 ` [PATCH 03/17] drm/i915: Hold a reference to the active HW context Chris Wilson
2019-03-13 13:39 ` Chris Wilson [this message]
2019-03-13 13:39 ` [PATCH 05/17] drm/i915/selftests: Provide stub reset functions Chris Wilson
2019-03-13 13:39 ` [PATCH 06/17] drm/i915: Switch to use HWS indices rather than addresses Chris Wilson
2019-03-13 13:39 ` [PATCH 07/17] drm/i915: Introduce the i915_user_extension_method Chris Wilson
2019-03-13 13:39 ` [PATCH 08/17] drm/i915: Create/destroy VM (ppGTT) for use with contexts Chris Wilson
2019-03-13 13:39 ` [PATCH 09/17] drm/i915: Extend CONTEXT_CREATE to set parameters upon construction Chris Wilson
2019-03-13 13:39 ` [PATCH 10/17] drm/i915: Allow contexts to share a single timeline across all engines Chris Wilson
2019-03-13 13:39 ` [PATCH 11/17] drm/i915: Allow userspace to clone contexts on creation Chris Wilson
2019-03-13 13:39 ` [PATCH 12/17] drm/i915: Allow a context to define its set of engines Chris Wilson
2019-03-13 13:39 ` [PATCH 13/17] drm/i915: Extend I915_CONTEXT_PARAM_SSEU to support local ctx->engine[] Chris Wilson
2019-03-13 13:39 ` [PATCH 14/17] drm/i915: Load balancing across a virtual engine Chris Wilson
2019-03-13 13:39 ` [PATCH 15/17] drm/i915: Extend execution fence to support a callback Chris Wilson
2019-03-13 13:39 ` [PATCH 16/17] drm/i915/execlists: Virtual engine bonding Chris Wilson
2019-03-13 14:39   ` Chris Wilson
2019-03-13 14:39   ` [PATCH] " Chris Wilson
2019-03-13 13:39 ` [PATCH 17/17] drm/i915: Allow specification of parallel execbuf Chris Wilson
2019-03-13 23:03 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/17] drm/i915: Hold a ref to the ring while retiring (rev2) Patchwork
2019-03-13 23:11 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-13 23:32 ` ✗ Fi.CI.BAT: failure " Patchwork

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=20190313133934.30312-4-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=Yokoyama@freedesktop.org \
    --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.