All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Harrison <john.c.harrison@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>
Cc: daniele.ceraolospurio@intel.com, tvrtko.ursulin@intel.com
Subject: Re: [PATCH] drm/i915: Lock timeline mutex directly in error path of eb_pin_timeline
Date: Thu, 20 Jan 2022 12:54:00 -0800	[thread overview]
Message-ID: <81558cf3-8eb3-7d45-d534-0769243d4bd1@intel.com> (raw)
In-Reply-To: <20220111163929.14017-1-matthew.brost@intel.com>

On 1/11/2022 08:39, Matthew Brost wrote:
> Don't use the interruptable version of the timeline mutex lock in the
> error path of eb_pin_timeline as the cleanup must always happen.
>
> v2:
>   (John Harrison)
>    - Don't check for interrupt during mutex lock
> v3:
>   (Tvrtko)
>    - A comment explaining why lock helper isn't used
>
> Fixes: 544460c33821 ("drm/i915: Multi-BB execbuf")
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>

> ---
>   drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 9e221ce427075..4a611d62e991a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -2518,9 +2518,14 @@ static int eb_pin_timeline(struct i915_execbuffer *eb, struct intel_context *ce,
>   				      timeout) < 0) {
>   			i915_request_put(rq);
>   
> -			tl = intel_context_timeline_lock(ce);
> +			/*
> +			 * Error path, cannot use intel_context_timeline_lock as
> +			 * that is user interruptable and this clean up step
> +			 * must be done.
> +			 */
> +			mutex_lock(&ce->timeline->mutex);
>   			intel_context_exit(ce);
> -			intel_context_timeline_unlock(tl);
> +			mutex_unlock(&ce->timeline->mutex);
>   
>   			if (nonblock)
>   				return -EWOULDBLOCK;


WARNING: multiple messages have this Message-ID (diff)
From: John Harrison <john.c.harrison@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Lock timeline mutex directly in error path of eb_pin_timeline
Date: Thu, 20 Jan 2022 12:54:00 -0800	[thread overview]
Message-ID: <81558cf3-8eb3-7d45-d534-0769243d4bd1@intel.com> (raw)
In-Reply-To: <20220111163929.14017-1-matthew.brost@intel.com>

On 1/11/2022 08:39, Matthew Brost wrote:
> Don't use the interruptable version of the timeline mutex lock in the
> error path of eb_pin_timeline as the cleanup must always happen.
>
> v2:
>   (John Harrison)
>    - Don't check for interrupt during mutex lock
> v3:
>   (Tvrtko)
>    - A comment explaining why lock helper isn't used
>
> Fixes: 544460c33821 ("drm/i915: Multi-BB execbuf")
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>

> ---
>   drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 9e221ce427075..4a611d62e991a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -2518,9 +2518,14 @@ static int eb_pin_timeline(struct i915_execbuffer *eb, struct intel_context *ce,
>   				      timeout) < 0) {
>   			i915_request_put(rq);
>   
> -			tl = intel_context_timeline_lock(ce);
> +			/*
> +			 * Error path, cannot use intel_context_timeline_lock as
> +			 * that is user interruptable and this clean up step
> +			 * must be done.
> +			 */
> +			mutex_lock(&ce->timeline->mutex);
>   			intel_context_exit(ce);
> -			intel_context_timeline_unlock(tl);
> +			mutex_unlock(&ce->timeline->mutex);
>   
>   			if (nonblock)
>   				return -EWOULDBLOCK;


  parent reply	other threads:[~2022-01-20 20:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 16:39 [PATCH] drm/i915: Lock timeline mutex directly in error path of eb_pin_timeline Matthew Brost
2022-01-11 16:39 ` [Intel-gfx] " Matthew Brost
2022-01-11 20:11 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Lock timeline mutex directly in error path of eb_pin_timeline (rev2) Patchwork
2022-01-12  2:06 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-01-20 20:54 ` John Harrison [this message]
2022-01-20 20:54   ` [Intel-gfx] [PATCH] drm/i915: Lock timeline mutex directly in error path of eb_pin_timeline John Harrison
  -- strict thread matches above, loose matches on Subject: below --
2022-01-04 23:30 Matthew Brost

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=81558cf3-8eb3-7d45-d534-0769243d4bd1@intel.com \
    --to=john.c.harrison@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=tvrtko.ursulin@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.