Skip to content

Commit 9184b68

Browse files
committed
drm/msm: Do rpm get sooner in the submit path
Unfortunately, due to an dev_pm_opp locking interaction with mm->mmap_sem, we need to do pm get before aquiring obj locks, otherwise we can have anger lockdep with the chain: opp_table_lock --> &mm->mmap_sem --> reservation_ww_class_mutex For an explicit fencing userspace, the impact should be minimal as we do all the fence waits before this point. It could result in some needless resumes in error cases, etc. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent 20224d7 commit 9184b68

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/gpu/drm/msm/msm_gem_submit.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,20 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
750750

751751
ret = submit_lookup_objects(submit, args, file);
752752
if (ret)
753-
goto out;
753+
goto out_pre_pm;
754754

755755
ret = submit_lookup_cmds(submit, args, file);
756756
if (ret)
757-
goto out;
757+
goto out_pre_pm;
758+
759+
/*
760+
* Thanks to dev_pm_opp opp_table_lock interactions with mm->mmap_sem
761+
* in the resume path, we need to to rpm get before we lock objs.
762+
* Which unfortunately might involve powering up the GPU sooner than
763+
* is necessary. But at least in the explicit fencing case, we will
764+
* have already done all the fence waiting.
765+
*/
766+
pm_runtime_get_sync(&gpu->pdev->dev);
758767

759768
/* copy_*_user while holding a ww ticket upsets lockdep */
760769
ww_acquire_init(&submit->ticket, &reservation_ww_class);
@@ -831,6 +840,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
831840

832841

833842
out:
843+
pm_runtime_put(&gpu->pdev->dev);
844+
out_pre_pm:
834845
submit_cleanup(submit);
835846
if (has_ww_ticket)
836847
ww_acquire_fini(&submit->ticket);

0 commit comments

Comments
 (0)