From: "Khatri, Sunil" <sukhatri@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>,
"Hosur, Priya" <Priya.Hosur@amd.com>
Cc: "Lazar, Lijo" <Lijo.Lazar@amd.com>,
"Kuehling, Felix" <Felix.Kuehling@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"Vishwakarma, Pratik" <Pratik.Vishwakarma@amd.com>,
"Gopalakrishnan,
Veerabadhran (Veera)" <Veerabadhran.Gopalakrishnan@amd.com>,
"Khatri, Sunil" <Sunil.Khatri@amd.com>,
"Liu, Shaoyun" <Shaoyun.Liu@amd.com>,
"Limonciello, Mario" <Mario.Limonciello@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: Re: [PATCH v3 2/2] drm/amdgpu: Add TLB flush after MES user queue unmap
Date: Mon, 17 Aug 2026 19:55:41 +0530 [thread overview]
Message-ID: <d3de23c7-8a10-45ff-900b-ad02c2a7218a@amd.com> (raw)
In-Reply-To: <CADnq5_Pj0gOHMupA+X9x6F-71TQJDeDiJQ6kdFgrLdzLh-z70Q@mail.gmail.com>
On 17-08-2026 07:49 pm, Alex Deucher wrote:
> On Sun, Aug 16, 2026 at 1:25 PM Hosur, Priya <Priya.Hosur@amd.com> wrote:
>> AMD General
>>
>>
>> Hi Felix, Lijo,
>>
>>
>>
>> Thanks for the clarification. I understand now - TLB flush is only needed after batch queue unmapping (eviction/suspension), not after each individual queue unmap.
>>
>>
>>
>> Alex - based on Felix's feedback, the userq unmap path doesn't need the same fix since it's per-queue unmap rather than batch unmap.
>>
> I think it's still needed when we evict all KGD userqs for a process
> (technically per GPU VM instance). E.g., the eviction fence case.
@priya, i am looking into this in the KGD userqueues. It's ok if you
drop that as it need some more insight to understand how well it fits
the KGD queues..
Regards
Sunil Khatri
>
> Alex
>
>>
>> I'll drop patch 2/2 (userq fix) and send v4 with only the KFD fix.
>>
>>
>>
>> Thanks and Regards,
>> Priya Hosur
>>
>>
>>
>> From: Lazar, Lijo <Lijo.Lazar@amd.com>
>> Sent: Friday, August 14, 2026 10:56 PM
>> To: Kuehling, Felix <Felix.Kuehling@amd.com>; Hosur, Priya <Priya.Hosur@amd.com>; amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com>; Khatri, Sunil <Sunil.Khatri@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
>> Cc: Vishwakarma, Pratik <Pratik.Vishwakarma@amd.com>; Gopalakrishnan, Veerabadhran (Veera) <Veerabadhran.Gopalakrishnan@amd.com>
>> Subject: Re: [PATCH v3 2/2] drm/amdgpu: Add TLB flush after MES user queue unmap
>>
>>
>>
>> AMD General
>>
>>
>>
>> Thanks for the details. Didn't realise that it is one by one removal. I thought it was something like unmap-all for a PAS id.
>>
>>
>>
>> Thanks,
>>
>> Lijo
>>
>> ________________________________
>>
>> From: Kuehling, Felix <Felix.Kuehling@amd.com>
>> Sent: Friday, 14 August 2026 22:17:50
>> To: Lazar, Lijo <Lijo.Lazar@amd.com>; Hosur, Priya <Priya.Hosur@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Khatri, Sunil <Sunil.Khatri@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
>> Cc: Vishwakarma, Pratik <Pratik.Vishwakarma@amd.com>; Gopalakrishnan, Veerabadhran (Veera) <Veerabadhran.Gopalakrishnan@amd.com>
>> Subject: Re: [PATCH v3 2/2] drm/amdgpu: Add TLB flush after MES user queue unmap
>>
>>
>>
>> AMD General
>>
>>
>>
>> We don't need to flush TLBs after every queue unmap. We only need to do it if there is an expectation that memory access is quiesced after unmapping. In the case of KFD, we are doing it when we're unmapping all queues, e.g. in MMU notifiers, evictions or when the debugger needs to stop the queues and look at memory contents. We only need one TLB flush after unmapping many queues.
>>
>>
>>
>> Therefore, MES should flush TLBs after every queue unmap. OTOH, MES must flush TLBs by itself when it switches VMIDs. This is not under driver control.
>>
>>
>>
>> I don't know what the requirements are for quiescing memory access after unmapping amdgpu user mode queues.
>>
>>
>>
>> Regards,
>>
>> Felix
>>
>> ________________________________
>>
>> From: Lazar, Lijo <Lijo.Lazar@amd.com>
>> Sent: Friday, August 14, 2026 12:29
>> To: Hosur, Priya <Priya.Hosur@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Khatri, Sunil <Sunil.Khatri@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
>> Cc: Vishwakarma, Pratik <Pratik.Vishwakarma@amd.com>; Gopalakrishnan, Veerabadhran (Veera) <Veerabadhran.Gopalakrishnan@amd.com>; Hosur, Priya <Priya.Hosur@amd.com>
>> Subject: Re: [PATCH v3 2/2] drm/amdgpu: Add TLB flush after MES user queue unmap
>>
>>
>>
>> AMD General
>>
>>
>>
>> Hi,
>>
>>
>>
>> Shouldn't this be a FW fix?
>>
>>
>>
>> Thanks,
>>
>> Lijo
>>
>> ________________________________
>>
>> From: Priya Hosur <Priya.Hosur@amd.com>
>> Sent: Friday, 14 August 2026 21:48:40
>> To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Khatri, Sunil <Sunil.Khatri@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Lazar, Lijo <Lijo.Lazar@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
>> Cc: Vishwakarma, Pratik <Pratik.Vishwakarma@amd.com>; Gopalakrishnan, Veerabadhran (Veera) <Veerabadhran.Gopalakrishnan@amd.com>; Hosur, Priya <Priya.Hosur@amd.com>
>> Subject: [PATCH v3 2/2] drm/amdgpu: Add TLB flush after MES user queue unmap
>>
>>
>>
>> Similar to the KFD fix, MES does not perform heavy-weight TLB
>> invalidation after unmapping user queues. Add
>> amdgpu_gmc_flush_gpu_tlb_pasid() after MES unmap succeeds in
>> amdgpu_userq_unmap_helper() to ensure in-flight memory accesses
>> complete before memory is freed or migrated.
>>
>> Change-Id: I94fe2c84547723b6b73816ce8d727a54bd773a6a
>> Signed-off-by: Priya Hosur <Priya.Hosur@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>> index 6d3ed55e9ab4..9fcf15d69b7b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>> @@ -375,6 +375,12 @@ static int amdgpu_userq_unmap_helper(struct amdgpu_usermode_queue *queue)
>> } else {
>> trace_amdgpu_userq_state_changed(queue, AMDGPU_USERQ_STATE_UNMAPPED);
>> queue->state = AMDGPU_USERQ_STATE_UNMAPPED;
>> + /*
>> + * Heavy-weight TLB flush after MES unmaps queue to ensure
>> + * in-flight memory accesses complete before memory is freed/migrated.
>> + * MES does not do this automatically unlike HWS.
>> + */
>> + amdgpu_gmc_flush_gpu_tlb_pasid(adev, queue->vm->pasid, 2, true, 0);
>> }
>> }
>>
>> --
>> 2.43.0
next prev parent reply other threads:[~2026-08-17 14:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 16:18 [PATCH v3 0/2] drm/amdkfd: Add TLB flush after MES queue eviction/suspension Priya Hosur
2026-08-14 16:18 ` [PATCH v3 1/2] " Priya Hosur
2026-08-14 16:18 ` [PATCH v3 2/2] drm/amdgpu: Add TLB flush after MES user queue unmap Priya Hosur
2026-08-14 16:29 ` Lazar, Lijo
2026-08-14 16:47 ` Kuehling, Felix
2026-08-14 17:25 ` Lazar, Lijo
2026-08-16 17:07 ` Hosur, Priya
2026-08-17 14:19 ` Alex Deucher
2026-08-17 14:25 ` Khatri, Sunil [this message]
2026-08-24 7:39 ` Christian König
2026-08-25 6:47 ` Khatri, Sunil
2026-08-25 10:36 ` Hosur, Priya
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=d3de23c7-8a10-45ff-900b-ad02c2a7218a@amd.com \
--to=sukhatri@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Lijo.Lazar@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Pratik.Vishwakarma@amd.com \
--cc=Priya.Hosur@amd.com \
--cc=Shaoyun.Liu@amd.com \
--cc=Sunil.Khatri@amd.com \
--cc=Veerabadhran.Gopalakrishnan@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
/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.