Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c04e0f3b authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Separate out the seqno-barrier from engine->get_seqno



In order to simplify future patches, extract the
lazy_coherency optimisation our of the engine->get_seqno() vfunc into
its own callback.

v2: Rename the barrier to engine->irq_seqno_barrier to try and better
reflect that the barrier is only required after the user interrupt before
reading the seqno (to ensure that the seqno update lands in time as we
do not have strict seqno-irq ordering on all platforms).

Reviewed-by: Dave Gordon <david.s.gordon@intel.com> [#v2]

v3: Comments for hangcheck paranoia. Mika wanted to keep the extra
barrier inside the hangcheck, just in case. I can argue that it doesn't
provide a barrier against anything, but the side-effects of applying the
barrier may prevent a false declaration of a hung GPU.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Dave Gordon <david.s.gordon@intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1460195877-20520-2-git-send-email-chris@chris-wilson.co.uk
parent 9b9ed309
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -598,7 +598,7 @@ static int i915_gem_pageflip_info(struct seq_file *m, void *data)
					   engine->name,
					   i915_gem_request_get_seqno(work->flip_queued_req),
					   dev_priv->next_seqno,
					   engine->get_seqno(engine, true),
					   engine->get_seqno(engine),
					   i915_gem_request_completed(work->flip_queued_req, true));
			} else
				seq_printf(m, "Flip not associated with any ring\n");
@@ -730,7 +730,7 @@ static void i915_ring_seqno_info(struct seq_file *m,
{
	if (engine->get_seqno) {
		seq_printf(m, "Current sequence (%s): %x\n",
			   engine->name, engine->get_seqno(engine, false));
			   engine->name, engine->get_seqno(engine));
	}
}

@@ -1346,8 +1346,8 @@ static int i915_hangcheck_info(struct seq_file *m, void *unused)
	intel_runtime_pm_get(dev_priv);

	for_each_engine_id(engine, dev_priv, id) {
		seqno[id] = engine->get_seqno(engine, false);
		acthd[id] = intel_ring_get_active_head(engine);
		seqno[id] = engine->get_seqno(engine);
	}

	i915_get_extra_instdone(dev, instdone);
+8 −4
Original line number Diff line number Diff line
@@ -3017,15 +3017,19 @@ i915_seqno_passed(uint32_t seq1, uint32_t seq2)
static inline bool i915_gem_request_started(struct drm_i915_gem_request *req,
					   bool lazy_coherency)
{
	u32 seqno = req->engine->get_seqno(req->engine, lazy_coherency);
	return i915_seqno_passed(seqno, req->previous_seqno);
	if (!lazy_coherency && req->engine->irq_seqno_barrier)
		req->engine->irq_seqno_barrier(req->engine);
	return i915_seqno_passed(req->engine->get_seqno(req->engine),
				 req->previous_seqno);
}

static inline bool i915_gem_request_completed(struct drm_i915_gem_request *req,
					      bool lazy_coherency)
{
	u32 seqno = req->engine->get_seqno(req->engine, lazy_coherency);
	return i915_seqno_passed(seqno, req->seqno);
	if (!lazy_coherency && req->engine->irq_seqno_barrier)
		req->engine->irq_seqno_barrier(req->engine);
	return i915_seqno_passed(req->engine->get_seqno(req->engine),
				 req->seqno);
}

int __must_check i915_gem_get_seqno(struct drm_device *dev, u32 *seqno);
+1 −1
Original line number Diff line number Diff line
@@ -931,8 +931,8 @@ static void i915_record_ring_state(struct drm_device *dev,

	ering->waiting = waitqueue_active(&engine->irq_queue);
	ering->instpm = I915_READ(RING_INSTPM(engine->mmio_base));
	ering->seqno = engine->get_seqno(engine, false);
	ering->acthd = intel_ring_get_active_head(engine);
	ering->seqno = engine->get_seqno(engine);
	ering->last_seqno = engine->last_submitted_seqno;
	ering->start = I915_READ_START(engine);
	ering->head = I915_READ_HEAD(engine);
+12 −2
Original line number Diff line number Diff line
@@ -2941,7 +2941,7 @@ static int semaphore_passed(struct intel_engine_cs *engine)
	if (signaller->hangcheck.deadlock >= I915_NUM_ENGINES)
		return -1;

	if (i915_seqno_passed(signaller->get_seqno(signaller, false), seqno))
	if (i915_seqno_passed(signaller->get_seqno(signaller), seqno))
		return 1;

	/* cursory check for an unkickable deadlock */
@@ -3100,8 +3100,18 @@ static void i915_hangcheck_elapsed(struct work_struct *work)

		semaphore_clear_deadlocks(dev_priv);

		seqno = engine->get_seqno(engine, false);
		/* We don't strictly need an irq-barrier here, as we are not
		 * serving an interrupt request, be paranoid in case the
		 * barrier has side-effects (such as preventing a broken
		 * cacheline snoop) and so be sure that we can see the seqno
		 * advance. If the seqno should stick, due to a stale
		 * cacheline, we would erroneously declare the GPU hung.
		 */
		if (engine->irq_seqno_barrier)
			engine->irq_seqno_barrier(engine);

		acthd = intel_ring_get_active_head(engine);
		seqno = engine->get_seqno(engine);

		if (engine->hangcheck.seqno == seqno) {
			if (ring_idle(engine, seqno)) {
+1 −1
Original line number Diff line number Diff line
@@ -562,7 +562,7 @@ TRACE_EVENT(i915_gem_request_notify,
	    TP_fast_assign(
			   __entry->dev = engine->dev->primary->index;
			   __entry->ring = engine->id;
			   __entry->seqno = engine->get_seqno(engine, false);
			   __entry->seqno = engine->get_seqno(engine);
			   ),

	    TP_printk("dev=%u, ring=%u, seqno=%u",
Loading