From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Xiaogang Chen <xiaogang.chen@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Felix Kuehling <Felix.Kuehling@amd.com>
Subject: [PATCH] drm/amdkfd: Remove skiping userptr buffer mapping when mmu notifier marks it as invalid
Date: Tue, 9 May 2023 18:17:37 -0400 [thread overview]
Message-ID: <20230509221738.477282-2-alexander.deucher@amd.com> (raw)
In-Reply-To: <20230509221738.477282-1-alexander.deucher@amd.com>
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>
Signed-off-by: Alex Deucher <alexander.deucher@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 58a774647573..40078c0a5585 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1942,16 +1942,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
*/
mutex_lock(&mem->process_info->lock);
- /* Lock notifier lock. 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)) {
- mutex_lock(&mem->process_info->notifier_lock);
- is_invalid_userptr = !!mem->invalid;
- mutex_unlock(&mem->process_info->notifier_lock);
- }
-
mutex_lock(&mem->lock);
domain = mem->domain;
--
2.40.1
next prev parent reply other threads:[~2023-05-09 22:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Alex Deucher [this message]
2023-05-10 15:00 ` [PATCH] drm/amdkfd: Remove skiping userptr buffer mapping when mmu notifier marks it as invalid Felix Kuehling
2023-05-10 15:02 ` Alex Deucher
2023-05-09 22:17 ` [PATCH] drm/amdgpu: Fix unmapping of aperture Alex Deucher
-- strict thread matches above, loose matches on Subject: below --
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
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=20230509221738.477282-2-alexander.deucher@amd.com \
--to=alexander.deucher@amd.com \
--cc=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