drm/i915: Add process identifier to requests
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 3 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2153,6 +2153,9 @@ struct drm_i915_gem_request {/** file_priv list entry for this request */ struct list_head client_list; +/** process identifier submitting this request */ +struct pid *pid; +uint32_t uniq;/**
drivers/gpu/drm/i915/i915_gem.c +3 -0
@@ -2483,6 +2483,7 @@ int __i915_add_request(struct intel_engine_cs *ring, request->emitted_jiffies = jiffies;list_add_tail (&request->list, &ring->request_list); request->file_priv =NULL ; + request->pid =get_pid (task_pid (current));if (file) {struct drm_i915_file_private *file_priv = file->driver_priv;
@@ -2572,6 +2573,8 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request)list_del (&request->list);i915_gem_request_remove_from_client (request); +put_pid (request->pid); +i915_gem_request_unreference (request); }
drivers/gpu/drm/i915/i915_gpu_error.c +2 -3
@@ -994,12 +994,11 @@ static void i915_gem_record_rings(struct drm_device *dev,i915_error_ggtt_object_create (dev_priv, ring->scratch.obj); -if (request->file_priv) { +if (request->pid) {struct task_struct *task;rcu_read_lock (); - task =pid_task (request->file_priv->file->pid, -PIDTYPE_PID ); + task =pid_task (request->pid,PIDTYPE_PID );if (task) {strcpy (error->ring[i].comm, task->comm); error->ring[i].pid = task->pid;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 36 lines · Mika Kuoppala
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.
Cc Kenneth Graunke <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 3 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2153,6 +2153,9 @@ struct drm_i915_gem_request {/** file_priv list entry for this request */ struct list_head client_list; +/** process identifier submitting this request */ +struct pid *pid; +uint32_t uniq;/** drivers/gpu/drm/i915/i915_gem.c +0
-0
drivers/gpu/drm/i915/i915_gem.c int __i915_add_request(struct intel_engine_cs *ring, · line 2488
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0@@ -2483,6 +2483,7 @@ int __i915_add_request(struct intel_engine_cs *ring, request->emitted_jiffies = jiffies;list_add_tail (&request->list, &ring->request_list); request->file_priv =NULL ; + request->pid =get_pid (task_pid (current));if (file) {
I would suggest you only track processes for requests submitted by userspace. Then if there is no associated pid, we know that the kernel was in control (and not stuck figuring out if kworker was acting on behalf of the user or the kernel).
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 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)
--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 5 +++++ drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++--- 3 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2153,6 +2153,9 @@ struct drm_i915_gem_request {/** file_priv list entry for this request */ struct list_head client_list; +/** process identifier submitting this request */ +struct pid *pid; +uint32_t uniq;/**
drivers/gpu/drm/i915/i915_gem.c +5 -0
@@ -2492,6 +2492,8 @@ int __i915_add_request(struct intel_engine_cs *ring,list_add_tail (&request->client_list, &file_priv->mm.request_list);spin_unlock (&file_priv->mm.lock); + + request->pid =get_pid (task_pid (current)); }trace_i915_gem_request_add (request);
@@ -2572,6 +2574,9 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request)list_del (&request->list);i915_gem_request_remove_from_client (request); +if (request->pid) +put_pid (request->pid); +i915_gem_request_unreference (request); }
drivers/gpu/drm/i915/i915_gpu_error.c +2 -3
@@ -994,12 +994,11 @@ static void i915_gem_record_rings(struct drm_device *dev,i915_error_ggtt_object_create (dev_priv, ring->scratch.obj); -if (request->file_priv) { +if (request->pid) {struct task_struct *task;rcu_read_lock (); - task =pid_task (request->file_priv->file->pid, -PIDTYPE_PID ); + task =pid_task (request->pid,PIDTYPE_PID );if (task) {strcpy (error->ring[i].comm, task->comm); error->ring[i].pid = task->pid;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 15 lines · Mika Kuoppala
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 <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>---
drivers/gpu/drm/i915/i915_gem.c static void i915_gem_free_request(struct drm_i915_gem_request *request) · line 2577
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0@@ -2572,6 +2574,9 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request)list_del (&request->list);i915_gem_request_remove_from_client (request); +if (request->pid)
put_pid() does the NULL check itself, might as well take advantage of that.
drivers/gpu/drm/i915/i915_gem.c static void i915_gem_free_request(struct drm_i915_gem_request *request) · line 2581
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c +2
-0+put_pid (request->pid); +i915_gem_request_unreference (request); }
Otherwise,
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedQuoted 19 lines · Chris Wilson
Quoted 18 lines · Mika Kuoppala
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 <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>---
drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -2572,6 +2574,9 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request)list_del (&request->list);i915_gem_request_remove_from_client (request);
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c static void i915_gem_free_request(struct drm_i915_gem_request *request) · line 2577
Quoted 1 line
drivers/gpu/drm/i915/i915_gem.c +1
-0+if (request->pid)
put_pid()does the NULL check itself, might as well take advantage of that.
Done while merging.
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c static void i915_gem_free_request(struct drm_i915_gem_request *request) · line 2581
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +2
-0+put_pid (request->pid); +i915_gem_request_unreference (request); }Otherwise,
Reviewed-by Chris Wilson <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Task id: 5766 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 282/282 282/282 ILK 313/313 313/313 SNB 309/323 309/323 IVB 380/380 380/380 BYT 296/296 296/296 HSW -1 425/425 424/425 BDW -1 318/318 317/318
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*HSW igt_gem_storedw_loop_vebox PASS(2) DMESG_WARN(1)PASS(1)
*BDW igt_gem_gtt_hog PASS(8) DMESG_WARN(1)PASS(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 42 lines · Chris Wilson
Quoted 41 lines · Mika Kuoppala
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.
Cc Kenneth Graunke <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 3 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2153,6 +2153,9 @@ struct drm_i915_gem_request {/** file_priv list entry for this request */ struct list_head client_list; +/** process identifier submitting this request */ +struct pid *pid; +uint32_t uniq;/** drivers/gpu/drm/i915/i915_gem.c +1
-0@@ -2483,6 +2483,7 @@ int __i915_add_request(struct intel_engine_cs *ring, request->emitted_jiffies = jiffies;list_add_tail (&request->list, &ring->request_list); request->file_priv =NULL ; + request->pid =get_pid (task_pid (current));
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem.c int __i915_add_request(struct intel_engine_cs *ring, · line 2488
Quoted 1 line
drivers/gpu/drm/i915/i915_gem.c +0
-0if (file) {I would suggest you only track processes for requests submitted by userspace. Then if there is no associated pid, we know that the kernel was in control (and not stuck figuring out if kworker was acting on behalf of the user or the kernel).
-Chris
With the GPU scheduler, the actual batch buffer submission via i915_add_request() could be disconnected from the original IOCTL call into the driver. Thus the recorded pid would be the kernel worker thread not the user land application. Is there any particular reason why the pid could not be recorded when the request is first created rather than when it is submitted?
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 48 lines · John Harrison
Quoted 37 lines · Chris Wilson
Quoted 36 lines · Mika Kuoppala
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.
Cc Kenneth Graunke <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 3 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2153,6 +2153,9 @@ struct drm_i915_gem_request {/** file_priv list entry for this request */ struct list_head client_list; +/** process identifier submitting this request */ +struct pid *pid; +uint32_t uniq;/** drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -2483,6 +2483,7 @@ int __i915_add_request(struct intel_engine_cs *ring, request->emitted_jiffies = jiffies;list_add_tail (&request->list, &ring->request_list);Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c int __i915_add_request(struct intel_engine_cs *ring, · line 2488
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0request->file_priv =NULL ; + request->pid =get_pid (task_pid (current));if (file) {I would suggest you only track processes for requests submitted by userspace. Then if there is no associated pid, we know that the kernel was in control (and not stuck figuring out if kworker was acting on behalf of the user or the kernel).
-Chris
Quoted 3 lines
With the GPU scheduler, the actual batch buffer submission via
i915_add_request()could be disconnected from the original IOCTL call into the driver.
However, with requests i915_add_request() should have been replaced by a engine/scheduler vfunc. The request is constucted from the execbuffer, thus can be associated with the user process. The request is then submitted intact to the scheduler for queueing for submission to the hardware.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Task id: 5760 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV -1 282/282 281/282
ILK 313/313 313/313 SNB 309/323 309/323 IVB 380/380 380/380 BYT 296/296 296/296 HSW -1 425/425 424/425 BDW -1 318/318 317/318 -------------------------------------Detailed------------------------------------- Platform Test drm-intel-nightly Series Applied *PNV igt_gen3_render_linear_blits PASS(2, M23) CRASH(1, M23)PASS(1, M23) HSW igt_kms_flip_plain-flip-fb-recreate-interruptible TIMEOUT(2, M20)PASS(1, M20) TIMEOUT(1, M20)PASS(1, M20) *BDW igt_gem_gtt_hog PASS(4, M30) DMESG_WARN(1, M30)PASS(1, M30)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx