[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250317093101.1784499d@collabora.com>
Date: Mon, 17 Mar 2025 09:31:01 +0100
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Adrián Larumbe <adrian.larumbe@...labora.com>
Cc: Steven Price <steven.price@....com>, Liviu Dudau <liviu.dudau@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
<mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>, kernel@...labora.com,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] drm/panthor: Display heap chunk entries in DebugFS
GEMS file
On Sun, 16 Mar 2025 21:51:35 +0000
Adrián Larumbe <adrian.larumbe@...labora.com> wrote:
> Expand the driver's DebugFS GEMS file to display entries for the heap
> chunks' GEM objects, both those allocated at heap creation time through an
> ioctl(), or in response to a tiler OOM event.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@...labora.com>
> ---
> drivers/gpu/drm/panthor/panthor_heap.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/panthor_heap.c
> index db0285ce5812..520d1fcf5c36 100644
> --- a/drivers/gpu/drm/panthor/panthor_heap.c
> +++ b/drivers/gpu/drm/panthor/panthor_heap.c
> @@ -139,6 +139,10 @@ static int panthor_alloc_heap_chunk(struct panthor_device *ptdev,
> struct panthor_heap_chunk *chunk;
> struct panthor_heap_chunk_header *hdr;
> int ret;
> +#ifdef CONFIG_DEBUG_FS
> + struct panthor_gem_object *obj;
> + const char *label;
> +#endif
>
> chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
> if (!chunk)
> @@ -180,6 +184,17 @@ static int panthor_alloc_heap_chunk(struct panthor_device *ptdev,
> heap->chunk_count++;
> mutex_unlock(&heap->lock);
>
> +#ifdef CONFIG_DEBUG_FS
> + obj = to_panthor_bo(chunk->bo->obj);
> +
> + mutex_lock(&ptdev->gems_lock);
> + list_add_tail(&obj->gems_node, &ptdev->gems);
> + mutex_unlock(&ptdev->gems_lock);
> +
> + label = kstrdup_const("\"Tiler heap chunk\"", GFP_KERNEL);
Do we really need the extra quotes around 'Tiler heap chunk'?
> + panthor_gem_label_bo(chunk->bo->obj, label);
> +#endif
Let's define a helper to assign a label to a kernel BO instead of
open-coding it here. BTW, I suspect we'll want to assign labels to
other kernel BOs too (FW buffers).
> +
> return 0;
>
> err_destroy_bo:
Powered by blists - more mailing lists