diff mbox

[06/19] drm/i915: Make intel_engine_dump irqsafe

Message ID 20180517074055.14638-6-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 17, 2018, 7:40 a.m. UTC
To be useful later, enable intel_engine_dump() to be called from irq
context (i.e. using saving and restoring irq start rather than assuming
we enter with irqs enabled).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Tvrtko Ursulin May 17, 2018, 10:28 a.m. UTC | #1
On 17/05/2018 08:40, Chris Wilson wrote:
> To be useful later, enable intel_engine_dump() to be called from irq
> context (i.e. using saving and restoring irq start rather than assuming
> we enter with irqs enabled).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/intel_engine_cs.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 828b7377d0d0..333318b340e1 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1358,6 +1358,7 @@ void intel_engine_dump(struct intel_engine_cs *engine,
>   	const struct intel_engine_execlists * const execlists = &engine->execlists;
>   	struct i915_gpu_error * const error = &engine->i915->gpu_error;
>   	struct i915_request *rq, *last;
> +	unsigned long flags;
>   	struct rb_node *rb;
>   	int count;
>   
> @@ -1424,7 +1425,8 @@ void intel_engine_dump(struct intel_engine_cs *engine,
>   		drm_printf(m, "\tDevice is asleep; skipping register dump\n");
>   	}
>   
> -	spin_lock_irq(&engine->timeline.lock);
> +	local_irq_save(flags);
> +	spin_lock(&engine->timeline.lock);
>   
>   	last = NULL;
>   	count = 0;
> @@ -1466,16 +1468,17 @@ void intel_engine_dump(struct intel_engine_cs *engine,
>   		print_request(m, last, "\t\tQ ");
>   	}
>   
> -	spin_unlock_irq(&engine->timeline.lock);
> +	spin_unlock(&engine->timeline.lock);
>   
> -	spin_lock_irq(&b->rb_lock);
> +	spin_lock(&b->rb_lock);
>   	for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
>   		struct intel_wait *w = rb_entry(rb, typeof(*w), node);
>   
>   		drm_printf(m, "\t%s [%d] waiting for %x\n",
>   			   w->tsk->comm, w->tsk->pid, w->seqno);
>   	}
> -	spin_unlock_irq(&b->rb_lock);
> +	spin_unlock(&b->rb_lock);
> +	local_irq_restore(flags);
>   
>   	drm_printf(m, "IRQ? 0x%lx (breadcrumbs? %s) (execlists? %s)\n",
>   		   engine->irq_posted,
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 828b7377d0d0..333318b340e1 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1358,6 +1358,7 @@  void intel_engine_dump(struct intel_engine_cs *engine,
 	const struct intel_engine_execlists * const execlists = &engine->execlists;
 	struct i915_gpu_error * const error = &engine->i915->gpu_error;
 	struct i915_request *rq, *last;
+	unsigned long flags;
 	struct rb_node *rb;
 	int count;
 
@@ -1424,7 +1425,8 @@  void intel_engine_dump(struct intel_engine_cs *engine,
 		drm_printf(m, "\tDevice is asleep; skipping register dump\n");
 	}
 
-	spin_lock_irq(&engine->timeline.lock);
+	local_irq_save(flags);
+	spin_lock(&engine->timeline.lock);
 
 	last = NULL;
 	count = 0;
@@ -1466,16 +1468,17 @@  void intel_engine_dump(struct intel_engine_cs *engine,
 		print_request(m, last, "\t\tQ ");
 	}
 
-	spin_unlock_irq(&engine->timeline.lock);
+	spin_unlock(&engine->timeline.lock);
 
-	spin_lock_irq(&b->rb_lock);
+	spin_lock(&b->rb_lock);
 	for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
 		struct intel_wait *w = rb_entry(rb, typeof(*w), node);
 
 		drm_printf(m, "\t%s [%d] waiting for %x\n",
 			   w->tsk->comm, w->tsk->pid, w->seqno);
 	}
-	spin_unlock_irq(&b->rb_lock);
+	spin_unlock(&b->rb_lock);
+	local_irq_restore(flags);
 
 	drm_printf(m, "IRQ? 0x%lx (breadcrumbs? %s) (execlists? %s)\n",
 		   engine->irq_posted,