Skip to content

Commit

Permalink
drm/msm: Do rpm get sooner in the submit path
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
robclark committed Nov 5, 2020
1 parent 20224d7 commit 9184b68
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/gpu/drm/msm/msm_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,20 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,

ret = submit_lookup_objects(submit, args, file);
if (ret)
goto out;
goto out_pre_pm;

ret = submit_lookup_cmds(submit, args, file);
if (ret)
goto out;
goto out_pre_pm;

/*
* Thanks to dev_pm_opp opp_table_lock interactions with mm->mmap_sem
* in the resume path, we need to to rpm get before we lock objs.
* Which unfortunately might involve powering up the GPU sooner than
* is necessary. But at least in the explicit fencing case, we will
* have already done all the fence waiting.
*/
pm_runtime_get_sync(&gpu->pdev->dev);

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


out:
pm_runtime_put(&gpu->pdev->dev);
out_pre_pm:
submit_cleanup(submit);
if (has_ww_ticket)
ww_acquire_fini(&submit->ticket);
Expand Down

0 comments on commit 9184b68

Please sign in to comment.