Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sultan Alsawaf <sultan@kerneltoast.com>
Cc: dri-devel@lists.freedesktop.org, David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org,
	Chris Wilson <chris@chris-wilson.co.uk>,
	stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Fix ref->mutex deadlock in i915_active_wait()
Date: Fri, 10 Apr 2020 11:08:38 +0200	[thread overview]
Message-ID: <20200410090838.GD1691838@kroah.com> (raw)
In-Reply-To: <20200407071809.3148-1-sultan@kerneltoast.com>

On Tue, Apr 07, 2020 at 12:18:09AM -0700, Sultan Alsawaf wrote:
> From: Sultan Alsawaf <sultan@kerneltoast.com>
> 
> The following deadlock exists in i915_active_wait() due to a double lock
> on ref->mutex (call chain listed in order from top to bottom):
>  i915_active_wait();
>  mutex_lock_interruptible(&ref->mutex); <-- ref->mutex first acquired
>  i915_active_request_retire();
>  node_retire();
>  active_retire();
>  mutex_lock_nested(&ref->mutex, SINGLE_DEPTH_NESTING); <-- DEADLOCK
> 
> Fix the deadlock by skipping the second ref->mutex lock when
> active_retire() is called through i915_active_request_retire().
> 
> Note that this bug only affects 5.4 and has since been fixed in 5.5.
> Normally, a backport of the fix from 5.5 would be in order, but the
> patch set that fixes this deadlock involves massive changes that are
> neither feasible nor desirable for backporting [1][2][3]. Therefore,
> this small patch was made to address the deadlock specifically for 5.4.
> 
> [1] 274cbf20fd10 ("drm/i915: Push the i915_active.retire into a worker")
> [2] 093b92287363 ("drm/i915: Split i915_active.mutex into an irq-safe spinlock for the rbtree")
> [3] 750bde2fd4ff ("drm/i915: Serialise with remote retirement")
> 
> Fixes: 12c255b5dad1 ("drm/i915: Provide an i915_active.acquire callback")
> Cc: <stable@vger.kernel.org> # 5.4.x
> Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
> ---
>  drivers/gpu/drm/i915/i915_active.c | 27 +++++++++++++++++++++++----
>  drivers/gpu/drm/i915/i915_active.h |  4 ++--
>  2 files changed, 25 insertions(+), 6 deletions(-)

Now queued up, thanks.

greg k-h
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-04-10  9:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200407062622.6443-1-sultan@kerneltoast.com>
2020-04-07  6:52 ` [Intel-gfx] [PATCH 0/1] drm/i915: Fix a deadlock that only affects 5.4 Greg KH
     [not found]   ` <20200407071809.3148-1-sultan@kerneltoast.com>
2020-04-10  9:08     ` Greg KH [this message]
2020-04-10 14:15       ` [Intel-gfx] [PATCH v2] drm/i915: Fix ref->mutex deadlock in i915_active_wait() Sultan Alsawaf
2020-04-10 14:17       ` Sultan Alsawaf
2020-04-11 11:39         ` Greg KH
2020-04-14  8:15           ` Chris Wilson
2020-04-14  8:23             ` Greg KH
2020-04-20  9:02               ` Joonas Lahtinen
2020-04-20 15:42                 ` Sultan Alsawaf
2020-04-21  8:04                   ` Joonas Lahtinen
2020-04-21 16:38                     ` Sultan Alsawaf
2020-04-21 20:55                       ` Jason A. Donenfeld
2020-04-14 14:35             ` Sultan Alsawaf
2020-04-10 11:46     ` [Intel-gfx] Patch "drm/i915: Fix ref->mutex deadlock in i915_active_wait()" has been added to the 5.4-stable tree gregkh
2020-04-10 11:56     ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
     [not found] ` <20200407062622.6443-2-sultan@kerneltoast.com>
2020-04-14  8:13   ` [Intel-gfx] [PATCH 1/1] drm/i915: Fix ref->mutex deadlock in i915_active_wait() Chris Wilson
2020-04-14 14:52     ` Sultan Alsawaf

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=20200410090838.GD1691838@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=airlied@linux.ie \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    --cc=sultan@kerneltoast.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox