@@ -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->pid, ti->process_desc);
amdgpu_vm_put_task_info(ti);
}
@@ -220,8 +220,8 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
coredump->reset_time.tv_nsec);
if (coredump->reset_task_info.pid)
- drm_printf(&p, "process_name: %s PID: %d\n",
- coredump->reset_task_info.process_name,
+ drm_printf(&p, "process: %s PID: %d\n",
+ coredump->reset_task_info.process_desc,
coredump->reset_task_info.pid);
/* SOC Information */
@@ -125,7 +125,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
if (ti) {
dev_err(adev->dev,
"Process information: process %s pid %d thread %s pid %d\n",
- ti->process_name, ti->tgid, ti->task_name, ti->pid);
+ ti->process_desc, ti->tgid, ti->task_name, ti->pid);
amdgpu_vm_put_task_info(ti);
}
@@ -2357,10 +2357,21 @@ amdgpu_vm_get_task_info_pasid(struct amdgpu_device *adev, u32 pasid)
static int amdgpu_vm_create_task_info(struct amdgpu_vm *vm)
{
- vm->task_info = kzalloc(sizeof(struct amdgpu_task_info), GFP_KERNEL);
+ char process_name[TASK_COMM_LEN];
+ int desc_len;
+
+ get_task_comm(process_name, current->group_leader);
+ desc_len = strlen(process_name);
+
+ vm->task_info = kzalloc(
+ struct_size(vm->task_info, process_desc, desc_len + 1),
+ GFP_KERNEL);
+
if (!vm->task_info)
return -ENOMEM;
+ strscpy(vm->task_info->process_desc, process_name, desc_len + 1);
+
kref_init(&vm->task_info->refcount);
return 0;
}
@@ -2375,8 +2386,6 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
if (!vm->task_info) {
if (amdgpu_vm_create_task_info(vm))
return;
-
- get_task_comm(vm->task_info->process_name, current->group_leader);
}
if (vm->task_info->pid == current->pid)
@@ -232,11 +232,11 @@ struct amdgpu_vm_pte_funcs {
};
struct amdgpu_task_info {
- char process_name[TASK_COMM_LEN];
char task_name[TASK_COMM_LEN];
pid_t pid;
pid_t tgid;
struct kref refcount;
+ char process_desc[];
};
/**
@@ -166,7 +166,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev,
if (task_info) {
dev_err(adev->dev,
" in process %s pid %d thread %s pid %d\n",
- task_info->process_name, task_info->tgid,
+ task_info->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -136,7 +136,7 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev,
if (task_info) {
dev_err(adev->dev,
" in process %s pid %d thread %s pid %d)\n",
- task_info->process_name, task_info->tgid,
+ task_info->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -129,7 +129,7 @@ static int gmc_v12_0_process_interrupt(struct amdgpu_device *adev,
if (task_info) {
dev_err(adev->dev,
" in process %s pid %d thread %s pid %d)\n",
- task_info->process_name, task_info->tgid,
+ task_info->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -1451,7 +1451,7 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
task_info = amdgpu_vm_get_task_info_pasid(adev, entry->pasid);
if (task_info) {
dev_err(adev->dev, " for process %s pid %d thread %s pid %d\n",
- task_info->process_name, task_info->tgid,
+ task_info->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -635,7 +635,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
if (task_info) {
dev_err(adev->dev,
" for process %s pid %d thread %s pid %d)\n",
- task_info->process_name, task_info->tgid,
+ task_info->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -2186,7 +2186,7 @@ static int sdma_v4_0_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->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -1701,7 +1701,7 @@ static int sdma_v4_4_2_print_iv_entry(struct amdgpu_device *adev,
task_info = amdgpu_vm_get_task_info_pasid(adev, entry->pasid);
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->process_desc, task_info->tgid,
task_info->task_name, task_info->pid);
amdgpu_vm_put_task_info(task_info);
}
@@ -1267,7 +1267,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_desc, ti->tgid, ti->task_name, ti->pid);
amdgpu_vm_put_task_info(ti);
}
}
And rename it process_desc, since it will soon contain more than just the process_name. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 +- 13 files changed, 25 insertions(+), 16 deletions(-)