aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@linux.intel.com>2015-02-12 03:26:02 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-02-13 17:28:37 -0500
commit071c92de1d24f36a217fb8264df27998c8c73df6 (patch)
treed06b6dbf85a26befd22b39508a18f695be58c791
parent65ca7514e21adbee25b8175fc909759c735d00ff (diff)
drm/i915: Add process identifier to requests
We use the pid of the process which opened our device when we track which was the culprit of the gpu hang. But as that file descriptor might get inherited, we might blame the wrong process when we record the error state. Track process identifiers in requests to always find the correct offender. v2: Track only user processes (Chris) Cc: Kenneth Graunke <kenneth@whitecape.org> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> [danvet: drop NULL check before put_pid as suggested by Chris.] Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gpu_error.c5
3 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b37604bbdf1a..5d8cb458f4f5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2160,6 +2160,9 @@ struct drm_i915_gem_request {
2160 /** file_priv list entry for this request */ 2160 /** file_priv list entry for this request */
2161 struct list_head client_list; 2161 struct list_head client_list;
2162 2162
2163 /** process identifier submitting this request */
2164 struct pid *pid;
2165
2163 uint32_t uniq; 2166 uint32_t uniq;
2164 2167
2165 /** 2168 /**
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 323706cefedf..f28f0dea6c96 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2493,6 +2493,8 @@ int __i915_add_request(struct intel_engine_cs *ring,
2493 list_add_tail(&request->client_list, 2493 list_add_tail(&request->client_list,
2494 &file_priv->mm.request_list); 2494 &file_priv->mm.request_list);
2495 spin_unlock(&file_priv->mm.lock); 2495 spin_unlock(&file_priv->mm.lock);
2496
2497 request->pid = get_pid(task_pid(current));
2496 } 2498 }
2497 2499
2498 trace_i915_gem_request_add(request); 2500 trace_i915_gem_request_add(request);
@@ -2573,6 +2575,8 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request)
2573 list_del(&request->list); 2575 list_del(&request->list);
2574 i915_gem_request_remove_from_client(request); 2576 i915_gem_request_remove_from_client(request);
2575 2577
2578 put_pid(request->pid);
2579
2576 i915_gem_request_unreference(request); 2580 i915_gem_request_unreference(request);
2577} 2581}
2578 2582
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 48ddbf44c862..a982849a5edd 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -994,12 +994,11 @@ static void i915_gem_record_rings(struct drm_device *dev,
994 i915_error_ggtt_object_create(dev_priv, 994 i915_error_ggtt_object_create(dev_priv,
995 ring->scratch.obj); 995 ring->scratch.obj);
996 996
997 if (request->file_priv) { 997 if (request->pid) {
998 struct task_struct *task; 998 struct task_struct *task;
999 999
1000 rcu_read_lock(); 1000 rcu_read_lock();
1001 task = pid_task(request->file_priv->file->pid, 1001 task = pid_task(request->pid, PIDTYPE_PID);
1002 PIDTYPE_PID);
1003 if (task) { 1002 if (task) {
1004 strcpy(error->ring[i].comm, task->comm); 1003 strcpy(error->ring[i].comm, task->comm);
1005 error->ring[i].pid = task->pid; 1004 error->ring[i].pid = task->pid;