[Nouveau] [PATCH] drm/nouveau: Drop mutex_lock_nested for atomic

Ben Skeggs skeggsb at gmail.com
Wed Sep 30 22:46:59 UTC 2020


On Wed, 30 Sep 2020 at 19:37, Daniel Vetter <daniel at ffwll.ch> wrote:
>
> On Wed, Sep 30, 2020 at 10:45:05AM +1000, Ben Skeggs wrote:
> > On Wed, 30 Sep 2020 at 00:52, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> > >
> > > On Thu, Sep 17, 2020 at 3:15 PM Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> > > >
> > > > Ben, did you have a chance to look at this?
> > >
> > > Ping
> > > -Daniel
> > >
> > > > On Mon, Aug 3, 2020 at 1:22 PM Maarten Lankhorst
> > > > <maarten.lankhorst at linux.intel.com> wrote:
> > > > >
> > > > > Op 02-08-2020 om 20:18 schreef Daniel Vetter:
> > > > > > Purely conjecture, but I think the original locking inversion with the
> > > > > > legacy page flip code between flipping and ttm's bo move function
> > > > > > shoudn't exist anymore with atomic: With atomic the bo pinning and
> > > > > > actual modeset commit is completely separated in the code patsh.
> > > > > >
> > > > > > This annotation was originally added in
> > > > > >
> > > > > > commit 060810d7abaabcab282e062c595871d661561400
> > > > > > Author: Ben Skeggs <bskeggs at redhat.com>
> > > > > > Date:   Mon Jul 8 14:15:51 2013 +1000
> > > > > >
> > > > > >     drm/nouveau: fix locking issues in page flipping paths
> > > > > >
> > > > > > due to
> > > > > >
> > > > > > commit b580c9e2b7ba5030a795aa2fb73b796523d65a78
> > > > > > Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
> > > > > > Date:   Thu Jun 27 13:48:18 2013 +0200
> > > > > >
> > > > > >     drm/nouveau: make flipping lockdep safe
> > > > > >
> > > > > > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> > > > > > Cc: Maarten Lankhorst <m.b.lankhorst at gmail.com>
> > > > > > Cc: Ben Skeggs <bskeggs at redhat.com>
> > > > > > Cc: Dave Airlie <airlied at gmail.com>
> > > > > > Cc: nouveau at lists.freedesktop.org
> > > > > > ---
> > > > > > I might be totally wrong, so this definitely needs testing :-)
> > > > > >
> > > > > > Cheers, Daniel
> > > > > > ---
> > > > > >  drivers/gpu/drm/nouveau/nouveau_bo.c | 6 +++++-
> > > > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > > > > > index 7806278dce57..a7b2a9bb0ffe 100644
> > > > > > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> > > > > > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > > > > > @@ -776,7 +776,11 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
> > > > > >                       return ret;
> > > > > >       }
> > > > > >
> > > > > > -     mutex_lock_nested(&cli->mutex, SINGLE_DEPTH_NESTING);
> > > > > > +     if (drm_drv_uses_atomic_modeset(drm->dev))
> > > > > > +             mutex_lock(&cli->mutex);
> > > > > > +     else
> > > > > > +             mutex_lock_nested(&cli->mutex, SINGLE_DEPTH_NESTING);
> > > > > > +
> > > > > >       ret = nouveau_fence_sync(nouveau_bo(bo), chan, true, intr);
> > > > > >       if (ret == 0) {
> > > > > >               ret = drm->ttm.move(chan, bo, &bo->mem, new_reg);
> > > > >
> > > > > Well if you're certain it works now. :)
> > > > >
> > > > > Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> > Acked-by: Ben Skeggs <bskeggs at redhat.com>
>
> Can you pull this in through your tree and maybe give it a spin just to
> make sure? I don't really have nouveau hardware here.
Yeah, I can do that easily enough.

Ben.

>
> Also it's entirely stand-alone, I was simply reviewing all the
> mutex_lock_nested we have in drm, and this one stuck out as probably not
> necessary anymore, at least with atomic.
>
> I guess I can also just stuff it into drm-misc-next and if it blows up,
> figure out what to do then :-)
> -Daniel
>
> >
> > > > >
> > > >
> > > >
> > > > --
> > > > Daniel Vetter
> > > > Software Engineer, Intel Corporation
> > > > http://blog.ffwll.ch
> > >
> > >
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > > _______________________________________________
> > > Nouveau mailing list
> > > Nouveau at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/nouveau
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


More information about the dri-devel mailing list