dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] drm/nouveau: Drop mutex_lock_nested for atomic
@ 2020-11-27 16:35 Daniel Vetter
  2020-12-01 17:27 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Vetter @ 2020-11-27 16:35 UTC (permalink / raw)
  To: DRI Development
  Cc: Maarten Lankhorst, Daniel Vetter, Ben Skeggs, nouveau, 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@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@gmail.com>
Date:   Thu Jun 27 13:48:18 2013 +0200

    drm/nouveau: make flipping lockdep safe

Acked-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: nouveau@lists.freedesktop.org
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 1386b0fc1640..43069dd8b027 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -774,7 +774,10 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict,
 			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, ctx->interruptible);
 	if (ret == 0) {
 		ret = drm->ttm.move(chan, bo, &bo->mem, new_reg);
-- 
2.29.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] drm/nouveau: Drop mutex_lock_nested for atomic
  2020-11-27 16:35 [PATCH RESEND] drm/nouveau: Drop mutex_lock_nested for atomic Daniel Vetter
@ 2020-12-01 17:27 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2020-12-01 17:27 UTC (permalink / raw)
  To: DRI Development
  Cc: Maarten Lankhorst, Daniel Vetter, Ben Skeggs, nouveau, Daniel Vetter

On Fri, Nov 27, 2020 at 05:35:28PM +0100, Daniel Vetter wrote:
> 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@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@gmail.com>
> Date:   Thu Jun 27 13:48:18 2013 +0200
> 
>     drm/nouveau: make flipping lockdep safe
> 
> Acked-by: Ben Skeggs <bskeggs@redhat.com>
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <m.b.lankhorst@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Dave Airlie <airlied@gmail.com>
> Cc: nouveau@lists.freedesktop.org

I stuffed this one into drm-misc-next now.
-Daniel

> ---
>  drivers/gpu/drm/nouveau/nouveau_bo.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 1386b0fc1640..43069dd8b027 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -774,7 +774,10 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict,
>  			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, ctx->interruptible);
>  	if (ret == 0) {
>  		ret = drm->ttm.move(chan, bo, &bo->mem, new_reg);
> -- 
> 2.29.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-01 17:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 16:35 [PATCH RESEND] drm/nouveau: Drop mutex_lock_nested for atomic Daniel Vetter
2020-12-01 17:27 ` Daniel Vetter

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).