Skip to content

Commit 7d442ea

Browse files
icklerodrigovivi
authored andcommitted
drm/i915: Cancel outstanding work after disabling heartbeats on an engine
We only allow persistent requests to remain on the GPU past the closure of their containing context (and process) so long as they are continuously checked for hangs or allow other requests to preempt them, as we need to ensure forward progress of the system. If we allow persistent contexts to remain on the system after the the hangcheck mechanism is disabled, the system may grind to a halt. On disabling the mechanism, we sent a pulse along the engine to remove all executing contexts from the engine which would check for hung contexts -- but we did not prevent those contexts from being resubmitted if they survived the final hangcheck. Fixes: 9a40bdd ("drm/i915/gt: Expose heartbeat interval via sysfs") Testcase: igt/gem_ctx_persistence/heartbeat-stop Signed-off-by: Chris Wilson <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: <[email protected]> # v5.7+ Reviewed-by: Tvrtko Ursulin <[email protected]> Acked-by: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 7a991cd) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 3cfea8c commit 7d442ea

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/gpu/drm/i915/gt/intel_engine.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,13 @@ intel_engine_has_preempt_reset(const struct intel_engine_cs *engine)
337337
return intel_engine_has_preemption(engine);
338338
}
339339

340+
static inline bool
341+
intel_engine_has_heartbeat(const struct intel_engine_cs *engine)
342+
{
343+
if (!IS_ACTIVE(CONFIG_DRM_I915_HEARTBEAT_INTERVAL))
344+
return false;
345+
346+
return READ_ONCE(engine->props.heartbeat_interval_ms);
347+
}
348+
340349
#endif /* _INTEL_RINGBUFFER_H_ */

drivers/gpu/drm/i915/i915_request.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,13 @@ bool __i915_request_submit(struct i915_request *request)
542542
if (i915_request_completed(request))
543543
goto xfer;
544544

545+
if (unlikely(intel_context_is_closed(request->context) &&
546+
!intel_engine_has_heartbeat(engine)))
547+
intel_context_set_banned(request->context);
548+
545549
if (unlikely(intel_context_is_banned(request->context)))
546550
i915_request_set_error_once(request, -EIO);
551+
547552
if (unlikely(fatal_error(request->fence.error)))
548553
__i915_request_skip(request);
549554

0 commit comments

Comments
 (0)