diff mbox

drm/i915: Redefine EINVAL for debugging

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

Commit Message

Chris Wilson June 21, 2018, 8:01 a.m. UTC
To aide debugging spurious EINVALs, include a debug message every time
we emit one from execbuf.

References: https://bugs.freedesktop.org/show_bug.cgi?id=106744
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Joonas Lahtinen June 21, 2018, 8:53 a.m. UTC | #1
Quoting Chris Wilson (2018-06-21 11:01:50)
> To aide debugging spurious EINVALs, include a debug message every time
> we emit one from execbuf.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=106744
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

That's special kind of evil. But should do the job.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

You might be able to get away from hardcoding the 22 with first
calling the macro __EINVAL and then doing some trickery.

Regards, Joonas

> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 437441f4af41..c2dd9b4cdace 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -66,6 +66,15 @@ enum {
>  #define __I915_EXEC_ILLEGAL_FLAGS \
>         (__I915_EXEC_UNKNOWN_FLAGS | I915_EXEC_CONSTANTS_MASK)
>  
> +/* Catch emission of unexpected errors for CI! */
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
> +#undef EINVAL
> +#define EINVAL ({ \
> +       DRM_DEBUG_DRIVER("EINVAL at %s:%d\n", __func__, __LINE__); \
> +       22; \
> +})
> +#endif
> +
>  /**
>   * DOC: User command execution
>   *
> -- 
> 2.18.0.rc2
>
Chris Wilson June 21, 2018, 9:14 a.m. UTC | #2
Quoting Joonas Lahtinen (2018-06-21 09:53:20)
> Quoting Chris Wilson (2018-06-21 11:01:50)
> > To aide debugging spurious EINVALs, include a debug message every time
> > we emit one from execbuf.
> > 
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=106744
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> That's special kind of evil. But should do the job.
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> You might be able to get away from hardcoding the 22 with first
> calling the macro __EINVAL and then doing some trickery.

Not sure what trickery. I tried the usual 
	#define __concat(x, y) x##y
indirection, but my CPP magic needs more power.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 437441f4af41..c2dd9b4cdace 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -66,6 +66,15 @@  enum {
 #define __I915_EXEC_ILLEGAL_FLAGS \
 	(__I915_EXEC_UNKNOWN_FLAGS | I915_EXEC_CONSTANTS_MASK)
 
+/* Catch emission of unexpected errors for CI! */
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
+#undef EINVAL
+#define EINVAL ({ \
+	DRM_DEBUG_DRIVER("EINVAL at %s:%d\n", __func__, __LINE__); \
+	22; \
+})
+#endif
+
 /**
  * DOC: User command execution
  *