From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 18/50] drm/i915: Remove intel_context.active_link
Date: Mon, 15 Apr 2019 12:10:17 +0100 [thread overview]
Message-ID: <2b263618-29c1-5029-9eca-d81929d2ac6c@linux.intel.com> (raw)
In-Reply-To: <20190412085410.10392-19-chris@chris-wilson.co.uk>
On 12/04/2019 09:53, Chris Wilson wrote:
> We no longer need to track the active intel_contexts within each engine,
> allowing us to drop a tricky mutex_lock from inside unpin (which may
> occur inside fs_reclaim).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gt/intel_context.c | 11 +----------
> drivers/gpu/drm/i915/gt/intel_context_types.h | 1 -
> drivers/gpu/drm/i915/i915_debugfs.c | 13 +++++++++----
> drivers/gpu/drm/i915/i915_gem_context.c | 2 --
> drivers/gpu/drm/i915/i915_gem_context_types.h | 1 -
> drivers/gpu/drm/i915/selftests/i915_gem_context.c | 1 -
> drivers/gpu/drm/i915/selftests/mock_context.c | 1 -
> 7 files changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
> index 5e506e648454..1f1761fc6597 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context.c
> +++ b/drivers/gpu/drm/i915/gt/intel_context.c
> @@ -49,7 +49,6 @@ int __intel_context_do_pin(struct intel_context *ce)
> return -EINTR;
>
> if (likely(!atomic_read(&ce->pin_count))) {
> - struct i915_gem_context *ctx = ce->gem_context;
> intel_wakeref_t wakeref;
>
> err = 0;
> @@ -58,11 +57,7 @@ int __intel_context_do_pin(struct intel_context *ce)
> if (err)
> goto err;
>
> - i915_gem_context_get(ctx);
> -
> - mutex_lock(&ctx->mutex);
> - list_add(&ce->active_link, &ctx->active_engines);
> - mutex_unlock(&ctx->mutex);
> + i915_gem_context_get(ce->gem_context); /* for ctx->ppgtt */
>
> intel_context_get(ce);
> smp_mb__before_atomic(); /* flush pin before it is visible */
> @@ -91,10 +86,6 @@ void intel_context_unpin(struct intel_context *ce)
> if (likely(atomic_dec_and_test(&ce->pin_count))) {
> ce->ops->unpin(ce);
>
> - mutex_lock(&ce->gem_context->mutex);
> - list_del(&ce->active_link);
> - mutex_unlock(&ce->gem_context->mutex);
> -
> i915_gem_context_put(ce->gem_context);
> intel_context_put(ce);
> }
> diff --git a/drivers/gpu/drm/i915/gt/intel_context_types.h b/drivers/gpu/drm/i915/gt/intel_context_types.h
> index 3579c2708321..d5a7dbd0daee 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_context_types.h
> @@ -38,7 +38,6 @@ struct intel_context {
> struct intel_engine_cs *engine;
> struct intel_engine_cs *active;
>
> - struct list_head active_link;
> struct list_head signal_link;
> struct list_head signals;
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 58956b49f392..6c6bd50d87c9 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -34,6 +34,7 @@
>
> #include "gt/intel_reset.h"
>
> +#include "i915_gem_context.h"
> #include "intel_dp.h"
> #include "intel_drv.h"
> #include "intel_fbc.h"
> @@ -396,9 +397,11 @@ static void print_context_stats(struct seq_file *m,
> struct i915_gem_context *ctx;
>
> list_for_each_entry(ctx, &i915->contexts.list, link) {
> - struct intel_context *ce;
> + struct i915_gem_engines_iter it;
> +
> + for_each_gem_engine(it, ctx) {
Why no i915_gem_context_lock_engines in debugfs?
Regards,
Tvrtko
> + struct intel_context *ce = it.context;
>
> - list_for_each_entry(ce, &ctx->active_engines, active_link) {
> if (ce->state)
> per_file_stats(0, ce->state->obj, &kstats);
> if (ce->ring)
> @@ -1893,7 +1896,7 @@ static int i915_context_status(struct seq_file *m, void *unused)
> return ret;
>
> list_for_each_entry(ctx, &dev_priv->contexts.list, link) {
> - struct intel_context *ce;
> + struct i915_gem_engines_iter it;
>
> seq_puts(m, "HW context ");
> if (!list_empty(&ctx->hw_id_link))
> @@ -1917,7 +1920,9 @@ static int i915_context_status(struct seq_file *m, void *unused)
> seq_putc(m, ctx->remap_slice ? 'R' : 'r');
> seq_putc(m, '\n');
>
> - list_for_each_entry(ce, &ctx->active_engines, active_link) {
> + for_each_gem_engine(it, ctx) {
> + struct intel_context *ce = it.context;
> +
> seq_printf(m, "%s: ", ce->engine->name);
> if (ce->state)
> describe_obj(m, ce->state->obj);
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 99c89dc7533e..889cbc0554e5 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -289,7 +289,6 @@ static void i915_gem_context_free(struct i915_gem_context *ctx)
> {
> lockdep_assert_held(&ctx->i915->drm.struct_mutex);
> GEM_BUG_ON(!i915_gem_context_is_closed(ctx));
> - GEM_BUG_ON(!list_empty(&ctx->active_engines));
>
> release_hw_id(ctx);
> i915_ppgtt_put(ctx->ppgtt);
> @@ -416,7 +415,6 @@ __create_context(struct drm_i915_private *dev_priv)
> list_add_tail(&ctx->link, &dev_priv->contexts.list);
> ctx->i915 = dev_priv;
> ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL);
> - INIT_LIST_HEAD(&ctx->active_engines);
> mutex_init(&ctx->mutex);
>
> mutex_init(&ctx->engines_mutex);
> diff --git a/drivers/gpu/drm/i915/i915_gem_context_types.h b/drivers/gpu/drm/i915/i915_gem_context_types.h
> index 5d146b7b84ec..33e5a0e36e75 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context_types.h
> +++ b/drivers/gpu/drm/i915/i915_gem_context_types.h
> @@ -158,7 +158,6 @@ struct i915_gem_context {
> atomic_t hw_id_pin_count;
> struct list_head hw_id_link;
>
> - struct list_head active_engines;
> struct mutex mutex;
>
> struct i915_sched_attr sched;
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> index 7fd224a4ca4c..deedd1898fe5 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> @@ -1675,7 +1675,6 @@ static int mock_context_barrier(void *arg)
> goto out;
> }
> i915_request_add(rq);
> - GEM_BUG_ON(list_empty(&ctx->active_engines));
>
> counter = 0;
> context_barrier_inject_fault = BIT(RCS0);
> diff --git a/drivers/gpu/drm/i915/selftests/mock_context.c b/drivers/gpu/drm/i915/selftests/mock_context.c
> index 71c750693585..10e67c931ed1 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_context.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_context.c
> @@ -50,7 +50,6 @@ mock_context(struct drm_i915_private *i915,
> INIT_RADIX_TREE(&ctx->handles_vma, GFP_KERNEL);
> INIT_LIST_HEAD(&ctx->handles_list);
> INIT_LIST_HEAD(&ctx->hw_id_link);
> - INIT_LIST_HEAD(&ctx->active_engines);
> mutex_init(&ctx->mutex);
>
> ret = i915_gem_context_pin_hw_id(ctx);
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-04-15 11:10 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 8:53 Excuse the preemption, I can see you are busy Chris Wilson
2019-04-12 8:53 ` [PATCH 01/50] drm/i915: Introduce struct class_instance for engines across the uAPI Chris Wilson
2019-04-15 8:26 ` Andi Shyti
2019-04-12 8:53 ` [PATCH 02/50] drm/i915: Mark up ips for RCU protection Chris Wilson
2019-04-16 12:35 ` Mika Kuoppala
2019-04-12 8:53 ` [PATCH 03/50] drm/i915: Store the default sseu setup on the engine Chris Wilson
2019-04-12 8:53 ` [PATCH 04/50] drm/i915: Move GraphicsTechnology files under gt/ Chris Wilson
2019-04-12 8:53 ` [PATCH 05/50] drm/i915: Introduce struct intel_wakeref Chris Wilson
2019-04-12 12:59 ` Tvrtko Ursulin
2019-04-12 13:12 ` Chris Wilson
2019-04-12 8:53 ` [PATCH 06/50] drm/i915: Pull the GEM powermangement coupling into its own file Chris Wilson
2019-04-12 8:53 ` [PATCH 07/50] drm/i915: Introduce context->enter() and context->exit() Chris Wilson
2019-04-12 13:00 ` Tvrtko Ursulin
2019-04-12 8:53 ` [PATCH 08/50] drm/i915: Pass intel_context to i915_request_create() Chris Wilson
2019-04-12 8:53 ` [PATCH 09/50] drm/i915: Invert the GEM wakeref hierarchy Chris Wilson
2019-04-12 8:53 ` [PATCH 10/50] drm/i915/gvt: Pin the per-engine GVT shadow contexts Chris Wilson
2019-04-12 8:53 ` [PATCH 11/50] drm/i915: Explicitly pin the logical context for execbuf Chris Wilson
2019-04-12 8:53 ` [PATCH 12/50] drm/i915: Export intel_context_instance() Chris Wilson
2019-04-12 8:53 ` [PATCH 13/50] drm/i915/selftests: Use the real kernel context for sseu isolation tests Chris Wilson
2019-04-12 8:53 ` [PATCH 14/50] drm/i915/selftests: Pass around intel_context for sseu Chris Wilson
2019-04-12 8:53 ` [PATCH 15/50] drm/i915: Pass intel_context to intel_context_pin_lock() Chris Wilson
2019-04-12 8:53 ` [PATCH 16/50] drm/i915: Split engine setup/init into two phases Chris Wilson
2019-04-12 8:53 ` [PATCH 17/50] drm/i915: Switch back to an array of logical per-engine HW contexts Chris Wilson
2019-04-12 13:31 ` Tvrtko Ursulin
2019-04-12 13:43 ` Chris Wilson
2019-04-12 14:37 ` Tvrtko Ursulin
2019-04-12 14:58 ` [PATCH v5] " Chris Wilson
2019-04-15 11:00 ` Tvrtko Ursulin
2019-04-15 11:02 ` Tvrtko Ursulin
2019-04-12 8:53 ` [PATCH 18/50] drm/i915: Remove intel_context.active_link Chris Wilson
2019-04-15 11:10 ` Tvrtko Ursulin [this message]
2019-04-15 12:42 ` Chris Wilson
2019-04-15 12:57 ` Tvrtko Ursulin
2019-04-12 8:53 ` [PATCH 19/50] drm/i915: Move i915_request_alloc into selftests/ Chris Wilson
2019-04-12 8:53 ` [PATCH 20/50] drm/i915: Allow multiple user handles to the same VM Chris Wilson
2019-04-12 8:53 ` [PATCH 21/50] drm/i915: Restore control over ppgtt for context creation ABI Chris Wilson
2019-04-12 8:53 ` [PATCH 22/50] drm/i915: Allow a context to define its set of engines Chris Wilson
2019-04-15 12:19 ` Tvrtko Ursulin
2019-04-15 12:31 ` Chris Wilson
2019-04-12 8:53 ` [PATCH 23/50] drm/i915: Re-expose SINGLE_TIMELINE flags for context creation Chris Wilson
2019-04-12 8:53 ` [PATCH 24/50] drm/i915: Allow userspace to clone contexts on creation Chris Wilson
2019-04-15 12:56 ` Tvrtko Ursulin
2019-04-17 7:53 ` Chris Wilson
2019-04-17 8:03 ` Tvrtko Ursulin
2019-04-12 8:53 ` [PATCH 25/50] drm/i915: Load balancing across a virtual engine Chris Wilson
2019-04-12 8:53 ` [PATCH 26/50] drm/i915: Apply an execution_mask to the virtual_engine Chris Wilson
2019-04-12 8:53 ` [PATCH 27/50] drm/i915: Extend execution fence to support a callback Chris Wilson
2019-04-12 8:53 ` [PATCH 28/50] drm/i915/execlists: Virtual engine bonding Chris Wilson
2019-04-12 8:53 ` [PATCH 29/50] drm/i915: Allow specification of parallel execbuf Chris Wilson
2019-04-12 8:53 ` [PATCH 30/50] drm/i915: Split GEM object type definition to its own header Chris Wilson
2019-04-12 8:53 ` [PATCH 31/50] drm/i915: Pull GEM ioctls interface to its own file Chris Wilson
2019-04-12 8:53 ` [PATCH 32/50] drm/i915: Move object->pages API to i915_gem_object.[ch] Chris Wilson
2019-04-12 8:53 ` [PATCH 33/50] drm/i915: Move shmem object setup to its own file Chris Wilson
2019-04-12 8:53 ` [PATCH 34/50] drm/i915: Move phys objects " Chris Wilson
2019-04-12 8:53 ` [PATCH 35/50] drm/i915: Move mmap and friends " Chris Wilson
2019-04-12 8:53 ` [PATCH 36/50] drm/i915: Move GEM domain management " Chris Wilson
2019-04-12 8:53 ` [PATCH 37/50] drm/i915: Move more GEM objects under gem/ Chris Wilson
2019-04-12 8:53 ` [PATCH 38/50] drm/i915: Pull scatterlist utils out of i915_gem.h Chris Wilson
2019-04-17 11:11 ` Matthew Auld
2019-04-17 11:17 ` Chris Wilson
2019-04-12 8:53 ` [PATCH 39/50] drm/i915: Move GEM object domain management from struct_mutex to local Chris Wilson
2019-04-12 15:03 ` Matthew Auld
2019-04-12 8:54 ` [PATCH 40/50] drm/i915: Move GEM object waiting to its own file Chris Wilson
2019-04-12 8:54 ` [PATCH 41/50] drm/i915: Move GEM object busy checking " Chris Wilson
2019-04-12 8:54 ` [PATCH 42/50] drm/i915: Move GEM client throttling " Chris Wilson
2019-04-12 8:54 ` [PATCH 43/50] drm/i915: Drop the deferred active reference Chris Wilson
2019-04-12 8:54 ` [PATCH 44/50] lockdep Chris Wilson
2019-04-12 8:54 ` [PATCH 45/50] drm/i915: Move object close under its own lock Chris Wilson
2019-04-12 8:54 ` [PATCH 46/50] drm/i915: Rename intel_context.active to .inflight Chris Wilson
2019-04-12 8:54 ` [PATCH 47/50] drm/i915: Keep contexts pinned until after the next kernel context switch Chris Wilson
2019-04-12 8:54 ` [PATCH 48/50] drm/i915: Stop retiring along engine Chris Wilson
2019-04-12 8:54 ` [PATCH 49/50] drm/i915: Replace engine->timeline with a plain list Chris Wilson
2019-04-12 13:29 ` [PATCH] " Chris Wilson
2019-04-12 8:54 ` [PATCH 50/50] drm/i915/execlists: Preempt-to-busy Chris Wilson
2019-04-12 10:14 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/50] drm/i915: Introduce struct class_instance for engines across the uAPI Patchwork
2019-04-12 10:30 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-04-12 12:11 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-04-12 12:18 ` Chris Wilson
2019-04-12 15:31 ` ✗ Fi.CI.BAT: failure for series starting with [01/50] drm/i915: Introduce struct class_instance for engines across the uAPI (rev3) 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=2b263618-29c1-5029-9eca-d81929d2ac6c@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;
as well as URLs for NNTP newsgroup(s).