diff mbox

[4/6] drm/i915: add flag to prevent dmesg spam on context banning

Message ID 1396900911-12415-5-git-send-email-rodrigo.vivi@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi April 7, 2014, 8:01 p.m. UTC
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Piglit runner and QA are both looking at the dmesg for
DRM_ERRORs with test cases.

Add flag to stop_rings debugfs interface to prevent DRM_ERROR
output when default context banning is being tested.

References: https://bugs.freedesktop.org/show_bug.cgi?id=75876
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
---
 drivers/gpu/drm/i915/i915_drv.h         | 18 ++++++++++++++++--
 drivers/gpu/drm/i915/i915_gem.c         |  5 +++--
 drivers/gpu/drm/i915/intel_ringbuffer.c |  2 +-
 3 files changed, 20 insertions(+), 5 deletions(-)

Comments

Mika Kuoppala April 8, 2014, 2:04 p.m. UTC | #1
Rodrigo Vivi <rodrigo.vivi@gmail.com> writes:

> From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>
> Piglit runner and QA are both looking at the dmesg for
> DRM_ERRORs with test cases.
>
> Add flag to stop_rings debugfs interface to prevent DRM_ERROR
> output when default context banning is being tested.
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=75876
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

This can be dropped. Superseded by:

1396023498-8635-1-git-send-email-mika.kuoppala@intel.com

-Mika
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 55addaa..d5cd981 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1099,8 +1099,12 @@  struct i915_gpu_error {
 	 */
 	wait_queue_head_t reset_queue;
 
-	/* For gpu hang simulation. */
-	unsigned int stop_rings;
+	/* For gpu hang simulation.
+	 * MSB for controlling DRM_ERROR with ctx bans
+	 */
+	u32 stop_rings;
+
+#define I915_SQUELCH_CTX_BAN_ERROR (1 << 31)
 
 	/* For missed irq/seqno simulation. */
 	unsigned int test_irq_rings;
@@ -2146,6 +2150,16 @@  static inline u32 i915_reset_count(struct i915_gpu_error *error)
 	return ((atomic_read(&error->reset_counter) & ~I915_WEDGED) + 1) / 2;
 }
 
+static inline u32 i915_stopped_rings(struct drm_i915_private *dev_priv)
+{
+	return dev_priv->gpu_error.stop_rings & ~I915_SQUELCH_CTX_BAN_ERROR;
+}
+
+static inline bool i915_squelch_ban_error(struct drm_i915_private *dev_priv)
+{
+	return dev_priv->gpu_error.stop_rings & I915_SQUELCH_CTX_BAN_ERROR;
+}
+
 void i915_gem_reset(struct drm_device *dev);
 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
 int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index c70121d..7598e86 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2277,8 +2277,9 @@  static bool i915_context_is_banned(struct drm_i915_private *dev_priv,
 		if (!i915_gem_context_is_default(ctx)) {
 			DRM_DEBUG("context hanging too fast, banning!\n");
 			return true;
-		} else if (dev_priv->gpu_error.stop_rings == 0) {
-			DRM_ERROR("gpu hanging too fast, banning!\n");
+		} else if (!i915_stopped_rings(dev_priv)) {
+			if (!i915_squelch_ban_error(dev_priv))
+				DRM_ERROR("gpu hanging too fast, banning!\n");
 			return true;
 		}
 	}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 3d76ce1..275afa5 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -46,7 +46,7 @@  void __intel_ring_advance(struct intel_ring_buffer *ring)
 	struct drm_i915_private *dev_priv = ring->dev->dev_private;
 
 	ring->tail &= ring->size - 1;
-	if (dev_priv->gpu_error.stop_rings & intel_ring_flag(ring))
+	if (i915_stopped_rings(dev_priv) & intel_ring_flag(ring))
 		return;
 	ring->write_tail(ring, ring->tail);
 }