Skip to contentSkip to conversation

drm/mst: drop cancel work sync in the mstb destroy path

PATCH In review Dave Airlie 2 participants 3 messages Sep 30, 2015

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/mst: drop cancel work sync in the mstb destroy path

From: Dave Airlie <[email protected]>

Since 9eb1e57f564d4e6e10991402726cc83fe0b9172f drm/dp/mst: make sure mst_primary mstb is valid in work function

we validate the mstb structs in the work function, and doing that takes a reference. So we should never get here with the work function running using the mstb device, only if the work function hasn't run yet or is running for another mstb.

So we don't need to sync the work here, this was causing lockdep spew when the device failed during the initial EDID read.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
index e23df5f..16f911c 100644
@@ -804,8 +804,6 @@ static void drm_dp_destroy_mst_branch_device(struct kref *kref)
 	struct drm_dp_mst_port *port, *tmp;
 	bool wake_tx = false;
 
-	cancel_work_sync(&mstb->mgr->work);
-
 	/*
 	 * destroy all ports - don't need lock
 	 * as there are no more references to the mst branch
Signature · 6 lines
2.4.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 5 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Since 9eb1e57f564d4e6e10991402726cc83fe0b9172f drm/dp/mst: make sure mst_primary mstb is valid in work function

Quoted 8 lines

we validate the mstb structs in the work function, and doing that takes a reference. So we should never get here with the work function running using the mstb device, only if the work function hasn't run yet or is running for another mstb.

So we don't need to sync the work here, this was causing lockdep spew when the device failed during the initial EDID read.

can you pls paste the lockdep spew here? I think I see the locking recursion but would like to be sure.

Quoted 10 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index e23df5f..16f911c 100644

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_destroy_mst_branch_device(struct kref *kref) · line 808

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -804,8 +804,6 @@ static void drm_dp_destroy_mst_branch_device(struct kref *kref)
 	struct drm_dp_mst_port *port, *tmp;
 	bool wake_tx = false;
 
-	cancel_work_sync(&mstb->mgr->work);
-

Without this there's no place any more where we stop this worker on teardown. Generally we need to sync with outstanding work at least in system suspend and on driver unload. I think we need a flush_work (outside of the locked region ofc!) in drm_dp_mst_topology_mgr_suspend and drm_dp_mst_topology_mgr_destroy. Might be better as a follow-up patch, but should imo be part of this.

With lockdep splat + 2x flush_work this is Reviewed-by: Daniel Vetter <[email protected]> -Daniel

Quoted 10 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 	/*
 	 * destroy all ports - don't need lock
 	 * as there are no more references to the mst branch
Signature · 6 lines
2.4.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 41 lines · Daniel Vetter
Quoted 5 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Since 9eb1e57f564d4e6e10991402726cc83fe0b9172f drm/dp/mst: make sure mst_primary mstb is valid in work function

Quoted 8 lines

we validate the mstb structs in the work function, and doing that takes a reference. So we should never get here with the work function running using the mstb device, only if the work function hasn't run yet or is running for another mstb.

So we don't need to sync the work here, this was causing lockdep spew when the device failed during the initial EDID read.

can you pls paste the lockdep spew here? I think I see the locking recursion but would like to be sure.

Quoted 10 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index e23df5f..16f911c 100644

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_destroy_mst_branch_device(struct kref *kref) · line 808

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -2
@@ -804,8 +804,6 @@ static void drm_dp_destroy_mst_branch_device(struct kref *kref)
 	struct drm_dp_mst_port *port, *tmp;
 	bool wake_tx = false;
 
-	cancel_work_sync(&mstb->mgr->work);
-

Without this there's no place any more where we stop this worker on teardown. Generally we need to sync with outstanding work at least in system suspend and on driver unload. I think we need a flush_work (outside of the locked region ofc!) in drm_dp_mst_topology_mgr_suspend and drm_dp_mst_topology_mgr_destroy. Might be better as a follow-up patch, but should imo be part of this.

Quoted 1 line

With lockdep splat + 2x flush_work this is Reviewed-by: Daniel Vetter <[email protected]>

*1x flush_work - the one in drm_dp_mst_topology_mgr_destroy is already there, I must have been blind ...
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel