Message ID | 1642868787-61384-1-git-send-email-lyz_cs@pku.edu.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/v3d: Add missing unlock | expand |
On 01/22, Yongzhi Liu wrote: > [why] > Unlock is needed on the error handling path to prevent dead lock. > > [how] > Fix this by adding drm_gem_unlock_reservations on the error handling path. > > Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn> > --- > drivers/gpu/drm/v3d/v3d_gem.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c > index c7ed2e1..0c989dc 100644 > --- a/drivers/gpu/drm/v3d/v3d_gem.c > +++ b/drivers/gpu/drm/v3d/v3d_gem.c > @@ -798,6 +798,8 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, > > if (!render->base.perfmon) { > ret = -ENOENT; > + drm_gem_unlock_reservations(last_job->bo, > + last_job->bo_count, &acquire_ctx); > goto fail; Hi, Nice catch! As unlock is handle in fail_unreserve, I would suggest you to keep the failures handling around there. In that case, the goto will target a place between `fail_unreserve:` and `fail:`, i.e. calls drm_gem_unlock_reservations (and the following cleanings) but don't call mutex_unlock. Thanks, Melissa > } > } > @@ -1027,6 +1029,8 @@ v3d_submit_csd_ioctl(struct drm_device *dev, void *data, > args->perfmon_id); > if (!job->base.perfmon) { > ret = -ENOENT; > + drm_gem_unlock_reservations(clean_job->bo, clean_job->bo_count, > + &acquire_ctx); > goto fail; > } > } > -- > 2.7.4 >
diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c index c7ed2e1..0c989dc 100644 --- a/drivers/gpu/drm/v3d/v3d_gem.c +++ b/drivers/gpu/drm/v3d/v3d_gem.c @@ -798,6 +798,8 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, if (!render->base.perfmon) { ret = -ENOENT; + drm_gem_unlock_reservations(last_job->bo, + last_job->bo_count, &acquire_ctx); goto fail; } } @@ -1027,6 +1029,8 @@ v3d_submit_csd_ioctl(struct drm_device *dev, void *data, args->perfmon_id); if (!job->base.perfmon) { ret = -ENOENT; + drm_gem_unlock_reservations(clean_job->bo, clean_job->bo_count, + &acquire_ctx); goto fail; } }
[why] Unlock is needed on the error handling path to prevent dead lock. [how] Fix this by adding drm_gem_unlock_reservations on the error handling path. Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn> --- drivers/gpu/drm/v3d/v3d_gem.c | 4 ++++ 1 file changed, 4 insertions(+)