[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250620235053.164614-4-olvaffe@gmail.com>
Date: Fri, 20 Jun 2025 16:50:52 -0700
From: Chia-I Wu <olvaffe@...il.com>
To: Boris Brezillon <boris.brezillon@...labora.com>,
Steven Price <steven.price@....com>,
Liviu Dudau <liviu.dudau@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/4] panthor: save task pid and comm in panthor_file
We would like to report them on gpu errors.
Signed-off-by: Chia-I Wu <olvaffe@...il.com>
---
drivers/gpu/drm/panthor/panthor_device.h | 6 ++++++
drivers/gpu/drm/panthor/panthor_drv.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
index 75ae6fd3a5128..8c31c1d4296b6 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -257,6 +257,12 @@ struct panthor_file {
/** @stats: cycle and timestamp measures for job execution. */
struct panthor_gpu_usage stats;
+ /** @pid: pid of the task created this file */
+ pid_t pid;
+
+ /** @comm: comm of the task created this file */
+ char *comm;
+
/** @refcount: ref count of this file */
struct kref refcount;
};
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index aea9609684b77..b9d86b86591db 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1400,6 +1400,7 @@ void panthor_file_release(struct kref *kref)
WARN_ON(pfile->vms || pfile->groups);
+ kfree(pfile->comm);
kfree(pfile);
}
@@ -1408,6 +1409,7 @@ panthor_open(struct drm_device *ddev, struct drm_file *file)
{
struct panthor_device *ptdev = container_of(ddev, struct panthor_device, base);
struct panthor_file *pfile;
+ struct task_struct *task;
int ret;
pfile = kzalloc(sizeof(*pfile), GFP_KERNEL);
@@ -1436,6 +1438,13 @@ panthor_open(struct drm_device *ddev, struct drm_file *file)
if (ret)
goto err_destroy_vm_pool;
+ task = get_pid_task(rcu_access_pointer(file->pid), PIDTYPE_PID);
+ if (task) {
+ pfile->pid = task->pid;
+ pfile->comm = kstrdup(task->comm, GFP_KERNEL);
+ put_task_struct(task);
+ }
+
kref_init(&pfile->refcount);
file->driver_priv = pfile;
--
2.50.0.714.g196bf9f422-goog
Powered by blists - more mailing lists