Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: amdgpu: Use struct drm_wedge_task_info inside of struct amdgpu_task_info

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>

+18 -19
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
··· 1786 1786 1787 1787 ti = amdgpu_vm_get_task_info_vm(vm); 1788 1788 if (ti) { 1789 - seq_printf(m, "pid:%d\tProcess:%s ----------\n", ti->pid, ti->process_name); 1789 + seq_printf(m, "pid:%d\tProcess:%s ----------\n", ti->task.pid, ti->process_name); 1790 1790 amdgpu_vm_put_task_info(ti); 1791 1791 } 1792 1792
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
··· 220 220 drm_printf(&p, "time: %lld.%09ld\n", coredump->reset_time.tv_sec, 221 221 coredump->reset_time.tv_nsec); 222 222 223 - if (coredump->reset_task_info.pid) 223 + if (coredump->reset_task_info.task.pid) 224 224 drm_printf(&p, "process_name: %s PID: %d\n", 225 225 coredump->reset_task_info.process_name, 226 - coredump->reset_task_info.pid); 226 + coredump->reset_task_info.task.pid); 227 227 228 228 /* SOC Information */ 229 229 drm_printf(&p, "\nSOC Information\n");
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 329 329 330 330 dev_warn(adev->dev, "validate_and_fence failed: %d\n", r); 331 331 if (ti) { 332 - dev_warn(adev->dev, "pid %d\n", ti->pid); 332 + dev_warn(adev->dev, "pid %d\n", ti->task.pid); 333 333 amdgpu_vm_put_task_info(ti); 334 334 } 335 335 }
+6 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 622 622 623 623 pr_warn_ratelimited("Evicted user BO is not reserved\n"); 624 624 if (ti) { 625 - pr_warn_ratelimited("pid %d\n", ti->pid); 625 + pr_warn_ratelimited("pid %d\n", ti->task.pid); 626 626 amdgpu_vm_put_task_info(ti); 627 627 } 628 628 ··· 2508 2508 if (!vm->task_info) 2509 2509 return; 2510 2510 2511 - if (vm->task_info->pid == current->pid) 2511 + if (vm->task_info->task.pid == current->pid) 2512 2512 return; 2513 2513 2514 - vm->task_info->pid = current->pid; 2515 - get_task_comm(vm->task_info->task_name, current); 2514 + vm->task_info->task.pid = current->pid; 2515 + get_task_comm(vm->task_info->task.comm, current); 2516 2516 2517 2517 if (current->group_leader->mm != current->mm) 2518 2518 return; ··· 2775 2775 2776 2776 dev_warn(adev->dev, 2777 2777 "VM memory stats for proc %s(%d) task %s(%d) is non-zero when fini\n", 2778 - ti->process_name, ti->pid, ti->task_name, ti->tgid); 2778 + ti->process_name, ti->task.pid, ti->task.comm, ti->tgid); 2779 2779 } 2780 2780 2781 2781 amdgpu_vm_put_task_info(vm->task_info); ··· 3164 3164 dev_err(adev->dev, 3165 3165 " Process %s pid %d thread %s pid %d\n", 3166 3166 task_info->process_name, task_info->tgid, 3167 - task_info->task_name, task_info->pid); 3167 + task_info->task.comm, task_info->task.pid); 3168 3168 }
+1 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
··· 236 236 }; 237 237 238 238 struct amdgpu_task_info { 239 + struct drm_wedge_task_info task; 239 240 char process_name[TASK_COMM_LEN]; 240 - char task_name[TASK_COMM_LEN]; 241 - pid_t pid; 242 241 pid_t tgid; 243 242 struct kref refcount; 244 243 };
+1 -1
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
··· 2187 2187 dev_dbg_ratelimited(adev->dev, 2188 2188 " for process %s pid %d thread %s pid %d\n", 2189 2189 task_info->process_name, task_info->tgid, 2190 - task_info->task_name, task_info->pid); 2190 + task_info->task.comm, task_info->task.pid); 2191 2191 amdgpu_vm_put_task_info(task_info); 2192 2192 } 2193 2193
+1 -1
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
··· 1884 1884 if (task_info) { 1885 1885 dev_dbg_ratelimited(adev->dev, " for process %s pid %d thread %s pid %d\n", 1886 1886 task_info->process_name, task_info->tgid, 1887 - task_info->task_name, task_info->pid); 1887 + task_info->task.comm, task_info->task.pid); 1888 1888 amdgpu_vm_put_task_info(task_info); 1889 1889 } 1890 1890
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_events.c
··· 1302 1302 if (ti) { 1303 1303 dev_err(dev->adev->dev, 1304 1304 "Queues reset on process %s tid %d thread %s pid %d\n", 1305 - ti->process_name, ti->tgid, ti->task_name, ti->pid); 1305 + ti->process_name, ti->tgid, ti->task.comm, ti->task.pid); 1306 1306 amdgpu_vm_put_task_info(ti); 1307 1307 } 1308 1308 }
+4 -4
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
··· 253 253 task_info = amdgpu_vm_get_task_info_pasid(dev->adev, pasid); 254 254 if (task_info) { 255 255 /* Report VM faults from user applications, not retry from kernel */ 256 - if (task_info->pid) 256 + if (task_info->task.pid) 257 257 kfd_smi_event_add(0, dev, KFD_SMI_EVENT_VMFAULT, KFD_EVENT_FMT_VMFAULT( 258 - task_info->pid, task_info->task_name)); 258 + task_info->task.pid, task_info->task.comm)); 259 259 amdgpu_vm_put_task_info(task_info); 260 260 } 261 261 } ··· 359 359 kfd_smi_event_add(0, pdd->dev, 360 360 start ? KFD_SMI_EVENT_PROCESS_START : 361 361 KFD_SMI_EVENT_PROCESS_END, 362 - KFD_EVENT_FMT_PROCESS(task_info->pid, 363 - task_info->task_name)); 362 + KFD_EVENT_FMT_PROCESS(task_info->task.pid, 363 + task_info->task.comm)); 364 364 amdgpu_vm_put_task_info(task_info); 365 365 } 366 366 }