drm: amdgpu: Use struct drm_wedge_task_info inside of struct amdgpu_task_info
authorAndré Almeida <andrealmeid@igalia.com>
Tue, 17 Jun 2025 12:49:48 +0000 (09:49 -0300)
committerAndré Almeida <andrealmeid@igalia.com>
Tue, 17 Jun 2025 14:32:47 +0000 (11:32 -0300)
To avoid a cast when calling drm_dev_wedged_event(), replace pid and
task name inside of struct amdgpu_task_info with struct
drm_wedge_task_info.

Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20250617124949.2151549-6-andrealmeid@igalia.com
Signed-off-by: André Almeida <andrealmeid@igalia.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
drivers/gpu/drm/amd/amdkfd/kfd_events.c
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c

index 8e626f5..dac4b92 100644 (file)
@@ -1786,7 +1786,7 @@ static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused)
 
                ti = amdgpu_vm_get_task_info_vm(vm);
                if (ti) {
-                       seq_printf(m, "pid:%d\tProcess:%s ----------\n", ti->pid, ti->process_name);
+                       seq_printf(m, "pid:%d\tProcess:%s ----------\n", ti->task.pid, ti->process_name);
                        amdgpu_vm_put_task_info(ti);
                }
 
index 7b50741..8a026bc 100644 (file)
@@ -220,10 +220,10 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
        drm_printf(&p, "time: %lld.%09ld\n", coredump->reset_time.tv_sec,
                   coredump->reset_time.tv_nsec);
 
-       if (coredump->reset_task_info.pid)
+       if (coredump->reset_task_info.task.pid)
                drm_printf(&p, "process_name: %s PID: %d\n",
                           coredump->reset_task_info.process_name,
-                          coredump->reset_task_info.pid);
+                          coredump->reset_task_info.task.pid);
 
        /* SOC Information */
        drm_printf(&p, "\nSOC Information\n");
index 0ecc88d..e5e33a6 100644 (file)
@@ -329,7 +329,7 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj,
 
                        dev_warn(adev->dev, "validate_and_fence failed: %d\n", r);
                        if (ti) {
-                               dev_warn(adev->dev, "pid %d\n", ti->pid);
+                               dev_warn(adev->dev, "pid %d\n", ti->task.pid);
                                amdgpu_vm_put_task_info(ti);
                        }
                }
index 3bf63ee..0ff95a5 100644 (file)
@@ -622,7 +622,7 @@ int amdgpu_vm_validate(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
                        pr_warn_ratelimited("Evicted user BO is not reserved\n");
                        if (ti) {
-                               pr_warn_ratelimited("pid %d\n", ti->pid);
+                               pr_warn_ratelimited("pid %d\n", ti->task.pid);
                                amdgpu_vm_put_task_info(ti);
                        }
 
@@ -2508,11 +2508,11 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
        if (!vm->task_info)
                return;
 
-       if (vm->task_info->pid == current->pid)
+       if (vm->task_info->task.pid == current->pid)
                return;
 
-       vm->task_info->pid = current->pid;
-       get_task_comm(vm->task_info->task_name, current);
+       vm->task_info->task.pid = current->pid;
+       get_task_comm(vm->task_info->task.comm, current);
 
        if (current->group_leader->mm != current->mm)
                return;
@@ -2775,7 +2775,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 
                dev_warn(adev->dev,
                         "VM memory stats for proc %s(%d) task %s(%d) is non-zero when fini\n",
-                        ti->process_name, ti->pid, ti->task_name, ti->tgid);
+                        ti->process_name, ti->task.pid, ti->task.comm, ti->tgid);
        }
 
        amdgpu_vm_put_task_info(vm->task_info);
@@ -3164,5 +3164,5 @@ void amdgpu_vm_print_task_info(struct amdgpu_device *adev,
        dev_err(adev->dev,
                " Process %s pid %d thread %s pid %d\n",
                task_info->process_name, task_info->tgid,
-               task_info->task_name, task_info->pid);
+               task_info->task.comm, task_info->task.pid);
 }
index 9ec5d94..fd086ef 100644 (file)
@@ -236,9 +236,8 @@ struct amdgpu_vm_pte_funcs {
 };
 
 struct amdgpu_task_info {
+       struct drm_wedge_task_info task;
        char            process_name[TASK_COMM_LEN];
-       char            task_name[TASK_COMM_LEN];
-       pid_t           pid;
        pid_t           tgid;
        struct kref     refcount;
 };
index 33ed2b1..f38004e 100644 (file)
@@ -2187,7 +2187,7 @@ static int sdma_v4_0_print_iv_entry(struct amdgpu_device *adev,
                dev_dbg_ratelimited(adev->dev,
                                    " for process %s pid %d thread %s pid %d\n",
                                    task_info->process_name, task_info->tgid,
-                                   task_info->task_name, task_info->pid);
+                                   task_info->task.comm, task_info->task.pid);
                amdgpu_vm_put_task_info(task_info);
        }
 
index 9c16911..bcde34e 100644 (file)
@@ -1884,7 +1884,7 @@ static int sdma_v4_4_2_print_iv_entry(struct amdgpu_device *adev,
        if (task_info) {
                dev_dbg_ratelimited(adev->dev, " for process %s pid %d thread %s pid %d\n",
                                    task_info->process_name, task_info->tgid,
-                                   task_info->task_name, task_info->pid);
+                                   task_info->task.comm, task_info->task.pid);
                amdgpu_vm_put_task_info(task_info);
        }
 
index 2b294ad..82905f3 100644 (file)
@@ -1302,7 +1302,7 @@ void kfd_signal_reset_event(struct kfd_node *dev)
                        if (ti) {
                                dev_err(dev->adev->dev,
                                        "Queues reset on process %s tid %d thread %s pid %d\n",
-                                       ti->process_name, ti->tgid, ti->task_name, ti->pid);
+                                       ti->process_name, ti->tgid, ti->task.comm, ti->task.pid);
                                amdgpu_vm_put_task_info(ti);
                        }
                }
index 83d9384..a499449 100644 (file)
@@ -253,9 +253,9 @@ void kfd_smi_event_update_vmfault(struct kfd_node *dev, uint16_t pasid)
        task_info = amdgpu_vm_get_task_info_pasid(dev->adev, pasid);
        if (task_info) {
                /* Report VM faults from user applications, not retry from kernel */
-               if (task_info->pid)
+               if (task_info->task.pid)
                        kfd_smi_event_add(0, dev, KFD_SMI_EVENT_VMFAULT, KFD_EVENT_FMT_VMFAULT(
-                                         task_info->pid, task_info->task_name));
+                                         task_info->task.pid, task_info->task.comm));
                amdgpu_vm_put_task_info(task_info);
        }
 }
@@ -359,8 +359,8 @@ void kfd_smi_event_process(struct kfd_process_device *pdd, bool start)
                kfd_smi_event_add(0, pdd->dev,
                                  start ? KFD_SMI_EVENT_PROCESS_START :
                                  KFD_SMI_EVENT_PROCESS_END,
-                                 KFD_EVENT_FMT_PROCESS(task_info->pid,
-                                 task_info->task_name));
+                                 KFD_EVENT_FMT_PROCESS(task_info->task.pid,
+                                 task_info->task.comm));
                amdgpu_vm_put_task_info(task_info);
        }
 }