* [PATCH v8 1/4] drm/panthor: Introduce BO labeling
@ 2025-04-15 19:15 Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels Adrián Larumbe
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Adrián Larumbe @ 2025-04-15 19:15 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: kernel, Adrián Larumbe, dri-devel, linux-kernel
Add a new character string Panthor BO field, and a function that allows
setting it from within the driver.
Driver takes care of freeing the string when it's replaced or no longer
needed at object destruction time, but allocating it is the responsibility
of callers.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/gpu/drm/panthor/panthor_gem.c | 46 +++++++++++++++++++++++++++
drivers/gpu/drm/panthor/panthor_gem.h | 17 ++++++++++
2 files changed, 63 insertions(+)
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index 8244a4e6c2a2..8dd7fa63f1ff 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -2,6 +2,7 @@
/* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */
/* Copyright 2023 Collabora ltd. */
+#include <linux/cleanup.h>
#include <linux/dma-buf.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
@@ -18,6 +19,14 @@ static void panthor_gem_free_object(struct drm_gem_object *obj)
struct panthor_gem_object *bo = to_panthor_bo(obj);
struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
+ /*
+ * Label might have been allocated with kstrdup_const(),
+ * we need to take that into account when freeing the memory
+ */
+ kfree_const(bo->label.str);
+
+ mutex_destroy(&bo->label.lock);
+
drm_gem_free_mmap_offset(&bo->base.base);
mutex_destroy(&bo->gpuva_list_lock);
drm_gem_shmem_free(&bo->base);
@@ -196,6 +205,7 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
obj->base.map_wc = !ptdev->coherent;
mutex_init(&obj->gpuva_list_lock);
drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
+ mutex_init(&obj->label.lock);
return &obj->base.base;
}
@@ -247,3 +257,39 @@ panthor_gem_create_with_handle(struct drm_file *file,
return ret;
}
+
+void
+panthor_gem_bo_set_label(struct drm_gem_object *obj, const char *label)
+{
+ struct panthor_gem_object *bo = to_panthor_bo(obj);
+ const char *old_label;
+
+ scoped_guard(mutex, &bo->label.lock) {
+ old_label = bo->label.str;
+ bo->label.str = label;
+ }
+
+ kfree_const(old_label);
+}
+
+void
+panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
+{
+ const char *str;
+
+ /* We should never attempt labelling a UM-exposed GEM object */
+ if (drm_WARN_ON(bo->obj->dev, bo->obj->handle_count > 0))
+ return;
+
+ if (!label)
+ return;
+
+ str = kstrdup_const(label, GFP_KERNEL);
+ if (!str) {
+ /* Failing to allocate memory for a label isn't a fatal condition */
+ drm_warn(bo->obj->dev, "Not enough memory to allocate BO label");
+ return;
+ }
+
+ panthor_gem_bo_set_label(bo->obj, str);
+}
diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
index 1a363bb814f4..af0d77338860 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.h
+++ b/drivers/gpu/drm/panthor/panthor_gem.h
@@ -46,6 +46,20 @@ struct panthor_gem_object {
/** @flags: Combination of drm_panthor_bo_flags flags. */
u32 flags;
+
+ /**
+ * @label: BO tagging fields. The label can be assigned within the
+ * driver itself or through a specific IOCTL.
+ */
+ struct {
+ /**
+ * @label.str: Pointer to NULL-terminated string,
+ */
+ const char *str;
+
+ /** @lock.str: Protects access to the @label.str field. */
+ struct mutex lock;
+ } label;
};
/**
@@ -91,6 +105,9 @@ panthor_gem_create_with_handle(struct drm_file *file,
struct panthor_vm *exclusive_vm,
u64 *size, u32 flags, uint32_t *handle);
+void panthor_gem_bo_set_label(struct drm_gem_object *obj, const char *label);
+void panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label);
+
static inline u64
panthor_kernel_bo_gpuva(struct panthor_kernel_bo *bo)
{
--
2.48.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
@ 2025-04-15 19:15 ` Adrián Larumbe
2025-04-17 12:26 ` Boris Brezillon
2025-04-15 19:15 ` [PATCH v8 3/4] drm/panthor: Label all kernel BO's Adrián Larumbe
` (4 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Adrián Larumbe @ 2025-04-15 19:15 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: kernel, Adrián Larumbe, dri-devel, linux-kernel
Allow UM to label a BO for which it possesses a DRM handle.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
---
drivers/gpu/drm/panthor/panthor_drv.c | 64 ++++++++++++++++++++++++++-
drivers/gpu/drm/panthor/panthor_gem.h | 2 +
include/uapi/drm/panthor_drm.h | 20 +++++++++
3 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index 06fe46e32073..7660627cafa1 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1331,6 +1331,66 @@ static int panthor_ioctl_vm_get_state(struct drm_device *ddev, void *data,
return 0;
}
+static int panthor_ioctl_bo_set_label(struct drm_device *ddev, void *data,
+ struct drm_file *file)
+{
+ struct drm_panthor_bo_set_label *args = data;
+ struct drm_gem_object *obj;
+ char *label_tmp = NULL;
+ long label_len = 0;
+ const char *label;
+ int ret = 0;
+
+ obj = drm_gem_object_lookup(file, args->handle);
+ if (!obj)
+ return -ENOENT;
+
+ if (args->label) {
+ label_tmp = kmalloc(PANTHOR_BO_LABEL_MAXLEN, GFP_KERNEL);
+ if (!label_tmp) {
+ ret = -ENOMEM;
+ goto err_put_obj;
+ }
+
+ label_len = strncpy_from_user(label_tmp, u64_to_user_ptr(args->label),
+ PANTHOR_BO_LABEL_MAXLEN);
+ if (label_len < 0) {
+ ret = label_len;
+ goto err_free_tmp;
+ }
+ }
+
+ if (label_len == PANTHOR_BO_LABEL_MAXLEN) {
+ ret = -E2BIG;
+ goto err_free_tmp;
+ }
+
+ /*
+ * We treat passing a label of length 0 and passing a NULL label
+ * differently, because even though they might seem conceptually
+ * similar, future uses of the BO label might expect a different
+ * behaviour in each case.
+ */
+ if (label_tmp) {
+ label = kstrdup(label_tmp, GFP_KERNEL);
+ if (!label) {
+ ret = -ENOMEM;
+ goto err_free_tmp;
+ }
+ } else {
+ label = NULL;
+ }
+
+ panthor_gem_bo_set_label(obj, label);
+
+err_free_tmp:
+ kfree(label_tmp);
+err_put_obj:
+ drm_gem_object_put(obj);
+
+ return ret;
+}
+
static int
panthor_open(struct drm_device *ddev, struct drm_file *file)
{
@@ -1400,6 +1460,7 @@ static const struct drm_ioctl_desc panthor_drm_driver_ioctls[] = {
PANTHOR_IOCTL(TILER_HEAP_CREATE, tiler_heap_create, DRM_RENDER_ALLOW),
PANTHOR_IOCTL(TILER_HEAP_DESTROY, tiler_heap_destroy, DRM_RENDER_ALLOW),
PANTHOR_IOCTL(GROUP_SUBMIT, group_submit, DRM_RENDER_ALLOW),
+ PANTHOR_IOCTL(BO_SET_LABEL, bo_set_label, DRM_RENDER_ALLOW),
};
static int panthor_mmap(struct file *filp, struct vm_area_struct *vma)
@@ -1509,6 +1570,7 @@ static void panthor_debugfs_init(struct drm_minor *minor)
* - 1.2 - adds DEV_QUERY_GROUP_PRIORITIES_INFO query
* - adds PANTHOR_GROUP_PRIORITY_REALTIME priority
* - 1.3 - adds DRM_PANTHOR_GROUP_STATE_INNOCENT flag
+ * - 1.4 - adds DRM_IOCTL_PANTHOR_BO_SET_LABEL ioctl
*/
static const struct drm_driver panthor_drm_driver = {
.driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ |
@@ -1522,7 +1584,7 @@ static const struct drm_driver panthor_drm_driver = {
.name = "panthor",
.desc = "Panthor DRM driver",
.major = 1,
- .minor = 3,
+ .minor = 4,
.gem_create_object = panthor_gem_create_object,
.gem_prime_import_sg_table = drm_gem_shmem_prime_import_sg_table,
diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
index af0d77338860..983cc8ca264e 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.h
+++ b/drivers/gpu/drm/panthor/panthor_gem.h
@@ -13,6 +13,8 @@
struct panthor_vm;
+#define PANTHOR_BO_LABEL_MAXLEN 4096
+
/**
* struct panthor_gem_object - Driver specific GEM object.
*/
diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
index 97e2c4510e69..226965673db5 100644
--- a/include/uapi/drm/panthor_drm.h
+++ b/include/uapi/drm/panthor_drm.h
@@ -127,6 +127,9 @@ enum drm_panthor_ioctl_id {
/** @DRM_PANTHOR_TILER_HEAP_DESTROY: Destroy a tiler heap. */
DRM_PANTHOR_TILER_HEAP_DESTROY,
+
+ /** @DRM_PANTHOR_BO_SET_LABEL: Label a BO. */
+ DRM_PANTHOR_BO_SET_LABEL,
};
/**
@@ -977,6 +980,21 @@ struct drm_panthor_tiler_heap_destroy {
__u32 pad;
};
+/**
+ * struct drm_panthor_bo_set_label - Arguments passed to DRM_IOCTL_PANTHOR_BO_SET_LABEL
+ */
+struct drm_panthor_bo_set_label {
+ /** @handle: Handle of the buffer object to label. */
+ __u32 handle;
+
+ /**
+ * @label: User pointer to a NUL-terminated string
+ *
+ * Length cannot be greater than 4096
+ */
+ __u64 label;
+};
+
/**
* DRM_IOCTL_PANTHOR() - Build a Panthor IOCTL number
* @__access: Access type. Must be R, W or RW.
@@ -1019,6 +1037,8 @@ enum {
DRM_IOCTL_PANTHOR(WR, TILER_HEAP_CREATE, tiler_heap_create),
DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY =
DRM_IOCTL_PANTHOR(WR, TILER_HEAP_DESTROY, tiler_heap_destroy),
+ DRM_IOCTL_PANTHOR_BO_SET_LABEL =
+ DRM_IOCTL_PANTHOR(WR, BO_SET_LABEL, bo_set_label),
};
#if defined(__cplusplus)
--
2.48.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v8 3/4] drm/panthor: Label all kernel BO's
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels Adrián Larumbe
@ 2025-04-15 19:15 ` Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS Adrián Larumbe
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Adrián Larumbe @ 2025-04-15 19:15 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: kernel, Adrián Larumbe, dri-devel, linux-kernel
Kernel BO's aren't exposed to UM, so labelling them is the responsibility
of the driver itself. This kind of tagging will prove useful in further
commits when want to expose these objects through DebugFS.
Expand panthor_kernel_bo_create() interface to take a NUL-terminated
string. No bounds checking is done because all label strings are given
as statically-allocated literals, but if a more complex kernel BO naming
scheme with explicit memory allocation and formatting was desired in the
future, this would have to change.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
---
drivers/gpu/drm/panthor/panthor_fw.c | 8 +++++---
drivers/gpu/drm/panthor/panthor_gem.c | 5 ++++-
drivers/gpu/drm/panthor/panthor_gem.h | 2 +-
drivers/gpu/drm/panthor/panthor_heap.c | 6 ++++--
drivers/gpu/drm/panthor/panthor_sched.c | 9 ++++++---
5 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
index 0f52766a3120..a7fdc4d8020d 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -449,7 +449,8 @@ panthor_fw_alloc_queue_iface_mem(struct panthor_device *ptdev,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC |
DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "Queue FW interface");
if (IS_ERR(mem))
return mem;
@@ -481,7 +482,8 @@ panthor_fw_alloc_suspend_buf_mem(struct panthor_device *ptdev, size_t size)
return panthor_kernel_bo_create(ptdev, panthor_fw_vm(ptdev), size,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "FW suspend buffer");
}
static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
@@ -601,7 +603,7 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
section->mem = panthor_kernel_bo_create(ptdev, panthor_fw_vm(ptdev),
section_size,
DRM_PANTHOR_BO_NO_MMAP,
- vm_map_flags, va);
+ vm_map_flags, va, "FW section");
if (IS_ERR(section->mem))
return PTR_ERR(section->mem);
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index 8dd7fa63f1ff..3f4ab5a2f2ae 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -76,13 +76,14 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo)
* @gpu_va: GPU address assigned when mapping to the VM.
* If gpu_va == PANTHOR_VM_KERNEL_AUTO_VA, the virtual address will be
* automatically allocated.
+ * @name: Descriptive label of the BO's contents
*
* Return: A valid pointer in case of success, an ERR_PTR() otherwise.
*/
struct panthor_kernel_bo *
panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
size_t size, u32 bo_flags, u32 vm_map_flags,
- u64 gpu_va)
+ u64 gpu_va, const char *name)
{
struct drm_gem_shmem_object *obj;
struct panthor_kernel_bo *kbo;
@@ -106,6 +107,8 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
kbo->obj = &obj->base;
bo->flags = bo_flags;
+ panthor_gem_kernel_bo_set_label(kbo, name);
+
/* The system and GPU MMU page size might differ, which becomes a
* problem for FW sections that need to be mapped at explicit address
* since our PAGE_SIZE alignment might cover a VA range that's
diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
index 983cc8ca264e..3c09af568e47 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.h
+++ b/drivers/gpu/drm/panthor/panthor_gem.h
@@ -153,7 +153,7 @@ panthor_kernel_bo_vunmap(struct panthor_kernel_bo *bo)
struct panthor_kernel_bo *
panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
size_t size, u32 bo_flags, u32 vm_map_flags,
- u64 gpu_va);
+ u64 gpu_va, const char *name);
void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo);
diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/panthor_heap.c
index 3bdf61c14264..d236e9ceade4 100644
--- a/drivers/gpu/drm/panthor/panthor_heap.c
+++ b/drivers/gpu/drm/panthor/panthor_heap.c
@@ -151,7 +151,8 @@ static int panthor_alloc_heap_chunk(struct panthor_heap_pool *pool,
chunk->bo = panthor_kernel_bo_create(pool->ptdev, pool->vm, heap->chunk_size,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "Tiler heap chunk");
if (IS_ERR(chunk->bo)) {
ret = PTR_ERR(chunk->bo);
goto err_free_chunk;
@@ -555,7 +556,8 @@ panthor_heap_pool_create(struct panthor_device *ptdev, struct panthor_vm *vm)
pool->gpu_contexts = panthor_kernel_bo_create(ptdev, vm, bosize,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "Heap pool");
if (IS_ERR(pool->gpu_contexts)) {
ret = PTR_ERR(pool->gpu_contexts);
goto err_destroy_pool;
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index 446ec780eb4a..43ee57728de5 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -3332,7 +3332,8 @@ group_create_queue(struct panthor_group *group,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC |
DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "CS ring buffer");
if (IS_ERR(queue->ringbuf)) {
ret = PTR_ERR(queue->ringbuf);
goto err_free_queue;
@@ -3362,7 +3363,8 @@ group_create_queue(struct panthor_group *group,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC |
DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "Group job stats");
if (IS_ERR(queue->profiling.slots)) {
ret = PTR_ERR(queue->profiling.slots);
@@ -3493,7 +3495,8 @@ int panthor_group_create(struct panthor_file *pfile,
DRM_PANTHOR_BO_NO_MMAP,
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC |
DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED,
- PANTHOR_VM_KERNEL_AUTO_VA);
+ PANTHOR_VM_KERNEL_AUTO_VA,
+ "Group sync objects");
if (IS_ERR(group->syncobjs)) {
ret = PTR_ERR(group->syncobjs);
goto err_put_group;
--
2.48.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 3/4] drm/panthor: Label all kernel BO's Adrián Larumbe
@ 2025-04-15 19:15 ` Adrián Larumbe
2025-04-17 14:25 ` Steven Price
2025-04-15 19:15 ` [PATCH v8 0/4] Panthor BO tagging and GEMS debug display Adrián Larumbe
` (2 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Adrián Larumbe @ 2025-04-15 19:15 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sumit Semwal, Christian König
Cc: kernel, Adrián Larumbe, dri-devel, linux-kernel, linux-media,
linaro-mm-sig
Add a device DebugFS file that displays a complete list of all the DRM
GEM objects that are exposed to UM through a DRM handle.
Since leaking object identifiers that might belong to a different NS is
inadmissible, this functionality is only made available in debug builds
with DEBUGFS support enabled.
File format is that of a table, with each entry displaying a variety of
fields with information about each GEM object.
Each GEM object entry in the file displays the following information
fields: Client PID, BO's global name, reference count, BO virtual size,
BO resize size, VM address in its DRM-managed range, BO label and a GEM
state flags.
There's also a usage flags field for the type of BO, which tells us
whether it's a kernel BO and/or mapped onto the FW's address space.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/gpu/drm/panthor/panthor_device.c | 5 +
drivers/gpu/drm/panthor/panthor_device.h | 11 ++
drivers/gpu/drm/panthor/panthor_drv.c | 26 ++++
drivers/gpu/drm/panthor/panthor_gem.c | 182 +++++++++++++++++++++++
drivers/gpu/drm/panthor/panthor_gem.h | 59 ++++++++
5 files changed, 283 insertions(+)
diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
index a9da1d1eeb70..b776e1a2e4f3 100644
--- a/drivers/gpu/drm/panthor/panthor_device.c
+++ b/drivers/gpu/drm/panthor/panthor_device.c
@@ -184,6 +184,11 @@ int panthor_device_init(struct panthor_device *ptdev)
if (ret)
return ret;
+#ifdef CONFIG_DEBUG_FS
+ drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
+ INIT_LIST_HEAD(&ptdev->gems.node);
+#endif
+
atomic_set(&ptdev->pm.state, PANTHOR_DEVICE_PM_STATE_SUSPENDED);
p = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (!p)
diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
index da6574021664..86206a961b38 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -205,6 +205,17 @@ struct panthor_device {
/** @fast_rate: Maximum device clock frequency. Set by DVFS */
unsigned long fast_rate;
+
+#ifdef CONFIG_DEBUG_FS
+ /** @gems: Device-wide list of GEM objects owned by at least one file. */
+ struct {
+ /** @gems.lock: Protects the device-wide list of GEM objects. */
+ struct mutex lock;
+
+ /** @node: Used to keep track of all the device's DRM objects */
+ struct list_head node;
+ } gems;
+#endif
};
struct panthor_gpu_usage {
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index 7660627cafa1..13f0b045c5fd 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1557,9 +1557,35 @@ static const struct file_operations panthor_drm_driver_fops = {
};
#ifdef CONFIG_DEBUG_FS
+static int panthor_gems_show(struct seq_file *m, void *data)
+{
+ struct drm_info_node *node = m->private;
+ struct drm_device *dev = node->minor->dev;
+ struct panthor_device *ptdev = container_of(dev, struct panthor_device, base);
+
+ panthor_gem_debugfs_print_bos(ptdev, m);
+
+ return 0;
+}
+
+
+static struct drm_info_list panthor_debugfs_list[] = {
+ {"gems", panthor_gems_show, 0, NULL},
+};
+
+static int panthor_gems_debugfs_init(struct drm_minor *minor)
+{
+ drm_debugfs_create_files(panthor_debugfs_list,
+ ARRAY_SIZE(panthor_debugfs_list),
+ minor->debugfs_root, minor);
+
+ return 0;
+}
+
static void panthor_debugfs_init(struct drm_minor *minor)
{
panthor_mmu_debugfs_init(minor);
+ panthor_gems_debugfs_init(minor);
}
#endif
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index 3f4ab5a2f2ae..1e3409c05891 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -11,14 +11,51 @@
#include <drm/panthor_drm.h>
#include "panthor_device.h"
+#include "panthor_fw.h"
#include "panthor_gem.h"
#include "panthor_mmu.h"
+#ifdef CONFIG_DEBUG_FS
+static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
+ struct panthor_gem_object *bo)
+{
+ INIT_LIST_HEAD(&bo->debugfs.node);
+
+ bo->debugfs.creator.tgid = current->group_leader->pid;
+ get_task_comm(bo->debugfs.creator.process_name, current->group_leader);
+
+ mutex_lock(&ptdev->gems.lock);
+ list_add_tail(&bo->debugfs.node, &ptdev->gems.node);
+ mutex_unlock(&ptdev->gems.lock);
+}
+
+static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo)
+{
+ struct panthor_device *ptdev = container_of(bo->base.base.dev,
+ struct panthor_device, base);
+
+ if (list_empty(&bo->debugfs.node))
+ return;
+
+ mutex_lock(&ptdev->gems.lock);
+ list_del_init(&bo->debugfs.node);
+ mutex_unlock(&ptdev->gems.lock);
+}
+
+#else
+static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
+ struct panthor_gem_object *bo)
+{}
+static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo) {}
+#endif
+
static void panthor_gem_free_object(struct drm_gem_object *obj)
{
struct panthor_gem_object *bo = to_panthor_bo(obj);
struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
+ panthor_gem_debugfs_bo_rm(bo);
+
/*
* Label might have been allocated with kstrdup_const(),
* we need to take that into account when freeing the memory
@@ -88,6 +125,7 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
struct drm_gem_shmem_object *obj;
struct panthor_kernel_bo *kbo;
struct panthor_gem_object *bo;
+ u32 debug_flags = PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL;
int ret;
if (drm_WARN_ON(&ptdev->base, !vm))
@@ -107,7 +145,11 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
kbo->obj = &obj->base;
bo->flags = bo_flags;
+ if (vm == panthor_fw_vm(ptdev))
+ debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
+
panthor_gem_kernel_bo_set_label(kbo, name);
+ panthor_gem_debugfs_set_usage_flags(to_panthor_bo(kbo->obj), debug_flags);
/* The system and GPU MMU page size might differ, which becomes a
* problem for FW sections that need to be mapped at explicit address
@@ -210,6 +252,8 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
mutex_init(&obj->label.lock);
+ panthor_gem_debugfs_bo_add(ptdev, obj);
+
return &obj->base.base;
}
@@ -258,6 +302,12 @@ panthor_gem_create_with_handle(struct drm_file *file,
/* drop reference from allocate - handle holds it now. */
drm_gem_object_put(&shmem->base);
+ /*
+ * No explicit flags are needed in the call below, since the
+ * function internally sets the INITIALIZED bit for us.
+ */
+ panthor_gem_debugfs_set_usage_flags(bo, 0);
+
return ret;
}
@@ -296,3 +346,135 @@ panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
panthor_gem_bo_set_label(bo->obj, str);
}
+
+#ifdef CONFIG_DEBUG_FS
+static void
+panthor_gem_debugfs_format_flags(char flags_str[], int flags_len,
+ const char * const names[], u32 name_count,
+ u32 flags)
+{
+ bool first = true;
+ int offset = 0;
+
+#define ACC_FLAGS(...) \
+ ({ \
+ offset += snprintf(flags_str + offset, flags_len - offset, ##__VA_ARGS__); \
+ if (offset == flags_len) \
+ return; \
+ })
+
+ ACC_FLAGS("%c", '(');
+
+ if (!flags)
+ ACC_FLAGS("%s", "none");
+
+ while (flags) {
+ u32 bit = fls(flags) - 1;
+ u32 idx = bit + 1;
+
+ if (!first)
+ ACC_FLAGS("%s", ",");
+
+ if (idx < name_count && names[idx])
+ ACC_FLAGS("%s", names[idx]);
+
+ first = false;
+ flags &= ~BIT(bit);
+ }
+
+ ACC_FLAGS("%c", ')');
+
+#undef ACC_FLAGS
+}
+
+struct gem_size_totals {
+ size_t size;
+ size_t resident;
+ size_t reclaimable;
+};
+
+static void panthor_gem_debugfs_bo_print(struct panthor_gem_object *bo,
+ struct seq_file *m,
+ struct gem_size_totals *totals)
+{
+ unsigned int refcount = kref_read(&bo->base.base.refcount);
+ char creator_info[32] = {};
+ size_t resident_size;
+ char gem_state_str[64] = {};
+ char gem_usage_str[64] = {};
+ u32 gem_usage_flags = bo->debugfs.flags & (u32)~PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
+ u32 gem_state_flags = 0;
+
+ static const char * const gem_state_flags_names[] = {
+ [PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED] = "imported",
+ [PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED] = "exported",
+ };
+
+ static const char * const gem_usage_flags_names[] = {
+ [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL] = "kernel",
+ [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED] = "fw-mapped",
+ };
+
+ /* Skip BOs being destroyed. */
+ if (!refcount)
+ return;
+
+ resident_size = bo->base.pages != NULL ? bo->base.base.size : 0;
+
+ snprintf(creator_info, sizeof(creator_info),
+ "%s/%d", bo->debugfs.creator.process_name, bo->debugfs.creator.tgid);
+ seq_printf(m, "%-32s%-16d%-16d%-16zd%-16zd%-16lx",
+ creator_info,
+ bo->base.base.name,
+ refcount,
+ bo->base.base.size,
+ resident_size,
+ drm_vma_node_start(&bo->base.base.vma_node));
+
+ if (bo->base.base.import_attach != NULL)
+ gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED;
+ if (bo->base.base.dma_buf != NULL)
+ gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED;
+
+ panthor_gem_debugfs_format_flags(gem_state_str, sizeof(gem_state_str),
+ gem_state_flags_names, ARRAY_SIZE(gem_state_flags_names),
+ gem_state_flags);
+ panthor_gem_debugfs_format_flags(gem_usage_str, sizeof(gem_usage_str),
+ gem_usage_flags_names, ARRAY_SIZE(gem_usage_flags_names),
+ gem_usage_flags);
+
+ seq_printf(m, "%-64s%-64s", gem_state_str, gem_usage_str);
+
+ scoped_guard(mutex, &bo->label.lock) {
+ seq_printf(m, "%s", bo->label.str ? : "");
+ }
+
+ seq_puts(m, "\n");
+
+ totals->size += bo->base.base.size;
+ totals->resident += resident_size;
+ if (bo->base.madv > 0)
+ totals->reclaimable += resident_size;
+}
+
+void panthor_gem_debugfs_print_bos(struct panthor_device *ptdev,
+ struct seq_file *m)
+{
+ struct gem_size_totals totals = {0};
+ struct panthor_gem_object *bo;
+
+ seq_puts(m, "created-by global-name refcount size resident-size file-offset state usage label\n");
+ seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
+
+ scoped_guard(mutex, &ptdev->gems.lock) {
+ list_for_each_entry(bo, &ptdev->gems.node, debugfs.node) {
+ if (bo->debugfs.flags & PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED)
+ panthor_gem_debugfs_bo_print(bo, m, &totals);
+ }
+ }
+
+ seq_puts(m, "=====================================================================================================================================================================================================================================================\n");
+ seq_printf(m, "Total size: %zd, Total resident: %zd, Total reclaimable: %zd\n",
+ totals.size, totals.resident, totals.reclaimable);
+}
+#endif
diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
index 3c09af568e47..94b244f0540e 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.h
+++ b/drivers/gpu/drm/panthor/panthor_gem.h
@@ -15,6 +15,48 @@ struct panthor_vm;
#define PANTHOR_BO_LABEL_MAXLEN 4096
+enum panthor_debugfs_gem_state_flags {
+ /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED: GEM BO is PRIME imported. */
+ PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED = BIT(0),
+
+ /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED: GEM BO is PRIME exported. */
+ PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED = BIT(1),
+};
+
+enum panthor_debugfs_gem_usage_flags {
+ /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL: BO is for kernel use only. */
+ PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL = BIT(0),
+
+ /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED: BO is mapped on the FW VM. */
+ PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED = BIT(1),
+
+ /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED: BO is ready for DebugFS display. */
+ PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED = BIT(31),
+};
+
+/**
+ * struct panthor_gem_debugfs - GEM object's DebugFS list information
+ */
+struct panthor_gem_debugfs {
+ /**
+ * @node: Node used to insert the object in the device-wide list of
+ * GEM objects, to display information about it through a DebugFS file.
+ */
+ struct list_head node;
+
+ /** @creator: Information about the UM process which created the GEM. */
+ struct {
+ /** @creator.process_name: Group leader name in owning thread's process */
+ char process_name[TASK_COMM_LEN];
+
+ /** @creator.tgid: PID of the thread's group leader within its process */
+ pid_t tgid;
+ } creator;
+
+ /** @flags: Combination of panthor_debugfs_gem_usage_flags flags */
+ u32 flags;
+};
+
/**
* struct panthor_gem_object - Driver specific GEM object.
*/
@@ -62,6 +104,10 @@ struct panthor_gem_object {
/** @lock.str: Protects access to the @label.str field. */
struct mutex lock;
} label;
+
+#ifdef CONFIG_DEBUG_FS
+ struct panthor_gem_debugfs debugfs;
+#endif
};
/**
@@ -157,4 +203,17 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo);
+#ifdef CONFIG_DEBUG_FS
+void panthor_gem_debugfs_print_bos(struct panthor_device *pfdev,
+ struct seq_file *m);
+static inline void
+panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags)
+{
+ bo->debugfs.flags = usage_flags | PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
+}
+
+#else
+void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) {};
+#endif
+
#endif /* __PANTHOR_GEM_H__ */
--
2.48.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v8 0/4] Panthor BO tagging and GEMS debug display
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
` (2 preceding siblings ...)
2025-04-15 19:15 ` [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS Adrián Larumbe
@ 2025-04-15 19:15 ` Adrián Larumbe
2025-04-17 12:21 ` [PATCH v8 1/4] drm/panthor: Introduce BO labeling Liviu Dudau
2025-04-17 14:24 ` Steven Price
5 siblings, 0 replies; 11+ messages in thread
From: Adrián Larumbe @ 2025-04-15 19:15 UTC (permalink / raw)
To: Boris Brezillon, Steven Price, Liviu Dudau, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Cc: kernel, Adrián Larumbe, dri-devel, linux-kernel
This patch series is aimed at providing UM with detailed memory profiling
information in debug builds. It is achieved through a device-wide list of
DRM GEM objects, and also implementing the ability to label BO's from UM
through a new IOCTL.
The new debugfs file shows a list of driver DRM GEM objects in tabular mode.
To visualise it, cat sudo cat /sys/kernel/debug/dri/*.gpu/gems.
To test this functionality from UM, please refer to this Mesa patch series:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224
Discussion of previous revision of this patch series can be found at:
https://lore.kernel.org/dri-devel/20250411150357.3308921-1-adrian.larumbe@collabora.com/
Changelog:
v8:
- Renamed NULL to NUL in comments describing NUL-terminated strings
- Removed 'size' parameter from labelling ioctl() as max length can be
handled by the kernel itself
- Made sure to use kfree_const() everywhere labels are freed
- Replaced maximum label size with numerical constant rather than page size
- Added some warnings and checks in kernel BO labelling function
v7:
- Improved formating of DebugFS GEM's status and usage flags
- Deleted some spurious white spaces
- Renamed usage flags setting function
v6:
- Replaced some mutex calls with scoped guards
- Documented data size limits in the label ioctl
- Simplified GEMS status flags treatment (Panthor doesn't use madvise)
- Fixed some array size and string bugs
- Improved the naming of GEM status and usage flags to reflect their meaning
- Improved the formatting of the output table
v5:
- Kept case and naming of kernel BO's consistent
- Increased the driver minor after new ioctl
- Now adds BO to debugfs GEMs list at GEM object creation time
- No longer try to hide BO creator's name when it's a workqueue or modprobe
- Reworked the procedure for printing GEM state and kernel BO flags
- Turned kernel BO flags and GEM state flags into bit enums
- Wait until BO state is marked as initialied for debugfs display
v4:
- Labelled all kernel BO's, not just heap chunks.
- Refactored DebugGFs GEMs list handling functions
- Added debugfs GEMS node mask to tell different kinds of BO's
Adrián Larumbe (4):
drm/panthor: Introduce BO labeling
drm/panthor: Add driver IOCTL for setting BO labels
drm/panthor: Label all kernel BO's
drm/panthor: show device-wide list of DRM GEM objects over DebugFS
drivers/gpu/drm/panthor/panthor_device.c | 5 +
drivers/gpu/drm/panthor/panthor_device.h | 11 ++
drivers/gpu/drm/panthor/panthor_drv.c | 90 ++++++++-
drivers/gpu/drm/panthor/panthor_fw.c | 8 +-
drivers/gpu/drm/panthor/panthor_gem.c | 233 ++++++++++++++++++++++-
drivers/gpu/drm/panthor/panthor_gem.h | 80 +++++++-
drivers/gpu/drm/panthor/panthor_heap.c | 6 +-
drivers/gpu/drm/panthor/panthor_sched.c | 9 +-
include/uapi/drm/panthor_drm.h | 20 ++
9 files changed, 451 insertions(+), 11 deletions(-)
--
2.48.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v8 1/4] drm/panthor: Introduce BO labeling
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
` (3 preceding siblings ...)
2025-04-15 19:15 ` [PATCH v8 0/4] Panthor BO tagging and GEMS debug display Adrián Larumbe
@ 2025-04-17 12:21 ` Liviu Dudau
2025-04-17 14:24 ` Steven Price
5 siblings, 0 replies; 11+ messages in thread
From: Liviu Dudau @ 2025-04-17 12:21 UTC (permalink / raw)
To: Adrián Larumbe
Cc: Boris Brezillon, Steven Price, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, kernel, dri-devel,
linux-kernel
On Tue, Apr 15, 2025 at 08:15:30PM +0100, Adrián Larumbe wrote:
> Add a new character string Panthor BO field, and a function that allows
> setting it from within the driver.
>
> Driver takes care of freeing the string when it's replaced or no longer
> needed at object destruction time, but allocating it is the responsibility
> of callers.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 46 +++++++++++++++++++++++++++
> drivers/gpu/drm/panthor/panthor_gem.h | 17 ++++++++++
> 2 files changed, 63 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index 8244a4e6c2a2..8dd7fa63f1ff 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -2,6 +2,7 @@
> /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */
> /* Copyright 2023 Collabora ltd. */
>
> +#include <linux/cleanup.h>
> #include <linux/dma-buf.h>
> #include <linux/dma-mapping.h>
> #include <linux/err.h>
> @@ -18,6 +19,14 @@ static void panthor_gem_free_object(struct drm_gem_object *obj)
> struct panthor_gem_object *bo = to_panthor_bo(obj);
> struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
>
> + /*
> + * Label might have been allocated with kstrdup_const(),
> + * we need to take that into account when freeing the memory
> + */
> + kfree_const(bo->label.str);
> +
> + mutex_destroy(&bo->label.lock);
> +
> drm_gem_free_mmap_offset(&bo->base.base);
> mutex_destroy(&bo->gpuva_list_lock);
> drm_gem_shmem_free(&bo->base);
> @@ -196,6 +205,7 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
> obj->base.map_wc = !ptdev->coherent;
> mutex_init(&obj->gpuva_list_lock);
> drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
> + mutex_init(&obj->label.lock);
>
> return &obj->base.base;
> }
> @@ -247,3 +257,39 @@ panthor_gem_create_with_handle(struct drm_file *file,
>
> return ret;
> }
> +
> +void
> +panthor_gem_bo_set_label(struct drm_gem_object *obj, const char *label)
> +{
> + struct panthor_gem_object *bo = to_panthor_bo(obj);
> + const char *old_label;
> +
> + scoped_guard(mutex, &bo->label.lock) {
> + old_label = bo->label.str;
> + bo->label.str = label;
> + }
> +
> + kfree_const(old_label);
> +}
> +
> +void
> +panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
> +{
> + const char *str;
> +
> + /* We should never attempt labelling a UM-exposed GEM object */
> + if (drm_WARN_ON(bo->obj->dev, bo->obj->handle_count > 0))
> + return;
> +
> + if (!label)
> + return;
> +
> + str = kstrdup_const(label, GFP_KERNEL);
> + if (!str) {
> + /* Failing to allocate memory for a label isn't a fatal condition */
> + drm_warn(bo->obj->dev, "Not enough memory to allocate BO label");
> + return;
> + }
> +
> + panthor_gem_bo_set_label(bo->obj, str);
> +}
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
> index 1a363bb814f4..af0d77338860 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.h
> +++ b/drivers/gpu/drm/panthor/panthor_gem.h
> @@ -46,6 +46,20 @@ struct panthor_gem_object {
>
> /** @flags: Combination of drm_panthor_bo_flags flags. */
> u32 flags;
> +
> + /**
> + * @label: BO tagging fields. The label can be assigned within the
> + * driver itself or through a specific IOCTL.
> + */
> + struct {
> + /**
> + * @label.str: Pointer to NULL-terminated string,
> + */
> + const char *str;
> +
> + /** @lock.str: Protects access to the @label.str field. */
> + struct mutex lock;
> + } label;
> };
>
> /**
> @@ -91,6 +105,9 @@ panthor_gem_create_with_handle(struct drm_file *file,
> struct panthor_vm *exclusive_vm,
> u64 *size, u32 flags, uint32_t *handle);
>
> +void panthor_gem_bo_set_label(struct drm_gem_object *obj, const char *label);
> +void panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label);
> +
> static inline u64
> panthor_kernel_bo_gpuva(struct panthor_kernel_bo *bo)
> {
> --
> 2.48.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels
2025-04-15 19:15 ` [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels Adrián Larumbe
@ 2025-04-17 12:26 ` Boris Brezillon
0 siblings, 0 replies; 11+ messages in thread
From: Boris Brezillon @ 2025-04-17 12:26 UTC (permalink / raw)
To: Adrián Larumbe
Cc: Steven Price, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, kernel, dri-devel,
linux-kernel
On Tue, 15 Apr 2025 20:15:31 +0100
Adrián Larumbe <adrian.larumbe@collabora.com> wrote:
> +/**
> + * struct drm_panthor_bo_set_label - Arguments passed to DRM_IOCTL_PANTHOR_BO_SET_LABEL
> + */
> +struct drm_panthor_bo_set_label {
> + /** @handle: Handle of the buffer object to label. */
> + __u32 handle;
> +
Funny that this one pops up just after I fixed a missing-padding-field
issue in panthor_drm.h. We really need to tool based on pahole to
detect those before merging.
TLDR;
/** @pad: MBZ. */
__u32 pad;
> + /**
> + * @label: User pointer to a NUL-terminated string
> + *
> + * Length cannot be greater than 4096
> + */
> + __u64 label;
> +};
> +
> /**
> * DRM_IOCTL_PANTHOR() - Build a Panthor IOCTL number
> * @__access: Access type. Must be R, W or RW.
> @@ -1019,6 +1037,8 @@ enum {
> DRM_IOCTL_PANTHOR(WR, TILER_HEAP_CREATE, tiler_heap_create),
> DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY =
> DRM_IOCTL_PANTHOR(WR, TILER_HEAP_DESTROY, tiler_heap_destroy),
> + DRM_IOCTL_PANTHOR_BO_SET_LABEL =
> + DRM_IOCTL_PANTHOR(WR, BO_SET_LABEL, bo_set_label),
> };
>
> #if defined(__cplusplus)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v8 1/4] drm/panthor: Introduce BO labeling
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
` (4 preceding siblings ...)
2025-04-17 12:21 ` [PATCH v8 1/4] drm/panthor: Introduce BO labeling Liviu Dudau
@ 2025-04-17 14:24 ` Steven Price
5 siblings, 0 replies; 11+ messages in thread
From: Steven Price @ 2025-04-17 14:24 UTC (permalink / raw)
To: Adrián Larumbe, Boris Brezillon, Liviu Dudau,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter
Cc: kernel, dri-devel, linux-kernel
On 15/04/2025 20:15, Adrián Larumbe wrote:
> Add a new character string Panthor BO field, and a function that allows
> setting it from within the driver.
>
> Driver takes care of freeing the string when it's replaced or no longer
> needed at object destruction time, but allocating it is the responsibility
> of callers.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 46 +++++++++++++++++++++++++++
> drivers/gpu/drm/panthor/panthor_gem.h | 17 ++++++++++
> 2 files changed, 63 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index 8244a4e6c2a2..8dd7fa63f1ff 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -2,6 +2,7 @@
> /* Copyright 2019 Linaro, Ltd, Rob Herring <robh@kernel.org> */
> /* Copyright 2023 Collabora ltd. */
>
> +#include <linux/cleanup.h>
> #include <linux/dma-buf.h>
> #include <linux/dma-mapping.h>
> #include <linux/err.h>
> @@ -18,6 +19,14 @@ static void panthor_gem_free_object(struct drm_gem_object *obj)
> struct panthor_gem_object *bo = to_panthor_bo(obj);
> struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
>
> + /*
> + * Label might have been allocated with kstrdup_const(),
> + * we need to take that into account when freeing the memory
> + */
> + kfree_const(bo->label.str);
> +
> + mutex_destroy(&bo->label.lock);
> +
> drm_gem_free_mmap_offset(&bo->base.base);
> mutex_destroy(&bo->gpuva_list_lock);
> drm_gem_shmem_free(&bo->base);
> @@ -196,6 +205,7 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
> obj->base.map_wc = !ptdev->coherent;
> mutex_init(&obj->gpuva_list_lock);
> drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
> + mutex_init(&obj->label.lock);
>
> return &obj->base.base;
> }
> @@ -247,3 +257,39 @@ panthor_gem_create_with_handle(struct drm_file *file,
>
> return ret;
> }
> +
> +void
> +panthor_gem_bo_set_label(struct drm_gem_object *obj, const char *label)
> +{
> + struct panthor_gem_object *bo = to_panthor_bo(obj);
> + const char *old_label;
> +
> + scoped_guard(mutex, &bo->label.lock) {
> + old_label = bo->label.str;
> + bo->label.str = label;
> + }
> +
> + kfree_const(old_label);
> +}
> +
> +void
> +panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
> +{
> + const char *str;
> +
> + /* We should never attempt labelling a UM-exposed GEM object */
> + if (drm_WARN_ON(bo->obj->dev, bo->obj->handle_count > 0))
> + return;
> +
> + if (!label)
> + return;
> +
> + str = kstrdup_const(label, GFP_KERNEL);
> + if (!str) {
> + /* Failing to allocate memory for a label isn't a fatal condition */
> + drm_warn(bo->obj->dev, "Not enough memory to allocate BO label");
> + return;
> + }
> +
> + panthor_gem_bo_set_label(bo->obj, str);
> +}
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
> index 1a363bb814f4..af0d77338860 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.h
> +++ b/drivers/gpu/drm/panthor/panthor_gem.h
> @@ -46,6 +46,20 @@ struct panthor_gem_object {
>
> /** @flags: Combination of drm_panthor_bo_flags flags. */
> u32 flags;
> +
> + /**
> + * @label: BO tagging fields. The label can be assigned within the
> + * driver itself or through a specific IOCTL.
> + */
> + struct {
> + /**
> + * @label.str: Pointer to NULL-terminated string,
> + */
> + const char *str;
> +
> + /** @lock.str: Protects access to the @label.str field. */
> + struct mutex lock;
> + } label;
> };
>
> /**
> @@ -91,6 +105,9 @@ panthor_gem_create_with_handle(struct drm_file *file,
> struct panthor_vm *exclusive_vm,
> u64 *size, u32 flags, uint32_t *handle);
>
> +void panthor_gem_bo_set_label(struct drm_gem_object *obj, const char *label);
> +void panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label);
> +
> static inline u64
> panthor_kernel_bo_gpuva(struct panthor_kernel_bo *bo)
> {
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS
2025-04-15 19:15 ` [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS Adrián Larumbe
@ 2025-04-17 14:25 ` Steven Price
2025-04-17 14:46 ` Adrián Larumbe
0 siblings, 1 reply; 11+ messages in thread
From: Steven Price @ 2025-04-17 14:25 UTC (permalink / raw)
To: Adrián Larumbe, Boris Brezillon, Liviu Dudau,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Sumit Semwal, Christian König
Cc: kernel, dri-devel, linux-kernel, linux-media, linaro-mm-sig
On 15/04/2025 20:15, Adrián Larumbe wrote:
> Add a device DebugFS file that displays a complete list of all the DRM
> GEM objects that are exposed to UM through a DRM handle.
>
> Since leaking object identifiers that might belong to a different NS is
> inadmissible, this functionality is only made available in debug builds
> with DEBUGFS support enabled.
>
> File format is that of a table, with each entry displaying a variety of
> fields with information about each GEM object.
>
> Each GEM object entry in the file displays the following information
> fields: Client PID, BO's global name, reference count, BO virtual size,
> BO resize size, VM address in its DRM-managed range, BO label and a GEM
> state flags.
>
> There's also a usage flags field for the type of BO, which tells us
> whether it's a kernel BO and/or mapped onto the FW's address space.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Although I feel I have to point out the table output is much wider than
it needs to be. I'd personally like it if some of the columns were made
narrower. But I guess the idea is this is going to be read by a script
anyway.
Thanks,
Steve
> ---
> drivers/gpu/drm/panthor/panthor_device.c | 5 +
> drivers/gpu/drm/panthor/panthor_device.h | 11 ++
> drivers/gpu/drm/panthor/panthor_drv.c | 26 ++++
> drivers/gpu/drm/panthor/panthor_gem.c | 182 +++++++++++++++++++++++
> drivers/gpu/drm/panthor/panthor_gem.h | 59 ++++++++
> 5 files changed, 283 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> index a9da1d1eeb70..b776e1a2e4f3 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.c
> +++ b/drivers/gpu/drm/panthor/panthor_device.c
> @@ -184,6 +184,11 @@ int panthor_device_init(struct panthor_device *ptdev)
> if (ret)
> return ret;
>
> +#ifdef CONFIG_DEBUG_FS
> + drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
> + INIT_LIST_HEAD(&ptdev->gems.node);
> +#endif
> +
> atomic_set(&ptdev->pm.state, PANTHOR_DEVICE_PM_STATE_SUSPENDED);
> p = alloc_page(GFP_KERNEL | __GFP_ZERO);
> if (!p)
> diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
> index da6574021664..86206a961b38 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.h
> +++ b/drivers/gpu/drm/panthor/panthor_device.h
> @@ -205,6 +205,17 @@ struct panthor_device {
>
> /** @fast_rate: Maximum device clock frequency. Set by DVFS */
> unsigned long fast_rate;
> +
> +#ifdef CONFIG_DEBUG_FS
> + /** @gems: Device-wide list of GEM objects owned by at least one file. */
> + struct {
> + /** @gems.lock: Protects the device-wide list of GEM objects. */
> + struct mutex lock;
> +
> + /** @node: Used to keep track of all the device's DRM objects */
> + struct list_head node;
> + } gems;
> +#endif
> };
>
> struct panthor_gpu_usage {
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index 7660627cafa1..13f0b045c5fd 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1557,9 +1557,35 @@ static const struct file_operations panthor_drm_driver_fops = {
> };
>
> #ifdef CONFIG_DEBUG_FS
> +static int panthor_gems_show(struct seq_file *m, void *data)
> +{
> + struct drm_info_node *node = m->private;
> + struct drm_device *dev = node->minor->dev;
> + struct panthor_device *ptdev = container_of(dev, struct panthor_device, base);
> +
> + panthor_gem_debugfs_print_bos(ptdev, m);
> +
> + return 0;
> +}
> +
> +
> +static struct drm_info_list panthor_debugfs_list[] = {
> + {"gems", panthor_gems_show, 0, NULL},
> +};
> +
> +static int panthor_gems_debugfs_init(struct drm_minor *minor)
> +{
> + drm_debugfs_create_files(panthor_debugfs_list,
> + ARRAY_SIZE(panthor_debugfs_list),
> + minor->debugfs_root, minor);
> +
> + return 0;
> +}
> +
> static void panthor_debugfs_init(struct drm_minor *minor)
> {
> panthor_mmu_debugfs_init(minor);
> + panthor_gems_debugfs_init(minor);
> }
> #endif
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index 3f4ab5a2f2ae..1e3409c05891 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -11,14 +11,51 @@
> #include <drm/panthor_drm.h>
>
> #include "panthor_device.h"
> +#include "panthor_fw.h"
> #include "panthor_gem.h"
> #include "panthor_mmu.h"
>
> +#ifdef CONFIG_DEBUG_FS
> +static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
> + struct panthor_gem_object *bo)
> +{
> + INIT_LIST_HEAD(&bo->debugfs.node);
> +
> + bo->debugfs.creator.tgid = current->group_leader->pid;
> + get_task_comm(bo->debugfs.creator.process_name, current->group_leader);
> +
> + mutex_lock(&ptdev->gems.lock);
> + list_add_tail(&bo->debugfs.node, &ptdev->gems.node);
> + mutex_unlock(&ptdev->gems.lock);
> +}
> +
> +static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo)
> +{
> + struct panthor_device *ptdev = container_of(bo->base.base.dev,
> + struct panthor_device, base);
> +
> + if (list_empty(&bo->debugfs.node))
> + return;
> +
> + mutex_lock(&ptdev->gems.lock);
> + list_del_init(&bo->debugfs.node);
> + mutex_unlock(&ptdev->gems.lock);
> +}
> +
> +#else
> +static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
> + struct panthor_gem_object *bo)
> +{}
> +static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo) {}
> +#endif
> +
> static void panthor_gem_free_object(struct drm_gem_object *obj)
> {
> struct panthor_gem_object *bo = to_panthor_bo(obj);
> struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
>
> + panthor_gem_debugfs_bo_rm(bo);
> +
> /*
> * Label might have been allocated with kstrdup_const(),
> * we need to take that into account when freeing the memory
> @@ -88,6 +125,7 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> struct drm_gem_shmem_object *obj;
> struct panthor_kernel_bo *kbo;
> struct panthor_gem_object *bo;
> + u32 debug_flags = PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL;
> int ret;
>
> if (drm_WARN_ON(&ptdev->base, !vm))
> @@ -107,7 +145,11 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> kbo->obj = &obj->base;
> bo->flags = bo_flags;
>
> + if (vm == panthor_fw_vm(ptdev))
> + debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
> +
> panthor_gem_kernel_bo_set_label(kbo, name);
> + panthor_gem_debugfs_set_usage_flags(to_panthor_bo(kbo->obj), debug_flags);
>
> /* The system and GPU MMU page size might differ, which becomes a
> * problem for FW sections that need to be mapped at explicit address
> @@ -210,6 +252,8 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
> drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
> mutex_init(&obj->label.lock);
>
> + panthor_gem_debugfs_bo_add(ptdev, obj);
> +
> return &obj->base.base;
> }
>
> @@ -258,6 +302,12 @@ panthor_gem_create_with_handle(struct drm_file *file,
> /* drop reference from allocate - handle holds it now. */
> drm_gem_object_put(&shmem->base);
>
> + /*
> + * No explicit flags are needed in the call below, since the
> + * function internally sets the INITIALIZED bit for us.
> + */
> + panthor_gem_debugfs_set_usage_flags(bo, 0);
> +
> return ret;
> }
>
> @@ -296,3 +346,135 @@ panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
>
> panthor_gem_bo_set_label(bo->obj, str);
> }
> +
> +#ifdef CONFIG_DEBUG_FS
> +static void
> +panthor_gem_debugfs_format_flags(char flags_str[], int flags_len,
> + const char * const names[], u32 name_count,
> + u32 flags)
> +{
> + bool first = true;
> + int offset = 0;
> +
> +#define ACC_FLAGS(...) \
> + ({ \
> + offset += snprintf(flags_str + offset, flags_len - offset, ##__VA_ARGS__); \
> + if (offset == flags_len) \
> + return; \
> + })
> +
> + ACC_FLAGS("%c", '(');
> +
> + if (!flags)
> + ACC_FLAGS("%s", "none");
> +
> + while (flags) {
> + u32 bit = fls(flags) - 1;
> + u32 idx = bit + 1;
> +
> + if (!first)
> + ACC_FLAGS("%s", ",");
> +
> + if (idx < name_count && names[idx])
> + ACC_FLAGS("%s", names[idx]);
> +
> + first = false;
> + flags &= ~BIT(bit);
> + }
> +
> + ACC_FLAGS("%c", ')');
> +
> +#undef ACC_FLAGS
> +}
> +
> +struct gem_size_totals {
> + size_t size;
> + size_t resident;
> + size_t reclaimable;
> +};
> +
> +static void panthor_gem_debugfs_bo_print(struct panthor_gem_object *bo,
> + struct seq_file *m,
> + struct gem_size_totals *totals)
> +{
> + unsigned int refcount = kref_read(&bo->base.base.refcount);
> + char creator_info[32] = {};
> + size_t resident_size;
> + char gem_state_str[64] = {};
> + char gem_usage_str[64] = {};
> + u32 gem_usage_flags = bo->debugfs.flags & (u32)~PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
> + u32 gem_state_flags = 0;
> +
> + static const char * const gem_state_flags_names[] = {
> + [PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED] = "imported",
> + [PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED] = "exported",
> + };
> +
> + static const char * const gem_usage_flags_names[] = {
> + [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL] = "kernel",
> + [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED] = "fw-mapped",
> + };
> +
> + /* Skip BOs being destroyed. */
> + if (!refcount)
> + return;
> +
> + resident_size = bo->base.pages != NULL ? bo->base.base.size : 0;
> +
> + snprintf(creator_info, sizeof(creator_info),
> + "%s/%d", bo->debugfs.creator.process_name, bo->debugfs.creator.tgid);
> + seq_printf(m, "%-32s%-16d%-16d%-16zd%-16zd%-16lx",
> + creator_info,
> + bo->base.base.name,
> + refcount,
> + bo->base.base.size,
> + resident_size,
> + drm_vma_node_start(&bo->base.base.vma_node));
> +
> + if (bo->base.base.import_attach != NULL)
> + gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED;
> + if (bo->base.base.dma_buf != NULL)
> + gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED;
> +
> + panthor_gem_debugfs_format_flags(gem_state_str, sizeof(gem_state_str),
> + gem_state_flags_names, ARRAY_SIZE(gem_state_flags_names),
> + gem_state_flags);
> + panthor_gem_debugfs_format_flags(gem_usage_str, sizeof(gem_usage_str),
> + gem_usage_flags_names, ARRAY_SIZE(gem_usage_flags_names),
> + gem_usage_flags);
> +
> + seq_printf(m, "%-64s%-64s", gem_state_str, gem_usage_str);
> +
> + scoped_guard(mutex, &bo->label.lock) {
> + seq_printf(m, "%s", bo->label.str ? : "");
> + }
> +
> + seq_puts(m, "\n");
> +
> + totals->size += bo->base.base.size;
> + totals->resident += resident_size;
> + if (bo->base.madv > 0)
> + totals->reclaimable += resident_size;
> +}
> +
> +void panthor_gem_debugfs_print_bos(struct panthor_device *ptdev,
> + struct seq_file *m)
> +{
> + struct gem_size_totals totals = {0};
> + struct panthor_gem_object *bo;
> +
> + seq_puts(m, "created-by global-name refcount size resident-size file-offset state usage label\n");
> + seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
> +
> + scoped_guard(mutex, &ptdev->gems.lock) {
> + list_for_each_entry(bo, &ptdev->gems.node, debugfs.node) {
> + if (bo->debugfs.flags & PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED)
> + panthor_gem_debugfs_bo_print(bo, m, &totals);
> + }
> + }
> +
> + seq_puts(m, "=====================================================================================================================================================================================================================================================\n");
> + seq_printf(m, "Total size: %zd, Total resident: %zd, Total reclaimable: %zd\n",
> + totals.size, totals.resident, totals.reclaimable);
> +}
> +#endif
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
> index 3c09af568e47..94b244f0540e 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.h
> +++ b/drivers/gpu/drm/panthor/panthor_gem.h
> @@ -15,6 +15,48 @@ struct panthor_vm;
>
> #define PANTHOR_BO_LABEL_MAXLEN 4096
>
> +enum panthor_debugfs_gem_state_flags {
> + /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED: GEM BO is PRIME imported. */
> + PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED = BIT(0),
> +
> + /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED: GEM BO is PRIME exported. */
> + PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED = BIT(1),
> +};
> +
> +enum panthor_debugfs_gem_usage_flags {
> + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL: BO is for kernel use only. */
> + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL = BIT(0),
> +
> + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED: BO is mapped on the FW VM. */
> + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED = BIT(1),
> +
> + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED: BO is ready for DebugFS display. */
> + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED = BIT(31),
> +};
> +
> +/**
> + * struct panthor_gem_debugfs - GEM object's DebugFS list information
> + */
> +struct panthor_gem_debugfs {
> + /**
> + * @node: Node used to insert the object in the device-wide list of
> + * GEM objects, to display information about it through a DebugFS file.
> + */
> + struct list_head node;
> +
> + /** @creator: Information about the UM process which created the GEM. */
> + struct {
> + /** @creator.process_name: Group leader name in owning thread's process */
> + char process_name[TASK_COMM_LEN];
> +
> + /** @creator.tgid: PID of the thread's group leader within its process */
> + pid_t tgid;
> + } creator;
> +
> + /** @flags: Combination of panthor_debugfs_gem_usage_flags flags */
> + u32 flags;
> +};
> +
> /**
> * struct panthor_gem_object - Driver specific GEM object.
> */
> @@ -62,6 +104,10 @@ struct panthor_gem_object {
> /** @lock.str: Protects access to the @label.str field. */
> struct mutex lock;
> } label;
> +
> +#ifdef CONFIG_DEBUG_FS
> + struct panthor_gem_debugfs debugfs;
> +#endif
> };
>
> /**
> @@ -157,4 +203,17 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
>
> void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo);
>
> +#ifdef CONFIG_DEBUG_FS
> +void panthor_gem_debugfs_print_bos(struct panthor_device *pfdev,
> + struct seq_file *m);
> +static inline void
> +panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags)
> +{
> + bo->debugfs.flags = usage_flags | PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
> +}
> +
> +#else
> +void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) {};
> +#endif
> +
> #endif /* __PANTHOR_GEM_H__ */
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS
2025-04-17 14:25 ` Steven Price
@ 2025-04-17 14:46 ` Adrián Larumbe
2025-04-17 15:06 ` Steven Price
0 siblings, 1 reply; 11+ messages in thread
From: Adrián Larumbe @ 2025-04-17 14:46 UTC (permalink / raw)
To: Steven Price
Cc: Boris Brezillon, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Sumit Semwal,
Christian König, kernel, dri-devel, linux-kernel,
linux-media, linaro-mm-sig
Hi Steve,
On 17.04.2025 15:25, Steven Price wrote:
> On 15/04/2025 20:15, Adrián Larumbe wrote:
> > Add a device DebugFS file that displays a complete list of all the DRM
> > GEM objects that are exposed to UM through a DRM handle.
> >
> > Since leaking object identifiers that might belong to a different NS is
> > inadmissible, this functionality is only made available in debug builds
> > with DEBUGFS support enabled.
> >
> > File format is that of a table, with each entry displaying a variety of
> > fields with information about each GEM object.
> >
> > Each GEM object entry in the file displays the following information
> > fields: Client PID, BO's global name, reference count, BO virtual size,
> > BO resize size, VM address in its DRM-managed range, BO label and a GEM
> > state flags.
> >
> > There's also a usage flags field for the type of BO, which tells us
> > whether it's a kernel BO and/or mapped onto the FW's address space.
> >
> > Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> > Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>
> Reviewed-by: Steven Price <steven.price@arm.com>
>
> Although I feel I have to point out the table output is much wider than
> it needs to be. I'd personally like it if some of the columns were made
> narrower. But I guess the idea is this is going to be read by a script
> anyway.
In a previous revision, table format was a lot tighter, but Boris
pointed out the number of BO flags might increase in the future, so in
order to save ourselves some headache form having to reformat
everything, it was best to give those fields some extra padding even if
that means BO label spans over the usual screen width.
> Thanks,
> Steve
>
> > ---
> > drivers/gpu/drm/panthor/panthor_device.c | 5 +
> > drivers/gpu/drm/panthor/panthor_device.h | 11 ++
> > drivers/gpu/drm/panthor/panthor_drv.c | 26 ++++
> > drivers/gpu/drm/panthor/panthor_gem.c | 182 +++++++++++++++++++++++
> > drivers/gpu/drm/panthor/panthor_gem.h | 59 ++++++++
> > 5 files changed, 283 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> > index a9da1d1eeb70..b776e1a2e4f3 100644
> > --- a/drivers/gpu/drm/panthor/panthor_device.c
> > +++ b/drivers/gpu/drm/panthor/panthor_device.c
> > @@ -184,6 +184,11 @@ int panthor_device_init(struct panthor_device *ptdev)
> > if (ret)
> > return ret;
> >
> > +#ifdef CONFIG_DEBUG_FS
> > + drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
> > + INIT_LIST_HEAD(&ptdev->gems.node);
> > +#endif
> > +
> > atomic_set(&ptdev->pm.state, PANTHOR_DEVICE_PM_STATE_SUSPENDED);
> > p = alloc_page(GFP_KERNEL | __GFP_ZERO);
> > if (!p)
> > diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
> > index da6574021664..86206a961b38 100644
> > --- a/drivers/gpu/drm/panthor/panthor_device.h
> > +++ b/drivers/gpu/drm/panthor/panthor_device.h
> > @@ -205,6 +205,17 @@ struct panthor_device {
> >
> > /** @fast_rate: Maximum device clock frequency. Set by DVFS */
> > unsigned long fast_rate;
> > +
> > +#ifdef CONFIG_DEBUG_FS
> > + /** @gems: Device-wide list of GEM objects owned by at least one file. */
> > + struct {
> > + /** @gems.lock: Protects the device-wide list of GEM objects. */
> > + struct mutex lock;
> > +
> > + /** @node: Used to keep track of all the device's DRM objects */
> > + struct list_head node;
> > + } gems;
> > +#endif
> > };
> >
> > struct panthor_gpu_usage {
> > diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> > index 7660627cafa1..13f0b045c5fd 100644
> > --- a/drivers/gpu/drm/panthor/panthor_drv.c
> > +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> > @@ -1557,9 +1557,35 @@ static const struct file_operations panthor_drm_driver_fops = {
> > };
> >
> > #ifdef CONFIG_DEBUG_FS
> > +static int panthor_gems_show(struct seq_file *m, void *data)
> > +{
> > + struct drm_info_node *node = m->private;
> > + struct drm_device *dev = node->minor->dev;
> > + struct panthor_device *ptdev = container_of(dev, struct panthor_device, base);
> > +
> > + panthor_gem_debugfs_print_bos(ptdev, m);
> > +
> > + return 0;
> > +}
> > +
> > +
> > +static struct drm_info_list panthor_debugfs_list[] = {
> > + {"gems", panthor_gems_show, 0, NULL},
> > +};
> > +
> > +static int panthor_gems_debugfs_init(struct drm_minor *minor)
> > +{
> > + drm_debugfs_create_files(panthor_debugfs_list,
> > + ARRAY_SIZE(panthor_debugfs_list),
> > + minor->debugfs_root, minor);
> > +
> > + return 0;
> > +}
> > +
> > static void panthor_debugfs_init(struct drm_minor *minor)
> > {
> > panthor_mmu_debugfs_init(minor);
> > + panthor_gems_debugfs_init(minor);
> > }
> > #endif
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> > index 3f4ab5a2f2ae..1e3409c05891 100644
> > --- a/drivers/gpu/drm/panthor/panthor_gem.c
> > +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> > @@ -11,14 +11,51 @@
> > #include <drm/panthor_drm.h>
> >
> > #include "panthor_device.h"
> > +#include "panthor_fw.h"
> > #include "panthor_gem.h"
> > #include "panthor_mmu.h"
> >
> > +#ifdef CONFIG_DEBUG_FS
> > +static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
> > + struct panthor_gem_object *bo)
> > +{
> > + INIT_LIST_HEAD(&bo->debugfs.node);
> > +
> > + bo->debugfs.creator.tgid = current->group_leader->pid;
> > + get_task_comm(bo->debugfs.creator.process_name, current->group_leader);
> > +
> > + mutex_lock(&ptdev->gems.lock);
> > + list_add_tail(&bo->debugfs.node, &ptdev->gems.node);
> > + mutex_unlock(&ptdev->gems.lock);
> > +}
> > +
> > +static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo)
> > +{
> > + struct panthor_device *ptdev = container_of(bo->base.base.dev,
> > + struct panthor_device, base);
> > +
> > + if (list_empty(&bo->debugfs.node))
> > + return;
> > +
> > + mutex_lock(&ptdev->gems.lock);
> > + list_del_init(&bo->debugfs.node);
> > + mutex_unlock(&ptdev->gems.lock);
> > +}
> > +
> > +#else
> > +static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
> > + struct panthor_gem_object *bo)
> > +{}
> > +static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo) {}
> > +#endif
> > +
> > static void panthor_gem_free_object(struct drm_gem_object *obj)
> > {
> > struct panthor_gem_object *bo = to_panthor_bo(obj);
> > struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
> >
> > + panthor_gem_debugfs_bo_rm(bo);
> > +
> > /*
> > * Label might have been allocated with kstrdup_const(),
> > * we need to take that into account when freeing the memory
> > @@ -88,6 +125,7 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> > struct drm_gem_shmem_object *obj;
> > struct panthor_kernel_bo *kbo;
> > struct panthor_gem_object *bo;
> > + u32 debug_flags = PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL;
> > int ret;
> >
> > if (drm_WARN_ON(&ptdev->base, !vm))
> > @@ -107,7 +145,11 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> > kbo->obj = &obj->base;
> > bo->flags = bo_flags;
> >
> > + if (vm == panthor_fw_vm(ptdev))
> > + debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
> > +
> > panthor_gem_kernel_bo_set_label(kbo, name);
> > + panthor_gem_debugfs_set_usage_flags(to_panthor_bo(kbo->obj), debug_flags);
> >
> > /* The system and GPU MMU page size might differ, which becomes a
> > * problem for FW sections that need to be mapped at explicit address
> > @@ -210,6 +252,8 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
> > drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
> > mutex_init(&obj->label.lock);
> >
> > + panthor_gem_debugfs_bo_add(ptdev, obj);
> > +
> > return &obj->base.base;
> > }
> >
> > @@ -258,6 +302,12 @@ panthor_gem_create_with_handle(struct drm_file *file,
> > /* drop reference from allocate - handle holds it now. */
> > drm_gem_object_put(&shmem->base);
> >
> > + /*
> > + * No explicit flags are needed in the call below, since the
> > + * function internally sets the INITIALIZED bit for us.
> > + */
> > + panthor_gem_debugfs_set_usage_flags(bo, 0);
> > +
> > return ret;
> > }
> >
> > @@ -296,3 +346,135 @@ panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
> >
> > panthor_gem_bo_set_label(bo->obj, str);
> > }
> > +
> > +#ifdef CONFIG_DEBUG_FS
> > +static void
> > +panthor_gem_debugfs_format_flags(char flags_str[], int flags_len,
> > + const char * const names[], u32 name_count,
> > + u32 flags)
> > +{
> > + bool first = true;
> > + int offset = 0;
> > +
> > +#define ACC_FLAGS(...) \
> > + ({ \
> > + offset += snprintf(flags_str + offset, flags_len - offset, ##__VA_ARGS__); \
> > + if (offset == flags_len) \
> > + return; \
> > + })
> > +
> > + ACC_FLAGS("%c", '(');
> > +
> > + if (!flags)
> > + ACC_FLAGS("%s", "none");
> > +
> > + while (flags) {
> > + u32 bit = fls(flags) - 1;
> > + u32 idx = bit + 1;
> > +
> > + if (!first)
> > + ACC_FLAGS("%s", ",");
> > +
> > + if (idx < name_count && names[idx])
> > + ACC_FLAGS("%s", names[idx]);
> > +
> > + first = false;
> > + flags &= ~BIT(bit);
> > + }
> > +
> > + ACC_FLAGS("%c", ')');
> > +
> > +#undef ACC_FLAGS
> > +}
> > +
> > +struct gem_size_totals {
> > + size_t size;
> > + size_t resident;
> > + size_t reclaimable;
> > +};
> > +
> > +static void panthor_gem_debugfs_bo_print(struct panthor_gem_object *bo,
> > + struct seq_file *m,
> > + struct gem_size_totals *totals)
> > +{
> > + unsigned int refcount = kref_read(&bo->base.base.refcount);
> > + char creator_info[32] = {};
> > + size_t resident_size;
> > + char gem_state_str[64] = {};
> > + char gem_usage_str[64] = {};
> > + u32 gem_usage_flags = bo->debugfs.flags & (u32)~PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
> > + u32 gem_state_flags = 0;
> > +
> > + static const char * const gem_state_flags_names[] = {
> > + [PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED] = "imported",
> > + [PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED] = "exported",
> > + };
> > +
> > + static const char * const gem_usage_flags_names[] = {
> > + [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL] = "kernel",
> > + [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED] = "fw-mapped",
> > + };
> > +
> > + /* Skip BOs being destroyed. */
> > + if (!refcount)
> > + return;
> > +
> > + resident_size = bo->base.pages != NULL ? bo->base.base.size : 0;
> > +
> > + snprintf(creator_info, sizeof(creator_info),
> > + "%s/%d", bo->debugfs.creator.process_name, bo->debugfs.creator.tgid);
> > + seq_printf(m, "%-32s%-16d%-16d%-16zd%-16zd%-16lx",
> > + creator_info,
> > + bo->base.base.name,
> > + refcount,
> > + bo->base.base.size,
> > + resident_size,
> > + drm_vma_node_start(&bo->base.base.vma_node));
> > +
> > + if (bo->base.base.import_attach != NULL)
> > + gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED;
> > + if (bo->base.base.dma_buf != NULL)
> > + gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED;
> > +
> > + panthor_gem_debugfs_format_flags(gem_state_str, sizeof(gem_state_str),
> > + gem_state_flags_names, ARRAY_SIZE(gem_state_flags_names),
> > + gem_state_flags);
> > + panthor_gem_debugfs_format_flags(gem_usage_str, sizeof(gem_usage_str),
> > + gem_usage_flags_names, ARRAY_SIZE(gem_usage_flags_names),
> > + gem_usage_flags);
> > +
> > + seq_printf(m, "%-64s%-64s", gem_state_str, gem_usage_str);
> > +
> > + scoped_guard(mutex, &bo->label.lock) {
> > + seq_printf(m, "%s", bo->label.str ? : "");
> > + }
> > +
> > + seq_puts(m, "\n");
> > +
> > + totals->size += bo->base.base.size;
> > + totals->resident += resident_size;
> > + if (bo->base.madv > 0)
> > + totals->reclaimable += resident_size;
> > +}
> > +
> > +void panthor_gem_debugfs_print_bos(struct panthor_device *ptdev,
> > + struct seq_file *m)
> > +{
> > + struct gem_size_totals totals = {0};
> > + struct panthor_gem_object *bo;
> > +
> > + seq_puts(m, "created-by global-name refcount size resident-size file-offset state usage label\n");
> > + seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
> > +
> > + scoped_guard(mutex, &ptdev->gems.lock) {
> > + list_for_each_entry(bo, &ptdev->gems.node, debugfs.node) {
> > + if (bo->debugfs.flags & PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED)
> > + panthor_gem_debugfs_bo_print(bo, m, &totals);
> > + }
> > + }
> > +
> > + seq_puts(m, "=====================================================================================================================================================================================================================================================\n");
> > + seq_printf(m, "Total size: %zd, Total resident: %zd, Total reclaimable: %zd\n",
> > + totals.size, totals.resident, totals.reclaimable);
> > +}
> > +#endif
> > diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
> > index 3c09af568e47..94b244f0540e 100644
> > --- a/drivers/gpu/drm/panthor/panthor_gem.h
> > +++ b/drivers/gpu/drm/panthor/panthor_gem.h
> > @@ -15,6 +15,48 @@ struct panthor_vm;
> >
> > #define PANTHOR_BO_LABEL_MAXLEN 4096
> >
> > +enum panthor_debugfs_gem_state_flags {
> > + /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED: GEM BO is PRIME imported. */
> > + PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED = BIT(0),
> > +
> > + /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED: GEM BO is PRIME exported. */
> > + PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED = BIT(1),
> > +};
> > +
> > +enum panthor_debugfs_gem_usage_flags {
> > + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL: BO is for kernel use only. */
> > + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL = BIT(0),
> > +
> > + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED: BO is mapped on the FW VM. */
> > + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED = BIT(1),
> > +
> > + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED: BO is ready for DebugFS display. */
> > + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED = BIT(31),
> > +};
> > +
> > +/**
> > + * struct panthor_gem_debugfs - GEM object's DebugFS list information
> > + */
> > +struct panthor_gem_debugfs {
> > + /**
> > + * @node: Node used to insert the object in the device-wide list of
> > + * GEM objects, to display information about it through a DebugFS file.
> > + */
> > + struct list_head node;
> > +
> > + /** @creator: Information about the UM process which created the GEM. */
> > + struct {
> > + /** @creator.process_name: Group leader name in owning thread's process */
> > + char process_name[TASK_COMM_LEN];
> > +
> > + /** @creator.tgid: PID of the thread's group leader within its process */
> > + pid_t tgid;
> > + } creator;
> > +
> > + /** @flags: Combination of panthor_debugfs_gem_usage_flags flags */
> > + u32 flags;
> > +};
> > +
> > /**
> > * struct panthor_gem_object - Driver specific GEM object.
> > */
> > @@ -62,6 +104,10 @@ struct panthor_gem_object {
> > /** @lock.str: Protects access to the @label.str field. */
> > struct mutex lock;
> > } label;
> > +
> > +#ifdef CONFIG_DEBUG_FS
> > + struct panthor_gem_debugfs debugfs;
> > +#endif
> > };
> >
> > /**
> > @@ -157,4 +203,17 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> >
> > void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo);
> >
> > +#ifdef CONFIG_DEBUG_FS
> > +void panthor_gem_debugfs_print_bos(struct panthor_device *pfdev,
> > + struct seq_file *m);
> > +static inline void
> > +panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags)
> > +{
> > + bo->debugfs.flags = usage_flags | PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
> > +}
> > +
> > +#else
> > +void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) {};
> > +#endif
> > +
> > #endif /* __PANTHOR_GEM_H__ */
Adrian Larumbe
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS
2025-04-17 14:46 ` Adrián Larumbe
@ 2025-04-17 15:06 ` Steven Price
0 siblings, 0 replies; 11+ messages in thread
From: Steven Price @ 2025-04-17 15:06 UTC (permalink / raw)
To: Adrián Larumbe
Cc: Boris Brezillon, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Sumit Semwal,
Christian König, kernel, dri-devel, linux-kernel,
linux-media, linaro-mm-sig
On 17/04/2025 15:46, Adrián Larumbe wrote:
> Hi Steve,
>
> On 17.04.2025 15:25, Steven Price wrote:
>> On 15/04/2025 20:15, Adrián Larumbe wrote:
>>> Add a device DebugFS file that displays a complete list of all the DRM
>>> GEM objects that are exposed to UM through a DRM handle.
>>>
>>> Since leaking object identifiers that might belong to a different NS is
>>> inadmissible, this functionality is only made available in debug builds
>>> with DEBUGFS support enabled.
>>>
>>> File format is that of a table, with each entry displaying a variety of
>>> fields with information about each GEM object.
>>>
>>> Each GEM object entry in the file displays the following information
>>> fields: Client PID, BO's global name, reference count, BO virtual size,
>>> BO resize size, VM address in its DRM-managed range, BO label and a GEM
>>> state flags.
>>>
>>> There's also a usage flags field for the type of BO, which tells us
>>> whether it's a kernel BO and/or mapped onto the FW's address space.
>>>
>>> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
>>> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
>>> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>>
>> Reviewed-by: Steven Price <steven.price@arm.com>
>>
>> Although I feel I have to point out the table output is much wider than
>> it needs to be. I'd personally like it if some of the columns were made
>> narrower. But I guess the idea is this is going to be read by a script
>> anyway.
>
> In a previous revision, table format was a lot tighter, but Boris
> pointed out the number of BO flags might increase in the future, so in
> order to save ourselves some headache form having to reformat
> everything, it was best to give those fields some extra padding even if
> that means BO label spans over the usual screen width.
Yeah, fair enough. It's always awkward with this sorts of interfaces.
Outputting something very machine readable (e.g. JSON) would be good for
scripts, but then it's terrible as a quick debugging aid. I'll just cook
up a simple script to reformat it to something I like ;)
Thanks,
Steve
>> Thanks,
>> Steve
>>
>>> ---
>>> drivers/gpu/drm/panthor/panthor_device.c | 5 +
>>> drivers/gpu/drm/panthor/panthor_device.h | 11 ++
>>> drivers/gpu/drm/panthor/panthor_drv.c | 26 ++++
>>> drivers/gpu/drm/panthor/panthor_gem.c | 182 +++++++++++++++++++++++
>>> drivers/gpu/drm/panthor/panthor_gem.h | 59 ++++++++
>>> 5 files changed, 283 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
>>> index a9da1d1eeb70..b776e1a2e4f3 100644
>>> --- a/drivers/gpu/drm/panthor/panthor_device.c
>>> +++ b/drivers/gpu/drm/panthor/panthor_device.c
>>> @@ -184,6 +184,11 @@ int panthor_device_init(struct panthor_device *ptdev)
>>> if (ret)
>>> return ret;
>>>
>>> +#ifdef CONFIG_DEBUG_FS
>>> + drmm_mutex_init(&ptdev->base, &ptdev->gems.lock);
>>> + INIT_LIST_HEAD(&ptdev->gems.node);
>>> +#endif
>>> +
>>> atomic_set(&ptdev->pm.state, PANTHOR_DEVICE_PM_STATE_SUSPENDED);
>>> p = alloc_page(GFP_KERNEL | __GFP_ZERO);
>>> if (!p)
>>> diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
>>> index da6574021664..86206a961b38 100644
>>> --- a/drivers/gpu/drm/panthor/panthor_device.h
>>> +++ b/drivers/gpu/drm/panthor/panthor_device.h
>>> @@ -205,6 +205,17 @@ struct panthor_device {
>>>
>>> /** @fast_rate: Maximum device clock frequency. Set by DVFS */
>>> unsigned long fast_rate;
>>> +
>>> +#ifdef CONFIG_DEBUG_FS
>>> + /** @gems: Device-wide list of GEM objects owned by at least one file. */
>>> + struct {
>>> + /** @gems.lock: Protects the device-wide list of GEM objects. */
>>> + struct mutex lock;
>>> +
>>> + /** @node: Used to keep track of all the device's DRM objects */
>>> + struct list_head node;
>>> + } gems;
>>> +#endif
>>> };
>>>
>>> struct panthor_gpu_usage {
>>> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
>>> index 7660627cafa1..13f0b045c5fd 100644
>>> --- a/drivers/gpu/drm/panthor/panthor_drv.c
>>> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
>>> @@ -1557,9 +1557,35 @@ static const struct file_operations panthor_drm_driver_fops = {
>>> };
>>>
>>> #ifdef CONFIG_DEBUG_FS
>>> +static int panthor_gems_show(struct seq_file *m, void *data)
>>> +{
>>> + struct drm_info_node *node = m->private;
>>> + struct drm_device *dev = node->minor->dev;
>>> + struct panthor_device *ptdev = container_of(dev, struct panthor_device, base);
>>> +
>>> + panthor_gem_debugfs_print_bos(ptdev, m);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +
>>> +static struct drm_info_list panthor_debugfs_list[] = {
>>> + {"gems", panthor_gems_show, 0, NULL},
>>> +};
>>> +
>>> +static int panthor_gems_debugfs_init(struct drm_minor *minor)
>>> +{
>>> + drm_debugfs_create_files(panthor_debugfs_list,
>>> + ARRAY_SIZE(panthor_debugfs_list),
>>> + minor->debugfs_root, minor);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> static void panthor_debugfs_init(struct drm_minor *minor)
>>> {
>>> panthor_mmu_debugfs_init(minor);
>>> + panthor_gems_debugfs_init(minor);
>>> }
>>> #endif
>>>
>>> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
>>> index 3f4ab5a2f2ae..1e3409c05891 100644
>>> --- a/drivers/gpu/drm/panthor/panthor_gem.c
>>> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
>>> @@ -11,14 +11,51 @@
>>> #include <drm/panthor_drm.h>
>>>
>>> #include "panthor_device.h"
>>> +#include "panthor_fw.h"
>>> #include "panthor_gem.h"
>>> #include "panthor_mmu.h"
>>>
>>> +#ifdef CONFIG_DEBUG_FS
>>> +static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
>>> + struct panthor_gem_object *bo)
>>> +{
>>> + INIT_LIST_HEAD(&bo->debugfs.node);
>>> +
>>> + bo->debugfs.creator.tgid = current->group_leader->pid;
>>> + get_task_comm(bo->debugfs.creator.process_name, current->group_leader);
>>> +
>>> + mutex_lock(&ptdev->gems.lock);
>>> + list_add_tail(&bo->debugfs.node, &ptdev->gems.node);
>>> + mutex_unlock(&ptdev->gems.lock);
>>> +}
>>> +
>>> +static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo)
>>> +{
>>> + struct panthor_device *ptdev = container_of(bo->base.base.dev,
>>> + struct panthor_device, base);
>>> +
>>> + if (list_empty(&bo->debugfs.node))
>>> + return;
>>> +
>>> + mutex_lock(&ptdev->gems.lock);
>>> + list_del_init(&bo->debugfs.node);
>>> + mutex_unlock(&ptdev->gems.lock);
>>> +}
>>> +
>>> +#else
>>> +static void panthor_gem_debugfs_bo_add(struct panthor_device *ptdev,
>>> + struct panthor_gem_object *bo)
>>> +{}
>>> +static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo) {}
>>> +#endif
>>> +
>>> static void panthor_gem_free_object(struct drm_gem_object *obj)
>>> {
>>> struct panthor_gem_object *bo = to_panthor_bo(obj);
>>> struct drm_gem_object *vm_root_gem = bo->exclusive_vm_root_gem;
>>>
>>> + panthor_gem_debugfs_bo_rm(bo);
>>> +
>>> /*
>>> * Label might have been allocated with kstrdup_const(),
>>> * we need to take that into account when freeing the memory
>>> @@ -88,6 +125,7 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
>>> struct drm_gem_shmem_object *obj;
>>> struct panthor_kernel_bo *kbo;
>>> struct panthor_gem_object *bo;
>>> + u32 debug_flags = PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL;
>>> int ret;
>>>
>>> if (drm_WARN_ON(&ptdev->base, !vm))
>>> @@ -107,7 +145,11 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
>>> kbo->obj = &obj->base;
>>> bo->flags = bo_flags;
>>>
>>> + if (vm == panthor_fw_vm(ptdev))
>>> + debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
>>> +
>>> panthor_gem_kernel_bo_set_label(kbo, name);
>>> + panthor_gem_debugfs_set_usage_flags(to_panthor_bo(kbo->obj), debug_flags);
>>>
>>> /* The system and GPU MMU page size might differ, which becomes a
>>> * problem for FW sections that need to be mapped at explicit address
>>> @@ -210,6 +252,8 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t
>>> drm_gem_gpuva_set_lock(&obj->base.base, &obj->gpuva_list_lock);
>>> mutex_init(&obj->label.lock);
>>>
>>> + panthor_gem_debugfs_bo_add(ptdev, obj);
>>> +
>>> return &obj->base.base;
>>> }
>>>
>>> @@ -258,6 +302,12 @@ panthor_gem_create_with_handle(struct drm_file *file,
>>> /* drop reference from allocate - handle holds it now. */
>>> drm_gem_object_put(&shmem->base);
>>>
>>> + /*
>>> + * No explicit flags are needed in the call below, since the
>>> + * function internally sets the INITIALIZED bit for us.
>>> + */
>>> + panthor_gem_debugfs_set_usage_flags(bo, 0);
>>> +
>>> return ret;
>>> }
>>>
>>> @@ -296,3 +346,135 @@ panthor_gem_kernel_bo_set_label(struct panthor_kernel_bo *bo, const char *label)
>>>
>>> panthor_gem_bo_set_label(bo->obj, str);
>>> }
>>> +
>>> +#ifdef CONFIG_DEBUG_FS
>>> +static void
>>> +panthor_gem_debugfs_format_flags(char flags_str[], int flags_len,
>>> + const char * const names[], u32 name_count,
>>> + u32 flags)
>>> +{
>>> + bool first = true;
>>> + int offset = 0;
>>> +
>>> +#define ACC_FLAGS(...) \
>>> + ({ \
>>> + offset += snprintf(flags_str + offset, flags_len - offset, ##__VA_ARGS__); \
>>> + if (offset == flags_len) \
>>> + return; \
>>> + })
>>> +
>>> + ACC_FLAGS("%c", '(');
>>> +
>>> + if (!flags)
>>> + ACC_FLAGS("%s", "none");
>>> +
>>> + while (flags) {
>>> + u32 bit = fls(flags) - 1;
>>> + u32 idx = bit + 1;
>>> +
>>> + if (!first)
>>> + ACC_FLAGS("%s", ",");
>>> +
>>> + if (idx < name_count && names[idx])
>>> + ACC_FLAGS("%s", names[idx]);
>>> +
>>> + first = false;
>>> + flags &= ~BIT(bit);
>>> + }
>>> +
>>> + ACC_FLAGS("%c", ')');
>>> +
>>> +#undef ACC_FLAGS
>>> +}
>>> +
>>> +struct gem_size_totals {
>>> + size_t size;
>>> + size_t resident;
>>> + size_t reclaimable;
>>> +};
>>> +
>>> +static void panthor_gem_debugfs_bo_print(struct panthor_gem_object *bo,
>>> + struct seq_file *m,
>>> + struct gem_size_totals *totals)
>>> +{
>>> + unsigned int refcount = kref_read(&bo->base.base.refcount);
>>> + char creator_info[32] = {};
>>> + size_t resident_size;
>>> + char gem_state_str[64] = {};
>>> + char gem_usage_str[64] = {};
>>> + u32 gem_usage_flags = bo->debugfs.flags & (u32)~PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
>>> + u32 gem_state_flags = 0;
>>> +
>>> + static const char * const gem_state_flags_names[] = {
>>> + [PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED] = "imported",
>>> + [PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED] = "exported",
>>> + };
>>> +
>>> + static const char * const gem_usage_flags_names[] = {
>>> + [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL] = "kernel",
>>> + [PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED] = "fw-mapped",
>>> + };
>>> +
>>> + /* Skip BOs being destroyed. */
>>> + if (!refcount)
>>> + return;
>>> +
>>> + resident_size = bo->base.pages != NULL ? bo->base.base.size : 0;
>>> +
>>> + snprintf(creator_info, sizeof(creator_info),
>>> + "%s/%d", bo->debugfs.creator.process_name, bo->debugfs.creator.tgid);
>>> + seq_printf(m, "%-32s%-16d%-16d%-16zd%-16zd%-16lx",
>>> + creator_info,
>>> + bo->base.base.name,
>>> + refcount,
>>> + bo->base.base.size,
>>> + resident_size,
>>> + drm_vma_node_start(&bo->base.base.vma_node));
>>> +
>>> + if (bo->base.base.import_attach != NULL)
>>> + gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED;
>>> + if (bo->base.base.dma_buf != NULL)
>>> + gem_state_flags |= PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED;
>>> +
>>> + panthor_gem_debugfs_format_flags(gem_state_str, sizeof(gem_state_str),
>>> + gem_state_flags_names, ARRAY_SIZE(gem_state_flags_names),
>>> + gem_state_flags);
>>> + panthor_gem_debugfs_format_flags(gem_usage_str, sizeof(gem_usage_str),
>>> + gem_usage_flags_names, ARRAY_SIZE(gem_usage_flags_names),
>>> + gem_usage_flags);
>>> +
>>> + seq_printf(m, "%-64s%-64s", gem_state_str, gem_usage_str);
>>> +
>>> + scoped_guard(mutex, &bo->label.lock) {
>>> + seq_printf(m, "%s", bo->label.str ? : "");
>>> + }
>>> +
>>> + seq_puts(m, "\n");
>>> +
>>> + totals->size += bo->base.base.size;
>>> + totals->resident += resident_size;
>>> + if (bo->base.madv > 0)
>>> + totals->reclaimable += resident_size;
>>> +}
>>> +
>>> +void panthor_gem_debugfs_print_bos(struct panthor_device *ptdev,
>>> + struct seq_file *m)
>>> +{
>>> + struct gem_size_totals totals = {0};
>>> + struct panthor_gem_object *bo;
>>> +
>>> + seq_puts(m, "created-by global-name refcount size resident-size file-offset state usage label\n");
>>> + seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n");
>>> +
>>> + scoped_guard(mutex, &ptdev->gems.lock) {
>>> + list_for_each_entry(bo, &ptdev->gems.node, debugfs.node) {
>>> + if (bo->debugfs.flags & PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED)
>>> + panthor_gem_debugfs_bo_print(bo, m, &totals);
>>> + }
>>> + }
>>> +
>>> + seq_puts(m, "=====================================================================================================================================================================================================================================================\n");
>>> + seq_printf(m, "Total size: %zd, Total resident: %zd, Total reclaimable: %zd\n",
>>> + totals.size, totals.resident, totals.reclaimable);
>>> +}
>>> +#endif
>>> diff --git a/drivers/gpu/drm/panthor/panthor_gem.h b/drivers/gpu/drm/panthor/panthor_gem.h
>>> index 3c09af568e47..94b244f0540e 100644
>>> --- a/drivers/gpu/drm/panthor/panthor_gem.h
>>> +++ b/drivers/gpu/drm/panthor/panthor_gem.h
>>> @@ -15,6 +15,48 @@ struct panthor_vm;
>>>
>>> #define PANTHOR_BO_LABEL_MAXLEN 4096
>>>
>>> +enum panthor_debugfs_gem_state_flags {
>>> + /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED: GEM BO is PRIME imported. */
>>> + PANTHOR_DEBUGFS_GEM_STATE_FLAG_IMPORTED = BIT(0),
>>> +
>>> + /** @PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED: GEM BO is PRIME exported. */
>>> + PANTHOR_DEBUGFS_GEM_STATE_FLAG_EXPORTED = BIT(1),
>>> +};
>>> +
>>> +enum panthor_debugfs_gem_usage_flags {
>>> + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL: BO is for kernel use only. */
>>> + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_KERNEL = BIT(0),
>>> +
>>> + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED: BO is mapped on the FW VM. */
>>> + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED = BIT(1),
>>> +
>>> + /** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED: BO is ready for DebugFS display. */
>>> + PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED = BIT(31),
>>> +};
>>> +
>>> +/**
>>> + * struct panthor_gem_debugfs - GEM object's DebugFS list information
>>> + */
>>> +struct panthor_gem_debugfs {
>>> + /**
>>> + * @node: Node used to insert the object in the device-wide list of
>>> + * GEM objects, to display information about it through a DebugFS file.
>>> + */
>>> + struct list_head node;
>>> +
>>> + /** @creator: Information about the UM process which created the GEM. */
>>> + struct {
>>> + /** @creator.process_name: Group leader name in owning thread's process */
>>> + char process_name[TASK_COMM_LEN];
>>> +
>>> + /** @creator.tgid: PID of the thread's group leader within its process */
>>> + pid_t tgid;
>>> + } creator;
>>> +
>>> + /** @flags: Combination of panthor_debugfs_gem_usage_flags flags */
>>> + u32 flags;
>>> +};
>>> +
>>> /**
>>> * struct panthor_gem_object - Driver specific GEM object.
>>> */
>>> @@ -62,6 +104,10 @@ struct panthor_gem_object {
>>> /** @lock.str: Protects access to the @label.str field. */
>>> struct mutex lock;
>>> } label;
>>> +
>>> +#ifdef CONFIG_DEBUG_FS
>>> + struct panthor_gem_debugfs debugfs;
>>> +#endif
>>> };
>>>
>>> /**
>>> @@ -157,4 +203,17 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
>>>
>>> void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo);
>>>
>>> +#ifdef CONFIG_DEBUG_FS
>>> +void panthor_gem_debugfs_print_bos(struct panthor_device *pfdev,
>>> + struct seq_file *m);
>>> +static inline void
>>> +panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags)
>>> +{
>>> + bo->debugfs.flags = usage_flags | PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED;
>>> +}
>>> +
>>> +#else
>>> +void panthor_gem_debugfs_set_usage_flags(struct panthor_gem_object *bo, u32 usage_flags) {};
>>> +#endif
>>> +
>>> #endif /* __PANTHOR_GEM_H__ */
>
> Adrian Larumbe
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-04-17 15:06 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 19:15 [PATCH v8 1/4] drm/panthor: Introduce BO labeling Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 2/4] drm/panthor: Add driver IOCTL for setting BO labels Adrián Larumbe
2025-04-17 12:26 ` Boris Brezillon
2025-04-15 19:15 ` [PATCH v8 3/4] drm/panthor: Label all kernel BO's Adrián Larumbe
2025-04-15 19:15 ` [PATCH v8 4/4] drm/panthor: show device-wide list of DRM GEM objects over DebugFS Adrián Larumbe
2025-04-17 14:25 ` Steven Price
2025-04-17 14:46 ` Adrián Larumbe
2025-04-17 15:06 ` Steven Price
2025-04-15 19:15 ` [PATCH v8 0/4] Panthor BO tagging and GEMS debug display Adrián Larumbe
2025-04-17 12:21 ` [PATCH v8 1/4] drm/panthor: Introduce BO labeling Liviu Dudau
2025-04-17 14:24 ` Steven Price
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox