Skip to contentSkip to conversation

drm/i915: Decode RING_BUFFER_HEAD in error state

PATCH In review Ben Widawsky 3 participants 4 messages Apr 21, 2013 – Apr 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Decode RING_BUFFER_HEAD in error state

I consistently forget how to decode the HEAD pointer. If we put it in the error state, one doesn't need to look in docs to find the relevant info.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +4 -1
index e913d32..dd5a64e 100644
@@ -643,7 +643,10 @@ static void i915_ring_error_state(struct seq_file *m,
 {
 	BUG_ON(ring >= I915_NUM_RINGS); /* shut up confused gcc */
 	seq_printf(m, "%s command stream:\n", ring_str(ring));
-	seq_printf(m, "  HEAD: 0x%08x\n", error->head[ring]);
+	seq_printf(m, "  HEAD: 0x%08x (wraps: %d; offset: 0x%08x)\n",
+		   error->head[ring],
+		   error->head[ring] >> 21,
+		   error->head[ring] & (0x7ffff << 2));
 	seq_printf(m, "  TAIL: 0x%08x\n", error->tail[ring]);
 	seq_printf(m, "  CTL: 0x%08x\n", error->ctl[ring]);
 	seq_printf(m, "  ACTHD: 0x%08x\n", error->acthd[ring]);
Signature · 1 line
1.8.2.1
#1 lore raw
Quoted 5 lines · Ben Widawsky

I consistently forget how to decode the HEAD pointer. If we put it in the error state, one doesn't need to look in docs to find the relevant info.

Turn the offset into an address and that would be really useful - then once can do a quick search on the value and jump straight into the right point in the ring.
error->head[ring] & (0x7ffff << 2) + error->ring[ring].batchbuffer->gtt_offset
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 11 lines · Chris Wilson
Quoted 5 lines · Ben Widawsky

I consistently forget how to decode the HEAD pointer. If we put it in the error state, one doesn't need to look in docs to find the relevant info.

Turn the offset into an address and that would be really useful - then once can do a quick search on the value and jump straight into the right point in the ring.
error->head[ring] & (0x7ffff << 2) + error->ring[ring].batchbuffer->gtt_offset

Also, shouldn't that kind of decode magic be done in intel_error_decode, where we have all the other stuff? Or is there a special reason? -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#3 lore raw
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Chris Wilson
Quoted 5 lines · Ben Widawsky

I consistently forget how to decode the HEAD pointer. If we put it in the error state, one doesn't need to look in docs to find the relevant info.

Quoted 8 lines
Quoted 4 lines

Turn the offset into an address and that would be really useful - then once can do a quick search on the value and jump straight into the right point in the ring.
error->head[ring] & (0x7ffff << 2) + error->ring[ring].batchbuffer->gtt_offset

Also, shouldn't that kind of decode magic be done in intel_error_decode, where we have all the other stuff? Or is there a special reason? -Daniel

Originally, I had 4 excuses, but 2 turned out to false.
1. I usually don't use error decode, and I suspect others don't as well.
2. HEAD decoding hasn't changed for as long as I can tell.
3. (false) I thought we already decoded other registers in the error
4. (false) It's easier to add this to the error dump than the tool.

Personally, I felt Chris' suggestion is something along the lines of what belongs in IGT, whereas this patch was the level of decoding worth doing in error dump.

Personally, I'm not opposed to decoding more registers that improve the usefulness of the error state without needing a tool, but I also understand why you wouldn't take it, and how it's a fuzzy line about which registers are appropriate to add vs. not.

I'm willing to add it to error dumper.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center