aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_bo.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2010-11-17 07:28:28 -0500
committerDave Airlie <airlied@redhat.com>2010-11-21 22:25:17 -0500
commit96726fe50feae74812a2ccf5d5da23cb01c0a413 (patch)
tree1c5cb041b88e33ae5d10cb9292852cc5ee5fb24b /drivers/gpu/drm/ttm/ttm_bo.c
parent68c4fa31aa52765314b4285a7835368ea35b509c (diff)
drm/ttm: Don't deadlock on recursive multi-bo reservations
Add an aid for the driver to detect deadlocks on multi-bo reservations Update documentation. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jerome Glisse <j.glisse@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 9ef893d5da88..5d8750830dc3 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -223,9 +223,18 @@ int ttm_bo_reserve_locked(struct ttm_buffer_object *bo,
223 /** 223 /**
224 * Deadlock avoidance for multi-bo reserving. 224 * Deadlock avoidance for multi-bo reserving.
225 */ 225 */
226 if (use_sequence && bo->seq_valid && 226 if (use_sequence && bo->seq_valid) {
227 (sequence - bo->val_seq < (1 << 31))) { 227 /**
228 return -EAGAIN; 228 * We've already reserved this one.
229 */
230 if (unlikely(sequence == bo->val_seq))
231 return -EDEADLK;
232 /**
233 * Already reserved by a thread that will not back
234 * off for us. We need to back off.
235 */
236 if (unlikely(sequence - bo->val_seq < (1 << 31)))
237 return -EAGAIN;
229 } 238 }
230 239
231 if (no_wait) 240 if (no_wait)