From: Mario Limonciello <superm1@kernel.org>
To: Honglei Huang <honghuan@amd.com>,
harry.wentland@amd.com, sunpeng.li@amd.com, siqueira@igalia.com,
Christian.Koenig@amd.com, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Ray.Huang@amd.com
Subject: Re: [PATCH] drm/amd/display: use kvzalloc to allocate struct dc
Date: Tue, 23 Jun 2026 07:08:14 -0700 [thread overview]
Message-ID: <35aa34d8-193f-4011-becf-3de7a3dcbdb2@kernel.org> (raw)
In-Reply-To: <20260623065635.2525331-1-honghuan@amd.com>
On 6/22/26 23:56, Honglei Huang wrote:
> struct dc has grown large over time (most of it the two inlined
> dc_scratch_space copies) and now sits close to the page allocator's 4 MiB
> contiguous allocation limit. Its actual size is not fixed by the source
> alone, it also depends on the compiler and the .configk, so it can
> easily cross 4 MiB, e.g. with a newer GCC or a config change, and once it
> does dc_create() fails.
>
> dc_create() allocates it with kzalloc(). Once struct dc exceeds 4 MiB the
> request is rounded up to order 11 (8 MiB), which is above MAX_PAGE_ORDER,
> so the page allocator warns and returns NULL. dc_create() then fails, DM
> init fails and amdgpu probe aborts with -EINVAL:
>
> WARNING: mm/page_alloc.c:5197 at __alloc_frozen_pages_noprof+0x2f9/0x380
> RSI: ...000b RBP: ...000b <- order = 11 (8 MiB)
> __kmalloc_large_noprof+0x1e/0xc0
> dc_create+0x38/0x660 [amdgpu]
> amdgpu_dm_init+0x2d9/0x510 [amdgpu]
> dm_hw_init+0x1b/0x90 [amdgpu]
> amdgpu 0000:03:00.0: hw_init of IP block <dm> failed -22
> amdgpu 0000:03:00.0: probe with driver amdgpu failed with error -22
>
> struct dc is software only state, never DMAed and only kept as an opaque
> pointer, so it needs no physically contiguous memory. Use kvzalloc()/
> kvfree() so it falls back to vmalloc(), removing the dependency on
> MAX_PAGE_ORDER. The underlying bloat of struct dc should be addressed
> separately.
>
Cc: stable@vger.kernel.org
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5406
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index b3530fbf32f..65bd927435e 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -1507,7 +1507,7 @@ static void disable_vbios_mode_if_required(
>
> struct dc *dc_create(const struct dc_init_data *init_params)
> {
> - struct dc *dc = kzalloc_obj(*dc);
> + struct dc *dc = kvzalloc_obj(*dc);
> unsigned int full_pipe_count;
>
> if (!dc)
> @@ -1555,7 +1555,7 @@ struct dc *dc_create(const struct dc_init_data *init_params)
>
> destruct_dc:
> dc_destruct(dc);
> - kfree(dc);
> + kvfree(dc);
> return NULL;
> }
>
> @@ -1604,7 +1604,7 @@ void dc_deinit_callbacks(struct dc *dc)
> void dc_destroy(struct dc **dc)
> {
> dc_destruct(*dc);
> - kfree(*dc);
> + kvfree(*dc);
> *dc = NULL;
> }
>
prev parent reply other threads:[~2026-06-23 14:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 6:56 [PATCH] drm/amd/display: use kvzalloc to allocate struct dc Honglei Huang
2026-06-23 14:08 ` Mario Limonciello [this message]
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=35aa34d8-193f-4011-becf-3de7a3dcbdb2@kernel.org \
--to=superm1@kernel.org \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Ray.Huang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=honghuan@amd.com \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@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 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.