Skip to contentSkip to conversation

drm/i915: implement NOA mux reprogramming at ctx-switch

PATCH New Lionel Landwerlin 2 participants 7 messages Aug 31, 2017 – Sep 1, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover drm/i915: implement NOA mux reprogramming at ctx-switch

Some pertinent changes suggested by Chris. The most important one being using the indirect-ctx batchbuffer.

Cheers,

Lionel Landwerlin (4):
drm/i915: don't specify pinned size for wa_bb pin/allocation drm/i915: extract per-ctx/indirect bb programming drm/i915: pass wa_ctx as argument
drm/i915: reprogram NOA muxes on context switch when using perf

 drivers/gpu/drm/i915/i915_drv.h  |   2 +
 drivers/gpu/drm/i915/i915_perf.c | 130 ++++++++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_lrc.c | 113 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_lrc.h |   1 +
 4 files changed, 187 insertions(+), 59 deletions(-)

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

#1 lore raw

PATCH v2 1/4 drm/i915: don't specify pinned size for wa_bb pin/allocation

We can rely on the i915_vma_pin() to use vma->size instead.

v2: Actually set the pin size to 0 to vma->size is used implicitly

    (Chris)
---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 3758ff81928d..09fb2b29a739 100644
@@ -1141,7 +1141,7 @@ static int lrc_setup_wa_ctx(struct intel_engine_cs *engine)
 		goto err;
 	}
 
-	err = i915_vma_pin(vma, 0, PAGE_SIZE, PIN_GLOBAL | PIN_HIGH);
+	err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL | PIN_HIGH);
 	if (err)
 		goto err;
 
Signature · 6 lines
2.14.1

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

PATCH v2 2/4 drm/i915: extract per-ctx/indirect bb programming

In reply to Lionel Landwerlin

Let's put this in its own function to reuse it later.

v2: Pull in condition in the extracted function (Chris)

---
 drivers/gpu/drm/i915/intel_lrc.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +23 -14
index 09fb2b29a739..9ea5a56956e3 100644
@@ -1906,6 +1906,28 @@ static u32 intel_lr_indirect_ctx_offset(struct intel_engine_cs *engine)
 	return indirect_ctx_offset;
 }
 
+static void execlists_init_reg_state_wa_bb(u32 *regs,
+					   struct intel_engine_cs *engine)
+{
+	struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
+	u32 ggtt_offset;
+
+	if (!wa_ctx->vma)
+		return;
+
+	ggtt_offset = i915_ggtt_offset(wa_ctx->vma);
+
+	regs[CTX_RCS_INDIRECT_CTX + 1] =
+		(ggtt_offset + wa_ctx->indirect_ctx.offset) |
+		(wa_ctx->indirect_ctx.size / CACHELINE_BYTES);
+
+	regs[CTX_RCS_INDIRECT_CTX_OFFSET + 1] =
+		intel_lr_indirect_ctx_offset(engine) << 6;
+
+	regs[CTX_BB_PER_CTX_PTR + 1] =
+		(ggtt_offset + wa_ctx->per_ctx.offset) | 0x01;
+}
+
 static void execlists_init_reg_state(u32 *regs,
 				     struct i915_gem_context *ctx,
 				     struct intel_engine_cs *engine,
@@ -1948,20 +1970,7 @@ static void execlists_init_reg_state(u32 *regs,
 		CTX_REG(regs, CTX_RCS_INDIRECT_CTX_OFFSET,
 			RING_INDIRECT_CTX_OFFSET(base), 0);
 
-		if (engine->wa_ctx.vma) {
-			struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
-			u32 ggtt_offset = i915_ggtt_offset(wa_ctx->vma);
-
-			regs[CTX_RCS_INDIRECT_CTX + 1] =
-				(ggtt_offset + wa_ctx->indirect_ctx.offset) |
-				(wa_ctx->indirect_ctx.size / CACHELINE_BYTES);
-
-			regs[CTX_RCS_INDIRECT_CTX_OFFSET + 1] =
-				intel_lr_indirect_ctx_offset(engine) << 6;
-
-			regs[CTX_BB_PER_CTX_PTR + 1] =
-				(ggtt_offset + wa_ctx->per_ctx.offset) | 0x01;
-		}
+		execlists_init_reg_state_wa_bb(regs, engine);
 	}
 
 	regs[CTX_LRI_HEADER_1] = MI_LOAD_REGISTER_IMM(9) | MI_LRI_FORCE_POSTED;
Signature · 6 lines
2.14.1

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

PATCH v2 3/4 drm/i915: pass wa_ctx as argument

In reply to Lionel Landwerlin

Rather than accessing it from the engine structure. This will be used for reprogramming later.

---
 drivers/gpu/drm/i915/intel_lrc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +7 -6
index 9ea5a56956e3..1cb67f8c0ff9 100644
@@ -1125,7 +1125,8 @@ static u32 *gen9_init_perctx_bb(struct intel_engine_cs *engine, u32 *batch)
 
 #define CTX_WA_BB_OBJ_SIZE (PAGE_SIZE)
 
-static int lrc_setup_wa_ctx(struct intel_engine_cs *engine)
+static int lrc_setup_wa_ctx(struct intel_engine_cs *engine,
+			    struct i915_ctx_workarounds *wa_ctx)
 {
 	struct drm_i915_gem_object *obj;
 	struct i915_vma *vma;
@@ -1145,7 +1146,7 @@ static int lrc_setup_wa_ctx(struct intel_engine_cs *engine)
 	if (err)
 		goto err;
 
-	engine->wa_ctx.vma = vma;
+	wa_ctx->vma = vma;
 	return 0;
 
 err:
@@ -1160,9 +1161,9 @@ static void lrc_destroy_wa_ctx(struct intel_engine_cs *engine)
 
 typedef u32 *(*wa_bb_func_t)(struct intel_engine_cs *engine, u32 *batch);
 
-static int intel_init_workaround_bb(struct intel_engine_cs *engine)
+static int intel_init_workaround_bb(struct intel_engine_cs *engine,
+				    struct i915_ctx_workarounds *wa_ctx)
 {
-	struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
 	struct i915_wa_ctx_bb *wa_bb[2] = { &wa_ctx->indirect_ctx,
 					    &wa_ctx->per_ctx };
 	wa_bb_func_t wa_bb_fn[2];
@@ -1190,7 +1191,7 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
 		return 0;
 	}
 
-	ret = lrc_setup_wa_ctx(engine);
+	ret = lrc_setup_wa_ctx(engine, wa_ctx);
 	if (ret) {
 		DRM_DEBUG_DRIVER("Failed to setup context WA page: %d\n", ret);
 		return ret;
@@ -1829,7 +1830,7 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
 	if (ret)
 		return ret;
 
-	ret = intel_init_workaround_bb(engine);
+	ret = intel_init_workaround_bb(engine, &engine->wa_ctx);
 	if (ret) {
 		/*
 		 * We continue even if we fail to initialize WA batch
Signature · 6 lines
2.14.1

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

PATCH v2 4/4 drm/i915: reprogram NOA muxes on context switch when using perf

In reply to Lionel Landwerlin

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. We need to reprogram them at context switch.

v2: Do reprogramming in indirect-ctx batchbuffer (Chris)
Simplify emission by reusing i915_oa_get_perctx_bb_size() (Chris)

---
 drivers/gpu/drm/i915/i915_drv.h  |   2 +
 drivers/gpu/drm/i915/i915_perf.c | 130 ++++++++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_lrc.c |  61 +++++++++++++++++-
 drivers/gpu/drm/i915/intel_lrc.h |   1 +
 4 files changed, 156 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 43d83ffae2d3..5157bf68323e 100644
@@ -3706,6 +3706,8 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
 void i915_oa_init_reg_state(struct intel_engine_cs *engine,
 			    struct i915_gem_context *ctx,
 			    uint32_t *reg_state);
+u32 i915_oa_get_perctx_bb_size(struct intel_engine_cs *engine);
+u32 *i915_oa_emit_perctx_bb(struct intel_engine_cs *engine, u32 *batch);
 
 /* i915_gem_evict.c */
 int __must_check i915_gem_evict_something(struct i915_address_space *vm,
drivers/gpu/drm/i915/i915_perf.c +95 -35

196 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.c +58 -3

105 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.h +1 -0
index 4ef6a6143f5d..bbaf9f563ad5 100644
@@ -65,6 +65,7 @@ enum {
 /* Logical Rings */
 void intel_logical_ring_cleanup(struct intel_engine_cs *engine);
 int logical_render_ring_init(struct intel_engine_cs *engine);
+int logical_render_ring_reload_wa_bb(struct intel_engine_cs *engine);
 int logical_xcs_ring_init(struct intel_engine_cs *engine);
 
 /* Logical Ring Contexts */
Signature · 6 lines
2.14.1

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

✓ Fi.CI.BAT: success for drm/i915: implement NOA mux reprogramming at ctx-switch (rev2)

In reply to Lionel Landwerlin
== Series Details ==

== Series Details ==

Series: drm/i915: implement NOA mux reprogramming at ctx-switch (rev2)
URL : https://patchwork.freedesktop.org/series/29564/
State : success

== Summary ==

Series 29564v2 drm/i915: implement NOA mux reprogramming at ctx-switch
https://patchwork.freedesktop.org/api/1.0/series/29564/revisions/2/mbox/

Test kms_cursor_legacy:

        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215 +1

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215

fi-bdw-5557u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-bdw-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:441s
fi-blb-e6850     total:288  pass:224  dwarn:1   dfail:0   fail:0   skip:63  time:359s
fi-bsw-n3050     total:288  pass:243  dwarn:0   dfail:0   fail:0   skip:45  time:556s
fi-bwr-2160      total:288  pass:184  dwarn:0   dfail:0   fail:0   skip:104 time:254s
fi-bxt-j4205     total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:521s
fi-byt-j1900     total:288  pass:254  dwarn:1   dfail:0   fail:0   skip:33  time:525s
fi-byt-n2820     total:288  pass:250  dwarn:1   dfail:0   fail:0   skip:37  time:520s
fi-elk-e7500     total:288  pass:230  dwarn:0   dfail:0   fail:0   skip:58  time:436s
fi-glk-2a        total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:610s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:2   skip:25  time:464s
fi-hsw-4770r     total:288  pass:263  dwarn:0   dfail:0   fail:0   skip:25  time:423s
fi-ilk-650       total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:426s
fi-ivb-3520m     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:496s
fi-ivb-3770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:475s
fi-kbl-7500u     total:288  pass:264  dwarn:1   dfail:0   fail:0   skip:23  time:518s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:596s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:596s
fi-pnv-d510      total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:527s
fi-skl-6260u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:471s
fi-skl-6700k     total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:529s
fi-skl-6770hq    total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:489s
fi-skl-gvtdvm    total:288  pass:266  dwarn:0   dfail:0   fail:0   skip:22  time:448s
fi-skl-x1585l    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:490s
fi-snb-2520m     total:288  pass:251  dwarn:0   dfail:0   fail:0   skip:37  time:546s
fi-snb-2600      total:288  pass:249  dwarn:0   dfail:0   fail:1   skip:38  time:405s

ccf4ca2d93383fe1a234aba83df9c21400216433 drm-tip: 2017y-08m-31d-18h-37m-46s UTC integration manifest 8a67e4baccf0 drm/i915: reprogram NOA muxes on context switch when using perf f2ef57f51836 drm/i915: pass wa_ctx as argument
9b60e084f9b4 drm/i915: extract per-ctx/indirect bb programming
23ac9b987219 drm/i915: don't specify pinned size for wa_bb pin/allocation

== Logs ==

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

#6 lore raw

✓ Fi.CI.IGT: success for drm/i915: implement NOA mux reprogramming at ctx-switch (rev2)

In reply to Lionel Landwerlin
== Series Details ==

== Series Details ==

Series: drm/i915: implement NOA mux reprogramming at ctx-switch (rev2)
URL : https://patchwork.freedesktop.org/series/29564/
State : success

== Summary ==

Test perf:

        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw total:2265 pass:1234 dwarn:0 dfail:0 fail:15 skip:1016 time:9589s

== Logs ==

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