From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, Ben Widawsky <ben@bwidawsk.net>
Subject: Re: [PATCH] [RFC] drm/i915: read-read semaphore optimization
Date: Tue, 13 Dec 2011 09:49:34 +0000 [thread overview]
Message-ID: <aefc95$2hvr0i@orsmga001.jf.intel.com> (raw)
In-Reply-To: <1323748328-10153-1-git-send-email-ben@bwidawsk.net>
On Mon, 12 Dec 2011 19:52:08 -0800, Ben Widawsky <ben@bwidawsk.net> wrote:
> Since we don't differentiate on the different GPU read domains, it
> should be safe to allow back to back reads to occur without issuing a
> wait (or flush in the non-semaphore case).
>
> This has the unfortunate side effect that we need to keep track of all
> the outstanding buffer reads so that we can synchronize on a write, to
> another ring (since we don't know which read finishes first). In other
> words, the code is quite simple for two rings, but gets more tricky for
> > 2 rings.
>
> Here is a picture of the solution to the above problem
>
> Ring 0 Ring 1 Ring 2
> batch 0 batch 1 batch 2
> read buffer A read buffer A wait batch 0
> wait batch 1
> write buffer A
>
> This code is really untested. I'm hoping for some feedback if this is
> worth cleaning up, and testing more thoroughly.
Yes, that race is quite valid and the reason why I thought I hadn't made
that optimisation. Darn. :(
To go a step further, we can split the obj->ring_list into
(obj->ring_read_list[NUM_RINGS], obj->num_readers, obj->last_read_seqno) and
(obj->ring_write_list, obj->last_write_seqno). At which point Daniel
complains about bloating every i915_gem_object, and we probably should
kmem_cache_alloc a i915_gem_object_seqno on demand. This allows us to track
objects in multiple rings and implement read-write locking, albeit at
significantly more complexity in managing the active lists.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
next prev parent reply other threads:[~2011-12-13 9:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 3:52 [PATCH] [RFC] drm/i915: read-read semaphore optimization Ben Widawsky
2011-12-13 9:49 ` Chris Wilson [this message]
2011-12-13 16:01 ` Daniel Vetter
2011-12-13 16:36 ` Keith Packard
2011-12-13 22:49 ` Ben Widawsky
2011-12-13 23:22 ` Keith Packard
2011-12-14 1:09 ` Eric Anholt
2011-12-14 3:25 ` Keith Packard
2011-12-13 16:59 ` Chris Wilson
2011-12-13 17:22 ` Eric Anholt
2011-12-13 18:36 ` Ben Widawsky
2012-01-16 21:50 ` Daniel Vetter
2012-01-16 22:20 ` Ben Widawsky
2012-01-17 3:41 ` Eric Anholt
2012-01-17 10:15 ` Daniel Vetter
2012-01-17 17:55 ` Eric Anholt
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='aefc95$2hvr0i@orsmga001.jf.intel.com' \
--to=chris@chris-wilson.co.uk \
--cc=ben@bwidawsk.net \
--cc=daniel.vetter@ffwll.ch \
--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 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.