Introduce a new execobject.flag (EXEC_OBJECT_CAPTURE) that userspace may use to indicate that it wants the contents of this buffer preserved in the error state (/sys/class/drm/cardN/error) following a GPU hang involving this batch. Use this at your discretion, the contents of the error state. although compressed, are allocated with GFP_ATOMIC (i.e. limited) and kept for all eternity (until the error state is destroyed). Based on an earlier patch by Ben Widawsky <ben@bwidawsk.net> Testcase: igt/gem_exec_capture Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ben Widawsky <ben@bwidawsk.net> Cc: Matt Turner <mattst88@gmail.com> Acked-by: Ben Widawsky <ben@bwidawsk.net> Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170415093902.22581-1-chris@chris-wilson.co.uk
Showing the changes to include/uapi (1 of 7 files). Show all
Unified · Split
| @@ -412,6 +412,12 @@ typedef struct drm_i915_irq_wait { · 411 unmodified lines | |||
| 412 | */ | 412 | */ |
| 413 | #define I915_PARAM_HAS_EXEC_FENCE 44 | 413 | #define I915_PARAM_HAS_EXEC_FENCE 44 |
| 414 | 414 | ||
| 415 | /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture | ||
| 416 | * user specified bufffers for post-mortem debugging of GPU hangs. See | ||
| 417 | * EXEC_OBJECT_CAPTURE. | ||
| 418 | */ | ||
| 419 | #define I915_PARAM_HAS_EXEC_CAPTURE 45 | ||
| 420 | |||
| 415 | typedef struct drm_i915_getparam { | 421 | typedef struct drm_i915_getparam { |
| 416 | __s32 param; | 422 | __s32 param; |
| 417 | /* | 423 | /* |
| @@ -775,8 +781,15 @@ struct drm_i915_gem_exec_object2 { · 357 unmodified lines | |||
| 775 | * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously. | 781 | * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously. |
| 776 | */ | 782 | */ |
| 777 | #define EXEC_OBJECT_ASYNC (1<<6) | 783 | #define EXEC_OBJECT_ASYNC (1<<6) |
| 784 | /* Request that the contents of this execobject be copied into the error | ||
| 785 | * state upon a GPU hang involving this batch for post-mortem debugging. | ||
| 786 | * These buffers are recorded in no particular order as "user" in | ||
| 787 | * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see | ||
| 788 | * if the kernel supports this flag. | ||
| 789 | */ | ||
| 790 | #define EXEC_OBJECT_CAPTURE (1<<7) | ||
| 778 | /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ | 791 | /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ |
| 779 | #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_ASYNC<<1) | 792 | #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1) |
| 780 | __u64 flags; | 793 | __u64 flags; |
| 781 | 794 | ||
| 782 | union { | 795 | union { |