diff options
author | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2013-01-15 08:56:37 -0500 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2013-01-15 08:56:37 -0500 |
commit | 63d0a4195560362e2e00a3ad38fc331d34e1da9b (patch) | |
tree | 64df3550af24b6f583c17aac878a9f1fb6fa85eb /include/drm/ttm | |
parent | 979ee290ff0a543352243145dc3654af5a856ab8 (diff) |
drm/ttm: remove lru_lock around ttm_bo_reserve
There should no longer be assumptions that reserve will always succeed
with the lru lock held, so we can safely break the whole atomic
reserve/lru thing. As a bonus this fixes most lockdep annotations for
reservations.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'include/drm/ttm')
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index e3a43a47d78c..6fff43222e20 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -790,16 +790,7 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); | |||
790 | * to make room for a buffer already reserved. (Buffers are reserved before | 790 | * to make room for a buffer already reserved. (Buffers are reserved before |
791 | * they are evicted). The following algorithm prevents such deadlocks from | 791 | * they are evicted). The following algorithm prevents such deadlocks from |
792 | * occurring: | 792 | * occurring: |
793 | * 1) Buffers are reserved with the lru spinlock held. Upon successful | 793 | * Processes attempting to reserve multiple buffers other than for eviction, |
794 | * reservation they are removed from the lru list. This stops a reserved buffer | ||
795 | * from being evicted. However the lru spinlock is released between the time | ||
796 | * a buffer is selected for eviction and the time it is reserved. | ||
797 | * Therefore a check is made when a buffer is reserved for eviction, that it | ||
798 | * is still the first buffer in the lru list, before it is removed from the | ||
799 | * list. @check_lru == 1 forces this check. If it fails, the function returns | ||
800 | * -EINVAL, and the caller should then choose a new buffer to evict and repeat | ||
801 | * the procedure. | ||
802 | * 2) Processes attempting to reserve multiple buffers other than for eviction, | ||
803 | * (typically execbuf), should first obtain a unique 32-bit | 794 | * (typically execbuf), should first obtain a unique 32-bit |
804 | * validation sequence number, | 795 | * validation sequence number, |
805 | * and call this function with @use_sequence == 1 and @sequence == the unique | 796 | * and call this function with @use_sequence == 1 and @sequence == the unique |
@@ -832,7 +823,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
832 | 823 | ||
833 | 824 | ||
834 | /** | 825 | /** |
835 | * ttm_bo_reserve_locked: | 826 | * ttm_bo_reserve_nolru: |
836 | * | 827 | * |
837 | * @bo: A pointer to a struct ttm_buffer_object. | 828 | * @bo: A pointer to a struct ttm_buffer_object. |
838 | * @interruptible: Sleep interruptible if waiting. | 829 | * @interruptible: Sleep interruptible if waiting. |
@@ -840,9 +831,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
840 | * @use_sequence: If @bo is already reserved, Only sleep waiting for | 831 | * @use_sequence: If @bo is already reserved, Only sleep waiting for |
841 | * it to become unreserved if @sequence < (@bo)->sequence. | 832 | * it to become unreserved if @sequence < (@bo)->sequence. |
842 | * | 833 | * |
843 | * Must be called with struct ttm_bo_global::lru_lock held, | 834 | * Will not remove reserved buffers from the lru lists. |
844 | * and will not remove reserved buffers from the lru lists. | ||
845 | * The function may release the LRU spinlock if it needs to sleep. | ||
846 | * Otherwise identical to ttm_bo_reserve. | 835 | * Otherwise identical to ttm_bo_reserve. |
847 | * | 836 | * |
848 | * Returns: | 837 | * Returns: |
@@ -855,7 +844,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
855 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | 844 | * -EDEADLK: Bo already reserved using @sequence. This error code will only |
856 | * be returned if @use_sequence is set to true. | 845 | * be returned if @use_sequence is set to true. |
857 | */ | 846 | */ |
858 | extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | 847 | extern int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo, |
859 | bool interruptible, | 848 | bool interruptible, |
860 | bool no_wait, bool use_sequence, | 849 | bool no_wait, bool use_sequence, |
861 | uint32_t sequence); | 850 | uint32_t sequence); |