Skip to contentSkip to conversation

drm/i915: Place the Global GTT VM first in the list of VM

PATCH In review Ben Widawsky 5 participants 26 messages Jan 25, 2014 – Jan 27, 2014

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

PATCH 1/5 drm/i915: Place the Global GTT VM first in the list of VM

From: Chris Wilson <[email protected]>

This is useful for debugging as we then know that the first entry is always the global GTT, and all later entries the per-process GTT VM.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index 024e454..946a577 100644
@@ -4634,7 +4634,7 @@ void i915_init_vm(struct drm_i915_private *dev_priv,
 	INIT_LIST_HEAD(&vm->active_list);
 	INIT_LIST_HEAD(&vm->inactive_list);
 	INIT_LIST_HEAD(&vm->global_link);
-	list_add(&vm->global_link, &dev_priv->vm_list);
+	list_add_tail(&vm->global_link, &dev_priv->vm_list);
 }
 
 void
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 2/5 drm/i915: Print captured bo for all VM in error state

From: Chris Wilson <[email protected]>

The current error state harks back to the era of just a single VM. For full-ppgtt, we capture every bo on every VM. It behoves us to then print every bo for every VM, which we currently fail to do and so miss vital information in the error state.

---
 drivers/gpu/drm/i915/i915_drv.h       |  4 +++
 drivers/gpu/drm/i915/i915_gpu_error.c | 66 ++++++++++++++++++++++++++---------
 2 files changed, 54 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index 20f0e78..e851a82 100644
@@ -329,6 +329,7 @@ struct drm_i915_error_state {
 	u32 faddr[I915_NUM_RINGS];
 	u64 fence[I915_MAX_NUM_FENCES];
 	struct timeval time;
+
 	struct drm_i915_error_ring {
 		struct drm_i915_error_object {
 			int page_count;
@@ -342,6 +343,7 @@ struct drm_i915_error_state {
 		} *requests;
 		int num_requests;
 	} ring[I915_NUM_RINGS];
+
 	struct drm_i915_error_buffer {
 		u32 size;
 		u32 name;
@@ -358,6 +360,8 @@ struct drm_i915_error_state {
 		u32 cache_level:3;
 	} **active_bo, **pinned_bo;
 	u32 *active_bo_count, *pinned_bo_count;
+	u32 vm_count;
+
 	struct intel_overlay_error_state *overlay;
 	struct intel_display_error_state *display;
 	int hangcheck_score[I915_NUM_RINGS];
drivers/gpu/drm/i915/i915_gpu_error.c +50 -16

112 lines not on this page · raw message

Signature · 1 line
1.8.5.3
#2 lore raw

PATCH 3/5 drm/i915: Create a USES_PPGTT macro

In reply to Ben Widawsky

There are cases where we want to know if there is a full, or aliased ppgtt. Having to always to the || is annoying. This shorthand will keep the code a bit cleaner/easier to read.

---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e851a82..6f68515 100644
@@ -1844,6 +1844,7 @@ struct drm_i915_file_private {
 #define HAS_PPGTT(dev)		(INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) && !IS_BROADWELL(dev))
 #define USES_ALIASING_PPGTT(dev) intel_enable_ppgtt(dev, false)
 #define USES_FULL_PPGTT(dev)	intel_enable_ppgtt(dev, true)
+#define USES_PPGTT(dev)		(USES_ALIASING_PPGTT(dev) || USES_FULL_PPGTT(dev))
 
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
 #define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical)
Signature · 1 line
1.8.5.3
#3 lore raw

Re: [PATCH 3/5] drm/i915: Create a USES_PPGTT macro

Quoted 14 lines · Ben Widawsky

There are cases where we want to know if there is a full, or aliased ppgtt. Having to always to the || is annoying. This shorthand will keep the code a bit cleaner/easier to read.

---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index e851a82..6f68515 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_file_private { · line 1847

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1844,6 +1844,7 @@ struct drm_i915_file_private {
 #define HAS_PPGTT(dev)		(INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) && !IS_BROADWELL(dev))
 #define USES_ALIASING_PPGTT(dev) intel_enable_ppgtt(dev, false)
 #define USES_FULL_PPGTT(dev)	intel_enable_ppgtt(dev, true)
+#define USES_PPGTT(dev)		(USES_ALIASING_PPGTT(dev) || USES_FULL_PPGTT(dev))

Just do an s/ALIASING/HW/ and we get to the same point with overall clearer code.
-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
 #define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical)
Signature · 6 lines
1.8.5.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw

Re: [PATCH 3/5] drm/i915: Create a USES_PPGTT macro

Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Ben Widawsky

There are cases where we want to know if there is a full, or aliased ppgtt. Having to always to the || is annoying. This shorthand will keep the code a bit cleaner/easier to read.

---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_file_private { · line 1847

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e851a82..6f68515 100644
@@ -1844,6 +1844,7 @@ struct drm_i915_file_private {
 #define HAS_PPGTT(dev)		(INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) && !IS_BROADWELL(dev))
 #define USES_ALIASING_PPGTT(dev) intel_enable_ppgtt(dev, false)
 #define USES_FULL_PPGTT(dev)	intel_enable_ppgtt(dev, true)
+#define USES_PPGTT(dev)		(USES_ALIASING_PPGTT(dev) || USES_FULL_PPGTT(dev))

Just do an s/ALIASING/HW/ and we get to the same point with overall clearer code.
-Daniel

I had plans to make USES_ALIASING actually mean it's using aliasing, and NOT full PPGTT. However, at this point, they are indeed logically equivalent. Let me go over the code again and see if we actually want an USES_ALIASING_PPGTT(), and if not, I'll do it your way. First, let's figure out if the series will get merged at all.

Quoted 16 lines
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)
 #define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical)
Signature · 6 lines
1.8.5.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#5 lore raw

Re: [PATCH 3/5] drm/i915: Create a USES_PPGTT macro

Quoted 14 lines · Ben Widawsky
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
index e851a82..6f68515 100644
@@ -1844,6 +1844,7 @@ struct drm_i915_file_private {
Quoted 8 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_file_private { · line 1847

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
 #define HAS_PPGTT(dev)             (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev) && !IS_BROADWELL(dev))
 #define USES_ALIASING_PPGTT(dev) intel_enable_ppgtt(dev, false)
 #define USES_FULL_PPGTT(dev)       intel_enable_ppgtt(dev, true)
+#define USES_PPGTT(dev)            (USES_ALIASING_PPGTT(dev) || USES_FULL_PPGTT(dev))

Just do an s/ALIASING/HW/ and we get to the same point with overall clearer code.
-Daniel

Quoted 5 lines

I had plans to make USES_ALIASING actually mean it's using aliasing, and NOT full PPGTT. However, at this point, they are indeed logically equivalent. Let me go over the code again and see if we actually want an USES_ALIASING_PPGTT(), and if not, I'll do it your way. First, let's figure out if the series will get merged at all.

Well I've had a giant wtf moment when looking through your ppgtt patches before the holidays due to this, until I've noticed that USES_ALIASING_PPGTT also holds for full ppgtt. So I'm voting very much for a cleanup here, the current code is confusing as hell in some areas, at least for incompetent me ;-)

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#6 lore raw

PATCH 4/5 drm/i915: Capture PPGTT info on error capture

In reply to Ben Widawsky
---
 drivers/gpu/drm/i915/i915_drv.h       |  7 ++++++
 drivers/gpu/drm/i915/i915_gpu_error.c | 41 +++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 6f68515..5105fd4 100644
@@ -359,6 +359,13 @@ struct drm_i915_error_state {
 		s32 ring:4;
 		u32 cache_level:3;
 	} **active_bo, **pinned_bo;
+	struct drm_i915_vm_info {
+		u32 gfx_mode;
+		union {
+			u64 pdp[4];
+			u32 pp_dir_base;
+		};
+	} vm_info[I915_NUM_RINGS];
 	u32 *active_bo_count, *pinned_bo_count;
 	u32 vm_count;
 
drivers/gpu/drm/i915/i915_gpu_error.c +41 -0

53 lines not on this page · raw message

Signature · 1 line
1.8.5.3
#7 lore raw

Re: [PATCH 4/5] drm/i915: Capture PPGTT info on error capture

Quoted 12 lines · Ben Widawsky
---
 drivers/gpu/drm/i915/i915_drv.h       |  7 ++++++
 drivers/gpu/drm/i915/i915_gpu_error.c | 41 +++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 6f68515..5105fd4 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 368

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +7 -0
@@ -359,6 +359,13 @@ struct drm_i915_error_state {
 		s32 ring:4;
 		u32 cache_level:3;
 	} **active_bo, **pinned_bo;
+	struct drm_i915_vm_info {
+		u32 gfx_mode;
+		union {
+			u64 pdp[4];
+			u32 pp_dir_base;
+		};
+	} vm_info[I915_NUM_RINGS];

Note for future janitorial work: let's coalesce all the per-ring information into the ring error struct.

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 369

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +0 -0
 	u32 *active_bo_count, *pinned_bo_count;

For instance, I thought active_bo was already being tracked per-ring. (Pinned bo is global since that exists more or less to make sure that our registers are pointing into pinned objects.)

Do we also want to capture?
GAC_ECO_BITS /* gen6,7 */
GAM_ECOCHK /* gen6,7 */
GAB_CTL /* gen6 */
GFX_MODE /* gen6 */

The rest looks good.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#8 lore raw

Re: [PATCH 4/5] drm/i915: Capture PPGTT info on error capture

Quoted 33 lines · Chris Wilson
Quoted 12 lines · Ben Widawsky
---
 drivers/gpu/drm/i915/i915_drv.h       |  7 ++++++
 drivers/gpu/drm/i915/i915_gpu_error.c | 41 +++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 6f68515..5105fd4 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 368

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +7 -0
@@ -359,6 +359,13 @@ struct drm_i915_error_state {
 		s32 ring:4;
 		u32 cache_level:3;
 	} **active_bo, **pinned_bo;
+	struct drm_i915_vm_info {
+		u32 gfx_mode;
+		union {
+			u64 pdp[4];
+			u32 pp_dir_base;
+		};
+	} vm_info[I915_NUM_RINGS];

Note for future janitorial work: let's coalesce all the per-ring information into the ring error struct.

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 369

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +0 -0
 	u32 *active_bo_count, *pinned_bo_count;

For instance, I thought active_bo was already being tracked per-ring. (Pinned bo is global since that exists more or less to make sure that our registers are pointing into pinned objects.)

Quoted 9 lines

Do we also want to capture?
GAC_ECO_BITS /* gen6,7 */
GAM_ECOCHK /* gen6,7 */
GAB_CTL /* gen6 */
GFX_MODE /* gen6 */

The rest looks good.
-Chris

I agree. I was pretty unhappy too with how we've done things, but as this information is immediately useful, I'd really like to not postpone. Does "The rest looks good." mean reviewed-by?

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#9 lore raw

Re: [PATCH 4/5] drm/i915: Capture PPGTT info on error capture

Quoted 40 lines · Ben Widawsky
Quoted 39 lines · Chris Wilson
Quoted 12 lines · Ben Widawsky
---
 drivers/gpu/drm/i915/i915_drv.h       |  7 ++++++
 drivers/gpu/drm/i915/i915_gpu_error.c | 41 +++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 6f68515..5105fd4 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 368

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +7 -0
@@ -359,6 +359,13 @@ struct drm_i915_error_state {
 		s32 ring:4;
 		u32 cache_level:3;
 	} **active_bo, **pinned_bo;
+	struct drm_i915_vm_info {
+		u32 gfx_mode;
+		union {
+			u64 pdp[4];
+			u32 pp_dir_base;
+		};
+	} vm_info[I915_NUM_RINGS];

Note for future janitorial work: let's coalesce all the per-ring information into the ring error struct.

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 369

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +0 -0
 	u32 *active_bo_count, *pinned_bo_count;

For instance, I thought active_bo was already being tracked per-ring. (Pinned bo is global since that exists more or less to make sure that our registers are pointing into pinned objects.)

Do we also want to capture?
GAC_ECO_BITS /* gen6,7 */
GAM_ECOCHK /* gen6,7 */
GAB_CTL /* gen6 */
GFX_MODE /* gen6 */

Quoted 7 lines
Quoted 3 lines

The rest looks good.
-Chris

I agree. I was pretty unhappy too with how we've done things, but as this information is immediately useful, I'd really like to not postpone. Does "The rest looks good." mean reviewed-by?

Yes. If you spend the 2 minutes to add reviewed-by to the changelog, you can also add the extra registers. ;-)
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#10 lore raw

PATCH 5/5 drm/i915: Fix error capture on BYT/BDW

In reply to Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Broken by:
commit 685987c6915222730f45141a89f1cd87fb092e9a

Author: Ben Widawsky <[email protected]>
Date:   Fri Dec 6 14:10:54 2013 -0800

drm/i915: Identify active VM for batchbuffer capture

---
 drivers/gpu/drm/i915/i915_gpu_error.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +15 -15
index 76bb010..6a859f1 100644
@@ -684,32 +684,32 @@ static void i915_gem_record_fences(struct drm_device *dev,
 
 /* This assumes all batchbuffers are executed from the PPGTT. It might have to
  * change in the future. */
-static bool is_active_vm(struct i915_address_space *vm,
+static bool is_active_vm(struct drm_i915_error_state *error,
+			 struct i915_address_space *vm,
 			 struct intel_ring_buffer *ring)
 {
 	struct drm_device *dev = vm->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
 
-	if (INTEL_INFO(dev)->gen < 7)
+	if (!HAS_PPGTT(dev))
 		return i915_is_ggtt(vm);
 
-	/* FIXME: This ignores that the global gtt vm is also on this list. */
+	if (i915_is_ggtt(vm) || !USES_PPGTT(dev))
+		return error->head[ring->id] &&
+			(error->acthd[ring->id] ==
+			(error->head[ring->id] & HEAD_ADDR));
+
 	ppgtt = container_of(vm, struct i915_hw_ppgtt, base);
 
-	if (INTEL_INFO(dev)->gen >= 8) {
-		u64 pdp0 = (u64)I915_READ(GEN8_RING_PDP_UDW(ring, 0)) << 32;
-		pdp0 |=  I915_READ(GEN8_RING_PDP_LDW(ring, 0));
-		return pdp0 == ppgtt->pd_dma_addr[0];
-	} else {
-		u32 pp_db;
-		pp_db = I915_READ(RING_PP_DIR_BASE(ring));
-		return (pp_db >> 10) == ppgtt->pd_offset;
-	}
+	if (INTEL_INFO(dev)->gen >= 8)
+		return error->vm_info[ring->id].pdp[0] == ppgtt->pd_dma_addr[0];
+	else
+		return error->vm_info[ring->id].pp_dir_base == ppgtt->pd_offset;
 }
 
 static struct drm_i915_error_object *
 i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
+			     struct drm_i915_error_state *error,
 			     struct intel_ring_buffer *ring)
 {
 	struct i915_address_space *vm;
@@ -735,7 +735,7 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
 
 	seqno = ring->get_seqno(ring, false);
 	list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
-		if (!is_active_vm(vm, ring))
+		if (!is_active_vm(error, vm, ring))
 			continue;
 
 		found_active = true;
@@ -877,7 +877,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
 		i915_record_ring_state(dev, error, ring);
 
 		error->ring[i].batchbuffer =
-			i915_error_first_batchbuffer(dev_priv, ring);
+			i915_error_first_batchbuffer(dev_priv, error, ring);
 
 		error->ring[i].ringbuffer =
 			i915_error_ggtt_object_create(dev_priv, ring->obj);
Signature · 1 line
1.8.5.3
#11 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

That should also apply here and be much simpler.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#12 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 17 lines · Chris Wilson
Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Quoted 11 lines

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

That should also apply here and be much simpler.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre

How does that solve hangs which aren't caused by requests?

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#13 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 24 lines · Ben Widawsky
Quoted 23 lines · Chris Wilson
Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

Quoted 3 lines
Quoted 1 line

That should also apply here and be much simpler.

How does that solve hangs which aren't caused by requests?

Was that an intentional rhetorical question?

The code you touch here only deals with requests - finding the current batchbuffer if any.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#14 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
Quoted 24 lines · Chris Wilson
Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

That should also apply here and be much simpler.

Quoted 8 lines
Quoted 1 line

How does that solve hangs which aren't caused by requests?

Was that an intentional rhetorical question?

The code you touch here only deals with requests - finding the current batchbuffer if any.
-Chris

It wasn't rhetorical. I temporarily ignored that all batches are tied to a request.

So what's the plan now? Just looking at the callers, we seem to have a couple of callers that can't easily identify the bad request.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#15 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 37 lines · Ben Widawsky
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
Quoted 24 lines · Chris Wilson
Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

That should also apply here and be much simpler.

Quoted 8 lines
Quoted 1 line

How does that solve hangs which aren't caused by requests?

Was that an intentional rhetorical question?

The code you touch here only deals with requests - finding the current batchbuffer if any.
-Chris

Quoted 5 lines

It wasn't rhetorical. I temporarily ignored that all batches are tied to a request.

So what's the plan now? Just looking at the callers, we seem to have a couple of callers that can't easily identify the bad request.

I was thinking along the lines of:

@@ -737,31 +709,16 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,

        }
 
        seqno = ring->get_seqno(ring, false);

- list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
- if (!is_active_vm(vm, ring))
+ list_for_each_entry(request, &ring->request_list, list) {
+ if (i915_seqno_passed(seqno, request->seqno))

                        continue;

- found_active = true;
-
- list_for_each_entry(vma, &vm->active_list, mm_list) {
- obj = vma->obj;
- if (obj->ring != ring)
- continue;
-
- if (i915_seqno_passed(seqno, obj->last_read_seqno))
- continue;
-
- if ((obj->base.read_domains & I915_GEM_DOMAIN_COMMAND) == 0)
- continue;
-
- /* We need to copy these to an anonymous buffer as the simplest
- * method to avoid being overwritten by userspace.
- */
- return i915_error_object_create(dev_priv, obj, vm);
- }
+ /* We need to copy these to an anonymous buffer as the simplest
+ * method to avoid being overwritten by userspace.
+ */

+               return i915_error_object_create(dev_priv, request->batch_obj, request->ctx->vm);
        }

- WARN_ON(!found_active);

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#16 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 72 lines · Chris Wilson
Quoted 37 lines · Ben Widawsky
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
Quoted 24 lines · Chris Wilson
Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

That should also apply here and be much simpler.

Quoted 8 lines
Quoted 1 line

How does that solve hangs which aren't caused by requests?

Was that an intentional rhetorical question?

The code you touch here only deals with requests - finding the current batchbuffer if any.
-Chris

Quoted 5 lines

It wasn't rhetorical. I temporarily ignored that all batches are tied to a request.

So what's the plan now? Just looking at the callers, we seem to have a couple of callers that can't easily identify the bad request.

I was thinking along the lines of:

(quoted diff) +2 -18
@@ -737,31 +709,16 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
        }
 
        seqno = ring->get_seqno(ring, false);
-       list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
-               if (!is_active_vm(vm, ring))
+       list_for_each_entry(request, &ring->request_list, list) {
+               if (i915_seqno_passed(seqno, request->seqno))
                        continue;
 
-               found_active = true;
-
-               list_for_each_entry(vma, &vm->active_list, mm_list) {
-                       obj = vma->obj;
-                       if (obj->ring != ring)
-                               continue;
-
-                       if (i915_seqno_passed(seqno, obj->last_read_seqno))
-                               continue;
-
-                       if ((obj->base.read_domains & I915_GEM_DOMAIN_COMMAND) == 0)
-                               continue;
-
-                       /* We need to copy these to an anonymous buffer as the simplest
-                        * method to avoid being overwritten by userspace.
-                        */

Review i915_error_first_batchbuffer(struct drm_i915_private *dev_priv, · line 722

Quoted 10 lines
(quoted diff) +4 -3
-                       return i915_error_object_create(dev_priv, obj, vm);
-               }
+               /* We need to copy these to an anonymous buffer as the simplest
+                * method to avoid being overwritten by userspace.
+                */
+               return i915_error_object_create(dev_priv, request->batch_obj, request->ctx->vm);
        }
 
-       WARN_ON(!found_active);
 

So per ring batchbuffers is okay with you (it's fine by me)?

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#17 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

In reply to Chris Wilson
Quoted 72 lines · Chris Wilson
Quoted 37 lines · Ben Widawsky
Quoted 27 lines · Chris Wilson
Quoted 26 lines · Ben Widawsky
Quoted 24 lines · Chris Wilson
Quoted 9 lines · Ben Widawsky

The previous check during error capture of whether or not the current VM should be scanned used, gen < 7. That was more or less trying to determine if there was a full PPGTT. At the time, this was sort of what I meant to do because I was more interested in working backwards from hardware state. However, this is incorrect because it will not include platforms that are greater than gen7, and not having PPGTT. Example would be BYT which is gen7 but doesn't have PPGTT, BDW, or any platform greater than gen7 with the PPGTT module parameter invoked.

Quoted 6 lines

I am /assuming/ BYT was broken, I have not actually checked.

While here, clean up the file a bit to avoid duplicate reads (now that the PPGTT info is in the error state).

I think Mika/Chris may have been looking at this too.

Sure, we are looking (for identifying the guilty request/batch) by using the older, simpler mechanism of finding the first incomplete request. I think that search is now definite since we preallocate the request and no longer do request collascing if ENOMEM (i.e. there is a 1:1 relationship between seqno/batch/request).

That should also apply here and be much simpler.

Quoted 8 lines
Quoted 1 line

How does that solve hangs which aren't caused by requests?

Was that an intentional rhetorical question?

The code you touch here only deals with requests - finding the current batchbuffer if any.
-Chris

Quoted 5 lines

It wasn't rhetorical. I temporarily ignored that all batches are tied to a request.

So what's the plan now? Just looking at the callers, we seem to have a couple of callers that can't easily identify the bad request.

I was thinking along the lines of:

(quoted diff) +2 -18
@@ -737,31 +709,16 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
        }
 
        seqno = ring->get_seqno(ring, false);
-       list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
-               if (!is_active_vm(vm, ring))
+       list_for_each_entry(request, &ring->request_list, list) {
+               if (i915_seqno_passed(seqno, request->seqno))
                        continue;
 
-               found_active = true;
-
-               list_for_each_entry(vma, &vm->active_list, mm_list) {
-                       obj = vma->obj;
-                       if (obj->ring != ring)
-                               continue;
-
-                       if (i915_seqno_passed(seqno, obj->last_read_seqno))
-                               continue;
-
-                       if ((obj->base.read_domains & I915_GEM_DOMAIN_COMMAND) == 0)
-                               continue;
-
-                       /* We need to copy these to an anonymous buffer as the simplest
-                        * method to avoid being overwritten by userspace.
-                        */

Review i915_error_first_batchbuffer(struct drm_i915_private *dev_priv, · line 722

Quoted 10 lines
(quoted diff) +4 -3
-                       return i915_error_object_create(dev_priv, obj, vm);
-               }
+               /* We need to copy these to an anonymous buffer as the simplest
+                * method to avoid being overwritten by userspace.
+                */
+               return i915_error_object_create(dev_priv, request->batch_obj, request->ctx->vm);
        }
 
-       WARN_ON(!found_active);
 

The other issue is the existing method doesn't rely as much on proper request handling, ie. this could be more resilient to driver bugs. I kind of want to keep both...

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#18 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 3 lines · Ben Widawsky

The other issue is the existing method doesn't rely as much on proper request handling, ie. this could be more resilient to driver bugs. I kind of want to keep both...

Actually I think it is. Part of the process of reading an error dump is tying together the registers with what is captured. If they are inconsistent, we know that the driver/capture is buggy. What happens in the real world is that the GPU executes something completely different than the batch buffer anyway...
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#19 lore raw

Re: [PATCH 5/5] drm/i915: Fix error capture on BYT/BDW

Quoted 5 lines · Chris Wilson
Quoted 3 lines · Ben Widawsky

The other issue is the existing method doesn't rely as much on proper request handling, ie. this could be more resilient to driver bugs. I kind of want to keep both...

Quoted 9 lines

Actually I think it is. Part of the process of reading an error dump is tying together the registers with what is captured. If they are inconsistent, we know that the driver/capture is buggy. What happens in the real world is that the GPU executes something completely different than the batch buffer anyway...
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre

Recapping IRC conversation - Chris is sending a patch to fix this problem with his solution.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Tested-by on v1 1/5
#20 lore raw
In reply to Ben Widawsky
Quoted 16 lines · Ben Widawsky

From: Chris Wilson <[email protected]>

This is useful for debugging as we then know that the first entry is always the global GTT, and all later entries the per-process GTT VM.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 024e454..946a577 100644

drivers/gpu/drm/i915/i915_gem.c void i915_init_vm(struct drm_i915_private *dev_priv, · line 4640

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -4634,7 +4634,7 @@ void i915_init_vm(struct drm_i915_private *dev_priv,
 	INIT_LIST_HEAD(&vm->active_list);
 	INIT_LIST_HEAD(&vm->inactive_list);
 	INIT_LIST_HEAD(&vm->global_link);
-	list_add(&vm->global_link, &dev_priv->vm_list);
+	list_add_tail(&vm->global_link, &dev_priv->vm_list);
 }
 
 void

These five patches are:

On Broadwell with drm-intel-nightly, I don't get the batchbuffer as part of my error state, which is a regression. With these patches, it's back again.

Thanks for investigating this, Ben.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw
Quoted 27 lines · Kenneth Graunke
Quoted 16 lines · Ben Widawsky

From: Chris Wilson <[email protected]>

This is useful for debugging as we then know that the first entry is always the global GTT, and all later entries the per-process GTT VM.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 024e454..946a577 100644

drivers/gpu/drm/i915/i915_gem.c void i915_init_vm(struct drm_i915_private *dev_priv, · line 4640

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -4634,7 +4634,7 @@ void i915_init_vm(struct drm_i915_private *dev_priv,
 	INIT_LIST_HEAD(&vm->active_list);
 	INIT_LIST_HEAD(&vm->inactive_list);
 	INIT_LIST_HEAD(&vm->global_link);
-	list_add(&vm->global_link, &dev_priv->vm_list);
+	list_add_tail(&vm->global_link, &dev_priv->vm_list);
 }
 
 void

These five patches are:

Quoted 7 lines

On Broadwell with drm-intel-nightly, I don't get the batchbuffer as part of my error state, which is a regression. With these patches, it's back again.

Thanks for investigating this, Ben.

I want to merge Mika's fixes for the reset stats ioctls, mostly since his patches are older and we also have neat testcases for them all. Then we can reconsider the issue here and how to best get at the right batch buffers. If it breaks development just boot with ppgtt=1 for now, for userspace nothing really changes compared to full ppgtt. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#22 lore raw
Quoted 34 lines · Daniel Vetter
Quoted 33 lines · Kenneth Graunke
Quoted 16 lines · Ben Widawsky

From: Chris Wilson <[email protected]>

This is useful for debugging as we then know that the first entry is always the global GTT, and all later entries the per-process GTT VM.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 024e454..946a577 100644

drivers/gpu/drm/i915/i915_gem.c void i915_init_vm(struct drm_i915_private *dev_priv, · line 4640

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -4634,7 +4634,7 @@ void i915_init_vm(struct drm_i915_private *dev_priv,
 	INIT_LIST_HEAD(&vm->active_list);
 	INIT_LIST_HEAD(&vm->inactive_list);
 	INIT_LIST_HEAD(&vm->global_link);
-	list_add(&vm->global_link, &dev_priv->vm_list);
+	list_add_tail(&vm->global_link, &dev_priv->vm_list);
 }
 
 void

These five patches are:

On Broadwell with drm-intel-nightly, I don't get the batchbuffer as part of my error state, which is a regression. With these patches, it's back again.

Quoted 9 lines
Quoted 1 line

Thanks for investigating this, Ben.

I want to merge Mika's fixes for the reset stats ioctls, mostly since his patches are older and we also have neat testcases for them all. Then we can reconsider the issue here and how to best get at the right batch buffers. If it breaks development just boot with ppgtt=1 for now, for userspace nothing really changes compared to full ppgtt. -Daniel

Do you mean i915.i915_enable_ppgtt=1? I still get no batchbuffer in the error state either with or without that.

But for now, Ben gave me a branch that fixes the issue, so I'll just keep using that until you get this sorted in next/nightly.

--Ken

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw
Quoted 45 lines · Kenneth Graunke
Quoted 34 lines · Daniel Vetter
Quoted 33 lines · Kenneth Graunke
Quoted 16 lines · Ben Widawsky

From: Chris Wilson <[email protected]>

This is useful for debugging as we then know that the first entry is always the global GTT, and all later entries the per-process GTT VM.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 024e454..946a577 100644

drivers/gpu/drm/i915/i915_gem.c void i915_init_vm(struct drm_i915_private *dev_priv, · line 4640

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -4634,7 +4634,7 @@ void i915_init_vm(struct drm_i915_private *dev_priv,
 	INIT_LIST_HEAD(&vm->active_list);
 	INIT_LIST_HEAD(&vm->inactive_list);
 	INIT_LIST_HEAD(&vm->global_link);
-	list_add(&vm->global_link, &dev_priv->vm_list);
+	list_add_tail(&vm->global_link, &dev_priv->vm_list);
 }
 
 void

These five patches are:

On Broadwell with drm-intel-nightly, I don't get the batchbuffer as part of my error state, which is a regression. With these patches, it's back again.

Quoted 9 lines
Quoted 1 line

Thanks for investigating this, Ben.

I want to merge Mika's fixes for the reset stats ioctls, mostly since his patches are older and we also have neat testcases for them all. Then we can reconsider the issue here and how to best get at the right batch buffers. If it breaks development just boot with ppgtt=1 for now, for userspace nothing really changes compared to full ppgtt. -Daniel

Quoted 8 lines

Do you mean i915.i915_enable_ppgtt=1? I still get no batchbuffer in the error state either with or without that.

But for now, Ben gave me a branch that fixes the issue, so I'll just keep using that until you get this sorted in next/nightly.

--Ken

Daniel, the issue is exactly with aliasing (any platform >= gen7 with aliasing to be precise). I did ask Ken to try some of Mika's patches before pursuing this, but since then I've asked Mika to send me exactly what I need to review. I am not sure they are exactly what I asked Ken to test.

In any case, I will try to review Mika's patches by Monday, however a quick glance lead me to believe they are unrelated to this.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#24 lore raw
Quoted 5 lines · Ben Widawsky

Daniel, the issue is exactly with aliasing (any platform >= gen7 with aliasing to be precise). I did ask Ken to try some of Mika's patches before pursuing this, but since then I've asked Mika to send me exactly what I need to review. I am not sure they are exactly what I asked Ken to test.

Oh, iirc I've looked at gen6 and there it seemed to worked ok. Could this just be a ALIASING vs. FULL vs. HW_PPGTT mixup? If so I'd prefer just the minimal patch to remedy that and then fix the full ppgtt dumper in a 2nd step.
-Daniel

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

Daniel, the issue is exactly with aliasing (any platform >= gen7 with aliasing to be precise). I did ask Ken to try some of Mika's patches before pursuing this, but since then I've asked Mika to send me exactly what I need to review. I am not sure they are exactly what I asked Ken to test.

Quoted 4 lines

Oh, iirc I've looked at gen6 and there it seemed to worked ok. Could this just be a ALIASING vs. FULL vs. HW_PPGTT mixup? If so I'd prefer just the minimal patch to remedy that and then fix the full ppgtt dumper in a 2nd step.

And since we seem to have a bit a confusion going on with no-ppgtt, aliasing ppgtt and full ppgtt a testcase for this would be useful. Should be fairly simply by submitting a bit of special noise after the MI_BB_END command for the hanging batches in the hangman testcase. Then we can just grep for that in the resulting error state. Bonus points for doing that on each ring and parsing the error state to make sure the cookie dword is indeed in the batch (and not part of some other date we dump).
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch