svn commit: r254862 - head/sys/dev/drm2/ttm
Jean-Sebastien Pedron
dumbbell at FreeBSD.org
Sun Aug 25 14:41:23 UTC 2013
Author: dumbbell
Date: Sun Aug 25 14:41:22 2013
New Revision: 254862
URL: http://svnweb.freebsd.org/changeset/base/254862
Log:
drm/ttm: Import Linux commit 7a1863084c9d90ce4b67d645bf9b0f1612e68f62
Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date: Tue Jan 15 14:56:48 2013 +0100
drm/ttm: cleanup ttm_eu_reserve_buffers handling
With the lru lock no longer required for protecting reservations we
can just do a ttm_bo_reserve_nolru on -EBUSY, and handle all errors
in a single path.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Reviewed-by: Jerome Glisse <jglisse at redhat.com>
Modified:
head/sys/dev/drm2/ttm/ttm_bo.c
head/sys/dev/drm2/ttm/ttm_execbuf_util.c
Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo.c Sun Aug 25 14:39:51 2013 (r254861)
+++ head/sys/dev/drm2/ttm/ttm_bo.c Sun Aug 25 14:41:22 2013 (r254862)
@@ -659,10 +659,8 @@ static int ttm_bo_delayed_delete(struct
ret = ttm_bo_reserve_nolru(entry, false, true, false, 0);
if (remove_all && ret) {
- mtx_unlock(&glob->lru_lock);
ret = ttm_bo_reserve_nolru(entry, false, false,
false, 0);
- mtx_lock(&glob->lru_lock);
}
if (!ret)
Modified: head/sys/dev/drm2/ttm/ttm_execbuf_util.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_execbuf_util.c Sun Aug 25 14:39:51 2013 (r254861)
+++ head/sys/dev/drm2/ttm/ttm_execbuf_util.c Sun Aug 25 14:41:22 2013 (r254862)
@@ -83,19 +83,6 @@ static void ttm_eu_list_ref_sub(struct l
}
}
-static int ttm_eu_wait_unreserved_locked(struct list_head *list,
- struct ttm_buffer_object *bo)
-{
- int ret;
-
- ttm_eu_del_from_lru_locked(list);
- ret = ttm_bo_wait_unreserved_locked(bo, true);
- if (unlikely(ret != 0))
- ttm_eu_backoff_reservation_locked(list);
- return ret;
-}
-
-
void ttm_eu_backoff_reservation(struct list_head *list)
{
struct ttm_validate_buffer *entry;
@@ -149,19 +136,21 @@ retry_locked:
list_for_each_entry(entry, list, head) {
struct ttm_buffer_object *bo = entry->bo;
-retry_this_bo:
ret = ttm_bo_reserve_nolru(bo, true, true, true, val_seq);
switch (ret) {
case 0:
break;
case -EBUSY:
- ret = ttm_eu_wait_unreserved_locked(list, bo);
- if (unlikely(ret != 0)) {
- mtx_unlock(&glob->lru_lock);
- ttm_eu_list_ref_sub(list);
- return ret;
- }
- goto retry_this_bo;
+ ttm_eu_del_from_lru_locked(list);
+ ret = ttm_bo_reserve_nolru(bo, true, false,
+ true, val_seq);
+ if (!ret)
+ break;
+
+ if (unlikely(ret != -EAGAIN))
+ goto err;
+
+ /* fallthrough */
case -EAGAIN:
ttm_eu_backoff_reservation_locked(list);
ttm_eu_list_ref_sub(list);
@@ -172,18 +161,13 @@ retry_this_bo:
}
goto retry_locked;
default:
- ttm_eu_backoff_reservation_locked(list);
- mtx_unlock(&glob->lru_lock);
- ttm_eu_list_ref_sub(list);
- return ret;
+ goto err;
}
entry->reserved = true;
if (unlikely(atomic_read(&bo->cpu_writers) > 0)) {
- ttm_eu_backoff_reservation_locked(list);
- mtx_unlock(&glob->lru_lock);
- ttm_eu_list_ref_sub(list);
- return -EBUSY;
+ ret = -EBUSY;
+ goto err;
}
}
@@ -192,6 +176,12 @@ retry_this_bo:
ttm_eu_list_ref_sub(list);
return 0;
+
+err:
+ ttm_eu_backoff_reservation_locked(list);
+ mtx_unlock(&glob->lru_lock);
+ ttm_eu_list_ref_sub(list);
+ return ret;
}
void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj)
More information about the svn-src-all
mailing list