From: Daniel Vetter <daniel@ffwll.ch>
To: "Volkin, Bradley D" <bradley.d.volkin@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Abort command parsing for chained batches
Date: Mon, 27 Oct 2014 09:58:01 +0100 [thread overview]
Message-ID: <20141027085801.GI26941@phenom.ffwll.local> (raw)
In-Reply-To: <20141024171751.GA1935@bdvolkin-ubuntu-desktop>
On Fri, Oct 24, 2014 at 10:17:51AM -0700, Volkin, Bradley D wrote:
> On Thu, Oct 23, 2014 at 08:52:59AM -0700, Volkin, Bradley D wrote:
> > On Thu, Oct 23, 2014 at 05:31:12AM -0700, Daniel Vetter wrote:
> > > On Wed, Oct 22, 2014 at 09:04:32AM -0700, Volkin, Bradley D wrote:
> > > > [snip]
> > > >
> > > > On Tue, Oct 21, 2014 at 08:50:33AM -0700, Daniel Vetter wrote:
> > > > > On Thu, Oct 16, 2014 at 12:24:42PM -0700, bradley.d.volkin@intel.com wrote:
> > > > > > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > > > > > index 1a0611b..1ed5702 100644
> > > > > > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > > > > > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > > > > > @@ -1368,17 +1368,19 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
> > > > > > batch_obj,
> > > > > > args->batch_start_offset,
> > > > > > file->is_master);
> > > > > > - if (ret)
> > > > > > - goto err;
> > > > > > -
> > > > > > - /*
> > > > > > - * XXX: Actually do this when enabling batch copy...
> > > > > > - *
> > > > > > - * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit
> > > > > > - * from MI_BATCH_BUFFER_START commands issued in the
> > > > > > - * dispatch_execbuffer implementations. We specifically don't
> > > > > > - * want that set when the command parser is enabled.
> > > > > > - */
> > > > > > + if (ret) {
> > > > > > + if (ret != -EACCES)
> > > > > > + goto err;
> > > > > > + } else {
> > > > > > + /*
> > > > > > + * XXX: Actually do this when enabling batch copy...
> > > > > > + *
> > > > > > + * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit
> > > > > > + * from MI_BATCH_BUFFER_START commands issued in the
> > > > > > + * dispatch_execbuffer implementations. We specifically don't
> > > > > > + * want that set when the command parser is enabled.
> > > > > > + */
> > > > > > + }
> > > > >
> > > > > Tbh this hunk here confuses me ... Why do we need to change anything here?
> > > >
> > > > Yeah, it makes more sense with the batch copy code, it's just that this
> > > > patch has to go in before the patch where we set I915_DISPATCH_SECURE.
> > > > The final logic basically goes like this:
> > > >
> > > > ret = i915_parse_cmds()
> > > > if ret == 0
> > > > dispatch shadow_batch_obj, flags = I915_DISPATCH_SECURE
> > > > else if ret == -EACCES // i.e. i915_parse_cmds() found an MI_BB_S
> > > > dispatch batch_obj, flags = 0
> > > > else
> > > > return error
> > > >
> > > > The point is that there's a restriction that chained batches must have
> > > > the AddressSpace bit set to the same value as the parent batch (i.e.
> > > > GGTT when batch copy is present). But because of the way libva uses
> > > > chained batches we can't parse or copy the chained batch to safely put
> > > > it into GGTT. So we fall back to dispatching the userspace-supplied
> > > > batch from PPGTT. I should probably have mentioned this restriction in
> > > > the commit message.
> > >
> > > Yeah I've figured that this makes more sense with the actual batch copy.
> > > Hence the suggestion to just leave out this hunk for now - that shouldn't
> > > have a functional impact at this stage if I'm not again blind?
> >
> > Oh, I see. Yeah, we can probably leave this part out of this patch and
> > just put it in with batch copy. I'll do a quick test and send an updated
> > patch if it looks good.
>
> I take that back. Reading this again, with appropriate levels of coffee in
> my system this time :), there is a functional impact to this hunk.
>
> We need the
>
> if (ret) {
> if (ret != -EACCES)
> goto err;
> }
>
> piece because i915_parse_cmds() will now return -EACCES for libva batches.
> If we don't filter -EACCES and instead propagate the error, we're basically
> rejecting all of their batches. Not exactly what we wanted. Beyond that, yes
> the other behavioral differences only come in with the batch copy series.
Oh indeed, now I see clearer ;-)
> We obviously don't need the empty else clause though. So if you agree with
> the patch otherwise then I'd say frob the else clause however you like when
> applying and I'll rebase the batch copy patches as needed. I'd prefer that
> you leave the -EACCES filter as written though because the final logic is
>
> if ret {
> if -EACCES
> else
> } else {
> }
I've merged the patch as-is with an improved commit message to explain
this a bit.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2014-10-27 8:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 19:24 [PATCH] drm/i915: Abort command parsing for chained batches bradley.d.volkin
2014-10-16 19:26 ` [PATCH] drm/i915: Abort command parsing for chained shuang.he
2014-10-21 15:50 ` [PATCH] drm/i915: Abort command parsing for chained batches Daniel Vetter
2014-10-22 16:04 ` Volkin, Bradley D
2014-10-23 12:31 ` Daniel Vetter
2014-10-23 15:52 ` Volkin, Bradley D
2014-10-24 17:17 ` Volkin, Bradley D
2014-10-27 8:58 ` Daniel Vetter [this message]
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=20141027085801.GI26941@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=bradley.d.volkin@intel.com \
--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