Skip to contentSkip to conversation

drm/ttm: A couple of small fixes

PATCH In review Thomas Hellstrom 3 participants 5 messages Apr 28, 2010 – May 27, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/ttm: A couple of small fixes

The first patch removes some leftover debug messages in the ttm_lock code so far only used by the vmwgfx driver.

The second patch removes the ttm_bo_block_reservation() function, since it is buggy. A bo shouldn't be reserved while remaining on lru lists.

#1 lore raw

PATCH 1/2 drm/ttm: Remove some leftover debug messages.

---
 drivers/gpu/drm/ttm/ttm_lock.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/gpu/drm/ttm/ttm_lock.c +1 -4
index 3d172ef..de41e55 100644
@@ -204,7 +204,6 @@ static int __ttm_vt_unlock(struct ttm_lock *lock)
 	lock->flags &= ~TTM_VT_LOCK;
 	wake_up_all(&lock->queue);
 	spin_unlock(&lock->lock);
-	printk(KERN_INFO TTM_PFX "vt unlock.\n");
 
 	return ret;
 }
@@ -265,10 +264,8 @@ int ttm_vt_lock(struct ttm_lock *lock,
 				   ttm_lock_type, &ttm_vt_lock_remove, NULL);
 	if (ret)
 		(void)__ttm_vt_unlock(lock);
-	else {
+	else
 		lock->vt_holder = tfile;
-		printk(KERN_INFO TTM_PFX "vt lock.\n");
-	}
 
 	return ret;
 }
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/2 drm/ttm: Remove the ttm_bo_block_reservation() function.

It's unused and buggy in its current form, since it can place a bo in the reserved state without removing it from lru lists.

---
 drivers/gpu/drm/ttm/ttm_bo.c    |   30 +-----------------------------
 include/drm/ttm/ttm_bo_driver.h |   28 ----------------------------
 2 files changed, 1 insertions(+), 57 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -29
index dd47b2a..0e3754a 100644
@@ -1716,40 +1716,12 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
 }
 EXPORT_SYMBOL(ttm_bo_wait);
 
-void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo)
-{
-	atomic_set(&bo->reserved, 0);
-	wake_up_all(&bo->event_queue);
-}
-
-int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible,
-			     bool no_wait)
-{
-	int ret;
-
-	while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) {
-		if (no_wait)
-			return -EBUSY;
-		else if (interruptible) {
-			ret = wait_event_interruptible
-			    (bo->event_queue, atomic_read(&bo->reserved) == 0);
-			if (unlikely(ret != 0))
-				return ret;
-		} else {
-			wait_event(bo->event_queue,
-				   atomic_read(&bo->reserved) == 0);
-		}
-	}
-	return 0;
-}
-
 int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait)
 {
 	int ret = 0;
 
 	/*
-	 * Using ttm_bo_reserve instead of ttm_bo_block_reservation
-	 * makes sure the lru lists are updated.
+	 * Using ttm_bo_reserve makes sure the lru lists are updated.
 	 */
 
 	ret = ttm_bo_reserve(bo, true, no_wait, false, 0);
include/drm/ttm/ttm_bo_driver.h +0 -28
index e929c27..6b9db91 100644
@@ -789,34 +789,6 @@ extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
 extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
 				  bool interruptible);
 
-/**
- * ttm_bo_block_reservation
- *
- * @bo: A pointer to a struct ttm_buffer_object.
- * @interruptible: Use interruptible sleep when waiting.
- * @no_wait: Don't sleep, but rather return -EBUSY.
- *
- * Block reservation for validation by simply reserving the buffer.
- * This is intended for single buffer use only without eviction,
- * and thus needs no deadlock protection.
- *
- * Returns:
- * -EBUSY: If no_wait == 1 and the buffer is already reserved.
- * -ERESTARTSYS: If interruptible == 1 and the process received a signal
- * while sleeping.
- */
-extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
-				    bool interruptible, bool no_wait);
-
-/**
- * ttm_bo_unblock_reservation
- *
- * @bo: A pointer to a struct ttm_buffer_object.
- *
- * Unblocks reservation leaving lru lists untouched.
- */
-extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
-
 /*
  * ttm_bo_util.c
  */
Signature · 1 line
1.6.2.5
#3 lore raw

Resend: [PATCH 0/2] drm/ttm: A couple of small fixes

In reply to Thomas Hellstrom

Ping!

Quoted 11 lines · Thomas Hellstrom

The first patch removes some leftover debug messages in the ttm_lock code so far only used by the vmwgfx driver.

The second patch removes the ttm_bo_block_reservation() function, since it is buggy. A bo shouldn't be reserved while remaining on lru lists.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

/Thomas

#4 lore raw

Re: Resend: [PATCH 0/2] drm/ttm: A couple of small fixes

Quoted 2 lines · Thomas Hellstrom

Ping!

Ack!

Should have been in 2.6.34.

Dave.