Skip to content

Commit 35dc4ce

Browse files
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: André Almeida <[email protected]>
1 parent cd37124 commit 35dc4ce

File tree

9 files changed

+18
-19
lines changed

9 files changed

+18
-19
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused)
17861786

17871787
ti = amdgpu_vm_get_task_info_vm(vm);
17881788
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);
17901790
amdgpu_vm_put_task_info(ti);
17911791
}
17921792

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
220220
drm_printf(&p, "time: %lld.%09ld\n", coredump->reset_time.tv_sec,
221221
coredump->reset_time.tv_nsec);
222222

223-
if (coredump->reset_task_info.pid)
223+
if (coredump->reset_task_info.task.pid)
224224
drm_printf(&p, "process_name: %s PID: %d\n",
225225
coredump->reset_task_info.process_name,
226-
coredump->reset_task_info.pid);
226+
coredump->reset_task_info.task.pid);
227227

228228
/* SOC Information */
229229
drm_printf(&p, "\nSOC Information\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj,
329329

330330
dev_warn(adev->dev, "validate_and_fence failed: %d\n", r);
331331
if (ti) {
332-
dev_warn(adev->dev, "pid %d\n", ti->pid);
332+
dev_warn(adev->dev, "pid %d\n", ti->task.pid);
333333
amdgpu_vm_put_task_info(ti);
334334
}
335335
}

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ int amdgpu_vm_validate(struct amdgpu_device *adev, struct amdgpu_vm *vm,
622622

623623
pr_warn_ratelimited("Evicted user BO is not reserved\n");
624624
if (ti) {
625-
pr_warn_ratelimited("pid %d\n", ti->pid);
625+
pr_warn_ratelimited("pid %d\n", ti->task.pid);
626626
amdgpu_vm_put_task_info(ti);
627627
}
628628

@@ -2508,11 +2508,11 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
25082508
if (!vm->task_info)
25092509
return;
25102510

2511-
if (vm->task_info->pid == current->pid)
2511+
if (vm->task_info->task.pid == current->pid)
25122512
return;
25132513

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);
25162516

25172517
if (current->group_leader->mm != current->mm)
25182518
return;
@@ -2775,7 +2775,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
27752775

27762776
dev_warn(adev->dev,
27772777
"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);
27792779
}
27802780

27812781
amdgpu_vm_put_task_info(vm->task_info);
@@ -3164,5 +3164,5 @@ void amdgpu_vm_print_task_info(struct amdgpu_device *adev,
31643164
dev_err(adev->dev,
31653165
" Process %s pid %d thread %s pid %d\n",
31663166
task_info->process_name, task_info->tgid,
3167-
task_info->task_name, task_info->pid);
3167+
task_info->task.comm, task_info->task.pid);
31683168
}

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ struct amdgpu_vm_pte_funcs {
236236
};
237237

238238
struct amdgpu_task_info {
239+
struct drm_wedge_task_info task;
239240
char process_name[TASK_COMM_LEN];
240-
char task_name[TASK_COMM_LEN];
241-
pid_t pid;
242241
pid_t tgid;
243242
struct kref refcount;
244243
};

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ static int sdma_v4_0_print_iv_entry(struct amdgpu_device *adev,
21872187
dev_dbg_ratelimited(adev->dev,
21882188
" for process %s pid %d thread %s pid %d\n",
21892189
task_info->process_name, task_info->tgid,
2190-
task_info->task_name, task_info->pid);
2190+
task_info->task.comm, task_info->task.pid);
21912191
amdgpu_vm_put_task_info(task_info);
21922192
}
21932193

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,7 @@ static int sdma_v4_4_2_print_iv_entry(struct amdgpu_device *adev,
18841884
if (task_info) {
18851885
dev_dbg_ratelimited(adev->dev, " for process %s pid %d thread %s pid %d\n",
18861886
task_info->process_name, task_info->tgid,
1887-
task_info->task_name, task_info->pid);
1887+
task_info->task.comm, task_info->task.pid);
18881888
amdgpu_vm_put_task_info(task_info);
18891889
}
18901890

drivers/gpu/drm/amd/amdkfd/kfd_events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ void kfd_signal_reset_event(struct kfd_node *dev)
13021302
if (ti) {
13031303
dev_err(dev->adev->dev,
13041304
"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);
13061306
amdgpu_vm_put_task_info(ti);
13071307
}
13081308
}

drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ void kfd_smi_event_update_vmfault(struct kfd_node *dev, uint16_t pasid)
253253
task_info = amdgpu_vm_get_task_info_pasid(dev->adev, pasid);
254254
if (task_info) {
255255
/* Report VM faults from user applications, not retry from kernel */
256-
if (task_info->pid)
256+
if (task_info->task.pid)
257257
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));
259259
amdgpu_vm_put_task_info(task_info);
260260
}
261261
}
@@ -359,8 +359,8 @@ void kfd_smi_event_process(struct kfd_process_device *pdd, bool start)
359359
kfd_smi_event_add(0, pdd->dev,
360360
start ? KFD_SMI_EVENT_PROCESS_START :
361361
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));
364364
amdgpu_vm_put_task_info(task_info);
365365
}
366366
}

0 commit comments

Comments
 (0)