All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Flush idle work when changing missed-irq fault injection
@ 2017-03-06  9:57 Chris Wilson
  2017-03-06 10:15 ` [PATCH v2] " Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Wilson @ 2017-03-06  9:57 UTC (permalink / raw)
  To: intel-gfx

In order for the missed-irq update to take effect, the device must be
idle. So when the user updates the fault injection via debugfs, idle the
device.

Testcase: igt/drv_missed_irq
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 4a3e5b9552f8..9b769ee231e9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4151,16 +4151,35 @@ i915_ring_missed_irq_set(void *data, u64 val)
 {
 	struct drm_i915_private *dev_priv = data;
 	struct drm_device *dev = &dev_priv->drm;
-	int ret;
+	int err;
+
+	err = mutex_lock_interruptible(&dev->struct_mutex);
+	if (err)
+		return err;
+
+	err = i915_gem_wait_for_idle(dev_priv,
+				     I915_WAIT_LOCKED |
+				     I915_WAIT_INTERRUPTIBLE);
+	if (err)
+		goto err_unlock;
+
+	/* Retire to kick idle work */
+	i915_gem_retire_requests(dev_priv);
+	GEM_BUG_ON(dev_priv->gt.active_requests);
 
-	/* Lock against concurrent debugfs callers */
-	ret = mutex_lock_interruptible(&dev->struct_mutex);
-	if (ret)
-		return ret;
 	dev_priv->gpu_error.missed_irq_rings = val;
 	mutex_unlock(&dev->struct_mutex);
 
+	/* Flush idle worker to disarm irq */
+	while (flush_delayed_work(&dev_priv->gt.idle_work))
+		;
+
+
 	return 0;
+
+err_unlock:
+	mutex_unlock(&dev->struct_mutex);
+	return err;
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(i915_ring_missed_irq_fops,
-- 
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] 6+ messages in thread

end of thread, other threads:[~2017-03-06 21:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06  9:57 [PATCH] drm/i915: Flush idle work when changing missed-irq fault injection Chris Wilson
2017-03-06 10:15 ` [PATCH v2] " Chris Wilson
2017-03-06 17:45   ` Tvrtko Ursulin
2017-03-06 21:03     ` Chris Wilson
2017-03-06 13:53 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush idle work when changing missed-irq fault injection (rev2) Patchwork
2017-03-06 16:17 ` ✓ Fi.CI.BAT: success " Patchwork

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.