From: sashiko-bot@kernel.org
To: "Priya Hosur" <Priya.Hosur@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/amdkfd: bound the APU GTT pool size by KFD's system memory limit
Date: Fri, 27 Nov 2026 08:43:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-236901@kernel.org> (raw)
In-Reply-To: <20261127082854.112025-3-Priya.Hosur@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/amdkfd: unaligned GTT pool size in
amdgpu_amdkfd_gtt_pool_size()
--
commit 17502322da1ca7a12d9a6715a32b9c3d4e96b211
Author: Priya Hosur <Priya.Hosur@amd.com>
drm/amdkfd: bound the APU GTT pool size by KFD's system memory limit
This commit caps the reported APU GTT pool size in
amdgpu_amdkfd_get_local_mem_info() and amdgpu_amdkfd_xcp_memory_size() by
the smaller of TTM's page limit and KFD's system memory limit.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index 0dab267eb3828..17c12edca4371 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -521,6 +521,17 @@ uint32_t amdgpu_amdkfd_get_fw_version(struct amdgpu_device *adev,
> return 0;
> }
>
> +/*
> + * Size of the GTT-backed pool reported on APUs. TTM may be configured above
> + * physical RAM, but KFD will not allocate beyond its system memory limit, so
> + * don't report more than that.
> + */
> +static u64 amdgpu_amdkfd_gtt_pool_size(void)
> +{
> + return min((u64)ttm_tt_pages_limit() << PAGE_SHIFT,
> + amdgpu_amdkfd_system_mem_limit());
> +}
[Severity: Low]
Can amdgpu_amdkfd_gtt_pool_size() return a byte count that is not aligned
to PAGE_SIZE?
In amdgpu_amdkfd_gpuvm_init_mem_limits(), max_system_mem_limit is derived
from mem - (mem >> 6), which is only 64-byte aligned whenever
si.totalram - si.totalhigh is not a multiple of 64 pages. Since
amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu() rounds every allocation up with
PAGE_ALIGN(size) before checking max_system_mem_limit, any sub-page
remainder advertised in local_mem_size_public and
amdgpu_amdkfd_xcp_memory_size() cannot be allocated. Rounding the result
down with ALIGN_DOWN(..., PAGE_SIZE) would match the partition branch in
amdgpu_amdkfd_xcp_memory_size().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127082854.112025-1-Priya.Hosur@amd.com?part=2
next prev parent reply other threads:[~2026-11-27 8:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 8:28 [PATCH 0/2] drm/amdkfd: report realistic free/total memory on GTT-backed APUs Priya Hosur
2026-11-27 8:28 ` [PATCH 1/2] drm/amdkfd: bound APU available memory by host available memory Priya Hosur
2026-11-27 8:37 ` sashiko-bot
2026-11-27 8:52 ` Stamenkovic, Strahinja
2026-11-27 8:28 ` [PATCH 2/2] drm/amdkfd: bound the APU GTT pool size by KFD's system memory limit Priya Hosur
2026-11-27 8:43 ` sashiko-bot [this message]
2026-11-27 8:52 ` Stamenkovic, Strahinja
2026-11-27 10:19 ` [PATCH v2 0/2] drm/amdkfd: report realistic free/total memory on GTT-backed APUs Priya Hosur
2026-11-27 10:19 ` [PATCH v2 1/2] drm/amdkfd: bound APU available memory by host available memory Priya Hosur
2026-11-27 10:19 ` [PATCH v2 2/2] drm/amdkfd: bound the APU GTT pool size by KFD's system memory limit Priya Hosur
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=sashiko-outbox-236901@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Priya.Hosur@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.