Re: [PATCH] drm/ttm: fix adding foreign BOs to the LRU during init

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

 



Am 10.01.2016 um 16:10 schrieb Thomas Hellstrom:
On 01/09/2016 11:46 AM, Christian König wrote:
It's correct that exported buffers can't be moved to another domain or
swapped to disk while another device is using it.

But for imports that's a different story:
an imported object should never end up on a LRU list in TTM because
TTM wouldn't know how to evict it.
Even currently the imported objects are actually added to the LRU. The
problem is just that they are not added immediately during creation,
but only with the first command submission.
Hmm. The fact that they are added to LRU at all sounds weird. What
happens when TTM tries to evict or even swap out an imported buffer?
Adding them to the domain LRU is perfectly normal for the imported buffers and also works fine as far as I know.

When TTM evicts them it just gets unmapped from GTT to make room in the address space, which at least for Radeon and Amdgpu is exactly what we want.

That imported buffers get added to the swap LRU is indeed nonsense, but not harmful as far as I can see. Going to fix that in a follow up patch.

Thanks for the comment,
Christian.


/Thomas


Regards,
Christian.

Am 09.01.2016 um 08:05 schrieb Thomas Hellstrom:
Hi!

I might be misunderderstanding the use-case here, but IIRC the
discussion with TTM vs imported / exported buffer objects is that a
buffer object needs to be marked NO_EVICT in TTM before it's exported
and an imported object should never end up on a LRU list in TTM because
TTM wouldn't know how to evict it.

/Thomas
On 01/08/2016 02:41 PM, Christian König wrote:
From: Christian König <christian.koenig@xxxxxxx>

If we import a BO with an eternal reservation object we don't
reserve/unreserve it. So we never add it to the LRU causing a possible
deny of service.

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
   drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++-
   1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c
b/drivers/gpu/drm/ttm/ttm_bo.c
index 745e996..a98a5d5 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1170,9 +1170,15 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
       if (likely(!ret))
           ret = ttm_bo_validate(bo, placement, interruptible, false);
   -    if (!resv)
+    if (!resv) {
           ttm_bo_unreserve(bo);
   +    } else if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
+        spin_lock(&bo->glob->lru_lock);
+        ttm_bo_add_to_lru(bo);
+        spin_unlock(&bo->glob->lru_lock);
+    }
+
       if (unlikely(ret))
           ttm_bo_unref(&bo);




_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://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