[Intel-gfx] [PATCH 1/2] drm/i915: Add BUG_ON when ring->private is NULL

Sean Paul seanpaul at chromium.org
Fri Mar 16 17:43:21 CET 2012


I have experienced a number of NULL pointer dereferences on
suspend/resume where ring->private is NULL. These come from failed
initialization of the ring buffer. Sincce this doesn't seem to be easily
recoverable, this patch adds a BUG_ON and a bread crumb pointer for
people who might encounter this in the future.

Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index ca3972f..8357822 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -198,9 +198,17 @@ gen6_render_ring_flush(struct intel_ring_buffer *ring,
 {
 	u32 flags = 0;
 	struct pipe_control *pc = ring->private;
-	u32 scratch_addr = pc->gtt_offset + 128;
+	u32 scratch_addr;
 	int ret;
 
+	/* This condition was being hit when the ring buffer wasn't being
+	 * properly initialized and subsequently cleaned (hence setting
+	 * ring->private to NULL).
+	 */
+	BUG_ON(pc == NULL);
+
+	scratch_addr = pc->gtt_offset + 128;
+
 	/* Force SNB workarounds for PIPE_CONTROL flushes */
 	intel_emit_post_sync_nonzero_flush(ring);
 
-- 
1.7.7.3




More information about the Intel-gfx mailing list