AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Donet Tom <donettom@linux.ibm.com>
To: "Christian König" <christian.koenig@amd.com>,
	amd-gfx@lists.freedesktop.org,
	"Felix Kuehling" <Felix.Kuehling@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Cc: Kent.Russell@amd.com, Ritesh Harjani <ritesh.list@gmail.com>,
	Vaidyanathan Srinivasan <svaidy@linux.ibm.com>,
	Mukesh Kumar Chaurasiya <mkchauras@linux.ibm.com>
Subject: Re: [RFC PATCH v1 4/8] amdgpu/amdgpu_ttm: Fix AMDGPU_GTT_MAX_TRANSFER_SIZE for non-4K page size
Date: Fri, 12 Dec 2025 17:44:26 +0530	[thread overview]
Message-ID: <39652916-6c9e-497d-801e-23e38f93dee3@linux.ibm.com> (raw)
In-Reply-To: <277c65ad-a3c3-4d99-a0f4-a6ca99e61ab4@amd.com>


On 12/12/25 2:23 PM, Christian König wrote:
> On 12/12/25 07:40, Donet Tom wrote:
>> The SDMA engine has a hardware limitation of 4 MB maximum transfer
>> size per operation.
> That is not correct. This is only true on ancient HW.
>
> What problems are you seeing here?
>
>> AMDGPU_GTT_MAX_TRANSFER_SIZE was hardcoded to
>> 512 pages, which worked correctly on systems with 4K pages but fails
>> on systems with larger page sizes.
>>
>> This patch divides the max transfer size / AMDGPU_GPU_PAGES_IN_CPU_PAGE
>> to match with non-4K page size systems.
> That is actually a bad idea. The value was meant to match the PMD size.


Hi Christian

Thank you for the reply.

In svm_migrate_copy_memory_gart(), the number of bytes to copy passed to 
amdgpu_copy_buffer() is based on the PMD size. On systems with a 4K page 
size, the PMD size is calculated correctly because 
AMDGPU_GTT_MAX_TRANSFER_SIZE is 512, and 512 × 4K = 2MB.

On systems with a 64K page size, however, the calculation becomes 512 × 
64K = 32MB. As a result, amdgpu_copy_buffer() ends up copying data in 
4MB chunks instead of PMD-sized chunks. To ensure consistent behavior 
across both 64K and 4K page-size systems, we adjusted the transfer size 
so that the maximum transfer remains 2MB, matching the PMD size.

The issue we observed was that the rocr-debug-agent test triggered SDMA 
hangs. This happened because an incorrect size was being passed when 
copying the GART mapping in svm_migrate_gart_map(). That problem was 
addressed in patch 3/8. While root-causing that issue, we also 
identified this inconsistency between 4K and 64K systems, So we felt 
that this change was needed to align the behavior with 4K system page sizes.



>
> Regards,
> Christian.
>
>> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
>> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> index 0be2728aa872..9d038feb25b0 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> @@ -37,7 +37,7 @@
>>   #define AMDGPU_PL_MMIO_REMAP	(TTM_PL_PRIV + 5)
>>   #define __AMDGPU_PL_NUM	(TTM_PL_PRIV + 6)
>>   
>> -#define AMDGPU_GTT_MAX_TRANSFER_SIZE	512
>> +#define AMDGPU_GTT_MAX_TRANSFER_SIZE	(512 / AMDGPU_GPU_PAGES_IN_CPU_PAGE)
>>   #define AMDGPU_GTT_NUM_TRANSFER_WINDOWS	2
>>   
>>   extern const struct attribute_group amdgpu_vram_mgr_attr_group;

  reply	other threads:[~2025-12-12 12:14 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12  6:40 [RFC PATCH v1 0/8] amdgpu/amdkfd: Add support for non-4K page size systems Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 1/8] drm/amdkfd: Relax size checking during queue buffer get Donet Tom
2025-12-15 20:25   ` Philip Yang
2025-12-16 10:12     ` Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 2/8] amdkfd/kfd_svm: Fix SVM map/unmap address conversion for non-4k page sizes Donet Tom
2025-12-15 20:44   ` Philip Yang
2025-12-16 10:09     ` Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 3/8] amdkfd/kfd_migrate: Fix GART PTE for non-4K pagesize in svm_migrate_gart_map() Donet Tom
2025-12-15 21:03   ` Philip Yang
2025-12-12  6:40 ` [RFC PATCH v1 4/8] amdgpu/amdgpu_ttm: Fix AMDGPU_GTT_MAX_TRANSFER_SIZE for non-4K page size Donet Tom
2025-12-12  8:53   ` Christian König
2025-12-12 12:14     ` Donet Tom [this message]
2026-01-06 12:55     ` Donet Tom
2026-01-08 12:31       ` Christian König
2026-01-09 10:22         ` Pierre-Eric Pelloux-Prayer
2026-01-09 12:57         ` Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 5/8] amdkfd/kfd_chardev: Add error message for non-4k pagesize failures Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 6/8] drm/amdgpu: Handle GPU page faults correctly on non-4K page systems Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 7/8] amdgpu: Align ctl_stack_size and wg_data_size to GPU page size instead of CPU page size Donet Tom
2025-12-12  9:04   ` Christian König
2025-12-12 12:29     ` Donet Tom
2025-12-19 10:27     ` Donet Tom
2026-01-06 13:01       ` Donet Tom
2025-12-12  6:40 ` [RFC PATCH v1 8/8] amdgpu: Fix MQD and control stack alignment for non-4K CPU page size systems Donet Tom
2025-12-12  9:01 ` [RFC PATCH v1 0/8] amdgpu/amdkfd: Add support for non-4K " Christian König
2025-12-12 10:45   ` Ritesh Harjani
2025-12-12 13:01     ` Christian König
2025-12-12 17:24       ` Alex Deucher
2025-12-15  9:47         ` Christian König
2025-12-15 10:11           ` Donet Tom
2025-12-15 16:11             ` Christian König
2025-12-16 10:08               ` Donet Tom
2025-12-16 16:06                 ` Christian König
2025-12-17  9:04                   ` Donet Tom
2025-12-17  9:46               ` Donet Tom
2025-12-17 10:10                 ` Christian König
2025-12-15 14:09           ` Alex Deucher
2025-12-16 13:54             ` Donet Tom
2025-12-16 14:02               ` Alex Deucher
2025-12-17  9:03                 ` Donet Tom
2025-12-17 14:23                   ` Alex Deucher
2025-12-17 21:31                     ` Yat Sin, David
2026-01-02 18:53                       ` Donet Tom
2026-01-06 12:58                       ` Donet Tom

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=39652916-6c9e-497d-801e-23e38f93dee3@linux.ibm.com \
    --to=donettom@linux.ibm.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Kent.Russell@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=mkchauras@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=svaidy@linux.ibm.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