From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org, Akash Goel <akash.goel@intel.com>
Subject: Re: [PATCH 11/16] drm/i915: Remove (struct_mutex) locking for busy-ioctl
Date: Fri, 05 Aug 2016 11:06:44 +0300 [thread overview]
Message-ID: <1470384404.3634.31.camel@linux.intel.com> (raw)
In-Reply-To: <20160805073443.GF12034@nuc-i3427.alporthouse.com>
On pe, 2016-08-05 at 08:34 +0100, Chris Wilson wrote:
> On Fri, Aug 05, 2016 at 10:05:38AM +0300, Joonas Lahtinen wrote:
> >
> > On ma, 2016-08-01 at 19:22 +0100, Chris Wilson wrote:
> > >
> > > By applying the same logic as for wait-ioctl, we can query whether a
> > > request has completed without holding struct_mutex. The biggest impact
> > > system-wide is removing the flush_active and the contention that causes.
> > >
> > > Testcase: igt/gem_busy
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Akash Goel <akash.goel@intel.com>
> > > ---
> > > drivers/gpu/drm/i915/i915_gem.c | 110 +++++++++++++++++++++++++++++-----------
> > > 1 file changed, 80 insertions(+), 30 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > > index 43069b05bdd2..f2f70f5ff9f4 100644
> > > --- a/drivers/gpu/drm/i915/i915_gem.c
> > > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > > @@ -3721,49 +3721,99 @@ i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj,
> > > i915_vma_unpin(i915_gem_obj_to_ggtt_view(obj, view));
> > > }
> > >
> > > +static __always_inline unsigned
> > > +__busy_read_flag(const struct drm_i915_gem_request *request)
> > > +{
> > > + return 0x10000 << request->engine->exec_id;
> > > +}
> > > +
> > > +static __always_inline unsigned int
> > > +__busy_write_flag(const struct drm_i915_gem_request *request)
> > > +{
> > > + return request->engine->exec_id;
> > Just realized (to my horror) this is not a flag, it's a bare ID, so
> > better not call the function _flag, but rather _id?
> Bah.
>
> __busy_write_id
> __busy_read_flag
> __busy_set_if_active
>
> busy_set_active_write_id() { __busy_set_if_active(ptr, __busy_write_id}; )
> busy_set_active_read_flag() { __busy_set_if_active(ptr, __busy_read_flag); }
>
This would be OK,
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> >
> > >
> > > + * but before we add its engine into the busy set, the other
> > > + * thread reallocates it and assigns it to a task on another
> > > + * engine with a fresh and incomplete seqno.
> > > + *
> > > + * So after we lookup the engine's id, we double check that
> > > + * the active request is the same and only then do we add it
> > > + * into the busy set.
> > > + */
> > > + rcu_read_lock();
> > > +
> > > + for_each_active(active, idx)
> > > + args->busy |= busy_read_flag(&obj->last_read[idx]);
> > So you mean this is double check against __I915_BO_ACTIVE, right?
> Yes. The ABI guarantees forward progress but __I915_BO_ACTIVE itself
> does not, so we confirm each of the active requests with the hardware.
>
> Will add.
> -Chris
>
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-08-05 8:06 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-01 18:22 Put RCU request lookup to use Chris Wilson
2016-08-01 18:22 ` [PATCH 01/16] drm/i915: Introduce i915_gem_active_wait_unlocked() Chris Wilson
2016-08-03 11:41 ` Joonas Lahtinen
2016-08-03 11:56 ` Chris Wilson
2016-08-03 12:04 ` Chris Wilson
2016-08-03 13:30 ` Joonas Lahtinen
2016-08-03 13:43 ` Chris Wilson
2016-08-04 11:51 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 02/16] drm/i915: Convert non-blocking waits for requests over to using RCU Chris Wilson
2016-08-03 13:23 ` Joonas Lahtinen
2016-08-03 13:36 ` Chris Wilson
2016-08-03 13:41 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 03/16] drm/i915: Convert non-blocking userptr " Chris Wilson
2016-08-03 13:27 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 04/16] drm/i915/userptr: Remove superfluous interruptible=false on waiting Chris Wilson
2016-08-03 13:43 ` Joonas Lahtinen
2016-08-03 13:49 ` Chris Wilson
2016-08-04 11:53 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 05/16] drm/i915: Enable i915_gem_wait_for_idle() without holding struct_mutex Chris Wilson
2016-08-01 19:28 ` Chris Wilson
2016-08-04 11:50 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 06/16] drm/gem/shrinker: Wait before acquiring struct_mutex under oom Chris Wilson
2016-08-04 6:46 ` Joonas Lahtinen
2016-08-04 6:52 ` Chris Wilson
2016-08-01 18:22 ` [PATCH 07/16] drm/i915: Tidy generation of the GTT mmap offset Chris Wilson
2016-08-04 7:25 ` Joonas Lahtinen
2016-08-04 7:30 ` Chris Wilson
2016-08-04 11:57 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 08/16] drm/i915: Remove unused no-shrinker-steal Chris Wilson
2016-08-04 7:26 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 09/16] drm/i915: Do a nonblocking wait first in pread/pwrite Chris Wilson
2016-08-04 7:53 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 10/16] drm/i915: Remove (struct_mutex) locking for wait-ioctl Chris Wilson
2016-08-04 8:26 ` Joonas Lahtinen
2016-08-04 8:37 ` Chris Wilson
2016-08-04 10:02 ` Chris Wilson
2016-08-04 12:00 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 11/16] drm/i915: Remove (struct_mutex) locking for busy-ioctl Chris Wilson
2016-08-04 10:25 ` Joonas Lahtinen
2016-08-04 10:30 ` Chris Wilson
2016-08-05 7:05 ` Joonas Lahtinen
2016-08-05 7:34 ` Chris Wilson
2016-08-05 8:06 ` Joonas Lahtinen [this message]
2016-08-01 18:22 ` [PATCH 12/16] drm/i915: Reduce locking inside swfinish ioctl Chris Wilson
2016-08-04 10:32 ` Joonas Lahtinen
2016-08-04 10:48 ` Chris Wilson
2016-08-01 18:22 ` [PATCH 13/16] drm/i915: Remove pinned check from madvise ioctl Chris Wilson
2016-08-04 10:36 ` Joonas Lahtinen
2016-08-04 10:42 ` Chris Wilson
2016-08-04 11:47 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 14/16] drm/i915: Remove locking for get_tiling Chris Wilson
2016-08-04 10:40 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 15/16] drm/i915: Repack fence tiling mode and stride into a single integer Chris Wilson
2016-08-04 11:17 ` Joonas Lahtinen
2016-08-04 11:34 ` Chris Wilson
2016-08-04 11:36 ` Joonas Lahtinen
2016-08-04 11:41 ` Chris Wilson
2016-08-04 12:02 ` Joonas Lahtinen
2016-08-01 18:22 ` [PATCH 16/16] drm/i915: Assert that the request hasn't been retired Chris Wilson
2016-08-04 11:18 ` Joonas Lahtinen
2016-08-02 5:00 ` ✗ Ro.CI.BAT: failure for series starting with [01/16] drm/i915: Introduce i915_gem_active_wait_unlocked() Patchwork
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=1470384404.3634.31.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=akash.goel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox