intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/execlists: Use a local lock for dfs_link access
Date: Wed, 16 Nov 2016 15:54:23 +0000	[thread overview]
Message-ID: <c4dfdcb7-65b0-f701-8fd4-1b3174d3af12@linux.intel.com> (raw)
In-Reply-To: <20161116152721.11053-1-chris@chris-wilson.co.uk>


On 16/11/2016 15:27, Chris Wilson wrote:
> Avoid requiring struct_mutex for exclusive access to the temporary
> dfs_link inside the i915_dependency as not all callers may want to touch
> struct_mutex. So rather than force them to take a highly contended
> lock, introduce a local lock for the execlists schedule operation.
>
> Reported-by: David Weinehall <david.weinehall@linux.intel.com>
> Fixes: 9a151987d709 ("drm/i915: Add execution priority boosting for mmioflips")

Grumble grumble, sloppy review. :I

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: David Weinehall <david.weinehall@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_lrc.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index e23b6a2600fb..10e59ff0d8f1 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -694,6 +694,7 @@ pt_lock_engine(struct i915_priotree *pt, struct intel_engine_cs *locked)
>
>  static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
>  {
> +	static DEFINE_MUTEX(lock);

Good enough for one GPU. :) Consider improving in the future as it is 
not in the spirit of the driver.

>  	struct intel_engine_cs *engine = NULL;
>  	struct i915_dependency *dep, *p;
>  	struct i915_dependency stack;
> @@ -702,8 +703,8 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
>  	if (prio <= READ_ONCE(request->priotree.priority))
>  		return;
>
> -	/* Need BKL in order to use the temporary link inside i915_dependency */
> -	lockdep_assert_held(&request->i915->drm.struct_mutex);
> +	/* Need global lock to use the temporary link inside i915_dependency */
> +	mutex_lock(&lock);
>
>  	stack.signaler = &request->priotree;
>  	list_add(&stack.dfs_link, &dfs);
> @@ -770,6 +771,8 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
>  	if (engine)
>  		spin_unlock_irq(&engine->timeline->lock);
>
> +	mutex_unlock(&lock);
> +
>  	/* XXX Do we need to preempt to make room for us and our deps? */
>  }
>
>

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

  reply	other threads:[~2016-11-16 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 15:27 [PATCH] drm/i915/execlists: Use a local lock for dfs_link access Chris Wilson
2016-11-16 15:54 ` Tvrtko Ursulin [this message]
2016-11-16 16:03   ` Chris Wilson
2016-11-17  8:45     ` Daniel Vetter
2016-11-17  8:52       ` Chris Wilson
2016-11-17  9:05         ` Daniel Vetter
2016-11-16 16:46 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-11-17  9:16 ` [PATCH] " David Weinehall

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=c4dfdcb7-65b0-f701-8fd4-1b3174d3af12@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).