From: Felix Kuehling <felix.kuehling@amd.com>
To: Eric Huang <jinhuieric.huang@amd.com>,
amd-gfx@lists.freedesktop.org, "Koenig,
Christian" <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/amdkfd: Fix dmabuf's redundant eviction when unmapping
Date: Tue, 4 Apr 2023 10:11:30 -0400 [thread overview]
Message-ID: <91875e99-89f0-5a5e-03fc-d08d3240c869@amd.com> (raw)
In-Reply-To: <20230403175949.131530-1-jinhuieric.huang@amd.com>
If we keep the BO in the GTT domain, it means it will not be updated if
we validate it again later in kfd_mem_dmamap_dmabuf. This means we'll
use stale DMA addresses when we update the page tables after evictions.
I think we'll need to find a different way to avoid triggering the
eviction fence on the original BO when changing the placement of the
DMABuf import here. If you need help brainstorming here, please share a
backtrace from the eviction generated with the debug_evictions module param.
Regards,
Felix
Am 2023-04-03 um 13:59 schrieb Eric Huang:
> dmabuf is allocated/mapped as GTT domain, when dma-unmapping dmabuf
> changing placement to CPU will trigger memory eviction after calling
> ttm_bo_validate, and the eviction will cause performance drop.
> Keeping the correct domain will solve the issue.
>
> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index a3b09edfd1bf..17b708acb447 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -642,7 +642,7 @@ kfd_mem_dmaunmap_dmabuf(struct kfd_mem_attachment *attachment)
> struct ttm_operation_ctx ctx = {.interruptible = true};
> struct amdgpu_bo *bo = attachment->bo_va->base.bo;
>
> - amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_CPU);
> + amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT);
> ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
> }
>
next prev parent reply other threads:[~2023-04-04 14:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 17:59 [PATCH] drm/amdkfd: Fix dmabuf's redundant eviction when unmapping Eric Huang
2023-04-04 14:11 ` Felix Kuehling [this message]
2023-04-04 14:36 ` Eric Huang
2023-04-04 20:40 ` Felix Kuehling
2023-04-10 18:28 ` Eric Huang
2023-04-10 18:50 ` Felix Kuehling
2023-04-10 19:03 ` Eric Huang
2023-04-10 19:09 ` Felix Kuehling
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=91875e99-89f0-5a5e-03fc-d08d3240c869@amd.com \
--to=felix.kuehling@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=jinhuieric.huang@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.