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 10/71] drm/i915/execlists: Refactor out complete_preempt_context()
Date: Thu,  3 May 2018 07:36:56 +0100	[thread overview]
Message-ID: <20180503063757.22238-10-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20180503063757.22238-1-chris@chris-wilson.co.uk>

As a complement to inject_preempt_context(), follow up with the function
to handle its completion. This will be useful should we wish to extend
the duties of the preempt-context for execlists.

v2: And do the same for the guc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jeff McGee <jeff.mcgee@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Jeff McGee <jeff.mcgee@intel.com> #v1
---
 drivers/gpu/drm/i915/intel_guc_submission.c | 26 ++++++++++++++-------
 drivers/gpu/drm/i915/intel_lrc.c            | 23 ++++++++++--------
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index 3d4aaaf74a84..9dbbe5b5390b 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -622,6 +622,21 @@ static void wait_for_guc_preempt_report(struct intel_engine_cs *engine)
 	report->report_return_status = INTEL_GUC_REPORT_STATUS_UNKNOWN;
 }
 
+static void complete_preempt_context(struct intel_engine_cs *engine)
+{
+	struct intel_engine_execlists *execlists = &engine->execlists;
+
+	GEM_BUG_ON(!execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT));
+
+	execlists_cancel_port_requests(execlists);
+	execlists_unwind_incomplete_requests(execlists);
+
+	wait_for_guc_preempt_report(engine);
+	intel_write_status_page(engine, I915_GEM_HWS_PREEMPT_INDEX, 0);
+
+	execlists_clear_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
+}
+
 /**
  * guc_submit() - Submit commands through GuC
  * @engine: engine associated with the commands
@@ -776,15 +791,8 @@ static void guc_submission_tasklet(unsigned long data)
 
 	if (execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT) &&
 	    intel_read_status_page(engine, I915_GEM_HWS_PREEMPT_INDEX) ==
-	    GUC_PREEMPT_FINISHED) {
-		execlists_cancel_port_requests(&engine->execlists);
-		execlists_unwind_incomplete_requests(execlists);
-
-		wait_for_guc_preempt_report(engine);
-
-		execlists_clear_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
-		intel_write_status_page(engine, I915_GEM_HWS_PREEMPT_INDEX, 0);
-	}
+	    GUC_PREEMPT_FINISHED)
+		complete_preempt_context(engine);
 
 	if (!execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT))
 		guc_dequeue(engine);
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index c29d5f5582c2..6067d1dc06ef 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -551,8 +551,18 @@ static void inject_preempt_context(struct intel_engine_cs *engine)
 	if (execlists->ctrl_reg)
 		writel(EL_CTRL_LOAD, execlists->ctrl_reg);
 
-	execlists_clear_active(&engine->execlists, EXECLISTS_ACTIVE_HWACK);
-	execlists_set_active(&engine->execlists, EXECLISTS_ACTIVE_PREEMPT);
+	execlists_clear_active(execlists, EXECLISTS_ACTIVE_HWACK);
+	execlists_set_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
+}
+
+static void complete_preempt_context(struct intel_engine_execlists *execlists)
+{
+	GEM_BUG_ON(!execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT));
+
+	execlists_cancel_port_requests(execlists);
+	execlists_unwind_incomplete_requests(execlists);
+
+	execlists_clear_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
 }
 
 static void execlists_dequeue(struct intel_engine_cs *engine)
@@ -1050,14 +1060,7 @@ static void execlists_submission_tasklet(unsigned long data)
 			if (status & GEN8_CTX_STATUS_COMPLETE &&
 			    buf[2*head + 1] == execlists->preempt_complete_status) {
 				GEM_TRACE("%s preempt-idle\n", engine->name);
-
-				execlists_cancel_port_requests(execlists);
-				execlists_unwind_incomplete_requests(execlists);
-
-				GEM_BUG_ON(!execlists_is_active(execlists,
-								EXECLISTS_ACTIVE_PREEMPT));
-				execlists_clear_active(execlists,
-						       EXECLISTS_ACTIVE_PREEMPT);
+				complete_preempt_context(execlists);
 				continue;
 			}
 
-- 
2.17.0

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

  parent reply	other threads:[~2018-05-03  6:38 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03  6:36 [PATCH 01/71] drm/i915/execlists: Drop preemption arbitrations points along the ring Chris Wilson
2018-05-03  6:36 ` [PATCH 02/71] drm/i915/execlists: Emit i915_trace_request_out for preemption Chris Wilson
2018-05-03  6:36 ` [PATCH 03/71] drm/i915: Lazily unbind vma on close Chris Wilson
2018-05-03 16:59   ` Tvrtko Ursulin
2018-05-03  6:36 ` [PATCH 04/71] drm/i915: Keep one request in our ring_list Chris Wilson
2018-05-03 17:04   ` Tvrtko Ursulin
2018-05-03  6:36 ` [PATCH 05/71] drm/i915/execlists: Disable submission tasklets when rescheduling Chris Wilson
2018-05-03 17:49   ` Tvrtko Ursulin
2018-05-03 19:50     ` Chris Wilson
2018-05-04  9:15       ` Tvrtko Ursulin
2018-05-04  9:31         ` Chris Wilson
2018-05-03  6:36 ` [PATCH 06/71] drm/i915: Detect if we missed kicking the execlists tasklet Chris Wilson
2018-05-03 13:08   ` Chris Wilson
2018-05-03  6:36 ` [PATCH 07/71] drm/i915: Move request->ctx aside Chris Wilson
2018-05-03  6:36 ` [PATCH 08/71] drm/i915: Move fiddling with engine->last_retired_context Chris Wilson
2018-05-03  6:36 ` [PATCH 09/71] drm/i915: Store a pointer to intel_context in i915_request Chris Wilson
2018-05-04 10:31   ` Tvrtko Ursulin
2018-05-03  6:36 ` Chris Wilson [this message]
2018-05-03  6:36 ` [PATCH 11/71] drm/i915: Move engine reset prepare/finish to backends Chris Wilson
2018-05-03  6:36 ` [PATCH 12/71] drm/i915: Split execlists/guc reset preparations Chris Wilson
2018-05-03  6:36 ` [PATCH 13/71] drm/i915/execlists: Flush pending preemption events during reset Chris Wilson
2018-05-03  6:37 ` [PATCH 14/71] drm/i915: Combine tasklet_kill and tasklet_disable Chris Wilson
2018-05-03  6:37 ` [PATCH 15/71] drm/i915: Stop parking the signaler around reset Chris Wilson
2018-05-03  6:37 ` [PATCH 16/71] drm/i915: Be irqsafe inside reset Chris Wilson
2018-05-03  6:37 ` [PATCH 17/71] drm/i915/execlists: Make submission tasklet hardirq safe Chris Wilson
2018-05-03  6:37 ` [PATCH 18/71] drm/i915/guc: " Chris Wilson
2018-05-03  6:37 ` [PATCH 19/71] drm/i915: Allow init_breadcrumbs to be used from irq context Chris Wilson
2018-05-03  6:37 ` [PATCH 20/71] drm/i915/execlists: Force preemption via reset on timeout Chris Wilson
2018-05-03  6:37 ` [PATCH 21/71] drm/i915/execlists: Try preempt-reset from hardirq timer context Chris Wilson
2018-05-03  6:37 ` [PATCH 22/71] drm/i915/preemption: Select timeout when scheduling Chris Wilson
2018-05-03  6:37 ` [PATCH 23/71] drm/i915: Use a preemption timeout to enforce interactivity Chris Wilson
2018-05-03  6:37 ` [PATCH 24/71] drm/i915: Allow user control over preempt timeout on their important context Chris Wilson
2018-05-03  6:37 ` [PATCH 25/71] drm/i915: Disable preemption and sleeping while using the punit sideband Chris Wilson
2018-05-03  6:37 ` [PATCH 26/71] drm/i915: Lift acquiring the vlv punit magic to a common sb-get Chris Wilson
2018-05-03  6:37 ` [PATCH 27/71] drm/i915: Lift sideband locking for vlv_punit_(read|write) Chris Wilson
2018-05-03  6:37 ` [PATCH 28/71] drm/i915: Reduce RPS update frequency on Valleyview/Cherryview Chris Wilson
2018-05-03  6:37 ` [PATCH 29/71] Revert "drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3" Chris Wilson
2018-05-03  6:37 ` [PATCH 30/71] drm/i915: Replace pcu_lock with sb_lock Chris Wilson
2018-05-03  6:37 ` [PATCH 31/71] drm/i915: Separate sideband declarations to intel_sideband.h Chris Wilson
2018-05-03  6:37 ` [PATCH 32/71] drm/i915: Merge sbi read/write into a single accessor Chris Wilson
2018-05-03  6:37 ` [PATCH 33/71] drm/i915: Merge sandybridge_pcode_(read|write) Chris Wilson
2018-05-03  6:37 ` [PATCH 34/71] drm/i915: Move sandybride pcode access to intel_sideband.c Chris Wilson
2018-05-03  6:37 ` [PATCH 35/71] drm/i915: Mark up Ironlake ips with rpm wakerefs Chris Wilson
2018-05-03  6:37 ` [PATCH 36/71] drm/i915: Record logical context support in driver caps Chris Wilson
2018-05-03  6:37 ` [PATCH 37/71] drm/i915: Generalize i915_gem_sanitize() to reset contexts Chris Wilson
2018-05-03  6:37 ` [PATCH 38/71] drm/i915: Enable render context support for Ironlake (gen5) Chris Wilson
2018-05-03  8:47   ` Chris Wilson
2018-05-03  6:37 ` [PATCH 39/71] drm/i915: Enable render context support for gen4 (Broadwater to Cantiga) Chris Wilson
2018-05-03  6:37 ` [PATCH 40/71] drm/i915: Split GT powermanagement functions to intel_gt_pm.c Chris Wilson
2018-05-03  6:37 ` [PATCH 41/71] drm/i915: Move rps worker " Chris Wilson
2018-05-03  6:37 ` [PATCH 42/71] drm/i915: Move all the RPS irq handlers to intel_gt_pm Chris Wilson
2018-05-03  6:37 ` [PATCH 43/71] drm/i915: Track HAS_RPS alongside HAS_RC6 in the device info Chris Wilson
2018-05-03  6:37 ` [PATCH 44/71] drm/i915: Remove defunct intel_suspend_gt_powersave() Chris Wilson
2018-05-03  6:37 ` [PATCH 45/71] drm/i915: Reorder GT interface code Chris Wilson
2018-05-03  6:37 ` [PATCH 46/71] drm/i915: Split control of rps and rc6 Chris Wilson
2018-05-03  6:37 ` [PATCH 47/71] drm/i915: Enabling rc6 and rps have different requirements, so separate them Chris Wilson
2018-05-03  6:37 ` [PATCH 48/71] drm/i915: Simplify rc6/rps enabling Chris Wilson
2018-05-03  6:37 ` [PATCH 49/71] drm/i915: Refactor frequency bounds computation Chris Wilson
2018-05-03  6:37 ` [PATCH 50/71] drm/i915: Rename rps min/max frequencies Chris Wilson
2018-05-03  6:37 ` [PATCH 51/71] drm/i915: Pull IPS into GT power management Chris Wilson
2018-05-03 10:13 ` [PATCH 01/71] drm/i915/execlists: Drop preemption arbitrations points along the ring Lionel Landwerlin
2018-05-03 10:18   ` Chris Wilson
2018-05-03 10:28     ` Lionel Landwerlin
2018-05-03 10:38       ` Chris Wilson
2018-05-03 16:37 ` Tvrtko Ursulin

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=20180503063757.22238-10-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.