[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5012eab1-3aaa-4559-b410-0972e0a18b7c@amd.com>
Date: Tue, 16 Jan 2024 15:52:17 +0100
From: Christian König <christian.koenig@....com>
To: Yangyu Chen <cyy@...self.name>, dri-devel@...ts.freedesktop.org
Cc: linux-kernel@...r.kernel.org, Huang Rui <ray.huang@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
Jiuyang Liu <liu@...yang.me>, Yichuan Gao <i@...is.me>,
Icenowy Zheng <uwu@...nowy.me>
Subject: Re: [PATCH 1/1] drm/ttm: allocate dummy_read_page without DMA32 on
fail
Am 16.01.24 um 14:02 schrieb Yangyu Chen:
> Some platforms may not have any memory in ZONE_DMA32 and use IOMMU to allow
> 32-bit-DMA-only device to work. Forcing GFP_DMA32 on dummy_read_page will
> fail on such platforms. Retry after fail will get this works on such
> platforms.
>
> Signed-off-by: Yangyu Chen <cyy@...self.name>
> ---
> drivers/gpu/drm/ttm/ttm_device.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index d48b39132b32..a07d9ea919b6 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -98,8 +98,13 @@ static int ttm_global_init(void)
> glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32);
Please add __GFP_NOWARN here to avoid the backtrace and warning on
allocation failure.
>
> if (unlikely(glob->dummy_read_page == NULL)) {
> - ret = -ENOMEM;
> - goto out;
> + /* Retry without GFP_DMA32 */
Well that is obvious, you need to describe why you retry without GFP_DMA32.
Something like /* Retry without GFP_DMA32 for platforms without
ZONE_DMA32 */, and probably better placed above the "if".
> + glob->dummy_read_page = alloc_page(__GFP_ZERO);
> + if (unlikely(glob->dummy_read_page == NULL)) {
> + ret = -ENOMEM;
> + goto out;
> + }
> + pr_warn("Failed to allocate dummy_read_page with GFP_DMA32, some old graphics card only has 32bit DMA may not work properly.\n");
Well maybe make that a bit shorter, something like "Using GFP_DMA32
fallback for the dummy page".
Regards,
Christian.
> }
>
> INIT_LIST_HEAD(&glob->device_list);
Powered by blists - more mailing lists