* [PATCH] drm/amdkfd: Use huge page size to check split svm range alignment
@ 2025-11-10 20:30 Xiaogang.Chen
2025-11-11 15:21 ` Philip Yang
0 siblings, 1 reply; 3+ messages in thread
From: Xiaogang.Chen @ 2025-11-10 20:30 UTC (permalink / raw)
To: amd-gfx; +Cc: Xiaogang Chen
From: Xiaogang Chen <xiaogang.chen@amd.com>
Fixes: 7ef6b2d4b7e5 (drm/amdkfd: remap unaligned svm ranges that have split)
When split svm ranges that have been mapped using huge page should use huge
page size(2MB) to check split range alignment, not prange->granularity that
means migration granularity.
Signed-off-by: Xiaogang Chen <xiaogang.chen@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 521c14c7a789..3af85c232659 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1149,7 +1149,7 @@ svm_range_split_tail(struct svm_range *prange, uint64_t new_last,
if (!r) {
list_add(&tail->list, insert_list);
- if (!IS_ALIGNED(new_last + 1, 1UL << prange->granularity))
+ if (!IS_ALIGNED(new_last + 1, 512))
list_add(&tail->update_list, remap_list);
}
return r;
@@ -1164,7 +1164,7 @@ svm_range_split_head(struct svm_range *prange, uint64_t new_start,
if (!r) {
list_add(&head->list, insert_list);
- if (!IS_ALIGNED(new_start, 1UL << prange->granularity))
+ if (!IS_ALIGNED(new_start, 512))
list_add(&head->update_list, remap_list);
}
return r;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdkfd: Use huge page size to check split svm range alignment
2025-11-10 20:30 [PATCH] drm/amdkfd: Use huge page size to check split svm range alignment Xiaogang.Chen
@ 2025-11-11 15:21 ` Philip Yang
2025-11-11 20:24 ` Chen, Xiaogang
0 siblings, 1 reply; 3+ messages in thread
From: Philip Yang @ 2025-11-11 15:21 UTC (permalink / raw)
To: Xiaogang.Chen, amd-gfx
On 2025-11-10 15:30, Xiaogang.Chen wrote:
> From: Xiaogang Chen <xiaogang.chen@amd.com>
>
> Fixes: 7ef6b2d4b7e5 (drm/amdkfd: remap unaligned svm ranges that have split)
>
> When split svm ranges that have been mapped using huge page should use huge
> page size(2MB) to check split range alignment, not prange->granularity that
> means migration granularity.
>
> Signed-off-by: Xiaogang Chen <xiaogang.chen@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 521c14c7a789..3af85c232659 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1149,7 +1149,7 @@ svm_range_split_tail(struct svm_range *prange, uint64_t new_last,
>
> if (!r) {
> list_add(&tail->list, insert_list);
> - if (!IS_ALIGNED(new_last + 1, 1UL << prange->granularity))
> + if (!IS_ALIGNED(new_last + 1, 512))
we should check the original prange size is larger than 512 pages
if (!IS_ALIGNED(new_last + 1, 512) && tail->last -
prange->start >= 512)
> list_add(&tail->update_list, remap_list);
> }
> return r;
> @@ -1164,7 +1164,7 @@ svm_range_split_head(struct svm_range *prange, uint64_t new_start,
>
> if (!r) {
> list_add(&head->list, insert_list);
> - if (!IS_ALIGNED(new_start, 1UL << prange->granularity))
> + if (!IS_ALIGNED(new_start, 512))
if (!IS_ALIGNED(new_start, 512) && prange->last - head->start >= 512)
Regards,
Philip
> list_add(&head->update_list, remap_list);
> }
> return r;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdkfd: Use huge page size to check split svm range alignment
2025-11-11 15:21 ` Philip Yang
@ 2025-11-11 20:24 ` Chen, Xiaogang
0 siblings, 0 replies; 3+ messages in thread
From: Chen, Xiaogang @ 2025-11-11 20:24 UTC (permalink / raw)
To: Philip Yang, amd-gfx
On 11/11/2025 9:21 AM, Philip Yang wrote:
>
> On 2025-11-10 15:30, Xiaogang.Chen wrote:
>> From: Xiaogang Chen <xiaogang.chen@amd.com>
>>
>> Fixes: 7ef6b2d4b7e5 (drm/amdkfd: remap unaligned svm ranges that have
>> split)
>>
>> When split svm ranges that have been mapped using huge page should
>> use huge
>> page size(2MB) to check split range alignment, not
>> prange->granularity that
>> means migration granularity.
>>
>> Signed-off-by: Xiaogang Chen <xiaogang.chen@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 521c14c7a789..3af85c232659 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
>> @@ -1149,7 +1149,7 @@ svm_range_split_tail(struct svm_range *prange,
>> uint64_t new_last,
>> if (!r) {
>> list_add(&tail->list, insert_list);
>> - if (!IS_ALIGNED(new_last + 1, 1UL << prange->granularity))
>> + if (!IS_ALIGNED(new_last + 1, 512))
> we should check the original prange size is larger than 512 pages
> if (!IS_ALIGNED(new_last + 1, 512) && tail->last -
> prange->start >= 512)
ok, but should be following one?
if (!IS_ALIGNED(tail->start, 512) || (tail->last - tail->start + 1)
< 512)
>> list_add(&tail->update_list, remap_list);
>> }
>> return r;
>> @@ -1164,7 +1164,7 @@ svm_range_split_head(struct svm_range *prange,
>> uint64_t new_start,
>> if (!r) {
>> list_add(&head->list, insert_list);
>> - if (!IS_ALIGNED(new_start, 1UL << prange->granularity))
>> + if (!IS_ALIGNED(new_start, 512))
>
> if (!IS_ALIGNED(new_start, 512) && prange->last - head->start >= 512)
same for head case, should use this?
if (!IS_ALIGNED( head->start , 512) || ( head->last - head->start + 1)
< 512)
Regards
Xiaogang
> Regards,
>
> Philip
>
>> list_add(&head->update_list, remap_list);
>> }
>> return r;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-11 20:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 20:30 [PATCH] drm/amdkfd: Use huge page size to check split svm range alignment Xiaogang.Chen
2025-11-11 15:21 ` Philip Yang
2025-11-11 20:24 ` Chen, Xiaogang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox