]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/i915: Cancel outstanding work after disabling heartbeats on an engine
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 28 Sep 2020 22:15:08 +0000 (23:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 11:38:54 +0000 (12:38 +0100)
commit 7d442ea7c504adcc9798b07cd8f6a0d235fca2da upstream.

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: 9a40bddd47ca ("drm/i915/gt: Expose heartbeat interval via sysfs")
Testcase: igt/gem_ctx_persistence/heartbeat-stop
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v5.7+
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200928221510.26044-1-chris@chris-wilson.co.uk
(cherry picked from commit 7a991cd3e3da9a56d5616b62d425db000a3242f2)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/gt/intel_engine.h
drivers/gpu/drm/i915/i915_request.c

index a9249a23903a92d252b23755dd078a22808d1280..fda90d49844a50870fc8acdfca11bff3d86fba76 100644 (file)
@@ -357,4 +357,13 @@ intel_engine_has_preempt_reset(const struct intel_engine_cs *engine)
        return intel_engine_has_preemption(engine);
 }
 
+static inline bool
+intel_engine_has_heartbeat(const struct intel_engine_cs *engine)
+{
+       if (!IS_ACTIVE(CONFIG_DRM_I915_HEARTBEAT_INTERVAL))
+               return false;
+
+       return READ_ONCE(engine->props.heartbeat_interval_ms);
+}
+
 #endif /* _INTEL_RINGBUFFER_H_ */
index 781a6783affe920f29bfe9fe39f6dbe8da64047b..4df7b2a16999ee5fbf3c5202ee35ee22fff66f1a 100644 (file)
@@ -549,8 +549,13 @@ bool __i915_request_submit(struct i915_request *request)
        if (i915_request_completed(request))
                goto xfer;
 
+       if (unlikely(intel_context_is_closed(request->context) &&
+                    !intel_engine_has_heartbeat(engine)))
+               intel_context_set_banned(request->context);
+
        if (unlikely(intel_context_is_banned(request->context)))
                i915_request_set_error_once(request, -EIO);
+
        if (unlikely(fatal_error(request->fence.error)))
                __i915_request_skip(request);