diff options
| author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-11-17 07:28:28 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2010-11-21 22:25:17 -0500 |
| commit | 96726fe50feae74812a2ccf5d5da23cb01c0a413 (patch) | |
| tree | 1c5cb041b88e33ae5d10cb9292852cc5ee5fb24b /include/drm | |
| parent | 68c4fa31aa52765314b4285a7835368ea35b509c (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 'include/drm')
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 95068e6024db..1e25a40c688e 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -859,6 +859,9 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); | |||
| 859 | * try again. (only if use_sequence == 1). | 859 | * try again. (only if use_sequence == 1). |
| 860 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | 860 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by |
| 861 | * a signal. Release all buffer reservations and return to user-space. | 861 | * a signal. Release all buffer reservations and return to user-space. |
| 862 | * -EBUSY: The function needed to sleep, but @no_wait was true | ||
| 863 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | ||
| 864 | * be returned if @use_sequence is set to true. | ||
| 862 | */ | 865 | */ |
| 863 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | 866 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, |
| 864 | bool interruptible, | 867 | bool interruptible, |
| @@ -868,11 +871,27 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
| 868 | /** | 871 | /** |
| 869 | * ttm_bo_reserve_locked: | 872 | * ttm_bo_reserve_locked: |
| 870 | * | 873 | * |
| 871 | * Similar to ttm_bo_reserve, but must be called with the glob::lru_lock | 874 | * @bo: A pointer to a struct ttm_buffer_object. |
| 872 | * spinlock held, and will not remove reserved buffers from the lru lists. | 875 | * @interruptible: Sleep interruptible if waiting. |
| 876 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. | ||
| 877 | * @use_sequence: If @bo is already reserved, Only sleep waiting for | ||
| 878 | * it to become unreserved if @sequence < (@bo)->sequence. | ||
| 879 | * | ||
| 880 | * Must be called with struct ttm_bo_global::lru_lock held, | ||
| 881 | * and will not remove reserved buffers from the lru lists. | ||
| 873 | * The function may release the LRU spinlock if it needs to sleep. | 882 | * The function may release the LRU spinlock if it needs to sleep. |
| 883 | * Otherwise identical to ttm_bo_reserve. | ||
| 884 | * | ||
| 885 | * Returns: | ||
| 886 | * -EAGAIN: The reservation may cause a deadlock. | ||
| 887 | * Release all buffer reservations, wait for @bo to become unreserved and | ||
| 888 | * try again. (only if use_sequence == 1). | ||
| 889 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | ||
| 890 | * a signal. Release all buffer reservations and return to user-space. | ||
| 891 | * -EBUSY: The function needed to sleep, but @no_wait was true | ||
| 892 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | ||
| 893 | * be returned if @use_sequence is set to true. | ||
| 874 | */ | 894 | */ |
| 875 | |||
| 876 | extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | 895 | extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, |
| 877 | bool interruptible, | 896 | bool interruptible, |
| 878 | bool no_wait, bool use_sequence, | 897 | bool no_wait, bool use_sequence, |
