diff mbox

[10/20] drm/i915: Watchdog timeout: DRM kernel interface enablement

Message ID 1445563962-20753-11-git-send-email-tomas.elf@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomas Elf Oct. 23, 2015, 1:32 a.m. UTC
Final enablement patch for GPU hang recovery using watchdog timeout.
Added execbuf flag for watchdog timeout in DRM kernel interface.

Signed-off-by: Tomas Elf <tomas.elf@intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 6 ++----
 include/uapi/drm/i915_drm.h      | 5 ++++-
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Chris Wilson Jan. 22, 2016, 1:59 p.m. UTC | #1
On Fri, Oct 23, 2015 at 02:32:32AM +0100, Tomas Elf wrote:
> Final enablement patch for GPU hang recovery using watchdog timeout.
> Added execbuf flag for watchdog timeout in DRM kernel interface.

Usual argument: per-batch or per-context flag? What's the use case being
consider that would favour one approach or another. That usecase should
be explained in the changelog so that we can be reminded of it again
later.
-Chris
arun.siluvery@linux.intel.com Jan. 22, 2016, 2:08 p.m. UTC | #2
On 22/01/2016 13:59, Chris Wilson wrote:
> On Fri, Oct 23, 2015 at 02:32:32AM +0100, Tomas Elf wrote:
>> Final enablement patch for GPU hang recovery using watchdog timeout.
>> Added execbuf flag for watchdog timeout in DRM kernel interface.
>
> Usual argument: per-batch or per-context flag? What's the use case being
> consider that would favour one approach or another. That usecase should
> be explained in the changelog so that we can be reminded of it again
> later.

It is per-batch, user expects certain workloads to be completed before 
watchdog times out hence it is per-batch.
This is mainly used for media workloads, don't know the exact usecase 
but I guess encode/decode work of frame to complete within a short time 
etc. I will add these details to commit msg.

regards
Arun

> -Chris
>
Daniel Vetter Jan. 25, 2016, 3:58 p.m. UTC | #3
On Fri, Jan 22, 2016 at 02:08:32PM +0000, Arun Siluvery wrote:
> On 22/01/2016 13:59, Chris Wilson wrote:
> >On Fri, Oct 23, 2015 at 02:32:32AM +0100, Tomas Elf wrote:
> >>Final enablement patch for GPU hang recovery using watchdog timeout.
> >>Added execbuf flag for watchdog timeout in DRM kernel interface.
> >
> >Usual argument: per-batch or per-context flag? What's the use case being
> >consider that would favour one approach or another. That usecase should
> >be explained in the changelog so that we can be reminded of it again
> >later.
> 
> It is per-batch, user expects certain workloads to be completed before
> watchdog times out hence it is per-batch.
> This is mainly used for media workloads, don't know the exact usecase but I
> guess encode/decode work of frame to complete within a short time etc. I
> will add these details to commit msg.

Usual reminder: We need an open-source user to get these new interfaces
in. Looking at that should make it pretty clear whether the watchdog
should be per-ctx or per-batch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 30cd0ac..9d01fc3 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1160,10 +1160,6 @@  int intel_execlists_submission(struct i915_execbuffer_params *params,
 	u32 instp_mask;
 	int ret;
 	bool watchdog_running = false;
-	/*
-	 * NB: Place-holder until watchdog timeout is enabled through DRM
-	 * execbuf interface
-	 */
 	bool enable_watchdog = false;
 
 	instp_mode = args->flags & I915_EXEC_CONSTANTS_MASK;
@@ -1201,6 +1197,8 @@  int intel_execlists_submission(struct i915_execbuffer_params *params,
 	if (ret)
 		return ret;
 
+	enable_watchdog = args->flags & I915_EXEC_ENABLE_WATCHDOG;
+
 	/* Start watchdog timer */
 	if (enable_watchdog) {
 		if (!intel_ring_supports_watchdog(ring))
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 67cebe6..79e6fc3 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -776,7 +776,10 @@  struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_RESOURCE_STREAMER     (1<<15)
 
-#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_RESOURCE_STREAMER<<1)
+/* Enable watchdog timer for this batch buffer */
+#define I915_EXEC_ENABLE_WATCHDOG       (1<<16)
+
+#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_ENABLE_WATCHDOG<<1)
 
 #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \