[2/2] drm/i915: Detect potential i915_reset_trylock() lockups
diff mbox series

Message ID 20190212130831.14425-2-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [1/2] drm/i915: Recursive i915_reset_trylock() verboten
Related show

Commit Message

Chris Wilson Feb. 12, 2019, 1:08 p.m. UTC
Use lockdep to warn before we wait indefinitely in case we may be
waiting indefinitely.

Suggested-by: Mika Kuoppala <mika.kuoppala@intel.com>
References: 2caffbf11762 ("drm/i915: Revoke mmaps and prevent access to fence registers across reset")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_reset.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Mika Kuoppala Feb. 12, 2019, 2:15 p.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> Use lockdep to warn before we wait indefinitely in case we may be
> waiting indefinitely.
>
> Suggested-by: Mika Kuoppala <mika.kuoppala@intel.com>
> References: 2caffbf11762 ("drm/i915: Revoke mmaps and prevent access to fence registers across reset")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_reset.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_reset.c b/drivers/gpu/drm/i915/i915_reset.c
> index c1b53533ada6..12e74decd7a2 100644
> --- a/drivers/gpu/drm/i915/i915_reset.c
> +++ b/drivers/gpu/drm/i915/i915_reset.c
> @@ -1305,6 +1305,9 @@ int i915_reset_trylock(struct drm_i915_private *i915)
>  	struct i915_gpu_error *error = &i915->gpu_error;
>  	int srcu;
>  
> +	might_lock(&error->reset_backoff_srcu);
> +	might_sleep();
> +
>  	rcu_read_lock();
>  	while (test_bit(I915_RESET_BACKOFF, &error->flags)) {
>  		rcu_read_unlock();
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/i915_reset.c b/drivers/gpu/drm/i915/i915_reset.c
index c1b53533ada6..12e74decd7a2 100644
--- a/drivers/gpu/drm/i915/i915_reset.c
+++ b/drivers/gpu/drm/i915/i915_reset.c
@@ -1305,6 +1305,9 @@  int i915_reset_trylock(struct drm_i915_private *i915)
 	struct i915_gpu_error *error = &i915->gpu_error;
 	int srcu;
 
+	might_lock(&error->reset_backoff_srcu);
+	might_sleep();
+
 	rcu_read_lock();
 	while (test_bit(I915_RESET_BACKOFF, &error->flags)) {
 		rcu_read_unlock();