* drm/ttm: Remove cpu_writers related code
@ 2012-08-20 13:32 Maarten Lankhorst
2012-08-20 15:16 ` Jerome Glisse
0 siblings, 1 reply; 2+ messages in thread
From: Maarten Lankhorst @ 2012-08-20 13:32 UTC (permalink / raw)
To: dri-devel
Nobody uses it, so might as well simplify the code some.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 36f4b28..ddfe393 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -141,7 +141,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
BUG_ON(atomic_read(&bo->list_kref.refcount));
BUG_ON(atomic_read(&bo->kref.refcount));
- BUG_ON(atomic_read(&bo->cpu_writers));
BUG_ON(bo->sync_obj != NULL);
BUG_ON(bo->mem.mm_node != NULL);
BUG_ON(!list_empty(&bo->lru));
@@ -1050,16 +1049,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
}
EXPORT_SYMBOL(ttm_bo_mem_space);
-int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait)
-{
- if ((atomic_read(&bo->cpu_writers) > 0) && no_wait)
- return -EBUSY;
-
- return wait_event_interruptible(bo->event_queue,
- atomic_read(&bo->cpu_writers) == 0);
-}
-EXPORT_SYMBOL(ttm_bo_wait_cpu);
-
int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
struct ttm_placement *placement,
bool interruptible, bool no_wait_reserve,
@@ -1211,7 +1200,6 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
kref_init(&bo->kref);
kref_init(&bo->list_kref);
- atomic_set(&bo->cpu_writers, 0);
atomic_set(&bo->reserved, 1);
init_waitqueue_head(&bo->event_queue);
INIT_LIST_HEAD(&bo->lru);
@@ -1769,35 +1757,6 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
}
EXPORT_SYMBOL(ttm_bo_wait);
-int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait)
-{
- struct ttm_bo_device *bdev = bo->bdev;
- int ret = 0;
-
- /*
- * Using ttm_bo_reserve makes sure the lru lists are updated.
- */
-
- ret = ttm_bo_reserve(bo, true, no_wait, false, 0);
- if (unlikely(ret != 0))
- return ret;
- spin_lock(&bdev->fence_lock);
- ret = ttm_bo_wait(bo, false, true, no_wait);
- spin_unlock(&bdev->fence_lock);
- if (likely(ret == 0))
- atomic_inc(&bo->cpu_writers);
- ttm_bo_unreserve(bo);
- return ret;
-}
-EXPORT_SYMBOL(ttm_bo_synccpu_write_grab);
-
-void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo)
-{
- if (atomic_dec_and_test(&bo->cpu_writers))
- wake_up_all(&bo->event_queue);
-}
-EXPORT_SYMBOL(ttm_bo_synccpu_write_release);
-
/**
* A buffer object shrink method that tries to swap out the first
* buffer object on the bo_global::swap_lru list.
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index f8187ea..626a3f6 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -439,7 +439,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
INIT_LIST_HEAD(&fbo->swap);
INIT_LIST_HEAD(&fbo->io_reserve_lru);
fbo->vm_node = NULL;
- atomic_set(&fbo->cpu_writers, 0);
fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj);
kref_init(&fbo->list_kref);
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
index 3832fe1..3f48a46 100644
--- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c
+++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
@@ -181,15 +181,6 @@ retry_this_bo:
}
entry->reserved = true;
- if (unlikely(atomic_read(&bo->cpu_writers) > 0)) {
- ttm_eu_backoff_reservation_locked(list);
- spin_unlock(&glob->lru_lock);
- ttm_eu_list_ref_sub(list);
- ret = ttm_bo_wait_cpu(bo, false);
- if (ret)
- return ret;
- goto retry;
- }
}
ttm_eu_del_from_lru_locked(list);
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index e15f2a8..0853162 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -225,12 +225,6 @@ struct ttm_buffer_object {
bool evicted;
/**
- * Members protected by the bo::reserved lock only when written to.
- */
-
- atomic_t cpu_writers;
-
- /**
* Members protected by the bdev::lru_lock.
*/
@@ -423,31 +417,6 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
int resched);
/**
- * ttm_bo_synccpu_write_grab
- *
- * @bo: The buffer object:
- * @no_wait: Return immediately if buffer is busy.
- *
- * Synchronizes a buffer object for CPU RW access. This means
- * blocking command submission that affects the buffer and
- * waiting for buffer idle. This lock is recursive.
- * Returns
- * -EBUSY if the buffer is busy and no_wait is true.
- * -ERESTARTSYS if interrupted by a signal.
- */
-extern int
-ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
-
-/**
- * ttm_bo_synccpu_write_release:
- *
- * @bo : The buffer object.
- *
- * Releases a synccpu lock.
- */
-extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
-
-/**
* ttm_bo_acc_size
*
* @bdev: Pointer to a ttm_bo_device struct.
@@ -513,7 +482,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
void (*destroy) (struct ttm_buffer_object *));
/**
- * ttm_bo_synccpu_object_init
+ * ttm_bo_create
*
* @bdev: Pointer to a ttm_bo_device struct.
* @bo: Pointer to a ttm_buffer_object to be initialized.
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index a05f1b5..75d5da7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -732,20 +732,6 @@ extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
struct ttm_mem_reg *mem);
-/**
- * ttm_bo_wait_for_cpu
- *
- * @bo: Pointer to a struct ttm_buffer_object.
- * @no_wait: Don't sleep while waiting.
- *
- * Wait until a buffer object is no longer sync'ed for CPU access.
- * Returns:
- * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
- * -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
- */
-
-extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
-
extern void ttm_bo_global_release(struct drm_global_reference *ref);
extern int ttm_bo_global_init(struct drm_global_reference *ref);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: drm/ttm: Remove cpu_writers related code
2012-08-20 13:32 drm/ttm: Remove cpu_writers related code Maarten Lankhorst
@ 2012-08-20 15:16 ` Jerome Glisse
0 siblings, 0 replies; 2+ messages in thread
From: Jerome Glisse @ 2012-08-20 15:16 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: dri-devel
On Mon, Aug 20, 2012 at 9:32 AM, Maarten Lankhorst
<maarten.lankhorst@canonical.com> wrote:
> Nobody uses it, so might as well simplify the code some.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
> ---
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 36f4b28..ddfe393 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -141,7 +141,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
>
> BUG_ON(atomic_read(&bo->list_kref.refcount));
> BUG_ON(atomic_read(&bo->kref.refcount));
> - BUG_ON(atomic_read(&bo->cpu_writers));
> BUG_ON(bo->sync_obj != NULL);
> BUG_ON(bo->mem.mm_node != NULL);
> BUG_ON(!list_empty(&bo->lru));
> @@ -1050,16 +1049,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
> }
> EXPORT_SYMBOL(ttm_bo_mem_space);
>
> -int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait)
> -{
> - if ((atomic_read(&bo->cpu_writers) > 0) && no_wait)
> - return -EBUSY;
> -
> - return wait_event_interruptible(bo->event_queue,
> - atomic_read(&bo->cpu_writers) == 0);
> -}
> -EXPORT_SYMBOL(ttm_bo_wait_cpu);
> -
> int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
> struct ttm_placement *placement,
> bool interruptible, bool no_wait_reserve,
> @@ -1211,7 +1200,6 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
>
> kref_init(&bo->kref);
> kref_init(&bo->list_kref);
> - atomic_set(&bo->cpu_writers, 0);
> atomic_set(&bo->reserved, 1);
> init_waitqueue_head(&bo->event_queue);
> INIT_LIST_HEAD(&bo->lru);
> @@ -1769,35 +1757,6 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
> }
> EXPORT_SYMBOL(ttm_bo_wait);
>
> -int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait)
> -{
> - struct ttm_bo_device *bdev = bo->bdev;
> - int ret = 0;
> -
> - /*
> - * Using ttm_bo_reserve makes sure the lru lists are updated.
> - */
> -
> - ret = ttm_bo_reserve(bo, true, no_wait, false, 0);
> - if (unlikely(ret != 0))
> - return ret;
> - spin_lock(&bdev->fence_lock);
> - ret = ttm_bo_wait(bo, false, true, no_wait);
> - spin_unlock(&bdev->fence_lock);
> - if (likely(ret == 0))
> - atomic_inc(&bo->cpu_writers);
> - ttm_bo_unreserve(bo);
> - return ret;
> -}
> -EXPORT_SYMBOL(ttm_bo_synccpu_write_grab);
> -
> -void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo)
> -{
> - if (atomic_dec_and_test(&bo->cpu_writers))
> - wake_up_all(&bo->event_queue);
> -}
> -EXPORT_SYMBOL(ttm_bo_synccpu_write_release);
> -
> /**
> * A buffer object shrink method that tries to swap out the first
> * buffer object on the bo_global::swap_lru list.
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index f8187ea..626a3f6 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -439,7 +439,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
> INIT_LIST_HEAD(&fbo->swap);
> INIT_LIST_HEAD(&fbo->io_reserve_lru);
> fbo->vm_node = NULL;
> - atomic_set(&fbo->cpu_writers, 0);
>
> fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj);
> kref_init(&fbo->list_kref);
> diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
> index 3832fe1..3f48a46 100644
> --- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
> @@ -181,15 +181,6 @@ retry_this_bo:
> }
>
> entry->reserved = true;
> - if (unlikely(atomic_read(&bo->cpu_writers) > 0)) {
> - ttm_eu_backoff_reservation_locked(list);
> - spin_unlock(&glob->lru_lock);
> - ttm_eu_list_ref_sub(list);
> - ret = ttm_bo_wait_cpu(bo, false);
> - if (ret)
> - return ret;
> - goto retry;
> - }
> }
>
> ttm_eu_del_from_lru_locked(list);
> diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
> index e15f2a8..0853162 100644
> --- a/include/drm/ttm/ttm_bo_api.h
> +++ b/include/drm/ttm/ttm_bo_api.h
> @@ -225,12 +225,6 @@ struct ttm_buffer_object {
> bool evicted;
>
> /**
> - * Members protected by the bo::reserved lock only when written to.
> - */
> -
> - atomic_t cpu_writers;
> -
> - /**
> * Members protected by the bdev::lru_lock.
> */
>
> @@ -423,31 +417,6 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
> int resched);
>
> /**
> - * ttm_bo_synccpu_write_grab
> - *
> - * @bo: The buffer object:
> - * @no_wait: Return immediately if buffer is busy.
> - *
> - * Synchronizes a buffer object for CPU RW access. This means
> - * blocking command submission that affects the buffer and
> - * waiting for buffer idle. This lock is recursive.
> - * Returns
> - * -EBUSY if the buffer is busy and no_wait is true.
> - * -ERESTARTSYS if interrupted by a signal.
> - */
> -extern int
> -ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
> -
> -/**
> - * ttm_bo_synccpu_write_release:
> - *
> - * @bo : The buffer object.
> - *
> - * Releases a synccpu lock.
> - */
> -extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
> -
> -/**
> * ttm_bo_acc_size
> *
> * @bdev: Pointer to a ttm_bo_device struct.
> @@ -513,7 +482,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
> void (*destroy) (struct ttm_buffer_object *));
>
> /**
> - * ttm_bo_synccpu_object_init
> + * ttm_bo_create
> *
> * @bdev: Pointer to a ttm_bo_device struct.
> * @bo: Pointer to a ttm_buffer_object to be initialized.
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index a05f1b5..75d5da7 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -732,20 +732,6 @@ extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
> extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
> struct ttm_mem_reg *mem);
>
> -/**
> - * ttm_bo_wait_for_cpu
> - *
> - * @bo: Pointer to a struct ttm_buffer_object.
> - * @no_wait: Don't sleep while waiting.
> - *
> - * Wait until a buffer object is no longer sync'ed for CPU access.
> - * Returns:
> - * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
> - * -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
> - */
> -
> -extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
> -
> extern void ttm_bo_global_release(struct drm_global_reference *ref);
> extern int ttm_bo_global_init(struct drm_global_reference *ref);
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-20 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 13:32 drm/ttm: Remove cpu_writers related code Maarten Lankhorst
2012-08-20 15:16 ` Jerome Glisse
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.