drm/i915: Show GEM_TRACE when detecting a failed GPU idle
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 9 Mar 2018 10:11:14 +0000 (10:11 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 13 Mar 2018 21:41:09 +0000 (21:41 +0000)
If we timeout waiting for the GPU to idle, something went seriously
wrong. We currently dump the engine state, but we can also dump the
ftrace buffer showing our last operations (when available).

In passing, note that since commit 559e040f1f08 ("drm/i915: Show the GPU
state when declaring wedged", we now show the engine state twice, once
in detecting the failed idle and then again on declaring wedged.

v2: ftrace_dump() takes a parameter specifying whether to dump all cpu
buffers or the local cpu's.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180309101114.1138-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem.h

index 58f8cf7d3b40ef6ad6e68aa05e029d4a82d2c778..d0624c57d9a6f3705f775ddefe4a54c39eaaa73f 100644 (file)
@@ -3672,16 +3672,7 @@ static int wait_for_engines(struct drm_i915_private *i915)
        if (wait_for(intel_engines_are_idle(i915), I915_IDLE_ENGINES_TIMEOUT)) {
                dev_err(i915->drm.dev,
                        "Failed to idle engines, declaring wedged!\n");
-               if (drm_debug & DRM_UT_DRIVER) {
-                       struct drm_printer p = drm_debug_printer(__func__);
-                       struct intel_engine_cs *engine;
-                       enum intel_engine_id id;
-
-                       for_each_engine(engine, i915, id)
-                               intel_engine_dump(engine, &p,
-                                                 "%s\n", engine->name);
-               }
-
+               GEM_TRACE_DUMP();
                i915_gem_set_wedged(i915);
                return -EIO;
        }
index f54c4ff74dedf3c914b41b20baae111b1515160a..8922344fc21bcde3480b2e729a29ca73d7642922 100644 (file)
 
 #if IS_ENABLED(CONFIG_DRM_I915_TRACE_GEM)
 #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
+#define GEM_TRACE_DUMP() ftrace_dump(DUMP_ALL)
 #else
 #define GEM_TRACE(...) do { } while (0)
+#define GEM_TRACE_DUMP() do { } while (0)
 #endif
 
 #define I915_NUM_ENGINES 8