Re: [PATCH] drm/ttm: fix busy memory to fail other user v3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2019年04月26日 17:11, Koenig, Christian wrote:
Am 26.04.19 um 11:07 schrieb zhoucm1:
[SNIP]
+ spin_lock(&glob->lru_lock);
+        for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
+            if (list_empty(&man->lru[i]))
+                continue;
+            bo = list_first_entry(&man->lru[i],
+                          struct ttm_buffer_object,
+                          lru);
You now need to check all BOs on the LRU, cause the first one where a
trylock failed is not necessarily the first one on the list.
Sorry, I don't get your opinion on this, Could you detail a bit how to
do that?
I though after ww_mutex_lock, cs is done, then DC can pick up any of
them.
The first_bo is not necessarily the first BO of the LRU, but the first
BO which failed in the trylock.

+
+            break;
+        }
+        /* verify if BO have been moved */
+        if (first_bo != bo) {
And in this case we would abort here without a good reason.
I got what you said now. I will change it soon.

-David

Christian.

+ spin_unlock(&glob->lru_lock);
+            ww_mutex_unlock(&bo->resv->lock);
+            return -EBUSY;
+        }
+        spin_unlock(&glob->lru_lock);
+        /* ok, pick up first busy BO to wait to evict */
       }
         kref_get(&bo->list_kref);
@@ -1784,7 +1819,10 @@ int ttm_bo_swapout(struct ttm_bo_global
*glob, struct ttm_operation_ctx *ctx)
       spin_lock(&glob->lru_lock);
       for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
           list_for_each_entry(bo, &glob->swap_lru[i], swap) {
-            if (ttm_bo_evict_swapout_allowable(bo, ctx, &locked)) {
+            bool busy = false;
Better make the parameter optional.
Will do.

-David
Christian.

+
+            if (ttm_bo_evict_swapout_allowable(bo, ctx, &locked,
+                               &busy)) {
                   ret = 0;
                   break;
               }

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux