Skip to contentSkip to conversation

drm/i915/execlists: Ensure the tasklet is decoupled upon shutdown

PATCH New Chris Wilson 2 participants 3 messages Nov 29, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/execlists: Ensure the tasklet is decoupled upon shutdown

Be safe and make sure the tasklet is flushed before destroying the engine's memory.

---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
index 4cd0d46b5da6..6ec2f022669e 100644
@@ -3779,6 +3779,7 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
 
 static void execlists_destroy(struct intel_engine_cs *engine)
 {
+	tasklet_kill(&engine->execlists.tasklet); /* flush residual softirq */
 	intel_engine_cleanup_common(engine);
 	lrc_destroy_wa_ctx(engine);
 	kfree(engine);
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/1 drm/i915/execlists: Ensure the tasklet is decoupled upon shutdown

As we only cancel the timers asynchronously, they may still be running on another CPU as we shutdown, raising one last softirq. So be safe and make sure the tasklet is flushed before destroying the engine's memory.

---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/gt/intel_lrc.c +10 -0
index 4cd0d46b5da6..fef4b7e823f5 100644
@@ -3777,8 +3777,18 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
 		engine->flags |= I915_ENGINE_HAS_RELATIVE_MMIO;
 }
 
+static void execlists_shutdown(struct intel_engine_cs *engine)
+{
+	/* Synchronise with residual timers and any softirq they raise */
+	del_timer_sync(&engine->execlists.timer);
+	del_timer_sync(&engine->execlists.preempt);
+	tasklet_kill(&engine->execlists.tasklet);
+}
+
 static void execlists_destroy(struct intel_engine_cs *engine)
 {
+	execlists_shutdown(engine);
+
 	intel_engine_cleanup_common(engine);
 	lrc_destroy_wa_ctx(engine);
 	kfree(engine);
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✗ Fi.CI.BAT: failure for drm/i915/execlists: Ensure the tasklet is decoupled upon shutdown (rev2)

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915/execlists: Ensure the tasklet is decoupled upon shutdown (rev2)
URL : https://patchwork.freedesktop.org/series/70221/
State : failure

== Summary ==

Applying: drm/i915/execlists: Ensure the tasklet is decoupled upon shutdown Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gt/intel_lrc.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx