Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ttm: fix ttm_bo_wait

reservation_object_wait_timeout_rcu() should enable signaling even with a
zero timeout, but ttm_bo_wait() can also be called from atomic context and
then it is not a good idea to do this.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
[sumits: fix checkpatch warnings]
Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-3-git-send-email-alexander.deucher@amd.com

authored by

Christian König and committed by
Sumit Semwal
98a6dd90 698c0f7f

+8 -1
+8 -1
drivers/gpu/drm/ttm/ttm_bo.c
··· 1611 1611 int ttm_bo_wait(struct ttm_buffer_object *bo, 1612 1612 bool interruptible, bool no_wait) 1613 1613 { 1614 - long timeout = no_wait ? 0 : 15 * HZ; 1614 + long timeout = 15 * HZ; 1615 + 1616 + if (no_wait) { 1617 + if (reservation_object_test_signaled_rcu(bo->resv, true)) 1618 + return 0; 1619 + else 1620 + return -EBUSY; 1621 + } 1615 1622 1616 1623 timeout = reservation_object_wait_timeout_rcu(bo->resv, true, 1617 1624 interruptible, timeout);