diff options
author | Rob Clark <robdclark@chromium.org> | 2022-03-17 19:51:39 +0300 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2022-04-22 01:01:08 +0300 |
commit | 39ba0c0d6cd13e9ae5fe0a75313efdbb3449d87a (patch) | |
tree | 2066b6a4712577e0abd4177f6c3a9000674b6a82 | |
parent | 4bfba71640f8578b3daadb551d6bce12a2d436d8 (diff) | |
download | linux-39ba0c0d6cd13e9ae5fe0a75313efdbb3449d87a.tar.xz |
drm/msm: Split out helper to get comm/cmdline
Deduplicate this from fault_worker and recover_worker.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/20220317165144.222101-3-robdclark@gmail.com
Signed-off-by: Rob Clark <robdclark@chromium.org>
-rw-r--r-- | drivers/gpu/drm/msm/msm_gpu.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index faf0c242874e..7a88dd6568c0 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -351,6 +351,20 @@ find_submit(struct msm_ringbuffer *ring, uint32_t fence) static void retire_submits(struct msm_gpu *gpu); +static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char **cmd) +{ + struct task_struct *task; + + task = get_pid_task(submit->pid, PIDTYPE_PID); + if (!task) + return; + + *comm = kstrdup(task->comm, GFP_KERNEL); + *cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL); + + put_task_struct(task); +} + static void recover_worker(struct kthread_work *work) { struct msm_gpu *gpu = container_of(work, struct msm_gpu, recover_work); @@ -367,18 +381,11 @@ static void recover_worker(struct kthread_work *work) submit = find_submit(cur_ring, cur_ring->memptrs->fence + 1); if (submit) { - struct task_struct *task; - /* Increment the fault counts */ submit->queue->faults++; submit->aspace->faults++; - task = get_pid_task(submit->pid, PIDTYPE_PID); - if (task) { - comm = kstrdup(task->comm, GFP_KERNEL); - cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL); - put_task_struct(task); - } + get_comm_cmdline(submit, &comm, &cmd); if (comm && cmd) { DRM_DEV_ERROR(dev->dev, "%s: offending task: %s (%s)\n", @@ -467,14 +474,7 @@ static void fault_worker(struct kthread_work *work) goto resume_smmu; if (submit) { - struct task_struct *task; - - task = get_pid_task(submit->pid, PIDTYPE_PID); - if (task) { - comm = kstrdup(task->comm, GFP_KERNEL); - cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL); - put_task_struct(task); - } + get_comm_cmdline(submit, &comm, &cmd); /* * When we get GPU iova faults, we can get 1000s of them, |