From: "Chen, Xiaogang" <xiaogang.chen@amd.com>
To: Philip Yang <yangp@amd.com>, Philip Yang <Philip.Yang@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Felix.Kuehling@amd.com
Subject: Re: [PATCH v2 2/2] drm/amdkfd: Stop user queues when process mm released
Date: Thu, 16 Oct 2025 09:46:51 -0500 [thread overview]
Message-ID: <3bf66993-7a24-4657-a264-cc44df5fb560@amd.com> (raw)
In-Reply-To: <c0daed21-77b2-664b-ed63-ae188fff2f06@amd.com>
On 10/15/2025 4:33 PM, Philip Yang wrote:
>
> On 2025-10-15 16:40, Chen, Xiaogang wrote:
>>
>>
>> On 10/15/2025 3:11 PM, Philip Yang wrote:
>>> In mmu notifier release callback, stop user queues to be safe because
>>> the SVM memory is going to unmap from CPU.
>>>
>>> Suggested-by: Felix Kuehling<felix.kuehling@amd.com>
>>> Signed-off-by: Philip Yang<Philip.Yang@amd.com>
>>> ---
>>> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 7 ++++++-
>>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>>> b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>>> index 0341f570f3d1..e2a0ae0394b8 100644
>>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>>> @@ -1221,11 +1221,16 @@ static void kfd_process_free_notifier(struct
>>> mmu_notifier *mn)
>>> static void kfd_process_notifier_release_internal(struct
>>> kfd_process *p)
>>> {
>>> - int i;
>>> + int i, r;
>>> cancel_delayed_work_sync(&p->eviction_work);
>>> cancel_delayed_work_sync(&p->restore_work);
>>> + WARN(debug_evictions, "Evicting pid %d", p->lead_thread->pid);
>>
>> Use warning message or debug message? I saw this WARN are used
>> several places. If the queues from kfd process p are still running
>> when come here we need to stop them. It is not error. debug message
>> is more suitable I think.
>>
> The module parameter debug_evictions can be set to true, use WARN to
> dump call back trace to help understand why queue is evicted, by
> default debug_evictions is false.
I agree stopping kfd process's queues during kfd process release. Just
wonder if change WARN to debug message form. We can use dump_stack() to
dump stack anyway, but it is not relevant to this patch.
>>> + r = kfd_process_evict_queues(p, KFD_QUEUE_EVICTION_TRIGGER_SVM);
>>
>> The evict reason KFD_QUEUE_EVICTION_TRIGGER_SVM is not good here as
>> it is general kfd process release. Maybe need another enum value.
>>
> Define new profiling event requires rocprofiler API change,
> KFD_QUEUE_EVICTION_TRIGGER_SVM seems the closest event from mmu notifier.
That is awkward. We may add a emu value at end that rocprofile would not
know for now.
Regards
Xiaogang
>
> Regards,
>
> Philip
>
>> Regards
>>
>> Xiaogagn
>>
>>> + if (r)
>>> + pr_debug("failed %d to quiesce KFD queues\n", r);
>>> +
>>> for (i = 0; i < p->n_pdds; i++) {
>>> struct kfd_process_device *pdd = p->pdds[i];
next prev parent reply other threads:[~2025-10-16 14:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 20:11 [PATCH v2 1/2] drm/amdkfd: Fix false positive queue buffer free warning Philip Yang
2025-10-15 20:11 ` [PATCH v2 2/2] drm/amdkfd: Stop user queues when process mm released Philip Yang
2025-10-15 20:40 ` Chen, Xiaogang
2025-10-15 21:33 ` Philip Yang
2025-10-16 14:46 ` Chen, Xiaogang [this message]
2025-10-17 22:34 ` Felix Kuehling
2025-10-17 22:43 ` Felix Kuehling
2025-10-20 14:26 ` Philip Yang
2025-10-15 21:01 ` [PATCH v2 1/2] drm/amdkfd: Fix false positive queue buffer free warning Chen, Xiaogang
2025-10-15 21:45 ` Philip Yang
2025-10-15 22:46 ` Chen, Xiaogang
2025-10-16 18:01 ` Philip Yang
2025-10-17 22:39 ` 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=3bf66993-7a24-4657-a264-cc44df5fb560@amd.com \
--to=xiaogang.chen@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=yangp@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