All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philip Yang <Philip.Yang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Felix.Kuehling@amd.com>, <christian.koenig@amd.com>,
	<Arunpravin.PaneerSelvam@amd.com>,
	Philip Yang <Philip.Yang@amd.com>
Subject: [PATCH v5 3/6] drm/amdgpu: Evict BOs from same process for contiguous allocation
Date: Tue, 23 Apr 2024 11:28:57 -0400	[thread overview]
Message-ID: <20240423152900.533-4-Philip.Yang@amd.com> (raw)
In-Reply-To: <20240423152900.533-1-Philip.Yang@amd.com>

When TTM failed to alloc VRAM, TTM try evict BOs from VRAM to system
memory then retry the allocation, this skips the KFD BOs from the same
process because KFD require all BOs are resident for user queues.

If TTM with TTM_PL_FLAG_CONTIGUOUS flag to alloc contiguous VRAM, allow
TTM evict KFD BOs from the same process, this will evict the user queues
first, and restore the queues later after contiguous VRAM allocation.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 851509c6e90e..c907d6005641 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1398,7 +1398,8 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
 	 */
 	dma_resv_for_each_fence(&resv_cursor, bo->base.resv,
 				DMA_RESV_USAGE_BOOKKEEP, f) {
-		if (amdkfd_fence_check_mm(f, current->mm))
+		if (amdkfd_fence_check_mm(f, current->mm) &&
+		    !(place->flags & TTM_PL_FLAG_CONTIGUOUS))
 			return false;
 	}
 
-- 
2.43.2


  parent reply	other threads:[~2024-04-23 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 15:28 [PATCH v5 0/6] Best effort contiguous VRAM allocation Philip Yang
2024-04-23 15:28 ` [PATCH v5 1/6] drm/amdgpu: Support " Philip Yang
2024-04-23 22:17   ` Felix Kuehling
2024-04-24 13:58     ` Philip Yang
2024-04-23 15:28 ` [PATCH v5 2/6] drm/amdgpu: Handle sg size limit for contiguous allocation Philip Yang
2024-04-24  6:14   ` Christian König
2024-04-23 15:28 ` Philip Yang [this message]
2024-04-23 22:16   ` [PATCH v5 3/6] drm/amdgpu: Evict BOs from same process " Felix Kuehling
2024-04-23 15:28 ` [PATCH v5 4/6] drm/amdkfd: Evict BO itself " Philip Yang
2024-04-23 22:15   ` Felix Kuehling
2024-04-24 13:41     ` Philip Yang
2024-04-23 15:28 ` [PATCH v5 5/6] drm/amdkfd: Increase KFD bo restore wait time Philip Yang
2024-04-23 22:06   ` Felix Kuehling
2024-04-23 15:29 ` [PATCH v5 6/6] drm/amdkfd: Bump kfd version for contiguous VRAM allocation Philip Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240423152900.533-4-Philip.Yang@amd.com \
    --to=philip.yang@amd.com \
    --cc=Arunpravin.PaneerSelvam@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.