From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 13/20] drm/i915: Teach execbuffer to take the engine wakeref not GT
Date: Mon, 22 Jul 2019 17:03:31 +0100 [thread overview]
Message-ID: <2fbe7c82-7324-e959-38ac-7841aa35a670@linux.intel.com> (raw)
In-Reply-To: <20190718070024.21781-13-chris@chris-wilson.co.uk>
On 18/07/2019 08:00, Chris Wilson wrote:
> In the next patch, we would like to couple into the engine wakeref to
> free the batch pool on idling. The caveat here is that we therefore want
> to track the engine wakeref more precisely and to hold it instead of the
> broader GT wakeref as we process the ioctl.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 36 ++++++++++++-------
> drivers/gpu/drm/i915/gt/intel_context.h | 7 ++++
> 2 files changed, 31 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index cbd7c6e3a1f8..8768d436e54b 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -2138,13 +2138,35 @@ static int eb_pin_context(struct i915_execbuffer *eb, struct intel_context *ce)
> if (err)
> return err;
>
> + /*
> + * Take a local wakeref for preparing to dispatch the execbuf as
> + * we expect to access the hardware fairly frequently in the
> + * process. Upon first dispatch, we acquire another prolonged
> + * wakeref that we hold until the GPU has been idle for at least
> + * 100ms.
Old comment but slightly not business of this layer to talk about 100ms.
> + */
> + err = intel_context_timeline_lock(ce);
> + if (err)
> + goto err_unpin;
> +
> + intel_context_enter(ce);
> + intel_context_timeline_unlock(ce);
> +
> eb->engine = ce->engine;
> eb->context = ce;
> return 0;
> +
> +err_unpin:
> + intel_context_unpin(ce);
> + return err;
> }
>
> static void eb_unpin_context(struct i915_execbuffer *eb)
> {
> + __intel_context_timeline_lock(eb->context);
Slight misuse of established semantics for underscores. (I'd expect no
locking, or something along those lines, not a difference between
interruptible and non-interruptible.)
> + intel_context_exit(eb->context);
> + intel_context_timeline_unlock(eb->context);
> +
> intel_context_unpin(eb->context);
> }
>
> @@ -2425,18 +2447,9 @@ i915_gem_do_execbuffer(struct drm_device *dev,
> if (unlikely(err))
> goto err_destroy;
>
> - /*
> - * Take a local wakeref for preparing to dispatch the execbuf as
> - * we expect to access the hardware fairly frequently in the
> - * process. Upon first dispatch, we acquire another prolonged
> - * wakeref that we hold until the GPU has been idle for at least
> - * 100ms.
> - */
> - intel_gt_pm_get(&eb.i915->gt);
> -
> err = i915_mutex_lock_interruptible(dev);
> if (err)
> - goto err_rpm;
> + goto err_context;
>
> err = eb_select_engine(&eb, file, args);
> if (unlikely(err))
> @@ -2601,8 +2614,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
> eb_unpin_context(&eb);
> err_unlock:
> mutex_unlock(&dev->struct_mutex);
> -err_rpm:
> - intel_gt_pm_put(&eb.i915->gt);
> +err_context:
> i915_gem_context_put(eb.gem_context);
> err_destroy:
> eb_destroy(&eb);
> diff --git a/drivers/gpu/drm/i915/gt/intel_context.h b/drivers/gpu/drm/i915/gt/intel_context.h
> index 23c7e4c0ce7c..485886d84a56 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context.h
> +++ b/drivers/gpu/drm/i915/gt/intel_context.h
> @@ -127,6 +127,13 @@ static inline void intel_context_put(struct intel_context *ce)
> kref_put(&ce->ref, ce->ops->destroy);
> }
>
> +static inline void
> +__intel_context_timeline_lock(struct intel_context *ce)
> + __acquires(&ce->ring->timeline->mutex)
> +{
> + mutex_lock(&ce->ring->timeline->mutex);
> +}
> +
> static inline int __must_check
> intel_context_timeline_lock(struct intel_context *ce)
> __acquires(&ce->ring->timeline->mutex)
>
But passable.
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-07-22 16:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190718070024.21781-1-chris@chris-wilson.co.uk>
2019-07-18 7:00 ` [PATCH 02/20] drm/i915/gt: Hook up intel_context_fini() Chris Wilson
2019-07-22 12:22 ` Tvrtko Ursulin
2019-07-18 7:00 ` [PATCH 04/20] drm/i915/execlists: Cancel breadcrumb on preempting the virtual engine Chris Wilson
2019-07-18 7:00 ` [PATCH 05/20] drm/i915: Hide unshrinkable context objects from the shrinker Chris Wilson
2019-07-18 7:00 ` [PATCH 06/20] drm/i915: Remove obsolete engine cleanup Chris Wilson
2019-07-22 12:46 ` Tvrtko Ursulin
2019-07-22 16:29 ` Chris Wilson
2019-07-18 7:00 ` [PATCH 07/20] drm/i915/gt: Move the [class][inst] lookup for engines onto the GT Chris Wilson
2019-07-18 7:00 ` [PATCH 09/20] drm/i915: Use intel_engine_lookup_user for probing HAS_BSD etc Chris Wilson
2019-07-22 12:49 ` Tvrtko Ursulin
2019-07-22 16:34 ` Chris Wilson
2019-07-18 7:00 ` [PATCH 11/20] drm/i915: Rely on spinlock protection for GPU error capture Chris Wilson
2019-07-22 13:40 ` Tvrtko Ursulin
2019-07-18 7:00 ` [PATCH 13/20] drm/i915: Teach execbuffer to take the engine wakeref not GT Chris Wilson
2019-07-22 16:03 ` Tvrtko Ursulin [this message]
2019-07-18 7:00 ` [PATCH 14/20] drm/i915/gt: Track timeline activeness in enter/exit Chris Wilson
2019-07-22 16:14 ` Tvrtko Ursulin
2019-07-22 16:42 ` Chris Wilson
2019-07-18 7:00 ` [PATCH 15/20] drm/i915/gt: Convert timeline tracking to spinlock Chris Wilson
2019-07-18 7:00 ` [PATCH 17/20] drm/i915/gt: Add to timeline requires the timeline mutex Chris Wilson
2019-07-18 7:00 ` [PATCH 18/20] drm/i915: Protect request retirement with timeline->mutex Chris Wilson
2019-07-18 7:00 ` [PATCH 20/20] drm/i915/gt: Mark context->active_count as protected by timeline->mutex Chris Wilson
2019-07-18 7:16 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/20] drm/i915: Move aliasing_ppgtt underneath its i915_ggtt Patchwork
2019-07-18 7:25 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-18 7:48 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-18 10:05 ` ✓ Fi.CI.IGT: " Patchwork
[not found] ` <20190718070024.21781-3-chris@chris-wilson.co.uk>
2019-07-22 12:33 ` [PATCH 03/20] drm/i915/gt: Provde a local intel_context.vm Tvrtko Ursulin
2019-07-22 16:28 ` Chris Wilson
2019-07-23 13:44 ` Tvrtko Ursulin
[not found] ` <20190718070024.21781-10-chris@chris-wilson.co.uk>
2019-07-22 12:53 ` [PATCH 10/20] drm/i915: Isolate i915_getparam_ioctl() Tvrtko Ursulin
2019-07-22 16:04 ` Tvrtko Ursulin
2019-07-22 16:16 ` Chris Wilson
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=2fbe7c82-7324-e959-38ac-7841aa35a670@linux.intel.com \
--to=tvrtko.ursulin@linux.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