From: Felix Kuehling <felix.kuehling@amd.com>
To: "Xiaogang.Chen" <xiaogang.chen@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: Remove skiping userptr buffer mapping when mmu notifier marks it as invalid
Date: Mon, 31 Oct 2022 11:42:21 -0400 [thread overview]
Message-ID: <97812dcf-482c-559e-21da-e033fc1e79d3@amd.com> (raw)
In-Reply-To: <20221029002632.729783-1-xiaogang.chen@amd.com>
Am 2022-10-28 um 20:26 schrieb Xiaogang.Chen:
> From: Xiaogang Chen <xiaogang.chen@amd.com>
>
> mmu notifier does not always hold mm->sem during call back. That causes a race condition
> between kfd userprt buffer mapping and mmu notifier which leds to gpu shadder or SDMA access
> userptr buffer before it has been mapped to gpu VM. Always map userptr buffer to avoid that
> though it may make some userprt buffers mapped two times.
>
> Suggested-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Signed-off-by: Xiaogang Chen <xiaogang.chen@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 10 ----------
> 1 file changed, 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index da9d475d7ef2..ba72a910d0d5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -1907,16 +1907,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
> */
> mutex_lock(&mem->process_info->lock);
>
> - /* Lock mmap-sem. If we find an invalid userptr BO, we can be
> - * sure that the MMU notifier is no longer running
> - * concurrently and the queues are actually stopped
> - */
> - if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
> - mmap_write_lock(current->mm);
> - is_invalid_userptr = atomic_read(&mem->invalid);
> - mmap_write_unlock(current->mm);
> - }
> -
> mutex_lock(&mem->lock);
>
> domain = mem->domain;
next prev parent reply other threads:[~2022-10-31 15:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 0:26 [PATCH] drm/amdkfd: Remove skiping userptr buffer mapping when mmu notifier marks it as invalid Xiaogang.Chen
2022-10-31 15:42 ` Felix Kuehling [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-05-09 22:17 [PATCH] drm/amdgpu: Fix xGMI access P2P mapping failure on GFXIP 9.4.3 Alex Deucher
2023-05-09 22:17 ` [PATCH] drm/amdkfd: Remove skiping userptr buffer mapping when mmu notifier marks it as invalid Alex Deucher
2023-05-10 15:00 ` Felix Kuehling
2023-05-10 15:02 ` Alex Deucher
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=97812dcf-482c-559e-21da-e033fc1e79d3@amd.com \
--to=felix.kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=xiaogang.chen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox