]> www.infradead.org Git - users/hch/configfs.git/commitdiff
drm/xe: Add process name to devcoredump
authorJosé Roberto de Souza <jose.souza@intel.com>
Wed, 22 May 2024 20:12:03 +0000 (13:12 -0700)
committerJosé Roberto de Souza <jose.souza@intel.com>
Thu, 23 May 2024 13:07:44 +0000 (06:07 -0700)
Process name help us track what application caused the gpug hang, this
is crucial when running several applications at the same time.

v2:
- handle Xe KMD exec_queues without VM

v3:
- use get_pid_task() (suggested by Nirmoy)

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240522201203.145403-1-jose.souza@intel.com
drivers/gpu/drm/xe/xe_devcoredump.c
drivers/gpu/drm/xe/xe_devcoredump_types.h

index 3d7980232be1c37de0ad73e15fbe12297b1bddd2..7602cc1399e7dbe9c13b351793ad99ae9a3de836 100644 (file)
@@ -110,6 +110,7 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
        drm_printf(&p, "Snapshot time: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec);
        ts = ktime_to_timespec64(ss->boot_time);
        drm_printf(&p, "Uptime: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec);
+       drm_printf(&p, "Process: %s\n", ss->process_name);
        xe_device_snapshot_print(xe, &p);
 
        drm_printf(&p, "\n**** GuC CT ****\n");
@@ -166,12 +167,24 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
        enum xe_hw_engine_id id;
        u32 adj_logical_mask = q->logical_mask;
        u32 width_mask = (0x1 << q->width) - 1;
+       const char *process_name = "no process";
+       struct task_struct *task = NULL;
+
        int i;
        bool cookie;
 
        ss->snapshot_time = ktime_get_real();
        ss->boot_time = ktime_get_boottime();
 
+       if (q->vm) {
+               task = get_pid_task(q->vm->xef->drm->pid, PIDTYPE_PID);
+               if (task)
+                       process_name = task->comm;
+       }
+       snprintf(ss->process_name, sizeof(ss->process_name), process_name);
+       if (task)
+               put_task_struct(task);
+
        ss->gt = q->gt;
        INIT_WORK(&ss->work, xe_devcoredump_deferred_snap_work);
 
index 6f654b63c7f1cbbefb93c0dd2be7b5a41905baa7..923cdf72a816a8d030ba5d937e11b579e39e3c13 100644 (file)
@@ -26,6 +26,8 @@ struct xe_devcoredump_snapshot {
        ktime_t snapshot_time;
        /** @boot_time:  Relative boot time so the uptime can be calculated. */
        ktime_t boot_time;
+       /** @process_name: Name of process that triggered this gpu hang */
+       char process_name[TASK_COMM_LEN];
 
        /** @gt: Affected GT, used by forcewake for delayed capture */
        struct xe_gt *gt;