In the userq fence gather and emit IOCTL path we acquire BO locks (via drm_exec/dma_resv_lock)before calling drm_syncobj_find_fence(). This causes drm_syncobj_find_fence() to complain because it is entered with locks held while the WAIT_FOR_SUBMIT flag is set in the calling context.
However, the userq userspace path does not rely on DRM_IOCTL_SYNCOBJ_WAIT to wait on fences that are dependencies of userq submissions. All waiting is handled separately, so the WAIT_FOR_SUBMIT flag is effectively unused for this IOCTL. Therefore, we simply clear the WAIT_FOR_SUBMIT flag for this path. This avoids the lockdep / drm_syncobj_find_fence() warning about being called under a locked context, and has no functional impact on userq behavior since DRM_IOCTL_SYNCOBJ_WAIT is not part of the userq synchronization model. Signed-off-by: Prike Liang <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c index 76f32fd768fb..7a309b0130d8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c @@ -708,7 +708,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data, for (i = 0; i < num_points; i++) { r = drm_syncobj_find_fence(filp, timeline_handles[i], timeline_points[i], - DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, + 0, &fence); if (r) goto exec_fini; @@ -726,7 +726,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data, r = drm_syncobj_find_fence(filp, syncobj_handles[i], 0, - DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, + 0, &fence); if (r) goto exec_fini; @@ -818,7 +818,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data, for (i = 0; i < num_points; i++) { r = drm_syncobj_find_fence(filp, timeline_handles[i], timeline_points[i], - DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, + 0, &fence); if (r) goto free_fences; @@ -844,7 +844,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data, r = drm_syncobj_find_fence(filp, syncobj_handles[i], 0, - DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, + 0, &fence); if (r) goto free_fences; -- 2.34.1
