Commit 25faf2f2 authored by Rob Clark's avatar Rob Clark

drm/msm: Show process names in gem_describe

In $debugfs/gem we already show any vma(s) associated with an object.
Also show process names if the vma's address space is a per-process
address space.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Reviewed-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 84c31ee1
...@@ -589,7 +589,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file) ...@@ -589,7 +589,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file)
kref_init(&ctx->ref); kref_init(&ctx->ref);
msm_submitqueue_init(dev, ctx); msm_submitqueue_init(dev, ctx);
ctx->aspace = msm_gpu_create_private_address_space(priv->gpu); ctx->aspace = msm_gpu_create_private_address_space(priv->gpu, current);
file->driver_priv = ctx; file->driver_priv = ctx;
return 0; return 0;
......
...@@ -842,11 +842,28 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m) ...@@ -842,11 +842,28 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
seq_puts(m, " vmas:"); seq_puts(m, " vmas:");
list_for_each_entry(vma, &msm_obj->vmas, list) list_for_each_entry(vma, &msm_obj->vmas, list) {
seq_printf(m, " [%s: %08llx,%s,inuse=%d]", const char *name, *comm;
vma->aspace != NULL ? vma->aspace->name : NULL, if (vma->aspace) {
vma->iova, vma->mapped ? "mapped" : "unmapped", struct msm_gem_address_space *aspace = vma->aspace;
struct task_struct *task =
get_pid_task(aspace->pid, PIDTYPE_PID);
if (task) {
comm = kstrdup(task->comm, GFP_KERNEL);
} else {
comm = NULL;
}
name = aspace->name;
} else {
name = comm = NULL;
}
seq_printf(m, " [%s%s%s: aspace=%p, %08llx,%s,inuse=%d]",
name, comm ? ":" : "", comm ? comm : "",
vma->aspace, vma->iova,
vma->mapped ? "mapped" : "unmapped",
vma->inuse); vma->inuse);
kfree(comm);
}
seq_puts(m, "\n"); seq_puts(m, "\n");
} }
......
...@@ -24,6 +24,11 @@ struct msm_gem_address_space { ...@@ -24,6 +24,11 @@ struct msm_gem_address_space {
spinlock_t lock; /* Protects drm_mm node allocation/removal */ spinlock_t lock; /* Protects drm_mm node allocation/removal */
struct msm_mmu *mmu; struct msm_mmu *mmu;
struct kref kref; struct kref kref;
/* For address spaces associated with a specific process, this
* will be non-NULL:
*/
struct pid *pid;
}; };
struct msm_gem_vma { struct msm_gem_vma {
......
...@@ -17,6 +17,7 @@ msm_gem_address_space_destroy(struct kref *kref) ...@@ -17,6 +17,7 @@ msm_gem_address_space_destroy(struct kref *kref)
drm_mm_takedown(&aspace->mm); drm_mm_takedown(&aspace->mm);
if (aspace->mmu) if (aspace->mmu)
aspace->mmu->funcs->destroy(aspace->mmu); aspace->mmu->funcs->destroy(aspace->mmu);
put_pid(aspace->pid);
kfree(aspace); kfree(aspace);
} }
......
...@@ -829,10 +829,9 @@ static int get_clocks(struct platform_device *pdev, struct msm_gpu *gpu) ...@@ -829,10 +829,9 @@ static int get_clocks(struct platform_device *pdev, struct msm_gpu *gpu)
/* Return a new address space for a msm_drm_private instance */ /* Return a new address space for a msm_drm_private instance */
struct msm_gem_address_space * struct msm_gem_address_space *
msm_gpu_create_private_address_space(struct msm_gpu *gpu) msm_gpu_create_private_address_space(struct msm_gpu *gpu, struct task_struct *task)
{ {
struct msm_gem_address_space *aspace = NULL; struct msm_gem_address_space *aspace = NULL;
if (!gpu) if (!gpu)
return NULL; return NULL;
...@@ -840,8 +839,11 @@ msm_gpu_create_private_address_space(struct msm_gpu *gpu) ...@@ -840,8 +839,11 @@ msm_gpu_create_private_address_space(struct msm_gpu *gpu)
* If the target doesn't support private address spaces then return * If the target doesn't support private address spaces then return
* the global one * the global one
*/ */
if (gpu->funcs->create_private_address_space) if (gpu->funcs->create_private_address_space) {
aspace = gpu->funcs->create_private_address_space(gpu); aspace = gpu->funcs->create_private_address_space(gpu);
if (!IS_ERR(aspace))
aspace->pid = get_pid(task_pid(task));
}
if (IS_ERR_OR_NULL(aspace)) if (IS_ERR_OR_NULL(aspace))
aspace = msm_gem_address_space_get(gpu->aspace); aspace = msm_gem_address_space_get(gpu->aspace);
......
...@@ -301,7 +301,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, ...@@ -301,7 +301,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
const char *name, struct msm_gpu_config *config); const char *name, struct msm_gpu_config *config);
struct msm_gem_address_space * struct msm_gem_address_space *
msm_gpu_create_private_address_space(struct msm_gpu *gpu); msm_gpu_create_private_address_space(struct msm_gpu *gpu, struct task_struct *task);
void msm_gpu_cleanup(struct msm_gpu *gpu); void msm_gpu_cleanup(struct msm_gpu *gpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment