diff options
author | Christian König <christian.koenig@amd.com> | 2016-11-07 16:16:15 -0500 |
---|---|---|
committer | Sumit Semwal <sumit.semwal@linaro.org> | 2016-11-08 14:16:04 -0500 |
commit | 98a6dd909bbd247ce10f36ce709906bc5e9dfeb0 (patch) | |
tree | 16908d221377dbf44d4c73569ab5111406c31530 | |
parent | 698c0f7ff21674ec08a4c6e99dd6da62fe5a344d (diff) |
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
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index f6ff579e8918..d5063618efa7 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -1611,7 +1611,14 @@ EXPORT_SYMBOL(ttm_bo_unmap_virtual); | |||
1611 | int ttm_bo_wait(struct ttm_buffer_object *bo, | 1611 | int ttm_bo_wait(struct ttm_buffer_object *bo, |
1612 | bool interruptible, bool no_wait) | 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 | timeout = reservation_object_wait_timeout_rcu(bo->resv, true, | 1623 | timeout = reservation_object_wait_timeout_rcu(bo->resv, true, |
1617 | interruptible, timeout); | 1624 | interruptible, timeout); |