Skip to contentSkip to conversation

Convert parts of intel_lrc.c to requests

RFC In review Mika Kuoppala 7 participants 24 messages Jul 3, 2015 – Jul 8, 2015

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

cover Convert parts of intel_lrc.c to requests

Hi,

Reader might think that I did this for only mark few elsps done deeper in callchain. But the reason is that I wanted to test more uniqueness guarantees for generation of context ids that is passed for hardware. And found out that the current code structure strips out all the request/context very early on.

So here is my take to not lose the request that I have found valuable in skl debugging.

-Mika

Mika Kuoppala (7):
drm/i915: Convert execlist_submit_contexts() for requests drm/i915: Convert execlists_update_context() for requests drm/i915: Assign request ringbuf before pin drm/i915: Convert intel_lr_context_pin() for requests drm/i915: Convert execlists_elsp_writ() for requests drm/i915: Convert execlists_ctx_descriptor() for requests drm/i915: Mark elsps submitted when they are pushed to hw

 drivers/gpu/drm/i915/i915_gem.c  |   8 +--
 drivers/gpu/drm/i915/intel_lrc.c | 117 +++++++++++++++++----------------------
 drivers/gpu/drm/i915/intel_lrc.h |   3 +-
 3 files changed, 56 insertions(+), 72 deletions(-)
Signature · 6 lines
2.1.4

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

PATCH 1/7 drm/i915: Convert execlist_submit_contexts() for requests

Pass around requests to carry context deeper in callchain.

---
 drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +14 -16
index 9b928ab..583210d 100644
@@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
 	return 0;
 }
 
-static void execlists_submit_contexts(struct intel_engine_cs *ring,
-				      struct intel_context *to0, u32 tail0,
-				      struct intel_context *to1, u32 tail1)
+static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
+				      struct drm_i915_gem_request *rq1)
 {
-	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq0->ring;
+	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
 	struct drm_i915_gem_object *ctx_obj1 = NULL;
-	struct intel_ringbuffer *ringbuf1 = NULL;
 
 	BUG_ON(!ctx_obj0);
 	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
-	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
+	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
 
-	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
+	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,
+				 rq0->ctx->ppgtt, rq0->tail);
+
+	if (rq1) {
+		ctx_obj1 = rq1->ctx->engine[ring->id].state;
 
-	if (to1) {
-		ringbuf1 = to1->engine[ring->id].ringbuf;
-		ctx_obj1 = to1->engine[ring->id].state;
 		BUG_ON(!ctx_obj1);
 		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
-		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
+		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
 
-		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
+		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
+					 rq1->ctx->ppgtt, rq1->tail);
 	}
 
 	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
@@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
 
 	WARN_ON(req1 && req1->elsp_submitted);
 
-	execlists_submit_contexts(ring, req0->ctx, req0->tail,
-				  req1 ? req1->ctx : NULL,
-				  req1 ? req1->tail : 0);
+	execlists_submit_requests(req0, req1);
 
 	req0->elsp_submitted++;
 	if (req1)
Signature · 6 lines
2.1.4

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

Re: [PATCH 1/7] drm/i915: Convert execlist_submit_contexts() for requests

Quoted 25 lines · Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
  drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
  1 file changed, 14 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +4 -5
index 9b928ab..583210d 100644
@@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
  	return 0;
  }
 
-static void execlists_submit_contexts(struct intel_engine_cs *ring,
-				      struct intel_context *to0, u32 tail0,
-				      struct intel_context *to1, u32 tail1)
+static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
+				      struct drm_i915_gem_request *rq1)
  {
-	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq0->ring;
+	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;

drivers/gpu/drm/i915/intel_lrc.c static int execlists_update_context(struct drm_i915_gem_object *ctx_obj, · line 372

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -3
  	struct drm_i915_gem_object *ctx_obj1 = NULL;
-	struct intel_ringbuffer *ringbuf1 = NULL;
 
  	BUG_ON(!ctx_obj0);
  	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
-	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
+	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
 
-	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
+	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,

Typo? Here it should be ctx_obj0.

Quoted 20 lines
drivers/gpu/drm/i915/intel_lrc.c +7 -5
+				 rq0->ctx->ppgtt, rq0->tail);
+
+	if (rq1) {
+		ctx_obj1 = rq1->ctx->engine[ring->id].state;
 
-	if (to1) {
-		ringbuf1 = to1->engine[ring->id].ringbuf;
-		ctx_obj1 = to1->engine[ring->id].state;
  		BUG_ON(!ctx_obj1);
  		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
-		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
+		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
 
-		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
+		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
+					 rq1->ctx->ppgtt, rq1->tail);
  	}
 
  	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);

drivers/gpu/drm/i915/intel_lrc.c static void execlists_context_unqueue(struct intel_engine_cs *ring) · line 449

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -3
@@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
 
  	WARN_ON(req1 && req1->elsp_submitted);
 
-	execlists_submit_contexts(ring, req0->ctx, req0->tail,
-				  req1 ? req1->ctx : NULL,
-				  req1 ? req1->tail : 0);
+	execlists_submit_requests(req0, req1);
 
  	req0->elsp_submitted++;
  	if (req1)

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

#3 lore raw

Re: [PATCH 1/7] drm/i915: Convert execlist_submit_contexts() for requests

Quoted 29 lines · Yu Dai
Quoted 28 lines · Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
  drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
  1 file changed, 14 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +4 -6
index 9b928ab..583210d 100644
@@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
  	return 0;
  }
 
-static void execlists_submit_contexts(struct intel_engine_cs *ring,
-				      struct intel_context *to0, u32 tail0,
-				      struct intel_context *to1, u32 tail1)
+static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
+				      struct drm_i915_gem_request *rq1)
  {
-	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq0->ring;
+	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
  	struct drm_i915_gem_object *ctx_obj1 = NULL;
-	struct intel_ringbuffer *ringbuf1 = NULL;
 
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int execlists_update_context(struct drm_i915_gem_object *ctx_obj, · line 372

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -2
  	BUG_ON(!ctx_obj0);
  	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
-	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
+	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
 
-	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
+	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,

Typo? Here it should be ctx_obj0.

Never mind. Issue got fixed by patch 2/7.
Alex

Quoted 23 lines
Quoted 23 lines
drivers/gpu/drm/i915/intel_lrc.c +7 -5
+				 rq0->ctx->ppgtt, rq0->tail);
+
+	if (rq1) {
+		ctx_obj1 = rq1->ctx->engine[ring->id].state;
 
-	if (to1) {
-		ringbuf1 = to1->engine[ring->id].ringbuf;
-		ctx_obj1 = to1->engine[ring->id].state;
  		BUG_ON(!ctx_obj1);
  		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
-		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
+		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
 
-		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
+		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
+					 rq1->ctx->ppgtt, rq1->tail);
  	}
 
  	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
@@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
 
  	WARN_ON(req1 && req1->elsp_submitted);
 
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static void execlists_context_unqueue(struct intel_engine_cs *ring) · line 449

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -3
-	execlists_submit_contexts(ring, req0->ctx, req0->tail,
-				  req1 ? req1->ctx : NULL,
-				  req1 ? req1->tail : 0);
+	execlists_submit_requests(req0, req1);
 
  	req0->elsp_submitted++;
  	if (req1)

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

#4 lore raw

Re: [PATCH 1/7] drm/i915: Convert execlist_submit_contexts() for requests

Quoted 35 lines · Yu Dai
Quoted 34 lines · Yu Dai
Quoted 33 lines · Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
  drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++----------------
  1 file changed, 14 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +5 -7
index 9b928ab..583210d 100644
@@ -358,29 +358,29 @@ static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
  	return 0;
  }
 
-static void execlists_submit_contexts(struct intel_engine_cs *ring,
-				      struct intel_context *to0, u32 tail0,
-				      struct intel_context *to1, u32 tail1)
+static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
+				      struct drm_i915_gem_request *rq1)
  {
-	struct drm_i915_gem_object *ctx_obj0 = to0->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf0 = to0->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq0->ring;
+	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
  	struct drm_i915_gem_object *ctx_obj1 = NULL;
-	struct intel_ringbuffer *ringbuf1 = NULL;
 
  	BUG_ON(!ctx_obj0);
  	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
-	WARN_ON(!i915_gem_obj_is_pinned(ringbuf0->obj));
+	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
 
Quoted 6 lines
Quoted 3 lines

drivers/gpu/drm/i915/intel_lrc.c static int execlists_update_context(struct drm_i915_gem_object *ctx_obj, · line 372

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -1
-	execlists_update_context(ctx_obj0, ringbuf0->obj, to0->ppgtt, tail0);
+	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,

Typo? Here it should be ctx_obj0.

Never mind. Issue got fixed by patch 2/7.
Alex

Well that will cause trouble for the bisecter :(

-Mika

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_lrc.c +8 -8
+				 rq0->ctx->ppgtt, rq0->tail);
+
+	if (rq1) {
+		ctx_obj1 = rq1->ctx->engine[ring->id].state;
 
-	if (to1) {
-		ringbuf1 = to1->engine[ring->id].ringbuf;
-		ctx_obj1 = to1->engine[ring->id].state;
  		BUG_ON(!ctx_obj1);
  		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
-		WARN_ON(!i915_gem_obj_is_pinned(ringbuf1->obj));
+		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
 
-		execlists_update_context(ctx_obj1, ringbuf1->obj, to1->ppgtt, tail1);
+		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
+					 rq1->ctx->ppgtt, rq1->tail);
  	}
 
  	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
@@ -443,9 +443,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
 
  	WARN_ON(req1 && req1->elsp_submitted);
 
-	execlists_submit_contexts(ring, req0->ctx, req0->tail,
-				  req1 ? req1->ctx : NULL,
-				  req1 ? req1->tail : 0);
+	execlists_submit_requests(req0, req1);
 
Quoted 8 lines
Quoted 3 lines

drivers/gpu/drm/i915/intel_lrc.c static void execlists_context_unqueue(struct intel_engine_cs *ring) · line 449

Quoted 2 lines
drivers/gpu/drm/i915/intel_lrc.c +0 -0
  	req0->elsp_submitted++;
  	if (req1)

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

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

#5 lore raw

PATCH 2/7 drm/i915: Convert execlists_update_context() for requests

In reply to Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
 drivers/gpu/drm/i915/intel_lrc.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +13 -19
index 583210d..4139eb6 100644
@@ -329,19 +329,24 @@ static void execlists_elsp_write(struct intel_engine_cs *ring,
 	spin_unlock(&dev_priv->uncore.lock);
 }
 
-static int execlists_update_context(struct drm_i915_gem_object *ctx_obj,
-				    struct drm_i915_gem_object *ring_obj,
-				    struct i915_hw_ppgtt *ppgtt,
-				    u32 tail)
+static int execlists_update_context(struct drm_i915_gem_request *rq)
 {
+	struct intel_engine_cs *ring = rq->ring;
+	struct i915_hw_ppgtt *ppgtt = rq->ctx->ppgtt;
+	struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
+	struct drm_i915_gem_object *rb_obj = rq->ringbuf->obj;
 	struct page *page;
 	uint32_t *reg_state;
 
+	BUG_ON(!ctx_obj);
+	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj));
+	WARN_ON(!i915_gem_obj_is_pinned(rb_obj));
+
 	page = i915_gem_object_get_page(ctx_obj, 1);
 	reg_state = kmap_atomic(page);
 
-	reg_state[CTX_RING_TAIL+1] = tail;
-	reg_state[CTX_RING_BUFFER_START+1] = i915_gem_obj_ggtt_offset(ring_obj);
+	reg_state[CTX_RING_TAIL+1] = rq->tail;
+	reg_state[CTX_RING_BUFFER_START+1] = i915_gem_obj_ggtt_offset(rb_obj);
 
 	/* True PPGTT with dynamic page allocation: update PDP registers and
 	 * point the unallocated PDPs to the scratch page
@@ -365,22 +370,11 @@ static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
 	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
 	struct drm_i915_gem_object *ctx_obj1 = NULL;
 
-	BUG_ON(!ctx_obj0);
-	WARN_ON(!i915_gem_obj_is_pinned(ctx_obj0));
-	WARN_ON(!i915_gem_obj_is_pinned(rq0->ringbuf->obj));
-
-	execlists_update_context(ctx_obj1, rq0->ringbuf->obj,
-				 rq0->ctx->ppgtt, rq0->tail);
+	execlists_update_context(rq0);
 
 	if (rq1) {
+		execlists_update_context(rq1);
 		ctx_obj1 = rq1->ctx->engine[ring->id].state;
-
-		BUG_ON(!ctx_obj1);
-		WARN_ON(!i915_gem_obj_is_pinned(ctx_obj1));
-		WARN_ON(!i915_gem_obj_is_pinned(rq1->ringbuf->obj));
-
-		execlists_update_context(ctx_obj1, rq1->ringbuf->obj,
-					 rq1->ctx->ppgtt, rq1->tail);
 	}
 
 	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
Signature · 6 lines
2.1.4

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

PATCH 3/7 drm/i915: Assign request ringbuf before pin

In reply to Mika Kuoppala

In preparation to make intel_lr_context_pin|unpin to accept requests, assign ringbuf into request before we call the pinning.

---
 drivers/gpu/drm/i915/intel_lrc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +5 -3
index 4139eb6..ab8a98c 100644
@@ -633,14 +633,16 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 {
 	int ret;
 
+	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
+
 	if (request->ctx != request->ring->default_context) {
 		ret = intel_lr_context_pin(request->ring, request->ctx);
-		if (ret)
+		if (ret) {
+			request->ringbuf = NULL;
 			return ret;
+		}
 	}
 
-	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
-
 	return 0;
 }
 
Signature · 6 lines
2.1.4

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

Re: [PATCH 3/7] drm/i915: Assign request ringbuf before pin

Quoted 13 lines · Mika Kuoppala

In preparation to make intel_lr_context_pin|unpin to accept requests, assign ringbuf into request before we call the pinning.

---
 drivers/gpu/drm/i915/intel_lrc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index 4139eb6..ab8a98c 100644

drivers/gpu/drm/i915/intel_lrc.c int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request · line 641

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
@@ -633,14 +633,16 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 {
 	int ret;
 
+	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
+
 	if (request->ctx != request->ring->default_context) {
 		ret = intel_lr_context_pin(request->ring, request->ctx);
-		if (ret)
+		if (ret) {
+			request->ringbuf = NULL;

You don't need to unset it again. We just trash the request on error. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 3/7 drm/i915: Assign request ringbuf before pin

In preparation to make intel_lr_context_pin|unpin to accept requests, assign ringbuf into request before we call the pinning.

v2: No need to unset ringbuf on error path (Chris)

---
 drivers/gpu/drm/i915/intel_lrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +2 -2
index 4139eb6..ace3a98 100644
@@ -633,14 +633,14 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 {
 	int ret;
 
+	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
+
 	if (request->ctx != request->ring->default_context) {
 		ret = intel_lr_context_pin(request->ring, request->ctx);
 		if (ret)
 			return ret;
 	}
 
-	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
-
 	return 0;
 }
 
Signature · 6 lines
2.1.4

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

PATCH 4/7 drm/i915: Convert intel_lr_context_pin() for requests

In reply to Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
 drivers/gpu/drm/i915/i915_gem.c  |  8 +++-----
 drivers/gpu/drm/i915/intel_lrc.c | 31 +++++++++++++++----------------
 drivers/gpu/drm/i915/intel_lrc.h |  3 +--
 3 files changed, 19 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -5
index 49016e0..927964b 100644
@@ -2620,10 +2620,8 @@ void i915_gem_request_free(struct kref *req_ref)
 
 	if (ctx) {
 		if (i915.enable_execlists) {
-			struct intel_engine_cs *ring = req->ring;
-
-			if (ctx != ring->default_context)
-				intel_lr_context_unpin(ring, ctx);
+			if (ctx != req->ring->default_context)
+				intel_lr_context_unpin(req);
 		}
 
 		i915_gem_context_unreference(ctx);
@@ -2765,7 +2763,7 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
 		list_del(&submit_req->execlist_link);
 
 		if (submit_req->ctx != ring->default_context)
-			intel_lr_context_unpin(ring, submit_req->ctx);
+			intel_lr_context_unpin(submit_req);
 
 		i915_gem_request_unreference(submit_req);
 	}
drivers/gpu/drm/i915/intel_lrc.c +15 -16
index ab8a98c..36f8660 100644
@@ -211,8 +211,7 @@ enum {
 #define GEN8_CTX_ID_SHIFT 32
 #define CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT  0x17
 
-static int intel_lr_context_pin(struct intel_engine_cs *ring,
-		struct intel_context *ctx);
+static int intel_lr_context_pin(struct drm_i915_gem_request *rq);
 
 /**
  * intel_sanitize_enable_execlists() - sanitize i915.enable_execlists
@@ -541,7 +540,7 @@ static int execlists_context_queue(struct drm_i915_gem_request *request)
 	int num_elements = 0;
 
 	if (request->ctx != ring->default_context)
-		intel_lr_context_pin(ring, request->ctx);
+		intel_lr_context_pin(request);
 
 	i915_gem_request_reference(request);
 
@@ -636,7 +635,7 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 	request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
 
 	if (request->ctx != request->ring->default_context) {
-		ret = intel_lr_context_pin(request->ring, request->ctx);
+		ret = intel_lr_context_pin(request);
 		if (ret) {
 			request->ringbuf = NULL;
 			return ret;
@@ -952,7 +951,7 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring)
 				ctx->engine[ring->id].state;
 
 		if (ctx_obj && (ctx != ring->default_context))
-			intel_lr_context_unpin(ring, ctx);
+			intel_lr_context_unpin(req);
 		list_del(&req->execlist_link);
 		i915_gem_request_unreference(req);
 	}
@@ -996,15 +995,15 @@ int logical_ring_flush_all_caches(struct drm_i915_gem_request *req)
 	return 0;
 }
 
-static int intel_lr_context_pin(struct intel_engine_cs *ring,
-		struct intel_context *ctx)
+static int intel_lr_context_pin(struct drm_i915_gem_request *rq)
 {
-	struct drm_i915_gem_object *ctx_obj = ctx->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf = ctx->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq->ring;
+	struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
+	struct intel_ringbuffer *ringbuf = rq->ringbuf;
 	int ret = 0;
 
 	WARN_ON(!mutex_is_locked(&ring->dev->struct_mutex));
-	if (ctx->engine[ring->id].pin_count++ == 0) {
+	if (rq->ctx->engine[ring->id].pin_count++ == 0) {
 		ret = i915_gem_obj_ggtt_pin(ctx_obj,
 				GEN8_LR_CONTEXT_ALIGN, 0);
 		if (ret)
@@ -1020,20 +1019,20 @@ static int intel_lr_context_pin(struct intel_engine_cs *ring,
 unpin_ctx_obj:
 	i915_gem_object_ggtt_unpin(ctx_obj);
 reset_pin_count:
-	ctx->engine[ring->id].pin_count = 0;
+	rq->ctx->engine[ring->id].pin_count = 0;
 
 	return ret;
 }
 
-void intel_lr_context_unpin(struct intel_engine_cs *ring,
-		struct intel_context *ctx)
+void intel_lr_context_unpin(struct drm_i915_gem_request *rq)
 {
-	struct drm_i915_gem_object *ctx_obj = ctx->engine[ring->id].state;
-	struct intel_ringbuffer *ringbuf = ctx->engine[ring->id].ringbuf;
+	struct intel_engine_cs *ring = rq->ring;
+	struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
+	struct intel_ringbuffer *ringbuf = rq->ringbuf;
 
 	if (ctx_obj) {
 		WARN_ON(!mutex_is_locked(&ring->dev->struct_mutex));
-		if (--ctx->engine[ring->id].pin_count == 0) {
+		if (--rq->ctx->engine[ring->id].pin_count == 0) {
 			intel_unpin_ringbuffer_obj(ringbuf);
 			i915_gem_object_ggtt_unpin(ctx_obj);
 		}
drivers/gpu/drm/i915/intel_lrc.h +1 -2
index f59940a..5c2baf2 100644
@@ -69,8 +69,7 @@ static inline void intel_logical_ring_emit(struct intel_ringbuffer *ringbuf,
 void intel_lr_context_free(struct intel_context *ctx);
 int intel_lr_context_deferred_create(struct intel_context *ctx,
 				     struct intel_engine_cs *ring);
-void intel_lr_context_unpin(struct intel_engine_cs *ring,
-		struct intel_context *ctx);
+void intel_lr_context_unpin(struct drm_i915_gem_request *req);
 void intel_lr_context_reset(struct drm_device *dev,
 			struct intel_context *ctx);
 
Signature · 6 lines
2.1.4

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

PATCH 5/7 drm/i915: Convert execlists_elsp_writ() for requests

In reply to Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
 drivers/gpu/drm/i915/intel_lrc.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +9 -11
index 36f8660..c3c029a 100644
@@ -292,12 +292,16 @@ static uint64_t execlists_ctx_descriptor(struct intel_engine_cs *ring,
 	return desc;
 }
 
-static void execlists_elsp_write(struct intel_engine_cs *ring,
-				 struct drm_i915_gem_object *ctx_obj0,
-				 struct drm_i915_gem_object *ctx_obj1)
+static void execlists_elsp_write(struct drm_i915_gem_request *rq0,
+				 struct drm_i915_gem_request *rq1)
 {
+
+	struct intel_engine_cs *ring = rq0->ring;
 	struct drm_device *dev = ring->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
+	struct drm_i915_gem_object *ctx_obj1 = rq1 ?
+		rq1->ctx->engine[ring->id].state : NULL;
 	uint64_t temp = 0;
 	uint32_t desc[4];
 
@@ -365,18 +369,12 @@ static int execlists_update_context(struct drm_i915_gem_request *rq)
 static void execlists_submit_requests(struct drm_i915_gem_request *rq0,
 				      struct drm_i915_gem_request *rq1)
 {
-	struct intel_engine_cs *ring = rq0->ring;
-	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
-	struct drm_i915_gem_object *ctx_obj1 = NULL;
-
 	execlists_update_context(rq0);
 
-	if (rq1) {
+	if (rq1)
 		execlists_update_context(rq1);
-		ctx_obj1 = rq1->ctx->engine[ring->id].state;
-	}
 
-	execlists_elsp_write(ring, ctx_obj0, ctx_obj1);
+	execlists_elsp_write(rq0, rq1);
 }
 
 static void execlists_context_unqueue(struct intel_engine_cs *ring)
Signature · 6 lines
2.1.4

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

PATCH 6/7 drm/i915: Convert execlists_ctx_descriptor() for requests

In reply to Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
 drivers/gpu/drm/i915/intel_lrc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +6 -8
index c3c029a..67ff460 100644
@@ -261,10 +261,11 @@ u32 intel_execlists_ctx_id(struct drm_i915_gem_object *ctx_obj)
 	return lrca >> 12;
 }
 
-static uint64_t execlists_ctx_descriptor(struct intel_engine_cs *ring,
-					 struct drm_i915_gem_object *ctx_obj)
+static uint64_t execlists_ctx_descriptor(struct drm_i915_gem_request *rq)
 {
+	struct intel_engine_cs *ring = rq->ring;
 	struct drm_device *dev = ring->dev;
+	struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
 	uint64_t desc;
 	uint64_t lrca = i915_gem_obj_ggtt_offset(ctx_obj);
 
@@ -299,21 +300,18 @@ static void execlists_elsp_write(struct drm_i915_gem_request *rq0,
 	struct intel_engine_cs *ring = rq0->ring;
 	struct drm_device *dev = ring->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
-	struct drm_i915_gem_object *ctx_obj1 = rq1 ?
-		rq1->ctx->engine[ring->id].state : NULL;
 	uint64_t temp = 0;
 	uint32_t desc[4];
 
 	/* XXX: You must always write both descriptors in the order below. */
-	if (ctx_obj1)
-		temp = execlists_ctx_descriptor(ring, ctx_obj1);
+	if (rq1)
+		temp = execlists_ctx_descriptor(rq1);
 	else
 		temp = 0;
 	desc[1] = (u32)(temp >> 32);
 	desc[0] = (u32)temp;
 
-	temp = execlists_ctx_descriptor(ring, ctx_obj0);
+	temp = execlists_ctx_descriptor(rq0);
 	desc[3] = (u32)(temp >> 32);
 	desc[2] = (u32)temp;
 
Signature · 6 lines
2.1.4

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

Re: [PATCH 6/7] drm/i915: Convert execlists_ctx_descriptor() for requests

Quoted 12 lines · Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
  drivers/gpu/drm/i915/intel_lrc.c | 14 ++++++--------
  1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index c3c029a..67ff460 100644

drivers/gpu/drm/i915/intel_lrc.c u32 intel_execlists_ctx_id(struct drm_i915_gem_object *ctx_obj) · line 265

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -2
@@ -261,10 +261,11 @@ u32 intel_execlists_ctx_id(struct drm_i915_gem_object *ctx_obj)
  	return lrca >> 12;
  }
 
-static uint64_t execlists_ctx_descriptor(struct intel_engine_cs *ring,
-					 struct drm_i915_gem_object *ctx_obj)
+static uint64_t execlists_ctx_descriptor(struct drm_i915_gem_request *rq)
  {

GuC patch series tries to utilize this function. However, changing from ring/context to request makes it unusable in the case where request is not needed (not available). This context descriptor has nothing to do with drm_i915_gem_request IMO. And it is waste of time to call it for each batch submission. This value is fixed when context is pinned. Maybe add a member ctx_desc into intel_context->engine; initialize the value within intel_lr_context_pin; then use it whenever needed.

Thanks,
Alex

Quoted 21 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -5
+	struct intel_engine_cs *ring = rq->ring;
  	struct drm_device *dev = ring->dev;
+	struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
  	uint64_t desc;
  	uint64_t lrca = i915_gem_obj_ggtt_offset(ctx_obj);
 
@@ -299,21 +300,18 @@ static void execlists_elsp_write(struct drm_i915_gem_request *rq0,
  	struct intel_engine_cs *ring = rq0->ring;
  	struct drm_device *dev = ring->dev;
  	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_i915_gem_object *ctx_obj0 = rq0->ctx->engine[ring->id].state;
-	struct drm_i915_gem_object *ctx_obj1 = rq1 ?
-		rq1->ctx->engine[ring->id].state : NULL;
  	uint64_t temp = 0;
  	uint32_t desc[4];
 
  	/* XXX: You must always write both descriptors in the order below. */
-	if (ctx_obj1)
-		temp = execlists_ctx_descriptor(ring, ctx_obj1);
+	if (rq1)
+		temp = execlists_ctx_descriptor(rq1);

drivers/gpu/drm/i915/intel_lrc.c static void execlists_elsp_write(struct drm_i915_gem_request *rq0, · line 317

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -1
  	else
  		temp = 0;
  	desc[1] = (u32)(temp >> 32);
  	desc[0] = (u32)temp;
 
-	temp = execlists_ctx_descriptor(ring, ctx_obj0);
+	temp = execlists_ctx_descriptor(rq0);
  	desc[3] = (u32)(temp >> 32);
  	desc[2] = (u32)temp;
 

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

#13 lore raw

Re: [PATCH 6/7] drm/i915: Convert execlists_ctx_descriptor() for requests

Quoted 31 lines · Yu Dai
Quoted 13 lines · Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
  drivers/gpu/drm/i915/intel_lrc.c | 14 ++++++--------
  1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index c3c029a..67ff460 100644

drivers/gpu/drm/i915/intel_lrc.c u32 intel_execlists_ctx_id(struct · line 266

Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -2
@@ -261,10 +261,11 @@ u32 intel_execlists_ctx_id(struct
 drm_i915_gem_object *ctx_obj)
      return lrca >> 12;
  }
-static uint64_t execlists_ctx_descriptor(struct intel_engine_cs *ring,
-                     struct drm_i915_gem_object *ctx_obj)
+static uint64_t execlists_ctx_descriptor(struct drm_i915_gem_request
 *rq)
  {

GuC patch series tries to utilize this function. However, changing from ring/context to request makes it unusable in the case where request is not needed (not available). This context descriptor has nothing to do with drm_i915_gem_request IMO. And it is waste of time to call it for each batch submission. This value is fixed when context is pinned. Maybe add a member ctx_desc into intel_context->engine; initialize the value within intel_lr_context_pin; then use it whenever needed.

Quoted 2 lines

Thanks,
Alex

Yes, I've effectively reversed this in the next GuC submission series, since we don't have a request during setup, and this function doesn't actually need one either; it's only being used as a handle for extracting the context and ring.

So in my version it will take an intel_context and a ring so it's up to the caller to extract those from the drm_i915_gem_request (rq->ctx) and (rq->ring) and pass them separately. Then the GuC can use it during setup as well as at runtime :)

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

#14 lore raw

Re: [PATCH 6/7] drm/i915: Convert execlists_ctx_descriptor() for requests

Quoted 40 lines · Dave Gordon
Quoted 31 lines · Yu Dai
Quoted 13 lines · Mika Kuoppala

Pass around requests to carry context deeper in callchain.

---
 drivers/gpu/drm/i915/intel_lrc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index c3c029a..67ff460 100644

drivers/gpu/drm/i915/intel_lrc.c u32 intel_execlists_ctx_id(struct · line 266

Quoted 8 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -2
@@ -261,10 +261,11 @@ u32 intel_execlists_ctx_id(struct
 drm_i915_gem_object *ctx_obj)
     return lrca >> 12;
 }
-static uint64_t execlists_ctx_descriptor(struct intel_engine_cs *ring,
-                     struct drm_i915_gem_object *ctx_obj)
+static uint64_t execlists_ctx_descriptor(struct drm_i915_gem_request
 *rq)
 {

GuC patch series tries to utilize this function. However, changing from ring/context to request makes it unusable in the case where request is not needed (not available). This context descriptor has nothing to do with drm_i915_gem_request IMO. And it is waste of time to call it for each batch submission. This value is fixed when context is pinned. Maybe add a member ctx_desc into intel_context->engine; initialize the value within intel_lr_context_pin; then use it whenever needed.

Quoted 2 lines

Thanks,
Alex

Yes, I've effectively reversed this in the next GuC submission series, since we don't have a request during setup, and this function doesn't actually need one either; it's only being used as a handle for extracting the context and ring.

Quoted 5 lines

So in my version it will take an intel_context and a ring so it's up to the caller to extract those from the drm_i915_gem_request (rq->ctx) and (rq->ring) and pass them separately. Then the GuC can use it during setup as well as at runtime :)

I admit I went one step too far on this one in the series. The bspec says the context ids created should be unique across all engines and all execlists. I was concerned that our lrca only setup and resubmission for pre-emption would break this rule. (and be the reason for skl hickups)

The bspec has a note about creating context id with ring/counter(seqno)/lrca combination. Thus the request -> descriptor creation.

I didn't post that patch as it didn't cure the skl hang. But it made debugging the context status queue easier as seqnos were part of context_id.

-Mika

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

#15 lore raw

PATCH 7/7 drm/i915: Mark elsps submitted when they are pushed to hw

In reply to Mika Kuoppala

Now when we have requests this deep on call chain, we can mark the elsp being submitted when it actually is. While we are it, remove unnecessary temp assignment as it is already initialized as zero.

---
 drivers/gpu/drm/i915/intel_lrc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +5 -7
index 67ff460..8bf4acb 100644
@@ -304,14 +304,16 @@ static void execlists_elsp_write(struct drm_i915_gem_request *rq0,
 	uint32_t desc[4];
 
 	/* XXX: You must always write both descriptors in the order below. */
-	if (rq1)
+	if (rq1) {
 		temp = execlists_ctx_descriptor(rq1);
-	else
-		temp = 0;
+		rq1->elsp_submitted++;
+	}
+
 	desc[1] = (u32)(temp >> 32);
 	desc[0] = (u32)temp;
 
 	temp = execlists_ctx_descriptor(rq0);
+	rq0->elsp_submitted++;
 	desc[3] = (u32)(temp >> 32);
 	desc[2] = (u32)temp;
 
@@ -433,10 +435,6 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
 	WARN_ON(req1 && req1->elsp_submitted);
 
 	execlists_submit_requests(req0, req1);
-
-	req0->elsp_submitted++;
-	if (req1)
-		req1->elsp_submitted++;
 }
 
 static bool execlists_check_remove_request(struct intel_engine_cs *ring,
Signature · 6 lines
2.1.4

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

Re: [PATCH 7/7] drm/i915: Mark elsps submitted when they are pushed to hw

Quoted 4 lines · Mika Kuoppala

Now when we have requests this deep on call chain, we can mark the elsp being submitted when it actually is. While we are it, remove unnecessary temp assignment as it is already initialized as zero.

Bah, which I think is bad practice (because when looking at patch contexts like this, you have no idea if that is true or not as you can't see the value). You could reduce the number of writes if you wanted to. Personally I went with

        uint32_t desc[4];

        if (ring->execlist_port[1]) {
                desc[0] = execlists_request_write_tail(ring,
                                                       ring->execlist_port[1]);
                desc[1] = ring->execlist_port[1]->seqno;
        } else
                desc[1] = desc[0] = 0;

        desc[2] = execlists_request_write_tail(ring, ring->execlist_port[0]);
        desc[3] = ring->execlist_port[0]->seqno;

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

PATCH 7/7 drm/i915: Mark elsps submitted when they are pushed to hw

Now when we have requests this deep on call chain, we can mark the elsp being submitted when it actually is. Remove temp variable and readjust commenting to more closely fit to the code.

v2: Avoid tmp variable and reduce number of writes (Chris)

---
 drivers/gpu/drm/i915/intel_lrc.c | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +15 -21
index 468f569..de35db6 100644
@@ -300,31 +300,29 @@ static void execlists_elsp_write(struct drm_i915_gem_request *rq0,
 	struct intel_engine_cs *ring = rq0->ring;
 	struct drm_device *dev = ring->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	uint64_t temp = 0;
-	uint32_t desc[4];
+	uint64_t desc[2];
 
-	/* XXX: You must always write both descriptors in the order below. */
-	if (rq1)
-		temp = execlists_ctx_descriptor(rq1);
-	else
-		temp = 0;
-	desc[1] = (u32)(temp >> 32);
-	desc[0] = (u32)temp;
+	if (rq1) {
+		desc[1] = execlists_ctx_descriptor(rq1);
+		rq1->elsp_submitted++;
+	} else {
+		desc[1] = 0;
+	}
 
-	temp = execlists_ctx_descriptor(rq0);
-	desc[3] = (u32)(temp >> 32);
-	desc[2] = (u32)temp;
+	desc[0] = execlists_ctx_descriptor(rq0);
+	rq0->elsp_submitted++;
 
+	/* You must always write both descriptors in the order below. */
 	spin_lock(&dev_priv->uncore.lock);
 	intel_uncore_forcewake_get__locked(dev_priv, FORCEWAKE_ALL);
-	I915_WRITE_FW(RING_ELSP(ring), desc[1]);
-	I915_WRITE_FW(RING_ELSP(ring), desc[0]);
-	I915_WRITE_FW(RING_ELSP(ring), desc[3]);
+	I915_WRITE_FW(RING_ELSP(ring), upper_32_bits(desc[1]));
+	I915_WRITE_FW(RING_ELSP(ring), lower_32_bits(desc[1]));
 
+	I915_WRITE_FW(RING_ELSP(ring), upper_32_bits(desc[0]));
 	/* The context is automatically loaded after the following */
-	I915_WRITE_FW(RING_ELSP(ring), desc[2]);
+	I915_WRITE_FW(RING_ELSP(ring), lower_32_bits(desc[0]));
 
-	/* ELSP is a wo register, so use another nearby reg for posting instead */
+	/* ELSP is a wo register, use another nearby reg for posting */
 	POSTING_READ_FW(RING_EXECLIST_STATUS(ring));
 	intel_uncore_forcewake_put__locked(dev_priv, FORCEWAKE_ALL);
 	spin_unlock(&dev_priv->uncore.lock);
@@ -433,10 +431,6 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)
 	WARN_ON(req1 && req1->elsp_submitted);
 
 	execlists_submit_requests(req0, req1);
-
-	req0->elsp_submitted++;
-	if (req1)
-		req1->elsp_submitted++;
 }
 
 static bool execlists_check_remove_request(struct intel_engine_cs *ring,
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 7/7
#18 lore raw

Re: [PATCH 7/7] drm/i915: Mark elsps submitted when they are pushed to hw

Quoted 8 lines · Mika Kuoppala

Now when we have requests this deep on call chain, we can mark the elsp being submitted when it actually is. Remove temp variable and readjust commenting to more closely fit to the code.

v2: Avoid tmp variable and reduce number of writes (Chris)

Looks cleaner to me,

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [PATCH 7/7] drm/i915: Mark elsps submitted when they are pushed to hw

Quoted 5 lines · Chris Wilson
Quoted 4 lines · Mika Kuoppala

Now when we have requests this deep on call chain, we can mark the elsp being submitted when it actually is. Remove temp variable and readjust commenting to more closely fit to the code.

Quoted 7 lines
Quoted 4 lines

v2: Avoid tmp variable and reduce number of writes (Chris)

Looks cleaner to me,

In fact, nothing in the series scared me and with the two minor changes, might as well apply that r-b to the whole series. For the benefit of others, can you repost the contracted series with my r-b applied? -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH 7/7] drm/i915: Mark elsps submitted when they are pushed to hw

Quoted 11 lines · Chris Wilson
Quoted 10 lines · Chris Wilson
Quoted 8 lines · Mika Kuoppala

Now when we have requests this deep on call chain, we can mark the elsp being submitted when it actually is. Remove temp variable and readjust commenting to more closely fit to the code.

v2: Avoid tmp variable and reduce number of writes (Chris)

Quoted 6 lines
Quoted 2 lines

Looks cleaner to me,

In fact, nothing in the series scared me and with the two minor changes, might as well apply that r-b to the whole series. For the benefit of others, can you repost the contracted series with my r-b applied?

Yeah maybe this was a bit too much splitting but I didn't find it too much so just went ahead and applied it all.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

PATCH 1/2 drm/i915: Convert execlist_submit_contexts() for requests

In reply to Chris Wilson

Make execlist_submit_context() accept requests instead of engine context objects, also renaming it to execlist_submit_requests() to better reflect the functionality. Keep passing requests as first class objects, all the way down to where elsps are written.

The benefits are that with requests, we can mold the request state where the actual hardware interactions happen. Author also expects more gains in debuggability and more leverage on context descriptor creation.

---
 drivers/gpu/drm/i915/i915_gem.c  |   8 ++-
 drivers/gpu/drm/i915/intel_lrc.c | 103 +++++++++++++++++----------------------
 drivers/gpu/drm/i915/intel_lrc.h |   3 +-
 3 files changed, 49 insertions(+), 65 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -5
index 49016e0..927964b 100644
@@ -2620,10 +2620,8 @@ void i915_gem_request_free(struct kref *req_ref)
 
 	if (ctx) {
 		if (i915.enable_execlists) {
-			struct intel_engine_cs *ring = req->ring;
-
-			if (ctx != ring->default_context)
-				intel_lr_context_unpin(ring, ctx);
+			if (ctx != req->ring->default_context)
+				intel_lr_context_unpin(req);
 		}
 
 		i915_gem_context_unreference(ctx);
@@ -2765,7 +2763,7 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
 		list_del(&submit_req->execlist_link);
 
 		if (submit_req->ctx != ring->default_context)
-			intel_lr_context_unpin(ring, submit_req->ctx);
+			intel_lr_context_unpin(submit_req);
 
 		i915_gem_request_unreference(submit_req);
 	}
drivers/gpu/drm/i915/intel_lrc.c +45 -58

210 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.h +1 -2
index d3dd3ac..e0299fb 100644
@@ -70,8 +70,7 @@ static inline void intel_logical_ring_emit(struct intel_ringbuffer *ringbuf,
 void intel_lr_context_free(struct intel_context *ctx);
 int intel_lr_context_deferred_create(struct intel_context *ctx,
 				     struct intel_engine_cs *ring);
-void intel_lr_context_unpin(struct intel_engine_cs *ring,
-		struct intel_context *ctx);
+void intel_lr_context_unpin(struct drm_i915_gem_request *req);
 void intel_lr_context_reset(struct drm_device *dev,
 			struct intel_context *ctx);
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 7/7
#22 lore raw

Re: [PATCH 7/7] drm/i915: Mark elsps submitted when they are pushed to hw

In reply to Mika Kuoppala

Task id: 6720 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  343/343              343/343

BYT -1 287/287 286/287
HSW 380/380 380/380
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*BYT igt@gem_partial_pwrite_pread@reads-uncached PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw
In reply to Mika Kuoppala
Quoted 7 lines · Mika Kuoppala

Hi,

Reader might think that I did this for only mark few elsps done deeper in callchain. But the reason is that I wanted to test more uniqueness guarantees for generation of context ids that is passed for hardware. And found out that the current code structure strips out all the request/context very early on.

It's a start. Most of the patches could be merged since they seem to be interrelated and not doing anything startling.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx