public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/12] drm/i915: extract some common olr+wedge code
Date: Sat, 28 Apr 2012 15:06:20 -0700	[thread overview]
Message-ID: <20120428150620.2795d30a@bwidawsk.net> (raw)
In-Reply-To: <1335516431_66049@CP5-2952>

On Fri, 27 Apr 2012 09:46:31 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Thu, 26 Apr 2012 16:03:07 -0700, Ben Widawsky <ben@bwidawsk.net>
> wrote:
> > +/*
> > + * Compare seqno against outstanding lazy request. Emit a request
> > if they are
> > + * equal. Seqno is updated with the new value if a request was
> > emitted.
> > + */
> > +static int
> > +i915_gem_check_olr(struct intel_ring_buffer *ring, u32 *seqno)
> > +{
> > +	int ret = 0;
> > +
> > +	BUG_ON(!mutex_is_locked(&ring->dev->struct_mutex));
> > +
> > +	if (*seqno == ring->outstanding_lazy_request) {
> > +		struct drm_i915_gem_request *request;
> > +
> > +		request = kzalloc(sizeof(*request), GFP_KERNEL);
> > +		if (request == NULL)
> > +			return -ENOMEM;
> > +
> > +		ret = i915_add_request(ring, NULL, request);
> > +		if (ret) {
> > +			kfree(request);
> > +			return ret;
> > +		}
> > +
> > +		*seqno = request->seqno;
> I'd love for this to be BUG_ON(seqno != request->seqno) and so drop
> the out parameter, as it would tidy all the callers up.
> > +	}
> > +
> > +	return ret;
> -Chris
> 

Got it, thanks.

I hesitated to do this initially because of the logic in
i915_gem_object_sync. In that function, the updated seqno is used by the
ring sync code, and without the outparam, there was no way to not modify
the behavior. However after inspecting the code a bit deeper, I
understand why it's not a functional change, and the BUG_ON asserts
that.

The one bit which is still not clear to me, even after IRC, is why we
need to add the olr request at this point at all. Even if the mbox update
is delayed for a bit, I don't understand why things won't work
correctly; though I've confirmed I do get a hangcheck if I remove the
bit of code.

Comments?

  reply	other threads:[~2012-04-28 22:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 23:02 [PATCH 00/12 v2] wait for BO with timeout Ben Widawsky
2012-04-26 23:02 ` [PATCH 01/12 v2] drm/i915: remove do_retire from i915_wait_request Ben Widawsky
2012-04-27 14:25   ` Daniel Vetter
2012-04-26 23:02 ` [PATCH 02/12] drm/i915: remove some extra retiring Ben Widawsky
2012-04-27 14:21   ` Daniel Vetter
2012-04-26 23:03 ` [PATCH 03/12 v2] drm/i915: move vbetool invoked ier stuff Ben Widawsky
2012-04-27 14:28   ` Daniel Vetter
2012-05-04 19:40   ` Jesse Barnes
2012-04-26 23:03 ` [PATCH 04/12 v2] drm/i915: kill waiting_seqno Ben Widawsky
2012-04-27 14:45   ` Daniel Vetter
2012-04-26 23:03 ` [PATCH 05/12 v2] drm/i915: drop polled waits from i915_wait_request Ben Widawsky
2012-04-27 14:46   ` Daniel Vetter
2012-04-26 23:03 ` [PATCH 06/12 v2] drm/i915: extract __wait_seqno " Ben Widawsky
2012-04-26 23:03 ` [PATCH 07/12] drm/i915: remove polled wait from throttle Ben Widawsky
2012-04-26 23:03 ` [PATCH 08/12 v2] drm/i915: use __wait_seqno for ring throttle Ben Widawsky
2012-04-27 14:50   ` Daniel Vetter
2012-04-26 23:03 ` [PATCH 09/12] drm/i915: timeout parameter for seqno wait Ben Widawsky
2012-04-27 14:14   ` Chris Wilson
2012-04-28 19:34     ` Ben Widawsky
2012-04-27 15:00   ` Daniel Vetter
2012-04-28  4:28     ` Ben Widawsky
2012-04-26 23:03 ` [PATCH 10/12] drm/i915: extract some common olr+wedge code Ben Widawsky
2012-04-27  8:46   ` Chris Wilson
2012-04-28 22:06     ` Ben Widawsky [this message]
2012-04-26 23:03 ` [PATCH 11/12 v2] drm/i915: wait render timeout ioctl Ben Widawsky
2012-04-27  8:44   ` Chris Wilson
2012-04-28 22:18     ` Ben Widawsky
2012-04-27 15:24   ` Chris Wilson
2012-04-29  2:11     ` Ben Widawsky
2012-04-29  2:33       ` Ben Widawsky
2012-04-29  9:27       ` Chris Wilson
2012-04-26 23:03 ` [PATCH 12/12] drm/i915: s/i915_wait_reqest/i915_wait_seqno/g Ben Widawsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120428150620.2795d30a@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox