All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v8 10/13] drm/i915: add infrastructure to hold off preemption on a request
Date: Tue,  9 Jul 2019 15:33:48 +0300	[thread overview]
Message-ID: <20190709123351.5645-11-lionel.g.landwerlin@intel.com> (raw)
In-Reply-To: <20190709123351.5645-1-lionel.g.landwerlin@intel.com>

We want to set this flag in the next commit on requests containing
perf queries so that the result of the perf query can just be a delta
of global counters, rather than doing post processing of the OA
buffer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c         |  7 ++++++-
 drivers/gpu/drm/i915/i915_priolist_types.h  |  7 +++++++
 drivers/gpu/drm/i915/i915_request.c         |  4 ++--
 drivers/gpu/drm/i915/i915_request.h         | 14 +++++++++++++-
 drivers/gpu/drm/i915/intel_guc_submission.c | 10 +++++++++-
 drivers/gpu/drm/i915/intel_pm.c             |  5 +++--
 6 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 30782af8f4bc..6c35d33f9647 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -256,7 +256,12 @@ static inline int rq_prio(const struct i915_request *rq)
 
 static int effective_prio(const struct i915_request *rq)
 {
-	int prio = rq_prio(rq);
+	int prio;
+
+	if (i915_request_has_perf(rq))
+		prio = I915_USER_PRIORITY(I915_PRIORITY_PERF);
+	else
+		prio = rq_prio(rq);
 
 	/*
 	 * On unwinding the active request, we give it a priority bump
diff --git a/drivers/gpu/drm/i915/i915_priolist_types.h b/drivers/gpu/drm/i915/i915_priolist_types.h
index 49709de69875..bb9d1e1fb94a 100644
--- a/drivers/gpu/drm/i915/i915_priolist_types.h
+++ b/drivers/gpu/drm/i915/i915_priolist_types.h
@@ -17,6 +17,13 @@ enum {
 	I915_PRIORITY_NORMAL = I915_CONTEXT_DEFAULT_PRIORITY,
 	I915_PRIORITY_MAX = I915_CONTEXT_MAX_USER_PRIORITY + 1,
 
+	/* Requests containing performance queries must not be preempted by
+	 * another context. They get scheduled with their default priority and
+	 * once they reach the execlist ports we bump them to
+	 * I915_PRIORITY_PERF so that they stick to the HW until they finish.
+	 */
+	I915_PRIORITY_PERF,
+
 	I915_PRIORITY_INVALID = INT_MIN
 };
 
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 5ff87c4a0cd5..222c9c56e9de 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -292,7 +292,7 @@ static bool i915_request_retire(struct i915_request *rq)
 		dma_fence_signal_locked(&rq->fence);
 	if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &rq->fence.flags))
 		i915_request_cancel_breadcrumb(rq);
-	if (rq->waitboost) {
+	if (i915_request_has_waitboost(rq)) {
 		GEM_BUG_ON(!atomic_read(&rq->i915->gt_pm.rps.num_waiters));
 		atomic_dec(&rq->i915->gt_pm.rps.num_waiters);
 	}
@@ -684,7 +684,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
 	rq->file_priv = NULL;
 	rq->batch = NULL;
 	rq->capture_list = NULL;
-	rq->waitboost = false;
+	rq->flags = 0;
 	rq->execution_mask = ALL_ENGINES;
 
 	INIT_LIST_HEAD(&rq->active_list);
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
index b58ceef92e20..26c46cdc67fe 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -216,7 +216,9 @@ struct i915_request {
 	/** Time at which this request was emitted, in jiffies. */
 	unsigned long emitted_jiffies;
 
-	bool waitboost;
+#define I915_REQUEST_WAITBOOST BIT(0)
+#define I915_REQUEST_NOPREEMPT BIT(1)
+	u32 flags;
 
 	/** timeline->request entry for this request */
 	struct list_head link;
@@ -430,6 +432,16 @@ static inline void i915_request_mark_complete(struct i915_request *rq)
 	rq->hwsp_seqno = (u32 *)&rq->fence.seqno; /* decouple from HWSP */
 }
 
+static inline bool i915_request_has_waitboost(const struct i915_request *rq)
+{
+	return rq->flags & I915_REQUEST_WAITBOOST;
+}
+
+static inline bool i915_request_has_perf(const struct i915_request *rq)
+{
+	return rq->flags & I915_REQUEST_NOPREEMPT;
+}
+
 bool i915_retire_requests(struct drm_i915_private *i915);
 
 #endif /* I915_REQUEST_H */
diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index 12c22359fdac..48e7ae3d67a2 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -707,6 +707,14 @@ static inline int rq_prio(const struct i915_request *rq)
 	return rq->sched.attr.priority | __NO_PREEMPTION;
 }
 
+static inline int effective_prio(const struct i915_request *rq)
+{
+	if (i915_request_has_perf(rq))
+		return I915_USER_PRIORITY(I915_PRIORITY_PERF) | __NO_PREEMPTION;
+
+	return rq_prio(rq);
+}
+
 static struct i915_request *schedule_in(struct i915_request *rq, int idx)
 {
 	trace_i915_request_in(rq, idx);
@@ -747,7 +755,7 @@ static void __guc_dequeue(struct intel_engine_cs *engine)
 				&engine->i915->guc.preempt_work[engine->id];
 			int prio = execlists->queue_priority_hint;
 
-			if (i915_scheduler_need_preempt(prio, rq_prio(last))) {
+			if (i915_scheduler_need_preempt(prio, effective_prio(last))) {
 				intel_write_status_page(engine,
 							I915_GEM_HWS_PREEMPT,
 							GUC_PREEMPT_INPROGRESS);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 87244d8215a7..0cecea228546 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -6876,9 +6876,10 @@ void gen6_rps_boost(struct i915_request *rq)
 	/* Serializes with i915_request_retire() */
 	boost = false;
 	spin_lock_irqsave(&rq->lock, flags);
-	if (!rq->waitboost && !dma_fence_is_signaled_locked(&rq->fence)) {
+	if (!i915_request_has_waitboost(rq) &&
+	    !dma_fence_is_signaled_locked(&rq->fence)) {
 		boost = !atomic_fetch_inc(&rps->num_waiters);
-		rq->waitboost = true;
+		rq->flags |= I915_REQUEST_WAITBOOST;
 	}
 	spin_unlock_irqrestore(&rq->lock, flags);
 	if (!boost)
-- 
2.22.0

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

  parent reply	other threads:[~2019-07-09 12:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 12:33 [PATCH v8 00/13] drm/i915: Vulkan performance query support Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 01/13] drm/i915/perf: ensure we keep a reference on the driver Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 02/13] drm/i915/perf: add missing delay for OA muxes configuration Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 03/13] drm/i915/perf: introduce a versioning of the i915-perf uapi Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 04/13] drm/i915/perf: allow for CS OA configs to be created lazily Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 05/13] drm/i915: enumerate scratch fields Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 06/13] drm/i915/perf: implement active wait for noa configurations Lionel Landwerlin
2019-07-10 23:43   ` Umesh Nerlige Ramappa
     [not found]     ` <156282659660.12280.4199368775706498585@skylake-alporthouse-com>
2019-07-11  7:47       ` Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 07/13] drm/i915: introduce a mechanism to extend execbuf2 Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 08/13] drm/i915: add syncobj timeline support Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 09/13] drm/i915: add a new perf configuration execbuf parameter Lionel Landwerlin
2019-07-09 12:53   ` Lionel Landwerlin
2019-07-09 13:10     ` Chris Wilson
2019-07-09 13:13       ` Chris Wilson
2019-07-10 11:09   ` Chris Wilson
2019-07-09 12:33 ` Lionel Landwerlin [this message]
2019-07-09 14:18   ` [PATCH v8 10/13] drm/i915: add infrastructure to hold off preemption on a request Chris Wilson
2019-07-09 12:33 ` [PATCH v8 11/13] drm/i915/perf: allow holding preemption on filtered ctx Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 12/13] drm/i915/perf: execute OA configuration from command stream Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 13/13] drm/i915: add support for perf configuration queries Lionel Landwerlin
2019-07-10 11:04   ` Chris Wilson
2019-07-09 13:08 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Vulkan performance query support (rev8) Patchwork
2019-07-09 13:15 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-09 13:27 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-09 20:30 ` [PATCH v8 00/13] drm/i915: Vulkan performance query support Chris Wilson
2019-07-10  9:06   ` Lionel Landwerlin
2019-07-10  1:20 ` ✗ Fi.CI.IGT: failure for drm/i915: Vulkan performance query support (rev8) 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=20190709123351.5645-11-lionel.g.landwerlin@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --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.