linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: Hillf Danton <hdanton@sina.com>, Rob Clark <robdclark@gmail.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Rob Clark <robdclark@chromium.org>, Sean Paul <sean@poorly.run>,
	David Airlie <airlied@linux.ie>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	freedreno <freedreno@lists.freedesktop.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH 13/14] drm/msm: Drop struct_mutex in shrinker path
Date: Mon, 5 Oct 2020 09:49:37 -0700	[thread overview]
Message-ID: <CAF6AEGveqvvv9MfBMAr34y9664fPouGjwPrK=v9OLVXv4dHzxg@mail.gmail.com> (raw)
In-Reply-To: <20201005140203.GS438822@phenom.ffwll.local>

On Mon, Oct 5, 2020 at 7:02 AM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Mon, Oct 05, 2020 at 05:24:19PM +0800, Hillf Danton wrote:
> >
> > On Sun,  4 Oct 2020 12:21:45
> > > From: Rob Clark <robdclark@chromium.org>
> > >
> > > Now that the inactive_list is protected by mm_lock, and everything
> > > else on per-obj basis is protected by obj->lock, we no longer depend
> > > on struct_mutex.
> > >
> > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > ---
> > >  drivers/gpu/drm/msm/msm_gem.c          |  1 -
> > >  drivers/gpu/drm/msm/msm_gem_shrinker.c | 54 --------------------------
> > >  2 files changed, 55 deletions(-)
> > >
> > [...]
> >
> > > @@ -71,13 +33,8 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
> > >  {
> > >     struct msm_drm_private *priv =
> > >             container_of(shrinker, struct msm_drm_private, shrinker);
> > > -   struct drm_device *dev = priv->dev;
> > >     struct msm_gem_object *msm_obj;
> > >     unsigned long freed = 0;
> > > -   bool unlock;
> > > -
> > > -   if (!msm_gem_shrinker_lock(dev, &unlock))
> > > -           return SHRINK_STOP;
> > >
> > >     mutex_lock(&priv->mm_lock);
> >
> > Better if the change in behavior is documented that SHRINK_STOP will
> > no longer be needed.
>
> btw I read through this and noticed you have your own obj lock, plus
> mutex_lock_nested. I strongly recommend to just cut over to dma_resv_lock
> for all object lock needs (soc drivers have been terrible with this
> unfortuntaly), and in the shrinker just use dma_resv_trylock instead of
> trying to play clever games outsmarting lockdep.
>
> I recently wrote an entire blog length rant on why I think
> mutex_lock_nested is too dangerous to be useful:
>
> https://blog.ffwll.ch/2020/08/lockdep-false-positives.html
>
> Not anything about this here, just general comment. The problem extends to
> shmem helpers and all that also having their own locks for everything.

the shrinker lock class has existed for a while.. and is based on the
idea that anything in the get-pages/vmap path cannot happen on a
WONTNEED bo.. although perhaps there should be a few more 'if
(WARN_ON(obj->madv != WILLNEED)) return -EBUSY'..

replacing obj->lock with dma_resv lock, might be a nice cleanup.. but
I think it will be a bit churny..

BR,
-R

> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

  parent reply	other threads:[~2020-10-05 16:49 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 19:21 [PATCH 00/14] drm/msm: de-struct_mutex-ification Rob Clark
2020-10-04 19:21 ` [PATCH 01/14] drm/msm: Use correct drm_gem_object_put() in fail case Rob Clark
2020-10-04 19:21 ` [PATCH 02/14] drm/msm: Drop chatty trace Rob Clark
2020-10-05 14:15   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 03/14] drm/msm: Move update_fences() Rob Clark
2020-10-05 14:16   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 04/14] drm/msm: Add priv->mm_lock to protect active/inactive lists Rob Clark
2020-10-04 22:15   ` Daniel Vetter
2020-10-05  0:10     ` Rob Clark
2020-10-05 14:19   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 05/14] drm/msm: Document and rename preempt_lock Rob Clark
2020-10-05 14:22   ` Jordan Crouse
2020-10-04 19:21 ` [PATCH 06/14] drm/msm: Protect ring->submits with it's own lock Rob Clark
2020-10-05 14:23   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 07/14] drm/msm: Refcount submits Rob Clark
2020-10-05 13:56   ` Daniel Vetter
2020-10-05 16:24     ` Rob Clark
2020-10-05 14:27   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 08/14] drm/msm: Remove obj->gpu Rob Clark
2020-10-05 14:28   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 09/14] drm/msm: Drop struct_mutex from the retire path Rob Clark
2020-10-05 14:29   ` [Freedreno] " Jordan Crouse
2020-10-04 19:21 ` [PATCH 10/14] drm/msm: Drop struct_mutex in free_object() path Rob Clark
2020-10-04 19:21 ` [PATCH 11/14] drm/msm: remove msm_gem_free_work Rob Clark
2020-10-04 19:21 ` [PATCH 12/14] drm/msm: drop struct_mutex in madvise path Rob Clark
2020-10-04 19:21 ` [PATCH 13/14] drm/msm: Drop struct_mutex in shrinker path Rob Clark
2020-10-04 19:21 ` [PATCH 14/14] drm/msm: Don't implicit-sync if only a single ring Rob Clark
     [not found] ` <20201005092419.15608-1-hdanton@sina.com>
2020-10-05 14:02   ` [PATCH 13/14] drm/msm: Drop struct_mutex in shrinker path Daniel Vetter
2020-10-05 16:17     ` Kristian Høgsberg
     [not found]       ` <20201006004416.15040-1-hdanton@sina.com>
2020-10-06  3:40         ` Rob Clark
2020-10-06  9:35           ` Daniel Vetter
2020-10-05 16:49     ` Rob Clark [this message]
2020-10-05 18:18       ` Daniel Vetter
2020-10-05 16:24 ` [Freedreno] [PATCH 00/14] drm/msm: de-struct_mutex-ification Kristian Høgsberg
2020-10-05 18:20   ` Daniel Vetter
2020-10-06  3:25     ` Rob Clark

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='CAF6AEGveqvvv9MfBMAr34y9664fPouGjwPrK=v9OLVXv4dHzxg@mail.gmail.com' \
    --to=robdclark@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hdanton@sina.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@chromium.org \
    --cc=sean@poorly.run \
    /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).