public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/execlists: Assert tasklet is locked for process_csb()
@ 2019-10-13 19:31 Chris Wilson
  2019-10-14  9:25 ` Tvrtko Ursulin
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Chris Wilson @ 2019-10-13 19:31 UTC (permalink / raw)
  To: intel-gfx

We rely on only the tasklet being allowed to call into process_csb(), so
assert that is locked when we do. As the tasklet uses a simple bitlock,
there is no strong lockdep checking so we must make do with a plain
assertion that the tasklet is running and assume that we are the
tasklet!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 1 +
 drivers/gpu/drm/i915/i915_gem.h     | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 8be9e69d5718..ab20433182d1 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1984,6 +1984,7 @@ static void process_csb(struct intel_engine_cs *engine)
 	u8 head, tail;
 
 	GEM_BUG_ON(USES_GUC_SUBMISSION(engine->i915));
+	GEM_BUG_ON(!tasklet_is_locked(&execlists->tasklet));
 
 	/*
 	 * Note that csb_write, csb_status may be either in HWSP or mmio.
diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
index db20d2b0842b..f6f9675848b8 100644
--- a/drivers/gpu/drm/i915/i915_gem.h
+++ b/drivers/gpu/drm/i915/i915_gem.h
@@ -86,6 +86,11 @@ static inline void tasklet_lock(struct tasklet_struct *t)
 		cpu_relax();
 }
 
+static inline bool tasklet_is_locked(const struct tasklet_struct *t)
+{
+	return test_bit(TASKLET_STATE_RUN, &t->state);
+}
+
 static inline void __tasklet_disable_sync_once(struct tasklet_struct *t)
 {
 	if (!atomic_fetch_inc(&t->count))
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-10-15  2:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-13 19:31 [PATCH] drm/i915/execlists: Assert tasklet is locked for process_csb() Chris Wilson
2019-10-14  9:25 ` Tvrtko Ursulin
2019-10-14  9:27   ` Chris Wilson
2019-10-14  9:28     ` Chris Wilson
2019-10-14  9:31       ` Chris Wilson
2019-10-14  9:37 ` [PATCH v2] " Chris Wilson
2019-10-14  9:43   ` Tvrtko Ursulin
2019-10-14 11:42 ` [PATCH v3] " Chris Wilson
2019-10-14 12:13 ` Chris Wilson
2019-10-14 17:47 ` ✓ Fi.CI.BAT: success for drm/i915/execlists: Assert tasklet is locked for process_csb() (rev4) Patchwork
2019-10-15  2:28 ` ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox