All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 03/15] drm/i915/execlists: Assert tasklet is locked for process_csb()
Date: Mon, 14 Oct 2019 10:07:45 +0100	[thread overview]
Message-ID: <20191014090757.32111-3-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20191014090757.32111-1-chris@chris-wilson.co.uk>

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 16b878d35814..fc4be76b3070 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1843,6 +1843,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

  parent reply	other threads:[~2019-10-14  9:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14  9:07 [PATCH 01/15] drm/i915/display: Squelch kerneldoc warnings Chris Wilson
2019-10-14  9:07 ` [PATCH 02/15] drm/i915/gem: Distinguish each object type Chris Wilson
2019-10-14  9:07 ` Chris Wilson [this message]
2019-10-14  9:07 ` [PATCH 04/15] drm/i915/execlists: Clear semaphore immediately upon ELSP promotion Chris Wilson
2019-10-14  9:07 ` [PATCH 05/15] drm/i915/execlists: Tweak virtual unsubmission Chris Wilson
2019-10-14  9:07 ` [PATCH 06/15] drm/i915/selftests: Check known register values within the context Chris Wilson
2019-10-14  9:59   ` Tvrtko Ursulin
2019-10-14 10:06     ` Chris Wilson
2019-10-14  9:07 ` [PATCH 07/15] drm/i915/selftests: Check that GPR are cleared for new contexts Chris Wilson
2019-10-14 10:08   ` Tvrtko Ursulin
2019-10-14  9:07 ` [PATCH 08/15] drm/i915: Expose engine properties via sysfs Chris Wilson
2019-10-14 10:17   ` Tvrtko Ursulin
2019-10-14 10:27     ` Chris Wilson
2019-10-14  9:07 ` [PATCH 09/15] drm/i915/execlists: Force preemption Chris Wilson
2019-10-14  9:07 ` [PATCH 10/15] drm/i915/gt: Introduce barrier pulses along engines Chris Wilson
2019-10-14 11:03   ` Tvrtko Ursulin
2019-10-14  9:07 ` [PATCH 11/15] drm/i915/execlists: Cancel banned contexts on schedule-out Chris Wilson
2019-10-14 12:00   ` Tvrtko Ursulin
2019-10-14 12:06     ` Chris Wilson
2019-10-14 12:25       ` Tvrtko Ursulin
2019-10-14 12:34         ` Chris Wilson
2019-10-14 13:13           ` Chris Wilson
2019-10-14 13:19             ` Tvrtko Ursulin
2019-10-14 13:23               ` Chris Wilson
2019-10-14 13:38                 ` Tvrtko Ursulin
2019-10-14  9:07 ` [PATCH 12/15] drm/i915/gem: Cancel non-persistent contexts on close Chris Wilson
2019-10-14 12:11   ` Tvrtko Ursulin
2019-10-14 12:21     ` Chris Wilson
2019-10-14 13:10       ` Tvrtko Ursulin
2019-10-14 13:34         ` Chris Wilson
2019-10-14 16:06           ` Tvrtko Ursulin
2019-10-14  9:07 ` [PATCH 13/15] drm/i915: Replace hangcheck by heartbeats Chris Wilson
2019-10-14 12:13   ` Tvrtko Ursulin
2019-10-14  9:07 ` [PATCH 14/15] drm/i915: Flush idle barriers when waiting Chris Wilson
2019-10-14  9:07 ` [PATCH 15/15] drm/i915/execlist: Trim immediate timeslice expiry Chris Wilson
2019-10-14 16:15 ` ✗ Fi.CI.BUILD: failure for series starting with [01/15] drm/i915/display: Squelch kerneldoc warnings Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191014090757.32111-3-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.