From: Philip Yang <yangp@amd.com>
To: "Chen, Xiaogang" <xiaogang.chen@amd.com>,
Philip Yang <Philip.Yang@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Felix.Kuehling@amd.com, harish.kasiviswanathan@amd.com
Subject: Re: [PATCH 2/3] drm/amdkfd: svm unmap use page aligned address
Date: Fri, 3 Oct 2025 11:03:09 -0400 [thread overview]
Message-ID: <7f23e178-8ba5-5e12-3708-42dc249e2fad@amd.com> (raw)
In-Reply-To: <75531fd4-74fa-424a-abed-3f5f03d7717d@amd.com>
On 2025-10-02 18:04, Chen, Xiaogang wrote:
>
> On 10/2/2025 12:43 PM, Philip Yang wrote:
>> svm_range_unmap_from_gpus uses page aligned start, end address, the end
>> address is inclusive.
>>
>> Fixes: 38c55f6719f7 ("drm/amdkfd: Handle lack of READ permissions in
>> SVM mapping")
>> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
>> b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
>> index e8a15751c125..742c28833650 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
>> @@ -1723,8 +1723,8 @@ static int svm_range_validate_and_map(struct
>> mm_struct *mm,
>> svm_range_lock(prange);
>> if (vma->vm_flags & VM_WRITE)
>> pr_debug("VM_WRITE without VM_READ is not
>> supported");
>> - s = max(start, prange->start);
>> - e = min(end, prange->last);
>> + s = max(start >> PAGE_SHIFT, prange->start);
>> + e = min((end - 1) >> PAGE_SHIFT, prange->last);
>
> I think the problem is more than that. Here "end" is the last place
> for prange gpu mapping and the handling here is for a vma. Should use
> end of the vma range to get "e".
You are right, end should use next - 1 instead, I will refactor the
patch series, send out v2.
regards,
Philip
>
> Regards
>
> Xiaogang
>
>> if (e >= s)
>> r = svm_range_unmap_from_gpus(prange, s, e,
>> KFD_SVM_UNMAP_TRIGGER_UNMAP_FROM_CPU);
next prev parent reply other threads:[~2025-10-03 15:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 17:43 [PATCH 1/3] drm/amdgpu: svm check hmm range kzalloc return NULL Philip Yang
2025-10-02 17:43 ` [PATCH 2/3] drm/amdkfd: svm unmap use page aligned address Philip Yang
2025-10-02 22:04 ` Chen, Xiaogang
2025-10-03 15:03 ` Philip Yang [this message]
2025-10-02 17:43 ` [PATCH 3/3] drm/amdkfd: Don't stuck in svm restore worker Philip Yang
2025-10-02 21:48 ` [PATCH 1/3] drm/amdgpu: svm check hmm range kzalloc return NULL Chen, Xiaogang
2025-10-03 15:12 ` Philip Yang
2025-10-03 15:39 ` Chen, Xiaogang
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=7f23e178-8ba5-5e12-3708-42dc249e2fad@amd.com \
--to=yangp@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=harish.kasiviswanathan@amd.com \
--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