Skip to contentSkip to conversation

drm/i915/bdw: The TLB invalidation mechanism has been removed from INSTPM

PATCH Applied Damien Lespiau 4 participants 6 messages Mar 13, 2014

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

PATCH 1/1 drm/i915/bdw: The TLB invalidation mechanism has been removed from INSTPM

While wandering in the spec, I noticed that BDW removes those 2 bits from INSTPM. I couldn't find any direct way to invalidate the TLB (ie without the ring working already). Maybe someone will be more lucky.

At least, we now know we may be a problem.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +8 -2
index c50388a..4eb3e06 100644
@@ -981,8 +981,14 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring)
 	I915_WRITE(mmio, (u32)ring->status_page.gfx_addr);
 	POSTING_READ(mmio);
 
-	/* Flush the TLB for this page */
-	if (INTEL_INFO(dev)->gen >= 6) {
+	/*
+	 * Flush the TLB for this page
+	 *
+	 * FIXME: These two bits have disappeared on gen8, so a question
+	 * arises: do we still need this and if so how should we go about
+	 * invalidating the TLB?
+	 */
+	if (INTEL_INFO(dev)->gen >= 6 && INTEL_INFO(dev)->gen < 8) {
 		u32 reg = RING_INSTPM(ring->mmio_base);
 
 		/* ring should be idle before issuing a sync flush*/
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Damien Lespiau

While wandering in the spec, I noticed that BDW removes those 2 bits from INSTPM. I couldn't find any direct way to invalidate the TLB (ie without the ring working already). Maybe someone will be more lucky.

At least, we now know we may be a problem.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -2
index c50388a..4eb3e06 100644
@@ -981,8 +981,14 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring)
 	I915_WRITE(mmio, (u32)ring->status_page.gfx_addr);
 	POSTING_READ(mmio);
 
-	/* Flush the TLB for this page */
-	if (INTEL_INFO(dev)->gen >= 6) {
+	/*

drivers/gpu/drm/i915/intel_ringbuffer.c void intel_ring_setup_status_page(struct intel_ring_buffer *ring) · line 994

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +7 -0
+	 * Flush the TLB for this page
+	 *
+	 * FIXME: These two bits have disappeared on gen8, so a question
+	 * arises: do we still need this and if so how should we go about
+	 * invalidating the TLB?
+	 */
+	if (INTEL_INFO(dev)->gen >= 6 && INTEL_INFO(dev)->gen < 8) {
 		u32 reg = RING_INSTPM(ring->mmio_base);
 
 		/* ring should be idle before issuing a sync flush*/

I'm missing something on the original patch, 884020bf3d2a3787a1cc6df902e98e0eec60330b. How were we emitting breadcrumbs without flushing the TLB? All bathcbuffers should be bookended by a TLB invalidate already, so I'm not sure the logic holds. Chris could explain that one a bit further?

The only reason I bring this up is I'd like to rip this out completely and have Thiago retest, or at least change the comment/commit message to be to reflect whatever light Chris sheds on the matter.

Anyway, the bits are definitely gone, and I also can't find a non-ring based replacement.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#2 lore raw
Quoted 40 lines · Ben Widawsky
Quoted 22 lines · Damien Lespiau

While wandering in the spec, I noticed that BDW removes those 2 bits from INSTPM. I couldn't find any direct way to invalidate the TLB (ie without the ring working already). Maybe someone will be more lucky.

At least, we now know we may be a problem.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -2
index c50388a..4eb3e06 100644
@@ -981,8 +981,14 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring)
 	I915_WRITE(mmio, (u32)ring->status_page.gfx_addr);
 	POSTING_READ(mmio);
 
-	/* Flush the TLB for this page */
-	if (INTEL_INFO(dev)->gen >= 6) {
+	/*

drivers/gpu/drm/i915/intel_ringbuffer.c void intel_ring_setup_status_page(struct intel_ring_buffer *ring) · line 994

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +7 -0
+	 * Flush the TLB for this page
+	 *
+	 * FIXME: These two bits have disappeared on gen8, so a question
+	 * arises: do we still need this and if so how should we go about
+	 * invalidating the TLB?
+	 */
+	if (INTEL_INFO(dev)->gen >= 6 && INTEL_INFO(dev)->gen < 8) {
 		u32 reg = RING_INSTPM(ring->mmio_base);
 
 		/* ring should be idle before issuing a sync flush*/

I'm missing something on the original patch, 884020bf3d2a3787a1cc6df902e98e0eec60330b. How were we emitting breadcrumbs without flushing the TLB? All bathcbuffers should be bookended by a TLB invalidate already, so I'm not sure the logic holds. Chris could explain that one a bit further?

Quoted 7 lines

The only reason I bring this up is I'd like to rip this out completely and have Thiago retest, or at least change the comment/commit message to be to reflect whatever light Chris sheds on the matter.

Anyway, the bits are definitely gone, and I also can't find a non-ring based replacement.

Queued for -next, thanks for the patch.
-Daniel

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

I'm missing something on the original patch, 884020bf3d2a3787a1cc6df902e98e0eec60330b. How were we emitting breadcrumbs without flushing the TLB? All bathcbuffers should be bookended by a TLB invalidate already, so I'm not sure the logic holds. Chris could explain that one a bit further?

Upon resume, the hardware continues writing the breadcrumbs into the old hws page (due to the stale TLB) and we try to read the seqno from the new page, so as shown by the error-states it appears that the breadcrumb writes are not happening. Since the hardware is writing to a random address, we are now corrupting random memory.

Which is what I thought I said in the changelog.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw
Quoted 7 lines · Chris Wilson

Upon resume, the hardware continues writing the breadcrumbs into the old hws page (due to the stale TLB) and we try to read the seqno from the new page, so as shown by the error-states it appears that the breadcrumb writes are not happening. Since the hardware is writing to a random address, we are now corrupting random memory.

Which is what I thought I said in the changelog.

Yes, you did say that. However, we should be idling on freeze, so the explanation
I was missing is how or why the HW is continuing to use the old status page even though we've had to do a TLB flush when we emit the next batch.

#5 lore raw
Quoted 7 lines · Ben Widawsky
Quoted 6 lines · Chris Wilson

Upon resume, the hardware continues writing the breadcrumbs into the old hws page (due to the stale TLB) and we try to read the seqno from the new page, so as shown by the error-states it appears that the breadcrumb writes are not happening. Since the hardware is writing to a random address, we are now corrupting random memory.

Quoted 6 lines
Quoted 1 line

Which is what I thought I said in the changelog.

Yes, you did say that. However, we should be idling on freeze, so the explanation
I was missing is how or why the HW is continuing to use the old status page even though we've had to do a TLB flush when we emit the next batch.

Different set of TLBs. This CS TLB appears to be unrelated to individual set of cache TLBs we flush with pipecontrols or flush_dw. -Chris

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