Skip to contentSkip to conversation

Per context dynamic (sub)slice power-gating

PATCH Superseded Tvrtko Ursulin 5 participants 30 messages Aug 14, 2018 – Aug 16, 2018

Subsystems (3)

v10 of 13 Superseded Latest is v13 →

lore
Share & tools
lore

Tvrtko Ursulin

author maintainer
#0 lore raw

v10 cover Per context dynamic (sub)slice power-gating

From: Tvrtko Ursulin <[email protected]>

Updated series after continuing Lionel's work.

Userspace for the feature is the media-driver project on GitHub. Please see
https://github.com/intel/media-driver/pull/271/commits.

Headline changes:

1.

No more master allow/disallow sysfs switch. Feature is unconditionally enabled for Gen11 and on other platforms it requires CAP_SYS_ADMIN.

*** To be discussed if this is a good idea or not. ***

2.

Two new patches due a) breaking out the global barrier, and b) fixing one GEM_BUG_ON regarding incorrent kernel context classification by i915_is_ggtt.

Otherwise please see individial patch change logs.

Main topic for the cover letter though is addressing the question of dynamic slice re-configuration performance impact.

Introduction into this problem space is that changing the (sub)slice configuration has a cost at context switch time in the order of tens of milli- seconds. (It varies per Gen and with different slice count transitions.)

So the question is whether a malicious unprivileged workload can negatively impact other clients. To try and answer this question I have extended gem_wsim and creating some test workloads. (Note that my testing was done on a Gen9 system. Overall message could be the same on Gen11 but needs to be verified.)

First test was a simulated video playback client running in parallel with a simulated game of both medium and high complexity (uses around 60% or 90% of the render engine respectively, and 7% of the blitter engine). I had two flavours of the playback client, one which runs normally and one which requests reduced slice configuration. Both workloads are targetting to run at 60fps.

Second test is the same but against a heavier simulated game workload, the one which uses around 90% of the render engine.

Results are achieved frames per second as observed from the game client:

No player Normal player SSEU enabled player
Medium game 59.6 59.6 59.6
Heavy game 59.7 58.4 58.1

Here we can see that the medium workload was not affected either by the normal or SSEU player, while the heavy workload did see a performance hit. Both with the video player running in parallel, and slighlty larger when the player was SSEU enabled.

Second test is running a malicious client (or clients) in parallel to the same simulated game workloads. These clients try to trigger many context switches by using multiple contexts with dependencies set up so request coalescing is defeated as much as possible.

I tested both with normal and SSEU enabled malicious clients:

DoS client SSEU DoS client
Medium game 59.5 59.6
Heavy game 57.8 55.4

For here we can see a similar picture as with the first test. Medium game client is not affected by either DoS client, while the heavy game client is, more so with the SSEU enabled attacker.

From both tests I think the conclusion is that dynamic SSEU switching does increase the magnitude of performance loss, especially with over-subscribed engines, due cost being proportional to context switch frequency.

Likelyhood is that it slightly lowers the utilization level at which this starts to happen, but does not introduce a completely new vector of attack - that is - where it was possible to DoS a system from an unprivileged client, it still is. In both cases (SSEU enabled or not), a malicious client has the option to grind the system to a halt, albeit it may need fewer submission threads to do so when it is SSEU enabled.

Chris Wilson (3):
drm/i915: Program RPCS for Broadwell
drm/i915: Record the sseu configuration per-context & engine drm/i915: Expose RPCS (SSEU) configuration to userspace

Lionel Landwerlin (3):
drm/i915/perf: simplify configure all context function drm/i915/perf: reuse intel_lrc ctx regs macro drm/i915/perf: lock powergating configuration to default when active

Tvrtko Ursulin (2):
drm/i915: Add global barrier support drm/i915: Explicitly mark Global GTT address spaces

 drivers/gpu/drm/i915/i915_drv.h         |  56 +++++++
 drivers/gpu/drm/i915/i915_gem.c         |   2 +
 drivers/gpu/drm/i915/i915_gem_context.c | 189 +++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_context.h |   4 +
 drivers/gpu/drm/i915/i915_gem_gtt.c     |   2 +
 drivers/gpu/drm/i915/i915_gem_gtt.h     |   5 +-
 drivers/gpu/drm/i915/i915_perf.c        |  68 +++++----
 drivers/gpu/drm/i915/i915_request.c     |  16 ++
 drivers/gpu/drm/i915/i915_request.h     |  10 ++
 drivers/gpu/drm/i915/intel_lrc.c        |  87 ++++++++---
 drivers/gpu/drm/i915/intel_lrc.h        |   3 +
 drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
 include/uapi/drm/i915_drm.h             |  43 ++++++
 13 files changed, 439 insertions(+), 50 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH v10 1/8 drm/i915: Program RPCS for Broadwell

From: Chris Wilson <[email protected]>

Currently we only configure the power gating for Skylake and above, but the configuration should equally apply to Broadwell and Braswell. Even though, there is not as much variation as for later generations, we want to expose control over the configuration to userspace and may want to opt out of the "always-enabled" setting.

---
 drivers/gpu/drm/i915/intel_lrc.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -7
index 3f90c74038ef..d3ffb268a7a1 100644
@@ -2489,13 +2489,6 @@ make_rpcs(struct drm_i915_private *dev_priv)
 {
 	u32 rpcs = 0;
 
-	/*
-	 * No explicit RPCS request is needed to ensure full
-	 * slice/subslice/EU enablement prior to Gen9.
-	*/
-	if (INTEL_GEN(dev_priv) < 9)
-		return 0;
-
 	/*
 	 * Starting in Gen9, render power gating can leave
 	 * slice/subslice/EU in a partially enabled state. We
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#2 lore raw

PATCH v10 2/8 drm/i915: Record the sseu configuration per-context & engine

In reply to Tvrtko Ursulin

From: Chris Wilson <[email protected]>

We want to expose the ability to reconfigure the slices, subslice and eu per context and per engine. To facilitate that, store the current configuration on the context for each engine, which is initially set to the device default upon creation.

v2: record sseu configuration per context & engine (Chris)

v3: introduce the i915_gem_context_sseu to store powergating
programming, sseu_dev_info has grown quite a bit (Lionel)

v4: rename i915_gem_sseu into intel_sseu (Chris)
use to_intel_context() (Chris)

v5: More to_intel_context() (Tvrtko)
Switch intel_sseu from union to struct (Tvrtko) Move context default sseu in existing loop (Chris)

v6: s/intel_sseu_from_device_sseu/intel_device_default_sseu/ (Tvrtko)

---
 drivers/gpu/drm/i915/i915_drv.h         | 14 ++++++++++++++
 drivers/gpu/drm/i915/i915_gem_context.c |  2 ++
 drivers/gpu/drm/i915/i915_gem_context.h |  4 ++++
 drivers/gpu/drm/i915/i915_request.h     | 10 ++++++++++
 drivers/gpu/drm/i915/intel_lrc.c        | 22 +++++++++++-----------
 5 files changed, 41 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +14 -0
index 5fa13887b911..d6049c3f911b 100644
@@ -3445,6 +3445,20 @@ mkwrite_device_info(struct drm_i915_private *dev_priv)
 	return (struct intel_device_info *)&dev_priv->info;
 }
 
+static inline struct intel_sseu
+intel_device_default_sseu(struct drm_i915_private *i915)
+{
+	const struct sseu_dev_info *sseu = &INTEL_INFO(i915)->sseu;
+	struct intel_sseu value = {
+		.slice_mask = sseu->slice_mask,
+		.subslice_mask = sseu->subslice_mask[0],
+		.min_eus_per_subslice = sseu->max_eus_per_subslice,
+		.max_eus_per_subslice = sseu->max_eus_per_subslice,
+	};
+
+	return value;
+}
+
 /* modesetting */
 extern void intel_modeset_init_hw(struct drm_device *dev);
 extern int intel_modeset_init(struct drm_device *dev);
drivers/gpu/drm/i915/i915_gem_context.c +2 -0
index f15a039772db..8a12984e7495 100644
@@ -291,6 +291,8 @@ __create_hw_context(struct drm_i915_private *dev_priv,
 		struct intel_context *ce = &ctx->__engine[n];
 
 		ce->gem_context = ctx;
+		/* Use the whole device by default */
+		ce->sseu = intel_device_default_sseu(dev_priv);
 	}
 
 	INIT_RADIX_TREE(&ctx->handles_vma, GFP_KERNEL);
drivers/gpu/drm/i915/i915_gem_context.h +4 -0
index 851dad6decd7..1e51c2a46644 100644
@@ -31,6 +31,7 @@
 
 #include "i915_gem.h"
 #include "i915_scheduler.h"
+#include "intel_device_info.h"
 
 struct pid;
 
@@ -157,6 +158,9 @@ struct i915_gem_context {
 		int pin_count;
 
 		const struct intel_context_ops *ops;
+
+		/** sseu: Control eu/slice partitioning */
+		struct intel_sseu sseu;
 	} __engine[I915_NUM_ENGINES];
 
 	/** ring_size: size for allocating the per-engine ring buffer */
drivers/gpu/drm/i915/i915_request.h +10 -0
index 9898301ab7ef..eb6f8cce16c4 100644
@@ -39,6 +39,16 @@ struct drm_i915_gem_object;
 struct i915_request;
 struct i915_timeline;
 
+/*
+ * Powergating configuration for a particular (context,engine).
+ */
+struct intel_sseu {
+	u8 slice_mask;
+	u8 subslice_mask;
+	u8 min_eus_per_subslice;
+	u8 max_eus_per_subslice;
+};
+
 struct intel_wait {
 	struct rb_node node;
 	struct task_struct *tsk;
drivers/gpu/drm/i915/intel_lrc.c +11 -11
index d3ffb268a7a1..7b2f2d6bb057 100644
@@ -2484,8 +2484,8 @@ int logical_xcs_ring_init(struct intel_engine_cs *engine)
 	return logical_ring_init(engine);
 }
 
-static u32
-make_rpcs(struct drm_i915_private *dev_priv)
+static u32 make_rpcs(const struct sseu_dev_info *sseu,
+		     struct intel_sseu ctx_sseu)
 {
 	u32 rpcs = 0;
 
@@ -2495,24 +2495,23 @@ make_rpcs(struct drm_i915_private *dev_priv)
 	 * must make an explicit request through RPCS for full
 	 * enablement.
 	*/
-	if (INTEL_INFO(dev_priv)->sseu.has_slice_pg) {
+	if (sseu->has_slice_pg) {
 		rpcs |= GEN8_RPCS_S_CNT_ENABLE;
-		rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.slice_mask) <<
-			GEN8_RPCS_S_CNT_SHIFT;
+		rpcs |= hweight8(ctx_sseu.slice_mask) << GEN8_RPCS_S_CNT_SHIFT;
 		rpcs |= GEN8_RPCS_ENABLE;
 	}
 
-	if (INTEL_INFO(dev_priv)->sseu.has_subslice_pg) {
+	if (sseu->has_subslice_pg) {
 		rpcs |= GEN8_RPCS_SS_CNT_ENABLE;
-		rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.subslice_mask[0]) <<
+		rpcs |= hweight8(ctx_sseu.subslice_mask) <<
 			GEN8_RPCS_SS_CNT_SHIFT;
 		rpcs |= GEN8_RPCS_ENABLE;
 	}
 
-	if (INTEL_INFO(dev_priv)->sseu.has_eu_pg) {
-		rpcs |= INTEL_INFO(dev_priv)->sseu.eu_per_subslice <<
+	if (sseu->has_eu_pg) {
+		rpcs |= ctx_sseu.min_eus_per_subslice <<
 			GEN8_RPCS_EU_MIN_SHIFT;
-		rpcs |= INTEL_INFO(dev_priv)->sseu.eu_per_subslice <<
+		rpcs |= ctx_sseu.max_eus_per_subslice <<
 			GEN8_RPCS_EU_MAX_SHIFT;
 		rpcs |= GEN8_RPCS_ENABLE;
 	}
@@ -2638,7 +2637,8 @@ static void execlists_init_reg_state(u32 *regs,
 	if (rcs) {
 		regs[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1);
 		CTX_REG(regs, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
-			make_rpcs(dev_priv));
+			make_rpcs(&INTEL_INFO(dev_priv)->sseu,
+				  to_intel_context(ctx, engine)->sseu));
 
 		i915_oa_init_reg_state(engine, ctx, regs);
 	}
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#3 lore raw

PATCH v10 3/8 drm/i915/perf: simplify configure all context function

In reply to Tvrtko Ursulin

From: Lionel Landwerlin <[email protected]>

We don't need any special treatment on error so just return as soon as possible.

---
 drivers/gpu/drm/i915/i915_perf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +4 -7
index 0376338d1f8d..49597cf31707 100644
@@ -1819,7 +1819,7 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 	/* Switch away from any user context. */
 	ret = gen8_switch_to_updated_kernel_context(dev_priv, oa_config);
 	if (ret)
-		goto out;
+		return ret;
 
 	/*
 	 * The OA register config is setup through the context image. This image
@@ -1838,7 +1838,7 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 				     wait_flags,
 				     MAX_SCHEDULE_TIMEOUT);
 	if (ret)
-		goto out;
+		return ret;
 
 	/* Update all contexts now that we've stalled the submission. */
 	list_for_each_entry(ctx, &dev_priv->contexts.list, link) {
@@ -1850,10 +1850,8 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 			continue;
 
 		regs = i915_gem_object_pin_map(ce->state->obj, I915_MAP_WB);
-		if (IS_ERR(regs)) {
-			ret = PTR_ERR(regs);
-			goto out;
-		}
+		if (IS_ERR(regs))
+			return PTR_ERR(regs);
 
 		ce->state->obj->mm.dirty = true;
 		regs += LRC_STATE_PN * PAGE_SIZE / sizeof(*regs);
@@ -1863,7 +1861,6 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 		i915_gem_object_unpin_map(ce->state->obj);
 	}
 
- out:
 	return ret;
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#4 lore raw

PATCH v10 4/8 drm/i915/perf: reuse intel_lrc ctx regs macro

In reply to Tvrtko Ursulin

From: Lionel Landwerlin <[email protected]>

Abstract the context image access a bit.

---
 drivers/gpu/drm/i915/i915_perf.c | 34 +++++++++++++++-----------------
 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +16 -18
index 49597cf31707..ccb20230df2c 100644
@@ -210,6 +210,7 @@
 #include "i915_oa_cflgt3.h"
 #include "i915_oa_cnl.h"
 #include "i915_oa_icl.h"
+#include "intel_lrc_reg.h"
 
 /* HW requires this to be a power of two, between 128k and 16M, though driver
  * is currently generally designed assuming the largest 16M size is used such
@@ -1636,27 +1637,25 @@ static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
 	u32 ctx_oactxctrl = dev_priv->perf.oa.ctx_oactxctrl_offset;
 	u32 ctx_flexeu0 = dev_priv->perf.oa.ctx_flexeu0_offset;
 	/* The MMIO offsets for Flex EU registers aren't contiguous */
-	u32 flex_mmio[] = {
-		i915_mmio_reg_offset(EU_PERF_CNTL0),
-		i915_mmio_reg_offset(EU_PERF_CNTL1),
-		i915_mmio_reg_offset(EU_PERF_CNTL2),
-		i915_mmio_reg_offset(EU_PERF_CNTL3),
-		i915_mmio_reg_offset(EU_PERF_CNTL4),
-		i915_mmio_reg_offset(EU_PERF_CNTL5),
-		i915_mmio_reg_offset(EU_PERF_CNTL6),
+	i915_reg_t flex_regs[] = {
+		EU_PERF_CNTL0,
+		EU_PERF_CNTL1,
+		EU_PERF_CNTL2,
+		EU_PERF_CNTL3,
+		EU_PERF_CNTL4,
+		EU_PERF_CNTL5,
+		EU_PERF_CNTL6,
 	};
 	int i;
 
-	reg_state[ctx_oactxctrl] = i915_mmio_reg_offset(GEN8_OACTXCONTROL);
-	reg_state[ctx_oactxctrl+1] = (dev_priv->perf.oa.period_exponent <<
-				      GEN8_OA_TIMER_PERIOD_SHIFT) |
-				     (dev_priv->perf.oa.periodic ?
-				      GEN8_OA_TIMER_ENABLE : 0) |
-				     GEN8_OA_COUNTER_RESUME;
+	CTX_REG(reg_state, ctx_oactxctrl, GEN8_OACTXCONTROL,
+		(dev_priv->perf.oa.period_exponent << GEN8_OA_TIMER_PERIOD_SHIFT) |
+		(dev_priv->perf.oa.periodic ? GEN8_OA_TIMER_ENABLE : 0) |
+		GEN8_OA_COUNTER_RESUME);
 
-	for (i = 0; i < ARRAY_SIZE(flex_mmio); i++) {
+	for (i = 0; i < ARRAY_SIZE(flex_regs); i++) {
 		u32 state_offset = ctx_flexeu0 + i * 2;
-		u32 mmio = flex_mmio[i];
+		u32 mmio = i915_mmio_reg_offset(flex_regs[i]);
 
 		/*
 		 * This arbitrary default will select the 'EU FPU0 Pipeline
@@ -1676,8 +1675,7 @@ static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
 			}
 		}
 
-		reg_state[state_offset] = mmio;
-		reg_state[state_offset+1] = value;
+		CTX_REG(reg_state, state_offset, flex_regs[i], value);
 	}
 }
 
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#5 lore raw

PATCH v10 5/8 drm/i915/perf: lock powergating configuration to default when active

In reply to Tvrtko Ursulin

From: Lionel Landwerlin <[email protected]>

If some of the contexts submitting workloads to the GPU have been configured to shutdown slices/subslices, we might loose the NOA configurations written in the NOA muxes.

One possible solution to this problem is to reprogram the NOA muxes when we switch to a new context. We initially tried this in the workaround batchbuffer but some concerns where raised about the cost of reprogramming at every context switch. This solution is also not without consequences from the userspace point of view. Reprogramming of the muxes can only happen once the powergating configuration has changed (which happens after context switch). This means for a window of time during the recording, counters recorded by the OA unit might be invalid. This requires userspace dealing with OA reports to discard the invalid values.

Minimizing the reprogramming could be implemented by tracking of the last programmed configuration somewhere in GGTT and use MI_PREDICATE to discard some of the programming commands, but the command streamer would still have to parse all the MI_LRI instructions in the workaround batchbuffer.

Another solution, which this change implements, is to simply disregard the user requested configuration for the period of time when i915/perf is active. There is no known issue with this apart from a performance penality for some media workloads that benefit from running on a partially powergated GPU. We already prevent RC6 from affecting the programming so it doesn't sound completely unreasonable to hold on powergating for the same reason.

v2: Leave RPCS programming in intel_lrc.c (Lionel)

v3: Update for s/union intel_sseu/struct intel_sseu/ (Lionel)
More to_intel_context() (Tvrtko) s/dev_priv/i915/ (Tvrtko)

---
 drivers/gpu/drm/i915/i915_drv.h  | 15 +++++++++++++++
 drivers/gpu/drm/i915/i915_perf.c | 23 ++++++++++++++++++-----
 drivers/gpu/drm/i915/intel_lrc.c | 11 +++++++----
 drivers/gpu/drm/i915/intel_lrc.h |  3 +++
 4 files changed, 43 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +15 -0
index d6049c3f911b..5c12d2676435 100644
@@ -3851,4 +3851,19 @@ static inline int intel_hws_csb_write_index(struct drm_i915_private *i915)
 		return I915_HWS_CSB_WRITE_INDEX;
 }
 
+static inline struct intel_sseu
+intel_engine_prepare_sseu(struct intel_engine_cs *engine,
+			  struct intel_sseu sseu)
+{
+	struct drm_i915_private *i915 = engine->i915;
+
+	/*
+	 * If i915/perf is active, we want a stable powergating configuration
+	 * on the system. The most natural configuration to take in that case
+	 * is the default (i.e maximum the hardware can do).
+	 */
+	return i915->perf.oa.exclusive_stream ?
+		intel_device_default_sseu(i915) : sseu;
+}
+
 #endif
drivers/gpu/drm/i915/i915_perf.c +18 -5
index ccb20230df2c..c2fc2399e0ed 100644
@@ -1631,7 +1631,8 @@ static void hsw_disable_metric_set(struct drm_i915_private *dev_priv)
  */
 static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
 					   u32 *reg_state,
-					   const struct i915_oa_config *oa_config)
+					   const struct i915_oa_config *oa_config,
+					   struct intel_sseu sseu)
 {
 	struct drm_i915_private *dev_priv = ctx->i915;
 	u32 ctx_oactxctrl = dev_priv->perf.oa.ctx_oactxctrl_offset;
@@ -1677,6 +1678,9 @@ static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
 
 		CTX_REG(reg_state, state_offset, flex_regs[i], value);
 	}
+
+	CTX_REG(reg_state, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
+		gen8_make_rpcs(&INTEL_INFO(dev_priv)->sseu, sseu));
 }
 
 /*
@@ -1807,6 +1811,7 @@ static int gen8_switch_to_updated_kernel_context(struct drm_i915_private *dev_pr
 static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 				       const struct i915_oa_config *oa_config)
 {
+	struct intel_sseu default_sseu = intel_device_default_sseu(dev_priv);
 	struct intel_engine_cs *engine = dev_priv->engine[RCS];
 	struct i915_gem_context *ctx;
 	int ret;
@@ -1854,7 +1859,8 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 		ce->state->obj->mm.dirty = true;
 		regs += LRC_STATE_PN * PAGE_SIZE / sizeof(*regs);
 
-		gen8_update_reg_state_unlocked(ctx, regs, oa_config);
+		gen8_update_reg_state_unlocked(ctx, regs, oa_config,
+					       oa_config ? default_sseu : ce->sseu);
 
 		i915_gem_object_unpin_map(ce->state->obj);
 	}
@@ -2226,14 +2232,21 @@ void i915_oa_init_reg_state(struct intel_engine_cs *engine,
 			    struct i915_gem_context *ctx,
 			    u32 *reg_state)
 {
+	struct drm_i915_private *i915 = engine->i915;
 	struct i915_perf_stream *stream;
 
 	if (engine->id != RCS)
 		return;
 
-	stream = engine->i915->perf.oa.exclusive_stream;
-	if (stream)
-		gen8_update_reg_state_unlocked(ctx, reg_state, stream->oa_config);
+	stream = i915->perf.oa.exclusive_stream;
+	if (stream) {
+		struct intel_sseu default_sseu =
+			intel_device_default_sseu(i915);
+
+		gen8_update_reg_state_unlocked(ctx, reg_state,
+					       stream->oa_config,
+					       default_sseu);
+	}
 }
 
 /**
drivers/gpu/drm/i915/intel_lrc.c +7 -4
index 7b2f2d6bb057..8a2997be7ef7 100644
@@ -2484,8 +2484,8 @@ int logical_xcs_ring_init(struct intel_engine_cs *engine)
 	return logical_ring_init(engine);
 }
 
-static u32 make_rpcs(const struct sseu_dev_info *sseu,
-		     struct intel_sseu ctx_sseu)
+u32 gen8_make_rpcs(const struct sseu_dev_info *sseu,
+		   struct intel_sseu ctx_sseu)
 {
 	u32 rpcs = 0;
 
@@ -2635,10 +2635,13 @@ static void execlists_init_reg_state(u32 *regs,
 	}
 
 	if (rcs) {
+		struct intel_sseu sseu = to_intel_context(ctx, engine)->sseu;
+
 		regs[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1);
 		CTX_REG(regs, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
-			make_rpcs(&INTEL_INFO(dev_priv)->sseu,
-				  to_intel_context(ctx, engine)->sseu));
+			gen8_make_rpcs(&INTEL_INFO(dev_priv)->sseu,
+				       intel_engine_prepare_sseu(engine,
+								 sseu)));
 
 		i915_oa_init_reg_state(engine, ctx, regs);
 	}
drivers/gpu/drm/i915/intel_lrc.h +3 -0
index f5a5502ecf70..bf3acdc3d0af 100644
@@ -104,4 +104,7 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv);
 
 void intel_execlists_set_default_submission(struct intel_engine_cs *engine);
 
+u32 gen8_make_rpcs(const struct sseu_dev_info *sseu,
+		   struct intel_sseu ctx_sseu);
+
 #endif /* _INTEL_LRC_H_ */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 5/8] drm/i915/perf: lock powergating configuration to default when active

Hey Tvrtko,

Thanks for taking over this series.

I've been talking to developers using the i915/perf interface and from their point of view, they expect the system to be in a stable configuration when doing measurements.

One issue with this patch on Gen11 is that it will lock the system in a configuration that isn't workable for media workloads (all subslices enabled).
So I think we should set the value for the locked configuration per generation (gen8-10: all slices/subslices, gen11: only subslices that contain VME samplers) so that we always get a functional configurations for all workloads. Could we want to select that configuration when opening perf?

Another question is how do we expose the selected value to the user. But that can be solved in a different series.

Cheers,

-
Lionel

Quoted 172 lines · Tvrtko Ursulin

From: Lionel Landwerlin <[email protected]>

If some of the contexts submitting workloads to the GPU have been configured to shutdown slices/subslices, we might loose the NOA configurations written in the NOA muxes.

One possible solution to this problem is to reprogram the NOA muxes when we switch to a new context. We initially tried this in the workaround batchbuffer but some concerns where raised about the cost of reprogramming at every context switch. This solution is also not without consequences from the userspace point of view. Reprogramming of the muxes can only happen once the powergating configuration has changed (which happens after context switch). This means for a window of time during the recording, counters recorded by the OA unit might be invalid. This requires userspace dealing with OA reports to discard the invalid values.

Minimizing the reprogramming could be implemented by tracking of the last programmed configuration somewhere in GGTT and use MI_PREDICATE to discard some of the programming commands, but the command streamer would still have to parse all the MI_LRI instructions in the workaround batchbuffer.

Another solution, which this change implements, is to simply disregard the user requested configuration for the period of time when i915/perf is active. There is no known issue with this apart from a performance penality for some media workloads that benefit from running on a partially powergated GPU. We already prevent RC6 from affecting the programming so it doesn't sound completely unreasonable to hold on powergating for the same reason.

v2: Leave RPCS programming in intel_lrc.c (Lionel)

v3: Update for s/union intel_sseu/struct intel_sseu/ (Lionel)
More to_intel_context() (Tvrtko) s/dev_priv/i915/ (Tvrtko)

---
  drivers/gpu/drm/i915/i915_drv.h  | 15 +++++++++++++++
  drivers/gpu/drm/i915/i915_perf.c | 23 ++++++++++++++++++-----
  drivers/gpu/drm/i915/intel_lrc.c | 11 +++++++----
  drivers/gpu/drm/i915/intel_lrc.h |  3 +++
  4 files changed, 43 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +15 -0
index d6049c3f911b..5c12d2676435 100644
@@ -3851,4 +3851,19 @@ static inline int intel_hws_csb_write_index(struct drm_i915_private *i915)
  		return I915_HWS_CSB_WRITE_INDEX;
  }
 
+static inline struct intel_sseu
+intel_engine_prepare_sseu(struct intel_engine_cs *engine,
+			  struct intel_sseu sseu)
+{
+	struct drm_i915_private *i915 = engine->i915;
+
+	/*
+	 * If i915/perf is active, we want a stable powergating configuration
+	 * on the system. The most natural configuration to take in that case
+	 * is the default (i.e maximum the hardware can do).
+	 */
+	return i915->perf.oa.exclusive_stream ?
+		intel_device_default_sseu(i915) : sseu;
+}
+
  #endif
drivers/gpu/drm/i915/i915_perf.c +18 -5
index ccb20230df2c..c2fc2399e0ed 100644
@@ -1631,7 +1631,8 @@ static void hsw_disable_metric_set(struct drm_i915_private *dev_priv)
   */
  static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
  					   u32 *reg_state,
-					   const struct i915_oa_config *oa_config)
+					   const struct i915_oa_config *oa_config,
+					   struct intel_sseu sseu)
  {
  	struct drm_i915_private *dev_priv = ctx->i915;
  	u32 ctx_oactxctrl = dev_priv->perf.oa.ctx_oactxctrl_offset;
@@ -1677,6 +1678,9 @@ static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
 
  		CTX_REG(reg_state, state_offset, flex_regs[i], value);
  	}
+
+	CTX_REG(reg_state, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
+		gen8_make_rpcs(&INTEL_INFO(dev_priv)->sseu, sseu));
  }
 
  /*
@@ -1807,6 +1811,7 @@ static int gen8_switch_to_updated_kernel_context(struct drm_i915_private *dev_pr
  static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
  				       const struct i915_oa_config *oa_config)
  {
+	struct intel_sseu default_sseu = intel_device_default_sseu(dev_priv);
  	struct intel_engine_cs *engine = dev_priv->engine[RCS];
  	struct i915_gem_context *ctx;
  	int ret;
@@ -1854,7 +1859,8 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
  		ce->state->obj->mm.dirty = true;
  		regs += LRC_STATE_PN * PAGE_SIZE / sizeof(*regs);
 
-		gen8_update_reg_state_unlocked(ctx, regs, oa_config);
+		gen8_update_reg_state_unlocked(ctx, regs, oa_config,
+					       oa_config ? default_sseu : ce->sseu);
 
  		i915_gem_object_unpin_map(ce->state->obj);
  	}
@@ -2226,14 +2232,21 @@ void i915_oa_init_reg_state(struct intel_engine_cs *engine,
  			    struct i915_gem_context *ctx,
  			    u32 *reg_state)
  {
+	struct drm_i915_private *i915 = engine->i915;
  	struct i915_perf_stream *stream;
 
  	if (engine->id != RCS)
  		return;
 
-	stream = engine->i915->perf.oa.exclusive_stream;
-	if (stream)
-		gen8_update_reg_state_unlocked(ctx, reg_state, stream->oa_config);
+	stream = i915->perf.oa.exclusive_stream;
+	if (stream) {
+		struct intel_sseu default_sseu =
+			intel_device_default_sseu(i915);
+
+		gen8_update_reg_state_unlocked(ctx, reg_state,
+					       stream->oa_config,
+					       default_sseu);
+	}
  }
 
  /**
drivers/gpu/drm/i915/intel_lrc.c +7 -4
index 7b2f2d6bb057..8a2997be7ef7 100644
@@ -2484,8 +2484,8 @@ int logical_xcs_ring_init(struct intel_engine_cs *engine)
  	return logical_ring_init(engine);
  }
 
-static u32 make_rpcs(const struct sseu_dev_info *sseu,
-		     struct intel_sseu ctx_sseu)
+u32 gen8_make_rpcs(const struct sseu_dev_info *sseu,
+		   struct intel_sseu ctx_sseu)
  {
  	u32 rpcs = 0;
 
@@ -2635,10 +2635,13 @@ static void execlists_init_reg_state(u32 *regs,
  	}
 
  	if (rcs) {
+		struct intel_sseu sseu = to_intel_context(ctx, engine)->sseu;
+
  		regs[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1);
  		CTX_REG(regs, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
-			make_rpcs(&INTEL_INFO(dev_priv)->sseu,
-				  to_intel_context(ctx, engine)->sseu));
+			gen8_make_rpcs(&INTEL_INFO(dev_priv)->sseu,
+				       intel_engine_prepare_sseu(engine,
+								 sseu)));
 
  		i915_oa_init_reg_state(engine, ctx, regs);
  	}
drivers/gpu/drm/i915/intel_lrc.h +0 -0
index f5a5502ecf70..bf3acdc3d0af 100644

drivers/gpu/drm/i915/intel_lrc.h void intel_lr_context_resume(struct drm_i915_private *dev_priv); · line 110

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.h +3 -0
@@ -104,4 +104,7 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv);
 
  void intel_execlists_set_default_submission(struct intel_engine_cs *engine);
 
+u32 gen8_make_rpcs(const struct sseu_dev_info *sseu,
+		   struct intel_sseu ctx_sseu);
+
  #endif /* _INTEL_LRC_H_ */

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH 5/8] drm/i915/perf: lock powergating configuration to default when active

Quoted 9 lines · Lionel Landwerlin

Hey Tvrtko,

Thanks for taking over this series.

I've been talking to developers using the i915/perf interface and from their point of view, they expect the system to be in a stable configuration when doing measurements.

One issue with this patch on Gen11 is that it will lock the system in a configuration that isn't workable for media workloads (all subslices enabled).
So I think we should set the value for the locked configuration per generation (gen8-10: all slices/subslices, gen11: only subslices that contain VME samplers) so that we always get a functional configurations for all workloads. Could we want to select that configuration when opening perf?

This would be via i915_perf.c/gen8_configure_all_contexts?

Sounds like an unfortunate but workable compromise. As long as there doesn't appear another asymmetric slice feature in the future, which doesn't align with VME. Like one workloads wants slices 0 & 2, another wants 1 & 3, or whatever. If that happens then I don't know what we do apart from locking out perf/OA.

Quoted 1 line

Another question is how do we expose the selected value to the user. But that can be solved in a different series.

SSEU get_param would cut it? Although it would be perhaps be unexpected to get different results depending on whether perf/OA is active or not.. Hm... export device and available bitmasks via get param? Device bitmask would be fixed and available would change depending on whether perf/OA is active or not.

Regards,

Tvrtko

Quoted 181 lines

Cheers,

-
Lionel

Quoted 175 lines · Tvrtko Ursulin

From: Lionel Landwerlin <[email protected]>

If some of the contexts submitting workloads to the GPU have been configured to shutdown slices/subslices, we might loose the NOA configurations written in the NOA muxes.

One possible solution to this problem is to reprogram the NOA muxes when we switch to a new context. We initially tried this in the workaround batchbuffer but some concerns where raised about the cost of reprogramming at every context switch. This solution is also not without consequences from the userspace point of view. Reprogramming of the muxes can only happen once the powergating configuration has changed (which happens after context switch). This means for a window of time during the recording, counters recorded by the OA unit might be invalid. This requires userspace dealing with OA reports to discard the invalid values.

Minimizing the reprogramming could be implemented by tracking of the last programmed configuration somewhere in GGTT and use MI_PREDICATE to discard some of the programming commands, but the command streamer would still have to parse all the MI_LRI instructions in the workaround batchbuffer.

Another solution, which this change implements, is to simply disregard the user requested configuration for the period of time when i915/perf is active. There is no known issue with this apart from a performance penality for some media workloads that benefit from running on a partially powergated GPU. We already prevent RC6 from affecting the programming so it doesn't sound completely unreasonable to hold on powergating for the same reason.

v2: Leave RPCS programming in intel_lrc.c (Lionel)

v3: Update for s/union intel_sseu/struct intel_sseu/ (Lionel) More to_intel_context() (Tvrtko) s/dev_priv/i915/ (Tvrtko)

---
  drivers/gpu/drm/i915/i915_drv.h  | 15 +++++++++++++++

  drivers/gpu/drm/i915/i915_perf.c | 23 ++++++++++++++++++-----
  drivers/gpu/drm/i915/intel_lrc.c | 11 +++++++----
  drivers/gpu/drm/i915/intel_lrc.h |  3 +++
  4 files changed, 43 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +8 -0
index d6049c3f911b..5c12d2676435 100644
@@ -3851,4 +3851,19 @@ static inline int 
 intel_hws_csb_write_index(struct drm_i915_private *i915)
           return I915_HWS_CSB_WRITE_INDEX;
   }
+static inline struct intel_sseu
+intel_engine_prepare_sseu(struct intel_engine_cs *engine,
+              struct intel_sseu sseu)
+{
+    struct drm_i915_private *i915 = engine->i915;
+
+    /*
+     * If i915/perf is active, we want a stable powergating 

configuration
+     * on the system. The most natural configuration to take in that case
+     * is the default (i.e maximum the hardware can do). +     */
+    return i915->perf.oa.exclusive_stream ?
+        intel_device_default_sseu(i915) : sseu;

drivers/gpu/drm/i915/i915_drv.h +2 -0
+}
+

  #endif

drivers/gpu/drm/i915/i915_perf.c +2 -1
index ccb20230df2c..c2fc2399e0ed 100644
@@ -1631,7 +1631,8 @@ static void hsw_disable_metric_set(struct 
 drm_i915_private *dev_priv)
    */
   static void gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
                          u32 *reg_state,
-                       const struct i915_oa_config *oa_config)
+                       const struct i915_oa_config *oa_config,
+                       struct intel_sseu sseu)
   {
       struct drm_i915_private *dev_priv = ctx->i915;

      u32 ctx_oactxctrl = dev_priv->perf.oa.ctx_oactxctrl_offset;

drivers/gpu/drm/i915/i915_perf.c +3 -0
@@ -1677,6 +1678,9 @@ static void 
 gen8_update_reg_state_unlocked(struct i915_gem_context *ctx,
           CTX_REG(reg_state, state_offset, flex_regs[i], value);
       }
+
+    CTX_REG(reg_state, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
+        gen8_make_rpcs(&INTEL_INFO(dev_priv)->sseu, sseu));
   }
   /*
@@ -1807,6 +1811,7 @@ static int 

gen8_switch_to_updated_kernel_context(struct drm_i915_private *dev_pr static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv, const struct i915_oa_config *oa_config) {
+    struct intel_sseu default_sseu = intel_device_default_sseu(dev_priv);
      struct intel_engine_cs *engine = dev_priv->engine[RCS]; struct i915_gem_context *ctx;
      int ret;

drivers/gpu/drm/i915/i915_perf.c +12 -4
@@ -1854,7 +1859,8 @@ static int gen8_configure_all_contexts(struct 
 drm_i915_private *dev_priv,
           ce->state->obj->mm.dirty = true;
           regs += LRC_STATE_PN * PAGE_SIZE / sizeof(*regs);
-        gen8_update_reg_state_unlocked(ctx, regs, oa_config);
+        gen8_update_reg_state_unlocked(ctx, regs, oa_config,
+                           oa_config ? default_sseu : ce->sseu);
           i915_gem_object_unpin_map(ce->state->obj);
       }
@@ -2226,14 +2232,21 @@ void i915_oa_init_reg_state(struct 
 intel_engine_cs *engine,
                   struct i915_gem_context *ctx,
                   u32 *reg_state)
   {
+    struct drm_i915_private *i915 = engine->i915;
       struct i915_perf_stream *stream;
       if (engine->id != RCS)
           return;
-    stream = engine->i915->perf.oa.exclusive_stream;
-    if (stream)
-        gen8_update_reg_state_unlocked(ctx, reg_state, 
 stream->oa_config);
+    stream = i915->perf.oa.exclusive_stream;
+    if (stream) {
+        struct intel_sseu default_sseu =
+            intel_device_default_sseu(i915);
+
+        gen8_update_reg_state_unlocked(ctx, reg_state,
+                           stream->oa_config,
+                           default_sseu);
+    }
   }
   /**
drivers/gpu/drm/i915/intel_lrc.c +7 -4
index 7b2f2d6bb057..8a2997be7ef7 100644
@@ -2484,8 +2484,8 @@ int logical_xcs_ring_init(struct intel_engine_cs 
 *engine)
       return logical_ring_init(engine);
   }
-static u32 make_rpcs(const struct sseu_dev_info *sseu,
-             struct intel_sseu ctx_sseu)
+u32 gen8_make_rpcs(const struct sseu_dev_info *sseu,
+           struct intel_sseu ctx_sseu)
   {
       u32 rpcs = 0;
@@ -2635,10 +2635,13 @@ static void execlists_init_reg_state(u32 *regs,
       }
       if (rcs) {
+        struct intel_sseu sseu = to_intel_context(ctx, engine)->sseu;
+
           regs[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1);
           CTX_REG(regs, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
-            make_rpcs(&INTEL_INFO(dev_priv)->sseu,
-                  to_intel_context(ctx, engine)->sseu));
+            gen8_make_rpcs(&INTEL_INFO(dev_priv)->sseu,
+                       intel_engine_prepare_sseu(engine,
+                                 sseu)));
           i915_oa_init_reg_state(engine, ctx, regs);
       }
drivers/gpu/drm/i915/intel_lrc.h +2 -0
index f5a5502ecf70..bf3acdc3d0af 100644
@@ -104,4 +104,7 @@ void intel_lr_context_resume(struct 
 drm_i915_private *dev_priv);
   void intel_execlists_set_default_submission(struct intel_engine_cs *engine);
+u32 gen8_make_rpcs(const struct sseu_dev_info *sseu,
+           struct intel_sseu ctx_sseu);
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.h void intel_lr_context_resume(struct drm_i915_private *dev_priv); · line 110

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.h +1 -0
+
   #endif /* _INTEL_LRC_H_ */

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH 5/8] drm/i915/perf: lock powergating configuration to default when active

Quoted 12 lines · Tvrtko Ursulin
Quoted 9 lines · Lionel Landwerlin

Hey Tvrtko,

Thanks for taking over this series.

I've been talking to developers using the i915/perf interface and from their point of view, they expect the system to be in a stable configuration when doing measurements.

One issue with this patch on Gen11 is that it will lock the system in a configuration that isn't workable for media workloads (all subslices enabled).
So I think we should set the value for the locked configuration per generation (gen8-10: all slices/subslices, gen11: only subslices that contain VME samplers) so that we always get a functional configurations for all workloads. Could we want to select that configuration when opening perf?

Quoted 7 lines

This would be via i915_perf.c/gen8_configure_all_contexts?

Sounds like an unfortunate but workable compromise. As long as there doesn't appear another asymmetric slice feature in the future, which doesn't align with VME. Like one workloads wants slices 0 & 2, another wants 1 & 3, or whatever. If that happens then I don't know what we do apart from locking out perf/OA.

Quoted 1 line

Another question is how do we expose the selected value to the user. But that can be solved in a different series.

SSEU get_param would cut it? Although it would be perhaps be unexpected to get different results depending on whether perf/OA is active or not.. Hm... export device and available bitmasks via get param? Device bitmask would be fixed and available would change depending on whether perf/OA is active or not.

Big downside to this is that observing something via OA would cause slow down of the whole system - since the SSEU config would be locked to a subset of slices on Gen11. :( Regardless or not of the details.. say even if we choose to lock only if there is one non-default SSEU context, that still locks all whilst perf/OA is active.

That's quite bad I think. But the alternative is to lock out perf/OA while non-default SSEU contexts are present. Which is also very bad. :(

Overall I don't see a solution. Latter is maybe better by being more explicit? Who are the perf/OA users and what would they prefer?

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH 5/8] drm/i915/perf: lock powergating configuration to default when active

Quoted 14 lines · Tvrtko Ursulin
Quoted 12 lines · Tvrtko Ursulin
Quoted 9 lines · Lionel Landwerlin

Hey Tvrtko,

Thanks for taking over this series.

I've been talking to developers using the i915/perf interface and from their point of view, they expect the system to be in a stable configuration when doing measurements.

One issue with this patch on Gen11 is that it will lock the system in a configuration that isn't workable for media workloads (all subslices enabled).
So I think we should set the value for the locked configuration per generation (gen8-10: all slices/subslices, gen11: only subslices that contain VME samplers) so that we always get a functional configurations for all workloads. Could we want to select that configuration when opening perf?

Quoted 7 lines
Quoted 7 lines

This would be via i915_perf.c/gen8_configure_all_contexts?

Sounds like an unfortunate but workable compromise. As long as there doesn't appear another asymmetric slice feature in the future, which doesn't align with VME. Like one workloads wants slices 0 & 2, another wants 1 & 3, or whatever. If that happens then I don't know what we do apart from locking out perf/OA.

Quoted 1 line

Another question is how do we expose the selected value to the user. But that can be solved in a different series.

SSEU get_param would cut it? Although it would be perhaps be unexpected to get different results depending on whether perf/OA is active or not.. Hm... export device and available bitmasks via get param? Device bitmask would be fixed and available would change depending on whether perf/OA is active or not.

I would avoid changing the get_param. This is supposed to report the physical device's properties. Maybe add an ioctl entry to report that configuration onto the i915_perf fd?

Quoted 6 lines

Big downside to this is that observing something via OA would cause slow down of the whole system - since the SSEU config would be locked to a subset of slices on Gen11. :( Regardless or not of the details.. say even if we choose to lock only if there is one non-default SSEU context, that still locks all whilst perf/OA is active.

That's quite bad I think. But the alternative is to lock out perf/OA while non-default SSEU contexts are present. Which is also very bad. :(

Overall I don't see a solution. Latter is maybe better by being more explicit? Who are the perf/OA users and what would they prefer?

The other solution I could think of would be to prevent schedule contexts that are not compatible with the OA configuration. That doesn't sound great either...

Quoted 5 lines

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#10 lore raw

PATCH v10 6/8 drm/i915: Add global barrier support

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Global barrier is a facility to allow serialization between different timelines.

After calling i915_gem_set_global_barrier on a request, all following submissions on any engine will be set up as depending on this global barrier. Once the global barrier has been completed it automatically gets cleared and things continue as normal.

This facility will be used by the upcoming context SSEU code.

-------------------------------------------------------------------------
This code was part of the larger SSEU patch but I extracted it to be separate for ease of review and clarity. I think it originates from Chris Wilson so permission pending I will change the author and add appropriate S-o-B.
-------------------------------------------------------------------------

---
 drivers/gpu/drm/i915/i915_drv.h     | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_gem.c     |  2 ++
 drivers/gpu/drm/i915/i915_request.c | 16 ++++++++++++++++
 3 files changed, 45 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +27 -0
index 5c12d2676435..643089ba01b9 100644
@@ -2098,6 +2098,16 @@ struct drm_i915_private {
 		u32 active_requests;
 		u32 request_serial;
 
+		/**
+		 * Global barrier for the ability to serialize ordering between
+		 * different timelines.
+		 *
+		 * Users can call i915_gem_set_global_barrier which will make
+		 * all subsequent submission be execute only after this barrier
+		 * has been completed.
+		 */
+		struct i915_gem_active global_barrier;
+
 		/**
 		 * Is the GPU currently considered idle, or busy executing
 		 * userspace requests? Whilst idle, we allow runtime power
@@ -3230,6 +3240,23 @@ i915_vm_to_ppgtt(struct i915_address_space *vm)
 	return container_of(vm, struct i915_hw_ppgtt, vm);
 }
 
+/**
+ * i915_gem_set_global_barrier - orders submission on different timelines
+ * @i915: i915 device private
+ * @rq: request after which new submissions can proceed
+ *
+ * Sets the passed in request as the serialization point for all subsequent
+ * submissions, regardless of the engine/timeline. Subsequent requests will not
+ * be submitted to GPU until the global barrier has been completed.
+ */
+static inline void
+i915_gem_set_global_barrier(struct drm_i915_private *i915,
+			    struct i915_request *rq)
+{
+	lockdep_assert_held(&i915->drm.struct_mutex);
+	i915_gem_active_set(&i915->gt.global_barrier, rq);
+}
+
 /* i915_gem_fence_reg.c */
 struct drm_i915_fence_reg *
 i915_reserve_fence(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_gem.c +2 -0
index 0453eb42a1a3..be462ef65786 100644
@@ -5752,6 +5752,8 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
 	if (!dev_priv->priorities)
 		goto err_dependencies;
 
+	init_request_active(&dev_priv->gt.global_barrier, NULL);
+
 	INIT_LIST_HEAD(&dev_priv->gt.timelines);
 	INIT_LIST_HEAD(&dev_priv->gt.active_rings);
 	INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
drivers/gpu/drm/i915/i915_request.c +16 -0
index 09ed48833b54..8b45f74dc748 100644
@@ -644,6 +644,18 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 	return NOTIFY_DONE;
 }
 
+static int add_global_barrier(struct i915_request *rq)
+{
+	struct i915_request *barrier;
+
+	barrier = i915_gem_active_raw(&rq->i915->gt.global_barrier,
+				      &rq->i915->drm.struct_mutex);
+	if (barrier)
+		return i915_request_await_dma_fence(rq, &barrier->fence);
+
+	return 0;
+}
+
 /**
  * i915_request_alloc - allocate a request structure
  *
@@ -806,6 +818,10 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
 	 */
 	rq->head = rq->ring->emit;
 
+	ret = add_global_barrier(rq);
+	if (ret)
+		goto err_unwind;
+
 	/* Unconditionally invalidate GPU caches and TLBs. */
 	ret = engine->emit_flush(rq, EMIT_INVALIDATE);
 	if (ret)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH 6/8] drm/i915: Add global barrier support

Chris, for this one please let me know if it is okay to give you authorship and to add your S-o-B.

Tvrtko

Quoted 110 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Global barrier is a facility to allow serialization between different timelines.

After calling i915_gem_set_global_barrier on a request, all following submissions on any engine will be set up as depending on this global barrier. Once the global barrier has been completed it automatically gets cleared and things continue as normal.

This facility will be used by the upcoming context SSEU code.

-------------------------------------------------------------------------
This code was part of the larger SSEU patch but I extracted it to be separate for ease of review and clarity. I think it originates from Chris Wilson so permission pending I will change the author and add appropriate S-o-B.
-------------------------------------------------------------------------

---
  drivers/gpu/drm/i915/i915_drv.h     | 27 +++++++++++++++++++++++++++
  drivers/gpu/drm/i915/i915_gem.c     |  2 ++
  drivers/gpu/drm/i915/i915_request.c | 16 ++++++++++++++++
  3 files changed, 45 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +27 -0
index 5c12d2676435..643089ba01b9 100644
@@ -2098,6 +2098,16 @@ struct drm_i915_private {
  		u32 active_requests;
  		u32 request_serial;
 
+		/**
+		 * Global barrier for the ability to serialize ordering between
+		 * different timelines.
+		 *
+		 * Users can call i915_gem_set_global_barrier which will make
+		 * all subsequent submission be execute only after this barrier
+		 * has been completed.
+		 */
+		struct i915_gem_active global_barrier;
+
  		/**
  		 * Is the GPU currently considered idle, or busy executing
  		 * userspace requests? Whilst idle, we allow runtime power
@@ -3230,6 +3240,23 @@ i915_vm_to_ppgtt(struct i915_address_space *vm)
  	return container_of(vm, struct i915_hw_ppgtt, vm);
  }
 
+/**
+ * i915_gem_set_global_barrier - orders submission on different timelines
+ * @i915: i915 device private
+ * @rq: request after which new submissions can proceed
+ *
+ * Sets the passed in request as the serialization point for all subsequent
+ * submissions, regardless of the engine/timeline. Subsequent requests will not
+ * be submitted to GPU until the global barrier has been completed.
+ */
+static inline void
+i915_gem_set_global_barrier(struct drm_i915_private *i915,
+			    struct i915_request *rq)
+{
+	lockdep_assert_held(&i915->drm.struct_mutex);
+	i915_gem_active_set(&i915->gt.global_barrier, rq);
+}
+
  /* i915_gem_fence_reg.c */
  struct drm_i915_fence_reg *
  i915_reserve_fence(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_gem.c +2 -0
index 0453eb42a1a3..be462ef65786 100644
@@ -5752,6 +5752,8 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
  	if (!dev_priv->priorities)
  		goto err_dependencies;
 
+	init_request_active(&dev_priv->gt.global_barrier, NULL);
+
  	INIT_LIST_HEAD(&dev_priv->gt.timelines);
  	INIT_LIST_HEAD(&dev_priv->gt.active_rings);
  	INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
drivers/gpu/drm/i915/i915_request.c +12 -0
index 09ed48833b54..8b45f74dc748 100644
@@ -644,6 +644,18 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
  	return NOTIFY_DONE;
  }
 
+static int add_global_barrier(struct i915_request *rq)
+{
+	struct i915_request *barrier;
+
+	barrier = i915_gem_active_raw(&rq->i915->gt.global_barrier,
+				      &rq->i915->drm.struct_mutex);
+	if (barrier)
+		return i915_request_await_dma_fence(rq, &barrier->fence);
+
+	return 0;
+}
+
  /**
   * i915_request_alloc - allocate a request structure
   *

drivers/gpu/drm/i915/i915_request.c i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx) · line 827

Quoted 10 lines
drivers/gpu/drm/i915/i915_request.c +4 -0
@@ -806,6 +818,10 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
  	 */
  	rq->head = rq->ring->emit;
 
+	ret = add_global_barrier(rq);
+	if (ret)
+		goto err_unwind;
+
  	/* Unconditionally invalidate GPU caches and TLBs. */
  	ret = engine->emit_flush(rq, EMIT_INVALIDATE);
  	if (ret)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#12 lore raw

PATCH v10 7/8 drm/i915: Explicitly mark Global GTT address spaces

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

So far we have been relying on vm->file pointer being NULL to declare something GGTT.

This has the unfortunate consequence that the default kernel context is also declared GGTT and interferes with the following patch which wants to instantiate VMA's and execute requests against the kernel context.

Change the is_ggtt test to use an explicit flag in struct address_space to solve this issue.

Note that the bit used is free since there is an alignment hole in the struct.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 ++
 drivers/gpu/drm/i915/i915_gem_gtt.h | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -0
index 4137af4bd8f5..64151ad2a02b 100644
@@ -3610,6 +3610,8 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
 	mutex_lock(&dev_priv->drm.struct_mutex);
 	i915_address_space_init(&ggtt->vm, dev_priv);
 
+	ggtt->vm.is_ggtt = true;
+
 	/* Only VLV supports read-only GGTT mappings */
 	ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv);
 
drivers/gpu/drm/i915/i915_gem_gtt.h +4 -1
index dd161c187a68..d8dd4d9280bd 100644
@@ -331,6 +331,9 @@ struct i915_address_space {
 
 	struct pagestash free_pages;
 
+	/* Global GTT */
+	bool is_ggtt:1;
+
 	/* Some systems require uncached updates of the page directories */
 	bool pt_kmap_wc:1;
 
@@ -364,7 +367,7 @@ struct i915_address_space {
 	I915_SELFTEST_DECLARE(bool scrub_64K);
 };
 
-#define i915_is_ggtt(V) (!(V)->file)
+#define i915_is_ggtt(vm) ((vm)->is_ggtt)
 
 static inline bool
 i915_vm_is_48bit(const struct i915_address_space *vm)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#13 lore raw

PATCH v10 8/8 drm/i915: Expose RPCS (SSEU) configuration to userspace

In reply to Tvrtko Ursulin

From: Chris Wilson <[email protected]>

We want to allow userspace to reconfigure the subslice configuration for its own use case. To do so, we expose a context parameter to allow adjustment of the RPCS register stored within the context image (and currently not accessible via LRI). If the context is adjusted before first use, the adjustment is for "free"; otherwise if the context is active we flush the context off the GPU (stalling all users) and forcing the GPU to save the context to memory where we can modify it and so ensure that the register is reloaded on next execution.

The overhead of managing additional EU subslices can be significant, especially in multi-context workloads. Non-GPGPU contexts should preferably disable the subslices it is not using, and others should fine-tune the number to match their workload.

We expose complete control over the RPCS register, allowing configuration of slice/subslice, via masks packed into a u64 for simplicity. For example,

	struct drm_i915_gem_context_param arg;
	struct drm_i915_gem_context_param_sseu sseu = { .class = 0,
	                                                .instance = 0, };

	memset(&arg, 0, sizeof(arg));
	arg.ctx_id = ctx;
	arg.param = I915_CONTEXT_PARAM_SSEU;
	arg.value = (uintptr_t) &sseu;
	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &arg) == 0) {
		sseu.packed.subslice_mask = 0;

		drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &arg);
	}

could be used to disable all subslices where supported.

v2: Fix offset of CTX_R_PWR_CLK_STATE in intel_lr_context_set_sseu() (Lionel)

v3: Add ability to program this per engine (Chris)

v4: Move most get_sseu() into i915_gem_context.c (Lionel)

v5: Validate sseu configuration against the device's capabilities (Lionel)

v6: Change context powergating settings through MI_SDM on kernel context (Chris)

v7: Synchronize the requests following a powergating setting change using a global
dependency (Chris)
Iterate timelines through dev_priv.gt.active_rings (Tvrtko) Disable RPCS configuration setting for non capable users (Lionel/Tvrtko)

v8: s/union intel_sseu/struct intel_sseu/ (Lionel)
s/dev_priv/i915/ (Tvrtko)
Change uapi class/instance fields to u16 (Tvrtko) Bump mask fields to 64bits (Lionel)
Don't return EPERM when dynamic sseu is disabled (Tvrtko)

v9: Import context image into kernel context's ppgtt only when
reconfiguring powergated slice/subslices (Chris) Use aliasing ppgtt when needed (Michel)

Tvrtko Ursulin:

v10:
* Update for upstream changes.
* Request submit needs a RPM reference.
* Reject on !FULL_PPGTT for simplicity.
* Pull out get/set param to helpers for readability and less indent.
* Use i915_request_await_dma_fence in add_global_barrier to skip waits on the same timeline and avoid GEM_BUG_ON.
* No need to explicitly assign a NULL pointer to engine in legacy mode.
* No need to move gen8_make_rpcs up.
* Factored out global barrier as prep patch.
* Allow to only CAP_SYS_ADMIN if !Gen11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100899
Issue: https://github.com/intel/media-driver/issues/267

Cc Dmitry Rogozhkin <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Zhipeng Gong <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 187 +++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_lrc.c        |  55 +++++++
 drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
 include/uapi/drm/i915_drm.h             |  43 ++++++
 4 files changed, 288 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +186 -1
index 8a12984e7495..6d6220634e9e 100644
@@ -773,6 +773,91 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
 	return 0;
 }
 
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+				  struct intel_engine_cs *engine,
+				  struct intel_sseu sseu)
+{
+	struct drm_i915_private *i915 = ctx->i915;
+	struct i915_request *rq;
+	struct intel_ring *ring;
+	int ret;
+
+	lockdep_assert_held(&i915->drm.struct_mutex);
+
+	/* Submitting requests etc needs the hw awake. */
+	intel_runtime_pm_get(i915);
+
+	i915_retire_requests(i915);
+
+	/* Now use the RCS to actually reconfigure. */
+	engine = i915->engine[RCS];
+
+	rq = i915_request_alloc(engine, i915->kernel_context);
+	if (IS_ERR(rq)) {
+		ret = PTR_ERR(rq);
+		goto out_put;
+	}
+
+	ret = engine->emit_rpcs_config(rq, ctx, sseu);
+	if (ret)
+		goto out_add;
+
+	/* Queue this switch after all other activity */
+	list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+		struct i915_request *prev;
+
+		prev = last_request_on_engine(ring->timeline, engine);
+		if (prev)
+			i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+							 &prev->submit,
+							 I915_FENCE_GFP);
+	}
+
+	i915_gem_set_global_barrier(i915, rq);
+
+out_add:
+	i915_request_add(rq);
+out_put:
+	intel_runtime_pm_put(i915);
+
+	return ret;
+}
+
+static int get_sseu(struct i915_gem_context *ctx,
+		    struct drm_i915_gem_context_param *args)
+{
+	struct drm_i915_gem_context_param_sseu user_sseu;
+	struct intel_engine_cs *engine;
+	struct intel_context *ce;
+
+	if (copy_from_user(&user_sseu, u64_to_user_ptr(args->value),
+			   sizeof(user_sseu)))
+		return -EFAULT;
+
+	if (user_sseu.rsvd1 || user_sseu.rsvd2)
+		return -EINVAL;
+
+	engine = intel_engine_lookup_user(ctx->i915,
+					  user_sseu.class,
+					  user_sseu.instance);
+	if (!engine)
+		return -EINVAL;
+
+	ce = to_intel_context(ctx, engine);
+
+	user_sseu.slice_mask = ce->sseu.slice_mask;
+	user_sseu.subslice_mask = ce->sseu.subslice_mask;
+	user_sseu.min_eus_per_subslice = ce->sseu.min_eus_per_subslice;
+	user_sseu.max_eus_per_subslice = ce->sseu.max_eus_per_subslice;
+
+	if (copy_to_user(u64_to_user_ptr(args->value), &user_sseu,
+			 sizeof(user_sseu)))
+		return -EFAULT;
+
+	return 0;
+}
+
 int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
 				    struct drm_file *file)
 {
@@ -810,6 +895,9 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
 	case I915_CONTEXT_PARAM_PRIORITY:
 		args->value = ctx->sched.priority;
 		break;
+	case I915_CONTEXT_PARAM_SSEU:
+		ret = get_sseu(ctx, args);
+		break;
 	default:
 		ret = -EINVAL;
 		break;
@@ -819,6 +907,101 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
 	return ret;
 }
 
+static int
+__user_to_context_sseu(const struct sseu_dev_info *device,
+		       const struct drm_i915_gem_context_param_sseu *user,
+		       struct intel_sseu *context)
+{
+	/* No zeros in any field. */
+	if (!user->slice_mask || !user->subslice_mask ||
+	    !user->min_eus_per_subslice || !user->max_eus_per_subslice)
+		return -EINVAL;
+
+	/* Max > min. */
+	if (user->max_eus_per_subslice < user->min_eus_per_subslice)
+		return -EINVAL;
+
+	/* Check validity against hardware. */
+	if (user->slice_mask & ~device->slice_mask)
+		return -EINVAL;
+
+	if (user->subslice_mask & ~device->subslice_mask[0])
+		return -EINVAL;
+
+	if (user->max_eus_per_subslice > device->max_eus_per_subslice)
+		return -EINVAL;
+
+	context->slice_mask = user->slice_mask;
+	context->subslice_mask = user->subslice_mask;
+	context->min_eus_per_subslice = user->min_eus_per_subslice;
+	context->max_eus_per_subslice = user->max_eus_per_subslice;
+
+	return 0;
+}
+
+static int set_sseu(struct i915_gem_context *ctx,
+		    struct drm_i915_gem_context_param *args)
+{
+	struct drm_i915_private *i915 = ctx->i915;
+	struct drm_i915_gem_context_param_sseu user_sseu;
+	struct intel_engine_cs *engine;
+	struct intel_sseu ctx_sseu;
+	struct intel_context *ce;
+	enum intel_engine_id id;
+	int ret;
+
+	if (args->size)
+		return -EINVAL;
+
+	if (!USES_FULL_PPGTT(i915))
+		return -ENODEV;
+
+	if (!IS_GEN11(i915) && !capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
+	if (copy_from_user(&user_sseu, u64_to_user_ptr(args->value),
+			   sizeof(user_sseu)))
+		return -EFAULT;
+
+	if (user_sseu.rsvd1 || user_sseu.rsvd2)
+		return -EINVAL;
+
+	engine = intel_engine_lookup_user(i915,
+					  user_sseu.class,
+					  user_sseu.instance);
+	if (!engine)
+		return -EINVAL;
+
+	if (!engine->emit_rpcs_config)
+		return -ENODEV;
+
+	ret = __user_to_context_sseu(&INTEL_INFO(i915)->sseu, &user_sseu,
+				     &ctx_sseu);
+	if (ret)
+		return ret;
+
+	ce = to_intel_context(ctx, engine);
+
+	/* Nothing to do if unmodified. */
+	if (!memcmp(&ce->sseu, &ctx_sseu, sizeof(ctx_sseu)))
+		return 0;
+
+	ret = i915_gem_context_reconfigure_sseu(ctx, engine, ctx_sseu);
+	if (ret)
+		return ret;
+
+	/*
+	 * Copy the configuration to all engines. Our hardware doesn't
+	 * currently support different configurations for each engine.
+	 */
+	for_each_engine(engine, i915, id) {
+		ce = to_intel_context(ctx, engine);
+		ce->sseu = ctx_sseu;
+	}
+
+	return 0;
+}
+
 int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
 				    struct drm_file *file)
 {
@@ -884,7 +1067,9 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
 				ctx->sched.priority = priority;
 		}
 		break;
-
+	case I915_CONTEXT_PARAM_SSEU:
+		ret = set_sseu(ctx, args);
+		break;
 	default:
 		ret = -EINVAL;
 		break;
drivers/gpu/drm/i915/intel_lrc.c +55 -0

67 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.h +4 -0
index 9090885d57de..acb8b6fe912a 100644
@@ -477,6 +477,10 @@ struct intel_engine_cs {
 	void		(*emit_breadcrumb)(struct i915_request *rq, u32 *cs);
 	int		emit_breadcrumb_sz;
 
+	int		(*emit_rpcs_config)(struct i915_request *rq,
+					    struct i915_gem_context *ctx,
+					    struct intel_sseu sseu);
+
 	/* Pass the request to the hardware queue (e.g. directly into
 	 * the legacy ringbuffer or to the end of an execlist).
 	 *
include/uapi/drm/i915_drm.h +43 -0

52 lines not on this page · raw message

Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)

Quoted 105 lines

From: Chris Wilson <[email protected]>

We want to allow userspace to reconfigure the subslice configuration for its own use case. To do so, we expose a context parameter to allow adjustment of the RPCS register stored within the context image (and currently not accessible via LRI). If the context is adjusted before first use, the adjustment is for "free"; otherwise if the context is active we flush the context off the GPU (stalling all users) and forcing the GPU to save the context to memory where we can modify it and so ensure that the register is reloaded on next execution.

The overhead of managing additional EU subslices can be significant, especially in multi-context workloads. Non-GPGPU contexts should preferably disable the subslices it is not using, and others should fine-tune the number to match their workload.

We expose complete control over the RPCS register, allowing configuration of slice/subslice, via masks packed into a u64 for simplicity. For example,

        struct drm_i915_gem_context_param arg;
        struct drm_i915_gem_context_param_sseu sseu = { .class = 0,
                                                        .instance = 0, };

        memset(&arg, 0, sizeof(arg));
        arg.ctx_id = ctx;
        arg.param = I915_CONTEXT_PARAM_SSEU;
        arg.value = (uintptr_t) &sseu;
        if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &arg) == 0) {
                sseu.packed.subslice_mask = 0;

                drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &arg);
        }

could be used to disable all subslices where supported.

v2: Fix offset of CTX_R_PWR_CLK_STATE in intel_lr_context_set_sseu() (Lionel)

v3: Add ability to program this per engine (Chris)

v4: Move most get_sseu() into i915_gem_context.c (Lionel)

v5: Validate sseu configuration against the device's capabilities (Lionel)

v6: Change context powergating settings through MI_SDM on kernel context (Chris)

v7: Synchronize the requests following a powergating setting change using a global
dependency (Chris)
Iterate timelines through dev_priv.gt.active_rings (Tvrtko) Disable RPCS configuration setting for non capable users (Lionel/Tvrtko)

v8: s/union intel_sseu/struct intel_sseu/ (Lionel)
s/dev_priv/i915/ (Tvrtko)
Change uapi class/instance fields to u16 (Tvrtko) Bump mask fields to 64bits (Lionel)
Don't return EPERM when dynamic sseu is disabled (Tvrtko)

v9: Import context image into kernel context's ppgtt only when
reconfiguring powergated slice/subslices (Chris) Use aliasing ppgtt when needed (Michel)

Tvrtko Ursulin:

v10:
* Update for upstream changes.
* Request submit needs a RPM reference.
* Reject on !FULL_PPGTT for simplicity.
* Pull out get/set param to helpers for readability and less indent.
* Use i915_request_await_dma_fence in add_global_barrier to skip waits on the same timeline and avoid GEM_BUG_ON.
* No need to explicitly assign a NULL pointer to engine in legacy mode.
* No need to move gen8_make_rpcs up.
* Factored out global barrier as prep patch.
* Allow to only CAP_SYS_ADMIN if !Gen11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100899
Issue: https://github.com/intel/media-driver/issues/267

Cc Dmitry Rogozhkin <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Zhipeng Gong <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 187 +++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_lrc.c        |  55 +++++++
 drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
 include/uapi/drm/i915_drm.h             |  43 ++++++
 4 files changed, 288 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +6 -0
index 8a12984e7495..6d6220634e9e 100644
@@ -773,6 +773,91 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
        return 0;
 }
 
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+                                 struct intel_engine_cs *engine,
+                                 struct intel_sseu sseu)
+{
+       struct drm_i915_private *i915 = ctx->i915;

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 791

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_context.c +10 -0
+       struct i915_request *rq;
+       struct intel_ring *ring;
+       int ret;
+
+       lockdep_assert_held(&i915->drm.struct_mutex);
+
+       /* Submitting requests etc needs the hw awake. */
+       intel_runtime_pm_get(i915);
+
+       i915_retire_requests(i915);

?

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 794

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+       /* Now use the RCS to actually reconfigure. */
+       engine = i915->engine[RCS];

? Modifying registers stored in another engine's context image.

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 802

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_context.c +8 -0
+
+       rq = i915_request_alloc(engine, i915->kernel_context);
+       if (IS_ERR(rq)) {
+               ret = PTR_ERR(rq);
+               goto out_put;
+       }
+
+       ret = engine->emit_rpcs_config(rq, ctx, sseu);

It's just an LRI, I'd rather we do it directly unless there's evidence that there will be na explicit rpcs config instruction in future. It just doesn't seem general enough.

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 806

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       if (ret)
+               goto out_add;
+
+       /* Queue this switch after all other activity */

Only needs to be after the target ctx.

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 810

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+               struct i915_request *prev;
+
+               prev = last_request_on_engine(ring->timeline, engine);

As constructed above you need target-engine + RCS.

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 817

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
+               if (prev)
+                       i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+                                                        &prev->submit,
+                                                        I915_FENCE_GFP);
+       }
+
+       i915_gem_set_global_barrier(i915, rq);

This is just for a link from ctx-engine to this rq. Overkill much? Presumably this stems from using the wrong engine.

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 820

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+out_add:
+       i915_request_add(rq);

And I'd still recommend not using indirect access if we can apply the changes immediately.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoting Lionel Landwerlin (2018-08-14 16:11:36)

Quoted 7 lines · Chris Wilson
Quoted 4 lines

And I'd still recommend not using indirect access if we can apply the changes immediately.
-Chris

Hangs on Gen9 :(

How does modifying the context image of an idle (unpinned) context cause a hang?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoted 11 lines · Chris Wilson

Quoting Lionel Landwerlin (2018-08-14 16:11:36)

Quoted 6 lines · Chris Wilson
Quoted 4 lines

And I'd still recommend not using indirect access if we can apply the changes immediately.
-Chris

Hangs on Gen9 :(

How does modifying the context image of an idle (unpinned) context cause a hang?
-Chris

I thought you meant a context modifying it's own RPCS register... no?

-
Lionel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoted 8 lines · Lionel Landwerlin
Quoted 7 lines · Chris Wilson

Quoting Lionel Landwerlin (2018-08-14 16:11:36)

Quoted 6 lines · Chris Wilson
Quoted 4 lines

And I'd still recommend not using indirect access if we can apply the changes immediately.
-Chris

Hangs on Gen9 :(

Quoted 8 lines
Quoted 4 lines

How does modifying the context image of an idle (unpinned) context cause a hang?
-Chris

I thought you meant a context modifying it's own RPCS register... no?

-
Lionel

Oh I get it now... Sorry, forget me :)

-
Lionel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

In reply to Chris Wilson
Quoted 110 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)

Quoted 109 lines

From: Chris Wilson <[email protected]>

We want to allow userspace to reconfigure the subslice configuration for its own use case. To do so, we expose a context parameter to allow adjustment of the RPCS register stored within the context image (and currently not accessible via LRI). If the context is adjusted before first use, the adjustment is for "free"; otherwise if the context is active we flush the context off the GPU (stalling all users) and forcing the GPU to save the context to memory where we can modify it and so ensure that the register is reloaded on next execution.

The overhead of managing additional EU subslices can be significant, especially in multi-context workloads. Non-GPGPU contexts should preferably disable the subslices it is not using, and others should fine-tune the number to match their workload.

We expose complete control over the RPCS register, allowing configuration of slice/subslice, via masks packed into a u64 for simplicity. For example,

         struct drm_i915_gem_context_param arg;
         struct drm_i915_gem_context_param_sseu sseu = { .class = 0,
                                                         .instance = 0, };

         memset(&arg, 0, sizeof(arg));
         arg.ctx_id = ctx;
         arg.param = I915_CONTEXT_PARAM_SSEU;
         arg.value = (uintptr_t) &sseu;
         if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &arg) == 0) {
                 sseu.packed.subslice_mask = 0;

                 drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &arg);
         }

could be used to disable all subslices where supported.

v2: Fix offset of CTX_R_PWR_CLK_STATE in intel_lr_context_set_sseu() (Lionel)

v3: Add ability to program this per engine (Chris)

v4: Move most get_sseu() into i915_gem_context.c (Lionel)

v5: Validate sseu configuration against the device's capabilities (Lionel)

v6: Change context powergating settings through MI_SDM on kernel context (Chris)

v7: Synchronize the requests following a powergating setting change using a global
dependency (Chris)
Iterate timelines through dev_priv.gt.active_rings (Tvrtko) Disable RPCS configuration setting for non capable users (Lionel/Tvrtko)

v8: s/union intel_sseu/struct intel_sseu/ (Lionel)
s/dev_priv/i915/ (Tvrtko)
Change uapi class/instance fields to u16 (Tvrtko) Bump mask fields to 64bits (Lionel)
Don't return EPERM when dynamic sseu is disabled (Tvrtko)

v9: Import context image into kernel context's ppgtt only when
reconfiguring powergated slice/subslices (Chris) Use aliasing ppgtt when needed (Michel)

Tvrtko Ursulin:

v10:
* Update for upstream changes.
* Request submit needs a RPM reference.
* Reject on !FULL_PPGTT for simplicity.
* Pull out get/set param to helpers for readability and less indent.
* Use i915_request_await_dma_fence in add_global_barrier to skip waits on the same timeline and avoid GEM_BUG_ON.
* No need to explicitly assign a NULL pointer to engine in legacy mode.
* No need to move gen8_make_rpcs up.
* Factored out global barrier as prep patch.
* Allow to only CAP_SYS_ADMIN if !Gen11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100899
Issue: https://github.com/intel/media-driver/issues/267

Cc Dmitry Rogozhkin <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Zhipeng Gong <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem_context.c | 187 +++++++++++++++++++++++-
  drivers/gpu/drm/i915/intel_lrc.c        |  55 +++++++
  drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
  include/uapi/drm/i915_drm.h             |  43 ++++++
  4 files changed, 288 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +10 -0
index 8a12984e7495..6d6220634e9e 100644
@@ -773,6 +773,91 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
         return 0;
  }
 
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+                                 struct intel_engine_cs *engine,
+                                 struct intel_sseu sseu)
+{
+       struct drm_i915_private *i915 = ctx->i915;
+       struct i915_request *rq;
+       struct intel_ring *ring;
+       int ret;
+
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 791

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_context.c +6 -0
+       lockdep_assert_held(&i915->drm.struct_mutex);
+
+       /* Submitting requests etc needs the hw awake. */
+       intel_runtime_pm_get(i915);
+
+       i915_retire_requests(i915);

?

I wondered myself but did not make myself dig through all the history of the series. Cannot think that it does anything useful in the current design.

Quoted 5 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 794

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+       /* Now use the RCS to actually reconfigure. */
+       engine = i915->engine[RCS];

? Modifying registers stored in another engine's context image.

Well, I was hoping design was kind of agreed by now.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+
+       rq = i915_request_alloc(engine, i915->kernel_context);
+       if (IS_ERR(rq)) {
+               ret = PTR_ERR(rq);
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 802

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+               goto out_put;
+       }
+
+       ret = engine->emit_rpcs_config(rq, ctx, sseu);

It's just an LRI, I'd rather we do it directly unless there's evidence that there will be na explicit rpcs config instruction in future. It just doesn't seem general enough.

No complaints, can do.

Quoted 6 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 806

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       if (ret)
+               goto out_add;
+
+       /* Queue this switch after all other activity */

Only needs to be after the target ctx.

True, so find just the timeline belonging to target context. Some backpointers would be needed to find it. Or a walk and compare against target ce->ring->timeline->fence_context. Sounds like more than the latter isn't justified for this use case.

Quoted 7 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 810

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+               struct i915_request *prev;
+
+               prev = last_request_on_engine(ring->timeline, engine);

As constructed above you need target-engine + RCS.

Target engine is always RCS. Looks like the engine param to this function is pointless.

Quoted 11 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 817

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
+               if (prev)
+                       i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+                                                        &prev->submit,
+                                                        I915_FENCE_GFP);
+       }
+
+       i915_gem_set_global_barrier(i915, rq);

This is just for a link from ctx-engine to this rq. Overkill much? Presumably this stems from using the wrong engine.

AFAIU this is to ensure target context cannot get ahead of this request. Without it could overtake and then there is no guarantee execbufs following set param will be with new SSEU configuration.

Quoted 7 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 820

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+out_add:
+       i915_request_add(rq);

And I'd still recommend not using indirect access if we can apply the changes immediately.

Direct (CPU) access means blocking in set param until the context is idle. AFAIR in one of the earlier version GPU idling approach was used but I thought that is very dangerous API. Can we somehow take just one context out of circulation? Still have to idle since it could be deep in the queue. The current approach is nicely async. And I don't like having two paths - direct if unpinned, or via GPU if pinned. In fact it would even be a third path since normally it happens via init_reg_state of pristine contexts.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoting Tvrtko Ursulin (2018-08-14 19:44:09)

Quoted 124 lines · Chris Wilson
Quoted 110 lines

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)

Quoted 109 lines

From: Chris Wilson <[email protected]>

We want to allow userspace to reconfigure the subslice configuration for its own use case. To do so, we expose a context parameter to allow adjustment of the RPCS register stored within the context image (and currently not accessible via LRI). If the context is adjusted before first use, the adjustment is for "free"; otherwise if the context is active we flush the context off the GPU (stalling all users) and forcing the GPU to save the context to memory where we can modify it and so ensure that the register is reloaded on next execution.

The overhead of managing additional EU subslices can be significant, especially in multi-context workloads. Non-GPGPU contexts should preferably disable the subslices it is not using, and others should fine-tune the number to match their workload.

We expose complete control over the RPCS register, allowing configuration of slice/subslice, via masks packed into a u64 for simplicity. For example,

         struct drm_i915_gem_context_param arg;
         struct drm_i915_gem_context_param_sseu sseu = { .class = 0,
                                                         .instance = 0, };

         memset(&arg, 0, sizeof(arg));
         arg.ctx_id = ctx;
         arg.param = I915_CONTEXT_PARAM_SSEU;
         arg.value = (uintptr_t) &sseu;
         if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &arg) == 0) {
                 sseu.packed.subslice_mask = 0;

                 drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &arg);
         }

could be used to disable all subslices where supported.

v2: Fix offset of CTX_R_PWR_CLK_STATE in intel_lr_context_set_sseu() (Lionel)

v3: Add ability to program this per engine (Chris)

v4: Move most get_sseu() into i915_gem_context.c (Lionel)

v5: Validate sseu configuration against the device's capabilities (Lionel)

v6: Change context powergating settings through MI_SDM on kernel context (Chris)

v7: Synchronize the requests following a powergating setting change using a global
dependency (Chris)
Iterate timelines through dev_priv.gt.active_rings (Tvrtko) Disable RPCS configuration setting for non capable users (Lionel/Tvrtko)

v8: s/union intel_sseu/struct intel_sseu/ (Lionel)
s/dev_priv/i915/ (Tvrtko)
Change uapi class/instance fields to u16 (Tvrtko) Bump mask fields to 64bits (Lionel)
Don't return EPERM when dynamic sseu is disabled (Tvrtko)

v9: Import context image into kernel context's ppgtt only when
reconfiguring powergated slice/subslices (Chris) Use aliasing ppgtt when needed (Michel)

Tvrtko Ursulin:

v10:
* Update for upstream changes.
* Request submit needs a RPM reference.
* Reject on !FULL_PPGTT for simplicity.
* Pull out get/set param to helpers for readability and less indent.
* Use i915_request_await_dma_fence in add_global_barrier to skip waits on the same timeline and avoid GEM_BUG_ON.
* No need to explicitly assign a NULL pointer to engine in legacy mode.
* No need to move gen8_make_rpcs up.
* Factored out global barrier as prep patch.
* Allow to only CAP_SYS_ADMIN if !Gen11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100899
Issue: https://github.com/intel/media-driver/issues/267

Cc Dmitry Rogozhkin <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Zhipeng Gong <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem_context.c | 187 +++++++++++++++++++++++-
  drivers/gpu/drm/i915/intel_lrc.c        |  55 +++++++
  drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
  include/uapi/drm/i915_drm.h             |  43 ++++++
  4 files changed, 288 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +10 -0
index 8a12984e7495..6d6220634e9e 100644
@@ -773,6 +773,91 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
         return 0;
  }
 
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+                                 struct intel_engine_cs *engine,
+                                 struct intel_sseu sseu)
+{
+       struct drm_i915_private *i915 = ctx->i915;
+       struct i915_request *rq;
+       struct intel_ring *ring;
+       int ret;
+
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 791

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_context.c +6 -0
+       lockdep_assert_held(&i915->drm.struct_mutex);
+
+       /* Submitting requests etc needs the hw awake. */
+       intel_runtime_pm_get(i915);
+
+       i915_retire_requests(i915);

?

I wondered myself but did not make myself dig through all the history of the series. Cannot think that it does anything useful in the current design.

Quoted 7 lines
Quoted 5 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 794

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+       /* Now use the RCS to actually reconfigure. */
+       engine = i915->engine[RCS];

? Modifying registers stored in another engine's context image.

Well, I was hoping design was kind of agreed by now.

:-p

This wasn't about using requests per-se, but raising the question of why use rcs to adjust the vcs context image. If we used vcs, the question of serialisation is then only on that engine.

Quoted 19 lines
Quoted 11 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 802

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
+       rq = i915_request_alloc(engine, i915->kernel_context);
+       if (IS_ERR(rq)) {
+               ret = PTR_ERR(rq);
+               goto out_put;
+       }
+
+       ret = engine->emit_rpcs_config(rq, ctx, sseu);

It's just an LRI, I'd rather we do it directly unless there's evidence that there will be na explicit rpcs config instruction in future. It just doesn't seem general enough.

No complaints, can do.

Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       if (ret)
+               goto out_add;
+
+       /* Queue this switch after all other activity */
Quoted 6 lines
Quoted 1 line

Only needs to be after the target ctx.

True, so find just the timeline belonging to target context. Some backpointers would be needed to find it. Or a walk and compare against target ce->ring->timeline->fence_context. Sounds like more than the latter isn't justified for this use case.

Right, we should be able to use ce->ring->timeline.

Quoted 9 lines
Quoted 6 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 810

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+               struct i915_request *prev;
+
+               prev = last_request_on_engine(ring->timeline, engine);

As constructed above you need target-engine + RCS.

Target engine is always RCS. Looks like the engine param to this function is pointless.

Always always? At the beginning the speculation was that the other engines were going to get their own subslice parameters. I guess that was on the same design sheet as the VCS commands...

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
+               if (prev)
+                       i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+                                                        &prev->submit,
+                                                        I915_FENCE_GFP);
+       }
+
+       i915_gem_set_global_barrier(i915, rq);
Quoted 6 lines
Quoted 2 lines

This is just for a link from ctx-engine to this rq. Overkill much? Presumably this stems from using the wrong engine.

AFAIU this is to ensure target context cannot get ahead of this request. Without it could overtake and then there is no guarantee execbufs following set param will be with new SSEU configuration.

Right, but we only need a fence on the target context to this request. The existing way would be to queue an empty request on the target with the await on this rq, but if you feel that is one request too many we can use a timeline barrier. Or if that is too narrow, an engine barrier. Over time, I can see that we may want all 3 barrier levels. The cost isn't too onerous.

Quoted 9 lines
Quoted 6 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 820

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+out_add:
+       i915_request_add(rq);

And I'd still recommend not using indirect access if we can apply the changes immediately.

Direct (CPU) access means blocking in set param until the context is idle.

No, it doesn't. It's is just a choice of whether you use request to a pinned context, or direct access if idle (literally ce->pin_count). Direct access is going to be near zero overhead.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoted 131 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-08-14 19:44:09)

Quoted 130 lines · Chris Wilson
Quoted 110 lines

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)

Quoted 109 lines

From: Chris Wilson <[email protected]>

We want to allow userspace to reconfigure the subslice configuration for its own use case. To do so, we expose a context parameter to allow adjustment of the RPCS register stored within the context image (and currently not accessible via LRI). If the context is adjusted before first use, the adjustment is for "free"; otherwise if the context is active we flush the context off the GPU (stalling all users) and forcing the GPU to save the context to memory where we can modify it and so ensure that the register is reloaded on next execution.

The overhead of managing additional EU subslices can be significant, especially in multi-context workloads. Non-GPGPU contexts should preferably disable the subslices it is not using, and others should fine-tune the number to match their workload.

We expose complete control over the RPCS register, allowing configuration of slice/subslice, via masks packed into a u64 for simplicity. For example,

          struct drm_i915_gem_context_param arg;
          struct drm_i915_gem_context_param_sseu sseu = { .class = 0,
                                                          .instance = 0, };

          memset(&arg, 0, sizeof(arg));
          arg.ctx_id = ctx;
          arg.param = I915_CONTEXT_PARAM_SSEU;
          arg.value = (uintptr_t) &sseu;
          if (drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &arg) == 0) {
                  sseu.packed.subslice_mask = 0;

                  drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &arg);
          }

could be used to disable all subslices where supported.

v2: Fix offset of CTX_R_PWR_CLK_STATE in intel_lr_context_set_sseu() (Lionel)

v3: Add ability to program this per engine (Chris)

v4: Move most get_sseu() into i915_gem_context.c (Lionel)

v5: Validate sseu configuration against the device's capabilities (Lionel)

v6: Change context powergating settings through MI_SDM on kernel context (Chris)

v7: Synchronize the requests following a powergating setting change using a global
dependency (Chris)
Iterate timelines through dev_priv.gt.active_rings (Tvrtko) Disable RPCS configuration setting for non capable users (Lionel/Tvrtko)

v8: s/union intel_sseu/struct intel_sseu/ (Lionel)
s/dev_priv/i915/ (Tvrtko)
Change uapi class/instance fields to u16 (Tvrtko) Bump mask fields to 64bits (Lionel)
Don't return EPERM when dynamic sseu is disabled (Tvrtko)

v9: Import context image into kernel context's ppgtt only when
reconfiguring powergated slice/subslices (Chris) Use aliasing ppgtt when needed (Michel)

Tvrtko Ursulin:

v10:
* Update for upstream changes.
* Request submit needs a RPM reference.
* Reject on !FULL_PPGTT for simplicity.
* Pull out get/set param to helpers for readability and less indent.
* Use i915_request_await_dma_fence in add_global_barrier to skip waits on the same timeline and avoid GEM_BUG_ON.
* No need to explicitly assign a NULL pointer to engine in legacy mode.
* No need to move gen8_make_rpcs up.
* Factored out global barrier as prep patch.
* Allow to only CAP_SYS_ADMIN if !Gen11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100899
Issue: https://github.com/intel/media-driver/issues/267

Cc Dmitry Rogozhkin <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Zhipeng Gong <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
   drivers/gpu/drm/i915/i915_gem_context.c | 187 +++++++++++++++++++++++-
   drivers/gpu/drm/i915/intel_lrc.c        |  55 +++++++
   drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
   include/uapi/drm/i915_drm.h             |  43 ++++++
   4 files changed, 288 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +10 -0
index 8a12984e7495..6d6220634e9e 100644
@@ -773,6 +773,91 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
          return 0;
   }
 
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+                                 struct intel_engine_cs *engine,
+                                 struct intel_sseu sseu)
+{
+       struct drm_i915_private *i915 = ctx->i915;
+       struct i915_request *rq;
+       struct intel_ring *ring;
+       int ret;
+
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 791

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_context.c +6 -0
+       lockdep_assert_held(&i915->drm.struct_mutex);
+
+       /* Submitting requests etc needs the hw awake. */
+       intel_runtime_pm_get(i915);
+
+       i915_retire_requests(i915);

?

I wondered myself but did not make myself dig through all the history of the series. Cannot think that it does anything useful in the current design.

Quoted 5 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 794

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+       /* Now use the RCS to actually reconfigure. */
+       engine = i915->engine[RCS];

? Modifying registers stored in another engine's context image.

Quoted 7 lines
Quoted 1 line

Well, I was hoping design was kind of agreed by now.

:-p

This wasn't about using requests per-se, but raising the question of why use rcs to adjust the vcs context image. If we used vcs, the question of serialisation is then only on that engine.

It only ever modifies the RCS context image - since that is where the feature is only supported AFAIU. And does it via RCS which again AFAIU ensures we not only received the user interrupt for the last previous rq on the timeline, but it has been fully context saved as well.

In the light of this perhaps the uAPI allowing set param on any engine is incorrect for now, and it should instead return -ENODEV for !RCS. It is misleading that SSEU config on other engines will succeed, but in fact the RCS context image is modified and SSEU configuration only applies if/when the RCS context runs.

So now I am thinking the uAPI is fine to support other engines for now, to be future proof, but unless I am not getting something it should really return -ENODEV for !RCS.

Quoted 33 lines
Quoted 19 lines
Quoted 11 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 802

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
+       rq = i915_request_alloc(engine, i915->kernel_context);
+       if (IS_ERR(rq)) {
+               ret = PTR_ERR(rq);
+               goto out_put;
+       }
+
+       ret = engine->emit_rpcs_config(rq, ctx, sseu);

It's just an LRI, I'd rather we do it directly unless there's evidence that there will be na explicit rpcs config instruction in future. It just doesn't seem general enough.

No complaints, can do.

Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       if (ret)
+               goto out_add;
+
+       /* Queue this switch after all other activity */
Quoted 6 lines
Quoted 1 line

Only needs to be after the target ctx.

True, so find just the timeline belonging to target context. Some backpointers would be needed to find it. Or a walk and compare against target ce->ring->timeline->fence_context. Sounds like more than the latter isn't justified for this use case.

Right, we should be able to use ce->ring->timeline.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+       list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+               struct i915_request *prev;
+
+               prev = last_request_on_engine(ring->timeline, engine);
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

As constructed above you need target-engine + RCS.

Target engine is always RCS. Looks like the engine param to this function is pointless.

Always always? At the beginning the speculation was that the other engines were going to get their own subslice parameters. I guess that was on the same design sheet as the VCS commands...

See above.

Quoted 16 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
+               if (prev)
+                       i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+                                                        &prev->submit,
+                                                        I915_FENCE_GFP);
+       }
+
+       i915_gem_set_global_barrier(i915, rq);
Quoted 6 lines
Quoted 2 lines

This is just for a link from ctx-engine to this rq. Overkill much? Presumably this stems from using the wrong engine.

AFAIU this is to ensure target context cannot get ahead of this request. Without it could overtake and then there is no guarantee execbufs following set param will be with new SSEU configuration.

Quoted 6 lines

Right, but we only need a fence on the target context to this request. The existing way would be to queue an empty request on the target with the await on this rq, but if you feel that is one request too many we can use a timeline barrier. Or if that is too narrow, an engine barrier. Over time, I can see that we may want all 3 barrier levels. The cost isn't too onerous.

Not sure exactly what you are thinking here but I think we do need a global barrier, or at least a barrier local to the RCS engine.

Since the context update is done from the kernel context, we have to ensure new requests against the target context cannot overtake the context update request.

Perhaps it would be sufficient to set the highest, non user accessible priority on the update request? Barrier sounds more future proof and correct from design point of view though.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 820

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
+
+out_add:
+       i915_request_add(rq);

And I'd still recommend not using indirect access if we can apply the changes immediately.

Quoted 6 lines
Quoted 2 lines

Direct (CPU) access means blocking in set param until the context is idle.

No, it doesn't. It's is just a choice of whether you use request to a pinned context, or direct access if idle (literally ce->pin_count). Direct access is going to be near zero overhead.

You cut all the rest of my comments here so it is unclear what you meant.

It was mostly about avoiding multiple paths to do the same thing. As I see it, we cannot only have the CPU update path - since it does imply idling the GPU. If you disagree with that please explain.

And if we do need the SDM path anyway, the CPU update path could be added later. I agree it would bring a small advantage of not having to add a global barrier *if* the target context is idle *and* RCS is busy with other contexts.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

In reply to Tvrtko Ursulin

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)

Quoted 39 lines
drivers/gpu/drm/i915/i915_gem_context.c +39 -0
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+                                 struct intel_engine_cs *engine,
+                                 struct intel_sseu sseu)
+{
+       struct drm_i915_private *i915 = ctx->i915;
+       struct i915_request *rq;
+       struct intel_ring *ring;
+       int ret;
+
+       lockdep_assert_held(&i915->drm.struct_mutex);
+
+       /* Submitting requests etc needs the hw awake. */
+       intel_runtime_pm_get(i915);
+
+       i915_retire_requests(i915);
+
+       /* Now use the RCS to actually reconfigure. */
+       engine = i915->engine[RCS];
+
+       rq = i915_request_alloc(engine, i915->kernel_context);
+       if (IS_ERR(rq)) {
+               ret = PTR_ERR(rq);
+               goto out_put;
+       }
+
+       ret = engine->emit_rpcs_config(rq, ctx, sseu);
+       if (ret)
+               goto out_add;
+
+       /* Queue this switch after all other activity */
+       list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+               struct i915_request *prev;
+
+               prev = last_request_on_engine(ring->timeline, engine);
+               if (prev)
+                       i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+                                                        &prev->submit,
+                                                        I915_FENCE_GFP);

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 824

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_context.c +10 -0
+       }
+
+       i915_gem_set_global_barrier(i915, rq);
+
+out_add:
+       i915_request_add(rq);
+out_put:
+       intel_runtime_pm_put(i915);
+
+       return ret;

Looks like we should be able to hook this up to a selftest to confirm the modification does land in the target context image, and a SRM to confirm it loaded.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoted 46 lines · Chris Wilson

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)

Quoted 45 lines
drivers/gpu/drm/i915/i915_gem_context.c +45 -0
+static int
+i915_gem_context_reconfigure_sseu(struct i915_gem_context *ctx,
+                                 struct intel_engine_cs *engine,
+                                 struct intel_sseu sseu)
+{
+       struct drm_i915_private *i915 = ctx->i915;
+       struct i915_request *rq;
+       struct intel_ring *ring;
+       int ret;
+
+       lockdep_assert_held(&i915->drm.struct_mutex);
+
+       /* Submitting requests etc needs the hw awake. */
+       intel_runtime_pm_get(i915);
+
+       i915_retire_requests(i915);
+
+       /* Now use the RCS to actually reconfigure. */
+       engine = i915->engine[RCS];
+
+       rq = i915_request_alloc(engine, i915->kernel_context);
+       if (IS_ERR(rq)) {
+               ret = PTR_ERR(rq);
+               goto out_put;
+       }
+
+       ret = engine->emit_rpcs_config(rq, ctx, sseu);
+       if (ret)
+               goto out_add;
+
+       /* Queue this switch after all other activity */
+       list_for_each_entry(ring, &i915->gt.active_rings, active_link) {
+               struct i915_request *prev;
+
+               prev = last_request_on_engine(ring->timeline, engine);
+               if (prev)
+                       i915_sw_fence_await_sw_fence_gfp(&rq->submit,
+                                                        &prev->submit,
+                                                        I915_FENCE_GFP);
+       }
+
+       i915_gem_set_global_barrier(i915, rq);
+
+out_add:
+       i915_request_add(rq);
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem_context.c int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, · line 824

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_context.c +4 -0
+out_put:
+       intel_runtime_pm_put(i915);
+
+       return ret;

Looks like we should be able to hook this up to a selftest to confirm the modification does land in the target context image, and a SRM to confirm it loaded.

Lionel wrote an IGT which reads it back via SRM so that should be covered. I will be posting the IGT counterpart at some point as well, ideally when the agreement on the i915 side is there.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace

Quoting Tvrtko Ursulin (2018-08-15 12:51:28)

Quoted 10 lines · Chris Wilson
Quoted 4 lines

Quoting Tvrtko Ursulin (2018-08-14 15:40:58)
Looks like we should be able to hook this up to a selftest to confirm the modification does land in the target context image, and a SRM to confirm it loaded.

Lionel wrote an IGT which reads it back via SRM so that should be covered. I will be posting the IGT counterpart at some point as well, ideally when the agreement on the i915 side is there.

Wouldn't you rather have both? I know I would :-p

The emphasis is slightly different, IGT wants to cover the ABI behaviour, selftests looking towards the edge cases hard to reach otherwise. But even a trivial selftest would let us know the series functions as intended.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#25 lore raw
In reply to Tvrtko Ursulin
Quoted 75 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Updated series after continuing Lionel's work.

Userspace for the feature is the media-driver project on GitHub. Please see
https://github.com/intel/media-driver/pull/271/commits.

Headline changes:

1.

No more master allow/disallow sysfs switch. Feature is unconditionally enabled for Gen11 and on other platforms it requires CAP_SYS_ADMIN.

*** To be discussed if this is a good idea or not. ***

2.

Two new patches due a) breaking out the global barrier, and b) fixing one GEM_BUG_ON regarding incorrent kernel context classification by i915_is_ggtt.

Otherwise please see individial patch change logs.

Main topic for the cover letter though is addressing the question of dynamic slice re-configuration performance impact.

Introduction into this problem space is that changing the (sub)slice configuration has a cost at context switch time in the order of tens of milli- seconds. (It varies per Gen and with different slice count transitions.)

So the question is whether a malicious unprivileged workload can negatively impact other clients. To try and answer this question I have extended gem_wsim and creating some test workloads. (Note that my testing was done on a Gen9 system. Overall message could be the same on Gen11 but needs to be verified.)

First test was a simulated video playback client running in parallel with a simulated game of both medium and high complexity (uses around 60% or 90% of the render engine respectively, and 7% of the blitter engine). I had two flavours of the playback client, one which runs normally and one which requests reduced slice configuration. Both workloads are targetting to run at 60fps.

Second test is the same but against a heavier simulated game workload, the one which uses around 90% of the render engine.

Results are achieved frames per second as observed from the game client:

No player Normal player SSEU enabled player
Medium game 59.6 59.6 59.6
Heavy game 59.7 58.4 58.1

Here we can see that the medium workload was not affected either by the normal or SSEU player, while the heavy workload did see a performance hit. Both with the video player running in parallel, and slighlty larger when the player was SSEU enabled.

Second test is running a malicious client (or clients) in parallel to the same simulated game workloads. These clients try to trigger many context switches by using multiple contexts with dependencies set up so request coalescing is defeated as much as possible.

I tested both with normal and SSEU enabled malicious clients:

DoS client SSEU DoS client
Medium game 59.5 59.6
Heavy game 57.8 55.4

For here we can see a similar picture as with the first test. Medium game client is not affected by either DoS client, while the heavy game client is, more so with the SSEU enabled attacker.

Quoted 1 line

From both tests I think the conclusion is that dynamic SSEU switching does

increase the magnitude of performance loss, especially with over-subscribed engines, due cost being proportional to context switch frequency.

Quoted 6 lines

Likelyhood is that it slightly lowers the utilization level at which this starts to happen, but does not introduce a completely new vector of attack - that is - where it was possible to DoS a system from an unprivileged client, it still is. In both cases (SSEU enabled or not), a malicious client has the option to grind the system to a halt, albeit it may need fewer submission threads to do so when it is SSEU enabled.

For reference, gem_wsim workloads used to test this (even though the number of people familiar with them is quite low):

Medium game workload:

1.RCS.1000-2000.0.0
1.RCS.1000-2000.0.0
1.RCS.1000-2000.0.0
1.RCS.1000-2000.0.0
1.RCS.1000-2000.0.0
P.2.1
2.BCS.1000.-2.0
2.RCS.2000.-1.1
p.16667

Heavy game workload:

1.RCS.500.0.0
1.RCS.2000.0.0
1.RCS.2000.0.0
1.RCS.2000.0.0
1.RCS.2000.0.0
1.RCS.2000.0.0
1.RCS.2000.0.0
P.2.1
2.BCS.1000.-2.0
2.RCS.2000.-1.1
p.16667

Normal video player:

1.VCS.5000-10000.0.0
2.RCS.1000-2000.-1.0
P.3.1
3.BCS.1000.-2.0
p.16667

SSEU enabled video player:

S.1.1
S.2.1
1.VCS.5000-10000.0.0
2.RCS.1000-2000.-1.0
P.3.1
3.BCS.1000.-2.0
p.16667

Malicious client:

1.RCS.1.0.0
2.RCS.1.-1.0

SSEU enabled malicious client:

S.2.1
1.RCS.1.0.0
2.RCS.1.-1.0

Regards,

Tvrtko

Quoted 15 lines

Chris Wilson (3):
drm/i915: Program RPCS for Broadwell
drm/i915: Record the sseu configuration per-context & engine drm/i915: Expose RPCS (SSEU) configuration to userspace

Lionel Landwerlin (3):
drm/i915/perf: simplify configure all context function drm/i915/perf: reuse intel_lrc ctx regs macro drm/i915/perf: lock powergating configuration to default when active

Tvrtko Ursulin (2):
drm/i915: Add global barrier support drm/i915: Explicitly mark Global GTT address spaces

Quoted 15 lines
  drivers/gpu/drm/i915/i915_drv.h         |  56 +++++++
  drivers/gpu/drm/i915/i915_gem.c         |   2 +
  drivers/gpu/drm/i915/i915_gem_context.c | 189 +++++++++++++++++++++++-
  drivers/gpu/drm/i915/i915_gem_context.h |   4 +
  drivers/gpu/drm/i915/i915_gem_gtt.c     |   2 +
  drivers/gpu/drm/i915/i915_gem_gtt.h     |   5 +-
  drivers/gpu/drm/i915/i915_perf.c        |  68 +++++----
  drivers/gpu/drm/i915/i915_request.c     |  16 ++
  drivers/gpu/drm/i915/i915_request.h     |  10 ++
  drivers/gpu/drm/i915/intel_lrc.c        |  87 ++++++++---
  drivers/gpu/drm/i915/intel_lrc.h        |   3 +
  drivers/gpu/drm/i915/intel_ringbuffer.h |   4 +
  include/uapi/drm/i915_drm.h             |  43 ++++++
  13 files changed, 439 insertions(+), 50 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#26 lore raw

✗ Fi.CI.CHECKPATCH: warning for Per context dynamic (sub)slice power-gating

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: Per context dynamic (sub)slice power-gating
URL : https://patchwork.freedesktop.org/series/48194/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
6a364f5371a6 drm/i915: Program RPCS for Broadwell
f2e29d92ffdf drm/i915: Record the sseu configuration per-context & engine
5802b42315f5 drm/i915/perf: simplify configure all context function
e3d46c7d1eb6 drm/i915/perf: reuse intel_lrc ctx regs macro
19449778b5b3 drm/i915/perf: lock powergating configuration to default when active
128663cebf31 drm/i915: Add global barrier support
46adb8a4a966 drm/i915: Explicitly mark Global GTT address spaces
-:44: WARNING:BOOL_BITFIELD: Avoid using bool as bitfield.  Prefer bool bitfields as unsigned int or u<8|16|32>
#44: FILE: drivers/gpu/drm/i915/i915_gem_gtt.h:335:
+	bool is_ggtt:1;

total: 0 errors, 1 warnings, 0 checks, 25 lines checked
491e75be6bef drm/i915: Expose RPCS (SSEU) configuration to userspace
-:40: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #40:
v2: Fix offset of CTX_R_PWR_CLK_STATE in intel_lr_context_set_sseu() (Lionel)

total: 0 errors, 1 warnings, 0 checks, 340 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

✗ Fi.CI.SPARSE: warning for Per context dynamic (sub)slice power-gating

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: Per context dynamic (sub)slice power-gating
URL : https://patchwork.freedesktop.org/series/48194/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Commit: drm/i915: Program RPCS for Broadwell
Okay!

Commit: drm/i915: Record the sseu configuration per-context & engine -drivers/gpu/drm/i915/selftests/../i915_drv.h:3684:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/selftests/../i915_drv.h:3698:16: warning: expression using sizeof(void)

Commit: drm/i915/perf: simplify configure all context function Okay!

Commit: drm/i915/perf: reuse intel_lrc ctx regs macro Okay!

Commit: drm/i915/perf: lock powergating configuration to default when active Okay!

Commit: drm/i915: Add global barrier support -drivers/gpu/drm/i915/selftests/../i915_drv.h:3698:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/selftests/../i915_drv.h:3725:16: warning: expression using sizeof(void)

Commit: drm/i915: Explicitly mark Global GTT address spaces Okay!

Commit: drm/i915: Expose RPCS (SSEU) configuration to userspace Okay!

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#28 lore raw

✓ Fi.CI.BAT: success for Per context dynamic (sub)slice power-gating

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: Per context dynamic (sub)slice power-gating
URL : https://patchwork.freedesktop.org/series/48194/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4666 -> Patchwork_9941 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/48194/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_9941 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      fi-skl-6700hq:      PASS -> DMESG-FAIL (fdo#106560, fdo#107174)

    
    ==== Possible fixes ====

    igt@drv_module_reload@basic-reload-inject:
      fi-hsw-4770r:       DMESG-WARN (fdo#107425) -> PASS

    igt@drv_selftest@live_hangcheck:
      fi-kbl-7560u:       DMESG-FAIL (fdo#106947, fdo#106560) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      {fi-byt-clapper}:   FAIL (fdo#103167) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
fdo#107174 https://bugs.freedesktop.org/show_bug.cgi?id=107174
fdo#107425 https://bugs.freedesktop.org/show_bug.cgi?id=107425

== Participating hosts (53 -> 49) ==

Additional (1): fi-glk-j4005
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* Linux: CI_DRM_4666 -> Patchwork_9941

CI_DRM_4666: 26f5eeef80e4332958ea855e90a4d015a9481e3f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4594: b0263e5d0563a81a42cf66e7d3b84662d3222862 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9941: 491e75be6beffef5d6503f91b4ce12d1fc3d7289 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

491e75be6bef drm/i915: Expose RPCS (SSEU) configuration to userspace 46adb8a4a966 drm/i915: Explicitly mark Global GTT address spaces 128663cebf31 drm/i915: Add global barrier support
19449778b5b3 drm/i915/perf: lock powergating configuration to default when active e3d46c7d1eb6 drm/i915/perf: reuse intel_lrc ctx regs macro 5802b42315f5 drm/i915/perf: simplify configure all context function f2e29d92ffdf drm/i915: Record the sseu configuration per-context & engine 6a364f5371a6 drm/i915: Program RPCS for Broadwell

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9941/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#29 lore raw

✗ Fi.CI.IGT: failure for Per context dynamic (sub)slice power-gating

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: Per context dynamic (sub)slice power-gating
URL : https://patchwork.freedesktop.org/series/48194/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4666_full -> Patchwork_9941_full =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_9941_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_9941_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_9941_full:

=== IGT changes ===

    ==== Possible regressions ====

    igt@drv_selftest@mock_vma:
      shard-apl:          PASS -> DMESG-FAIL +1
      shard-snb:          PASS -> DMESG-FAIL

    igt@gem_ctx_param@invalid-param-get:
      shard-apl:          PASS -> FAIL
      shard-glk:          PASS -> FAIL
      shard-hsw:          PASS -> FAIL
      shard-kbl:          PASS -> FAIL

    igt@gem_ctx_param@invalid-param-set:
      shard-kbl:          PASS -> DMESG-FAIL +1
      shard-hsw:          PASS -> DMESG-FAIL +1
      shard-snb:          PASS -> FAIL +1
      shard-glk:          PASS -> DMESG-FAIL +1

    
    ==== Warnings ====

    igt@drv_selftest@live_evict:
      shard-snb:          PASS -> SKIP +17

    igt@drv_selftest@live_execlists:
      shard-hsw:          PASS -> SKIP +17

    igt@drv_selftest@live_objects:
      shard-glk:          PASS -> SKIP +17

    igt@drv_selftest@live_requests:
      shard-kbl:          PASS -> SKIP +17

    igt@drv_selftest@live_workarounds:
      shard-apl:          PASS -> SKIP +17

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

== Known issues ==

Here are the changes found in Patchwork_9941_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_cursor_legacy@cursor-vs-flip-legacy:
      shard-hsw:          PASS -> FAIL (fdo#103355)

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-apl:          PASS -> FAIL (fdo#105363, fdo#102887)

    
    ==== Possible fixes ====

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4666 -> Patchwork_9941

CI_DRM_4666: 26f5eeef80e4332958ea855e90a4d015a9481e3f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4594: b0263e5d0563a81a42cf66e7d3b84662d3222862 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9941: 491e75be6beffef5d6503f91b4ce12d1fc3d7289 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9941/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx