Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Record the tail at each request and use it to estimate the head
Date: Wed, 8 Feb 2012 19:28:28 +0100	[thread overview]
Message-ID: <20120208182828.GG5030@phenom.ffwll.local> (raw)
In-Reply-To: <1328724390-28037-1-git-send-email-chris@chris-wilson.co.uk>

On Wed, Feb 08, 2012 at 06:06:30PM +0000, Chris Wilson wrote:
> By recording the location of every request in the ringbuffer, we know
> that in order to retire the request the GPU must have finished reading
> it and so the GPU head is now beyond the tail of the request. We can
> therefore provide a conservative estimate of where the GPU is reading
> from in order to avoid having to read back the ring buffer registers
> when polling for space upon starting a new write into the ringbuffer.
> 
> A secondary effect is that this allows us to convert
> intel_ring_buffer_wait() to use i915_wait_request() and so consolidate
> upon the single function to handle the complicated task of waiting upon
> the GPU. A necessary precaution is that we need to make that wait
> uninterruptible to match the existing conditions as all the callers of
> intel_ring_begin() have not been audited to handle ERESTARTSYS
> correctly.
> 
> By using a conservative estimate for the head, and always processing all
> outstanding requests first, we prevent a race condition between using
> the estimate and direct reads of I915_RING_HEAD which could result in
> the value of the head going backwards, and the tail overflowing once
> again. We are also careful to mark any request that we skip over in
> order to free space in ring as consumed which provides a
> self-consistency check.
> 
> Given sufficient abuse, such as a set of unthrottled GPU bound
> cairo-traces, avoiding the use of I915_RING_HEAD gives a 10-20% boost on
> Sandy Bridge (i5-2520m):
>   firefox-paintball  18927ms -> 15646ms: 1.21x speedup
>   firefox-fishtank   12563ms -> 11278ms: 1.11x speedup
> which is a mild consolation for the performance those traces achieved from
> exploiting the buggy autoreported head.
> 
> v2: Add a few more comments and make request->tail a conservative
> estimate as suggested by Daniel Vetter.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

  reply	other threads:[~2012-02-08 18:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 13:34 [PATCH 1/2] drm/i915: Remove use of the autoreported ringbuffer HEAD position Chris Wilson
2012-02-08 13:34 ` [PATCH 2/2] drm/i915: Record the tail at each request and use it to estimate the head Chris Wilson
2012-02-08 14:51   ` Daniel Vetter
2012-02-08 18:06     ` [PATCH] " Chris Wilson
2012-02-08 18:28       ` Daniel Vetter [this message]
2012-02-08 18:56       ` Eugeni Dodonov
2012-02-08 19:21         ` Chris Wilson
2012-02-08 14:54 ` [PATCH 1/2] drm/i915: Remove use of the autoreported ringbuffer HEAD position Daniel Vetter
2012-02-08 17:36   ` Keith Packard
2012-02-08 18:02     ` Daniel Vetter
2012-02-08 18:17       ` Chris Wilson
2012-02-08 18:24         ` Daniel Vetter
2012-02-08 19:13       ` Keith Packard
2012-02-08 20:09   ` [PATCH 1/2] drm/i915: Record the in-flight requests at the time of a hang Chris Wilson
2012-02-08 20:09     ` [PATCH 2/2] drm/i915: Record the position of the request upon error Chris Wilson
2012-02-08 22:34       ` Daniel Vetter
2012-02-10 14:51       ` Eugeni Dodonov
2012-02-08 22:33     ` [PATCH 1/2] drm/i915: Record the in-flight requests at the time of a hang Daniel Vetter
2012-02-21 19:23 ` [PATCH 1/2] drm/i915: Remove use of the autoreported ringbuffer HEAD position Eric Anholt
2012-02-27 16:53 ` Jesse Barnes

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=20120208182828.GG5030@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --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