Skip to content

Commit d3f5524

Browse files
Erik Kurzingeremersion
authored andcommitted
drm/syncobj: call might_sleep before waiting for fence submission
If either the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT or DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE flags are passed to drm_syncobj_array_wait_timeout, the function might sleep if the fence at one of the given timeline points has not yet been submitted. Therefore, we should call might_sleep in that case to catch potential bugs. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Simon Ser <contact@emersion.fr> Link: https://patchwork.freedesktop.org/patch/msgid/20240119163208.3723457-3-ekurzinger@nvidia.com
1 parent 18226ba commit d3f5524

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/drm_syncobj.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,10 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
10441044
uint32_t signaled_count, i;
10451045

10461046
if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT |
1047-
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE))
1047+
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) {
1048+
might_sleep();
10481049
lockdep_assert_none_held_once();
1050+
}
10491051

10501052
points = kmalloc_array(count, sizeof(*points), GFP_KERNEL);
10511053
if (points == NULL)

0 commit comments

Comments
 (0)