All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: paper over missed irq issues with force wake vodoo
@ 2012-01-04 16:52 Daniel Vetter
  2012-01-04 18:15 ` Eugeni Dodonov
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Daniel Vetter @ 2012-01-04 16:52 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Eugeni Dodonov, stable

Two things seem to do the trick on my ivb machine here:
- prevent the gt from powering down while waiting for seqno
  notification interrupts by grabbing the force_wake in get_irq (and
  dropping it in put_irq again).
- ordering writes from the ring's CS by reading a CS register, ACTHD
  seems to work.

Only the blt&bsd ring on ivb seem to be massively affected by this,
but for paranoia do this dance also on the render ring and on snb
(i.e. all gpus with forcewake).

Tested with Eric's glCopyPixels loop which without this patch scores a
missed irq every few seconds.

This patch needs my forcewake rework to use a spinlock instead of
dev->struct_mutex.

Cc: stable@kernel.org
Cc: Eric Anholt <eric@anholt.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---

For easier testing grab my -next branch at

http://cgit.freedesktop.org/~danvet/drm/log/?h=my-next

Cheers, Daniel

 drivers/gpu/drm/i915/intel_ringbuffer.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index cf6e159..dbbc565 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -631,6 +631,15 @@ render_ring_add_request(struct intel_ring_buffer *ring,
 }
 
 static u32
+gen6_ring_get_seqno(struct intel_ring_buffer *ring)
+{
+	/* Workaround for force correct ordering between irq and seqno writes on
+	 * ivb (and maybe also on snb). */
+	intel_ring_get_active_head(ring);
+	return intel_read_status_page(ring, I915_GEM_HWS_INDEX);
+}
+
+static u32
 ring_get_seqno(struct intel_ring_buffer *ring)
 {
 	return intel_read_status_page(ring, I915_GEM_HWS_INDEX);
@@ -795,6 +804,11 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
 	if (!dev->irq_enabled)
 	       return false;
 
+	/* It looks like we need to prevent the gt from suspending while waiting
+	 * for an notifiy irq, otherwise irqs seem to get lost on at least the
+	 * blt/bsd rings. */
+	gen6_gt_force_wake_get(dev_priv);
+
 	spin_lock(&ring->irq_lock);
 	if (ring->irq_refcount++ == 0) {
 		ring->irq_mask &= ~rflag;
@@ -819,6 +833,8 @@ gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
 		ironlake_disable_irq(dev_priv, gflag);
 	}
 	spin_unlock(&ring->irq_lock);
+
+	gen6_gt_force_wake_put(dev_priv);
 }
 
 static bool
@@ -1329,7 +1345,7 @@ static const struct intel_ring_buffer gen6_bsd_ring = {
 	.write_tail		= gen6_bsd_ring_write_tail,
 	.flush			= gen6_ring_flush,
 	.add_request		= gen6_add_request,
-	.get_seqno		= ring_get_seqno,
+	.get_seqno		= gen6_ring_get_seqno,
 	.irq_get		= gen6_bsd_ring_get_irq,
 	.irq_put		= gen6_bsd_ring_put_irq,
 	.dispatch_execbuffer	= gen6_ring_dispatch_execbuffer,
@@ -1388,7 +1404,7 @@ static const struct intel_ring_buffer gen6_blt_ring = {
 	.write_tail		= ring_write_tail,
 	.flush			= blt_ring_flush,
 	.add_request		= gen6_add_request,
-	.get_seqno		= ring_get_seqno,
+	.get_seqno		= gen6_ring_get_seqno,
 	.irq_get		= blt_ring_get_irq,
 	.irq_put		= blt_ring_put_irq,
 	.dispatch_execbuffer	= gen6_ring_dispatch_execbuffer,
@@ -1410,6 +1426,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
 		ring->flush = gen6_render_ring_flush;
 		ring->irq_get = gen6_render_ring_get_irq;
 		ring->irq_put = gen6_render_ring_put_irq;
+		ring->get_seqno = gen6_ring_get_seqno;
 	} else if (IS_GEN5(dev)) {
 		ring->add_request = pc_render_add_request;
 		ring->get_seqno = pc_render_get_seqno;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2012-01-18  0:24 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04 16:52 [PATCH] drm/i915: paper over missed irq issues with force wake vodoo Daniel Vetter
2012-01-04 18:15 ` Eugeni Dodonov
2012-01-04 18:40   ` Daniel Vetter
2012-01-05  2:27     ` Keith Packard
2012-01-05 11:13       ` Daniel Vetter
2012-01-05 11:23         ` Eugeni Dodonov
2012-01-05 22:11     ` [PATCH] drm/i915: rip out the HWSTAM missed irq workaround Daniel Vetter
2012-01-05 23:29       ` Ben Widawsky
2012-01-06 16:03       ` Eugeni Dodonov
2012-01-09 22:00       ` Keith Packard
2012-01-09 23:39         ` Daniel Vetter
2012-01-10  2:09           ` Keith Packard
2012-01-10  7:58             ` Daniel Vetter
2012-01-18  0:24       ` Ben Widawsky
2012-01-10 12:20     ` [PATCH] drm/i915: paper over missed irq issues with force wake vodoo Daniel Vetter
2012-01-11  0:51       ` Eric Anholt
2012-01-11  4:44         ` Keith Packard
2012-01-11  6:21           ` Ben Widawsky
2012-01-11  9:59           ` Daniel Vetter
2012-01-11  5:41       ` Kenneth Graunke
2012-01-13 16:42     ` Keith Packard
2012-01-13 23:52       ` Daniel Vetter
2012-01-13 23:55         ` Daniel Vetter
2012-01-14  0:11         ` Keith Packard
2012-01-14  0:31           ` Daniel Vetter
2012-01-14  0:50             ` Keith Packard
2012-01-14 12:12               ` Daniel Vetter
2012-01-15  6:35                 ` Keith Packard
2012-01-15 15:03                   ` Daniel Vetter
2012-01-16  0:06                     ` Keith Packard
2012-01-05 23:29 ` Ben Widawsky
2012-01-08 13:01   ` Daniel Vetter
2012-01-09  5:09   ` Keith Packard
2012-01-06 20:56 ` Keith Packard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.