Skip to contentSkip to conversation

drm/nouveau: Drop mutex_lock_nested for atomic

PATCH RESEND In review Daniel Vetter 2 participants 2 messages Nov 27, 2020 – Dec 1, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 drm/nouveau: Drop mutex_lock_nested for atomic

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 <[email protected]>
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 <[email protected]>
Date:   Thu Jun 27 13:48:18 2013 +0200

drm/nouveau: make flipping lockdep safe

---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +4 -1
index 1386b0fc1640..43069dd8b027 100644
@@ -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);
Signature · 1 line
2.29.2
#1 lore raw
Quoted 21 lines · 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 <[email protected]>
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 <[email protected]>
Date:   Thu Jun 27 13:48:18 2013 +0200

drm/nouveau: make flipping lockdep safe

Quoted 7 lines

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

Quoted 23 lines
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +4 -1
index 1386b0fc1640..43069dd8b027 100644
@@ -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);
Signature · 1 line
2.29.2
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch