From: Dave Gordon <david.s.gordon@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/i915: Track & check calls to intel(_logical)_ring_{begin, advance}
Date: Fri, 12 Dec 2014 18:28:01 +0000 [thread overview]
Message-ID: <548B33B1.2030000@intel.com> (raw)
In-Reply-To: <20141212171239.GI22904@nuc-i3427.alporthouse.com>
On 12/12/14 17:12, Chris Wilson wrote:
> On Fri, Dec 12, 2014 at 04:13:03PM +0000, Dave Gordon wrote:
>> static inline void intel_ring_advance(struct intel_engine_cs *ring)
>> {
>> struct intel_ringbuffer *ringbuf = ring->buffer;
>> - ringbuf->tail &= ringbuf->size - 1;
>> +
>> + __intel_ringbuffer_check(ringbuf);
>> +
>> + /*
>> + * Tail == effecive_size is legitimate (buffer exactly full).
>> + * Tail > effective_size is not, and should give a warning,
>> + * but we'll reset tail in both cases to prevent further chaos
>> + */
>> + if (ringbuf->tail >= ringbuf->effective_size)
>> + ringbuf->tail -= ringbuf->effective_size;
>
> Urm. No. If you never write into the reserved pair of cachelines at the
> end of the ringbuffer but the hw reads garbage from it, you lose.
This won't happen, because (with the first patch of this set applied)
the check for sufficient space uses effective_size, but the wrap code
uses the actual size. Thus, once the next chunk won't fit in the
available space up to the effective_size, we write NOPs all over
whatever is left up to the total size. The part between the effective
and the actual sizes is therefore always (and only) written with NOPs.
> tail &= size - 1; is a nice description of how the hw works that is
> suitable for inlining, with all the magic in begin().
>
> The goal is to remove the duplicated logic from intel_lrc.c, use
> requests completely, and remove the dri1 hangover. To repeat what I said
> last time:
> http://cgit.freedesktop.org/~ickle/linux-2.6/tree/drivers/gpu/drm/i915/intel_ringbuffer.c?h=requests#n2447
> is where I want us to go, a single piece of logic for ring management.
> -Chris
I agree with the deduplication, which is why nearly all these changes
are in functions operating on ringbuffers (not rings), and located in
intel_ringbuffer.h, with only minimal changes in the execlist and legacy
paths to use these common functions rather than having two implementations.
So, what I think I'll do is rework this third patch to merge the
tail-masking into the common function; rename it to something other than
/check/; and then the legacy and LRC versions become trivial wrappers
round this.
Are you happy with the first two patches?
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-12-12 18:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-12 16:13 [PATCH 0/3] Three small patches to ringbuffer calculations Dave Gordon
2014-12-12 16:13 ` [PATCH 1/3] drm/i915: use effective_size for " Dave Gordon
2014-12-12 16:13 ` [PATCH 2/3] drm/i915: recheck ringspace after wait+retire Dave Gordon
2014-12-12 16:13 ` [PATCH 3/3] drm/i915: Track & check calls to intel(_logical)_ring_{begin, advance} Dave Gordon
2014-12-12 17:12 ` Chris Wilson
2014-12-12 18:28 ` Dave Gordon [this message]
2014-12-15 14:31 ` [PATCH 3/3, v2] " Dave Gordon
2014-12-14 6:06 ` [PATCH 3/3] " shuang.he
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=548B33B1.2030000@intel.com \
--to=david.s.gordon@intel.com \
--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 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.