diff mbox

[2/4] drm/i915: Always clear semaphore mboxes on seqno wrap

Message ID 1355762669-6806-2-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Dec. 17, 2012, 4:44 p.m. UTC
We need to clear the hw semaphore values explicitly.
Even if sync_seqnos are zero, there might still be
invalid values in the hw semaphores when we wrap.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c |   12 ------------
 1 file changed, 12 deletions(-)

Comments

Chris Wilson Dec. 17, 2012, 7:15 p.m. UTC | #1
On Mon, 17 Dec 2012 18:44:27 +0200, Mika Kuoppala <mika.kuoppala@linux.intel.com> wrote:
> We need to clear the hw semaphore values explicitly.
> Even if sync_seqnos are zero, there might still be
> invalid values in the hw semaphores when we wrap.

This changelog does not make it clear why you want this patch. This is
for enabling a future feature, right?

Anyway, after initial misgivings because I thought you were trying to
fix a bug rather than add a feature, and provided that you improve the
changelog,

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Mika Kuoppala Dec. 18, 2012, 2:19 p.m. UTC | #2
Chris Wilson <chris@chris-wilson.co.uk> writes:

> On Mon, 17 Dec 2012 18:44:27 +0200, Mika Kuoppala <mika.kuoppala@linux.intel.com> wrote:
>> We need to clear the hw semaphore values explicitly.
>> Even if sync_seqnos are zero, there might still be
>> invalid values in the hw semaphores when we wrap.
>
> This changelog does not make it clear why you want this patch. This is
> for enabling a future feature, right?
>
> Anyway, after initial misgivings because I thought you were trying to
> fix a bug rather than add a feature, and provided that you improve the
> changelog,

The intent is to always clear the mboxes and also set the hws page when
seqno is set. Both when wrapping and setting seqno from debugfs. 
The hws part is needed to fix a bug where initial seqno in hws page is
zero (after boot) and driver seqno is past the 2^31 boundary.
I guess i could have split the mboxes and hws page setting apart
saving the optimization but the gain would be little.

I think this is also issue on suspend/resume if we have passed 2^31 on
suspend and we come back with driver setting initial seqno to 1.

In both cases i915_seqno_passed(ring->get_seqno(), driver_seqno) will
return errorneous value.

> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris

Does r-b still stand after the explanation above?

-Mika
Chris Wilson Dec. 18, 2012, 2:29 p.m. UTC | #3
On Tue, 18 Dec 2012 16:19:52 +0200, Mika Kuoppala <mika.kuoppala@linux.intel.com> wrote:
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > On Mon, 17 Dec 2012 18:44:27 +0200, Mika Kuoppala <mika.kuoppala@linux.intel.com> wrote:
> >> We need to clear the hw semaphore values explicitly.
> >> Even if sync_seqnos are zero, there might still be
> >> invalid values in the hw semaphores when we wrap.
> >
> > This changelog does not make it clear why you want this patch. This is
> > for enabling a future feature, right?
> >
> > Anyway, after initial misgivings because I thought you were trying to
> > fix a bug rather than add a feature, and provided that you improve the
> > changelog,
> 
> The intent is to always clear the mboxes and also set the hws page when
> seqno is set. Both when wrapping and setting seqno from debugfs. 
> The hws part is needed to fix a bug where initial seqno in hws page is
> zero (after boot) and driver seqno is past the 2^31 boundary.
> I guess i could have split the mboxes and hws page setting apart
> saving the optimization but the gain would be little.
> 
> I think this is also issue on suspend/resume if we have passed 2^31 on
> suspend and we come back with driver setting initial seqno to 1.
> 
> In both cases i915_seqno_passed(ring->get_seqno(), driver_seqno) will
> return errorneous value.
> 
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > -Chris
> 
> Does r-b still stand after the explanation above?

Not really, that's an explanation for the series (setting initial seqno
values was incomplete, we needed to adjust the hw side as well as our
bookkeeping). But it doesn't explain why you want to change
i915_gem_seqno_handle_wrap() in this patch, which as far as I can tell
is because you want to reuse it later for a more general purpose.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8dc5cc1..0231fdb 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1932,18 +1932,6 @@  i915_gem_handle_seqno_wrap(struct drm_device *dev)
 	struct intel_ring_buffer *ring;
 	int ret, i, j;
 
-	/* The hardware uses various monotonic 32-bit counters, if we
-	 * detect that they will wraparound we need to idle the GPU
-	 * and reset those counters.
-	 */
-	ret = 0;
-	for_each_ring(ring, dev_priv, i) {
-		for (j = 0; j < ARRAY_SIZE(ring->sync_seqno); j++)
-			ret |= ring->sync_seqno[j] != 0;
-	}
-	if (ret == 0)
-		return ret;
-
 	/* Carefully retire all requests without writing to the rings */
 	for_each_ring(ring, dev_priv, i) {
 		ret = intel_ring_idle(ring);