[04/18] drm/i915: Only emit the 'send bug report' once for a GPU hang

Submitted by Chris Wilson on Aug. 19, 2019, 7:58 a.m.

Details

Message ID 20190819075835.20065-5-chris@chris-wilson.co.uk
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Chris Wilson Aug. 19, 2019, 7:58 a.m.
Use a locked xchg to ensure that the global log message giving
instructions on how to send a bug report is emitted precisely once.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index b0ae055b6c82..e284bd76fa86 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1765,7 +1765,7 @@  void i915_capture_error_state(struct drm_i915_private *i915,
 		return;
 	}
 
-	if (!warned &&
+	if (!xchg(&warned, true) &&
 	    ktime_get_real_seconds() - DRIVER_TIMESTAMP < DAY_AS_SECONDS(180)) {
 		pr_info("GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.\n");
 		pr_info("Please file a _new_ bug report on bugs.freedesktop.org against DRI -> DRM/Intel\n");
@@ -1773,7 +1773,6 @@  void i915_capture_error_state(struct drm_i915_private *i915,
 		pr_info("The GPU crash dump is required to analyze GPU hangs, so please always attach it.\n");
 		pr_info("GPU crash dump saved to /sys/class/drm/card%d/error\n",
 			i915->drm.primary->index);
-		warned = true;
 	}
 }
 

Comments

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Use a locked xchg to ensure that the global log message giving
> instructions on how to send a bug report is emitted precisely once.
>

Well you must have run into this as this patch appeared.
Arguably better than some read/write once trickery.

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

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index b0ae055b6c82..e284bd76fa86 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1765,7 +1765,7 @@ void i915_capture_error_state(struct drm_i915_private *i915,
>  		return;
>  	}
>  
> -	if (!warned &&
> +	if (!xchg(&warned, true) &&
>  	    ktime_get_real_seconds() - DRIVER_TIMESTAMP < DAY_AS_SECONDS(180)) {
>  		pr_info("GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.\n");
>  		pr_info("Please file a _new_ bug report on bugs.freedesktop.org against DRI -> DRM/Intel\n");
> @@ -1773,7 +1773,6 @@ void i915_capture_error_state(struct drm_i915_private *i915,
>  		pr_info("The GPU crash dump is required to analyze GPU hangs, so please always attach it.\n");
>  		pr_info("GPU crash dump saved to /sys/class/drm/card%d/error\n",
>  			i915->drm.primary->index);
> -		warned = true;
>  	}
>  }
>  
> -- 
> 2.23.0.rc1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Mika Kuoppala (2019-08-19 12:29:46)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > Use a locked xchg to ensure that the global log message giving
> > instructions on how to send a bug report is emitted precisely once.
> >
> 
> Well you must have run into this as this patch appeared.
> Arguably better than some read/write once trickery.

No... Just an eye to the future. I made this a non-device specific
message as it is purely informative, but I don't want our users informed
multiple times concurrently!
-Chris