drm/msm/kms: Use nested locking for crtc lock instead of custom classes
PATCH 1/1 drm/msm/kms: Use nested locking for crtc lock instead of custom classes
We don't need to make up custom lock classes here, we can simply use mutex_lock_nested() and pass in the index of the crtc to the locking APIs instead. This helps lockdep understand that these are really different locks while avoiding having to allocate custom lockdep classes.
--- drivers/gpu/drm/msm/msm_atomic.c | 7 +++++-- drivers/gpu/drm/msm/msm_kms.h | 8 ++------ 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/msm_atomic.c +5 -2
@@ -57,10 +57,13 @@ static void vblank_put(struct msm_kms *kms, unsigned crtc_mask)static void lock_crtcs (struct msm_kms *kms,unsigned int crtc_mask) { +int crtc_index;struct drm_crtc *crtc; -for_each_crtc_mask (kms->dev, crtc, crtc_mask) -mutex_lock (&kms->commit_lock[drm_crtc_index (crtc)]); +for_each_crtc_mask (kms->dev, crtc, crtc_mask) { + crtc_index =drm_crtc_index (crtc); +mutex_lock_nested (&kms->commit_lock[crtc_index], crtc_index); + } }static void unlock_crtcs (struct msm_kms *kms,unsigned int crtc_mask)
drivers/gpu/drm/msm/msm_kms.h +2 -6
@@ -157,7 +157,6 @@ struct msm_kms {* from the crtc's pending_timer close to end of the frame: */ struct mutex commit_lock[MAX_CRTCS ]; -struct lock_class_key commit_lock_keys[MAX_CRTCS ];unsigned pending_crtc_mask;struct msm_pending_timer pending_timers[MAX_CRTCS ]; };
@@ -167,11 +166,8 @@ static inline int msm_kms_init(struct msm_kms *kms, {unsigned i, ret; -for (i =0 ; i <ARRAY_SIZE (kms->commit_lock); i++) { -lockdep_register_key (&kms->commit_lock_keys[i]); -__mutex_init (&kms->commit_lock[i],"&kms->commit_lock[i]" , - &kms->commit_lock_keys[i]); - } +for (i =0 ; i <ARRAY_SIZE (kms->commit_lock); i++) +mutex_init (&kms->commit_lock[i]); kms->funcs = funcs;
base-commit: 182b4a2d251305201b6f9cae29067f7112f05835
Signature · 6 lines
https://chromeos.dev _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
This patch was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
Quoted 6 lines · On Thu, 11 Feb 2021 14:40:58 -0800 you wrote:
We don't need to make up custom lock classes here, we can simply use
mutex_lock_nested()and pass in the index of the crtc to the locking APIs instead. This helps lockdep understand that these are really different locks while avoiding having to allocate custom lockdep classes.
Quoted 6 lines
Cc Krishna Manikandan <[email protected]>Suggested-by Daniel Vetter <[email protected]>Fixes b3d91800d9ac ("drm/msm: Fix race condition in msm driver with async layer updates")Signed-off-by Stephen Boyd <[email protected]>[...]
Here is the summary with links:
- drm/msm/kms: Use nested locking for crtc lock instead of custom classes
https://git.kernel.org/qcom/c/743c97ca9dc9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html