All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable
@ 2017-09-12 12:47 Michał Winiarski
  2017-09-12 12:47 ` [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests Michał Winiarski
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Michał Winiarski @ 2017-09-12 12:47 UTC (permalink / raw)
  To: intel-gfx

Originally removed in:
c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")

Were accidentaly restored in:
925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")

We can also remove unused variable and replace it with a WARN.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
 drivers/gpu/drm/i915/intel_uc.h            | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 48a1e9349a2c..8a550785b257 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -602,7 +602,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	struct intel_guc *guc = &rq->i915->guc;
 	struct i915_guc_client *client = guc->execbuf_client;
 	unsigned long flags;
-	int b_ret;
 
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
@@ -611,7 +610,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	spin_lock_irqsave(&client->wq_lock, flags);
 
 	guc_wq_item_append(client, rq);
-	b_ret = guc_ring_doorbell(client);
+	WARN_ON(guc_ring_doorbell(client));
 
 	client->submissions[engine_id] += 1;
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 22ae52b17b0f..69daf4c01cd0 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -59,10 +59,6 @@ struct drm_i915_gem_request;
  *                available in the work queue (note, the queue is shared,
  *                not per-engine). It is OK for this to be nonzero, but
  *                it should not be huge!
- *   b_fail: failed to ring the doorbell. This should never happen, unless
- *           somehow the hardware misbehaves, or maybe if the GuC firmware
- *           crashes? We probably need to reset the GPU to recover.
- *   retcode: errno from last guc_submit()
  */
 struct i915_guc_client {
 	struct i915_vma *vma;
-- 
2.13.5

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests
  2017-09-12 12:47 [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
@ 2017-09-12 12:47 ` Michał Winiarski
  2017-09-12 13:35   ` Chris Wilson
  2017-09-12 12:47 ` [PATCH 3/4] drm/i915/guc: Make adding GuC work items lockless Michał Winiarski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Michał Winiarski @ 2017-09-12 12:47 UTC (permalink / raw)
  To: intel-gfx

To create an upper bound on number of GuC workitems, we need to change
the way that requests are being submitted. Rather than submitting each
request as an individual workitem, we can do coalescing in a similar way
we're handlig execlist submission ports. We also need to stop pretending
that we're doing "lite-restore" in GuC submission (we would create a
workitem each time we hit this condition). This allows us to completely
remove the reservation, replacing it with a compile time check.

v2: Also coalesce when replaying on reset (Daniele)
v3: Consistent wq_resv - per-request (Daniele)
v4: Squash removing wq_resv

References: https://bugs.freedesktop.org/show_bug.cgi?id=101873
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Jeff McGee <jeff.mcgee@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c        |   2 -
 drivers/gpu/drm/i915/i915_guc_submission.c | 179 ++++++++++-------------------
 drivers/gpu/drm/i915/intel_lrc.c           |  25 +---
 drivers/gpu/drm/i915/intel_uc.h            |  11 --
 4 files changed, 62 insertions(+), 155 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 6338018f655d..f5fd00cfb3b0 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2450,8 +2450,6 @@ static void i915_guc_client_info(struct seq_file *m,
 	seq_printf(m, "\tWQ size %d, offset: 0x%x, tail %d\n",
 		client->wq_size, client->wq_offset, client->wq_tail);
 
-	seq_printf(m, "\tWork queue full: %u\n", client->no_wq_space);
-
 	for_each_engine(engine, dev_priv, id) {
 		u64 submissions = client->submissions[id];
 		tot += submissions;
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 8a550785b257..6f0adcd2a058 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -406,63 +406,6 @@ static void guc_stage_desc_fini(struct intel_guc *guc,
 	memset(desc, 0, sizeof(*desc));
 }
 
-/**
- * i915_guc_wq_reserve() - reserve space in the GuC's workqueue
- * @request:	request associated with the commands
- *
- * Return:	0 if space is available
- *		-EAGAIN if space is not currently available
- *
- * This function must be called (and must return 0) before a request
- * is submitted to the GuC via i915_guc_submit() below. Once a result
- * of 0 has been returned, it must be balanced by a corresponding
- * call to submit().
- *
- * Reservation allows the caller to determine in advance that space
- * will be available for the next submission before committing resources
- * to it, and helps avoid late failures with complicated recovery paths.
- */
-int i915_guc_wq_reserve(struct drm_i915_gem_request *request)
-{
-	const size_t wqi_size = sizeof(struct guc_wq_item);
-	struct i915_guc_client *client = request->i915->guc.execbuf_client;
-	struct guc_process_desc *desc = __get_process_desc(client);
-	u32 freespace;
-	int ret;
-
-	spin_lock_irq(&client->wq_lock);
-	freespace = CIRC_SPACE(client->wq_tail, desc->head, client->wq_size);
-	freespace -= client->wq_rsvd;
-	if (likely(freespace >= wqi_size)) {
-		client->wq_rsvd += wqi_size;
-		ret = 0;
-	} else {
-		client->no_wq_space++;
-		ret = -EAGAIN;
-	}
-	spin_unlock_irq(&client->wq_lock);
-
-	return ret;
-}
-
-static void guc_client_update_wq_rsvd(struct i915_guc_client *client, int size)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&client->wq_lock, flags);
-	client->wq_rsvd += size;
-	spin_unlock_irqrestore(&client->wq_lock, flags);
-}
-
-void i915_guc_wq_unreserve(struct drm_i915_gem_request *request)
-{
-	const int wqi_size = sizeof(struct guc_wq_item);
-	struct i915_guc_client *client = request->i915->guc.execbuf_client;
-
-	GEM_BUG_ON(READ_ONCE(client->wq_rsvd) < wqi_size);
-	guc_client_update_wq_rsvd(client, -wqi_size);
-}
-
 /* Construct a Work Item and append it to the GuC's Work Queue */
 static void guc_wq_item_append(struct i915_guc_client *client,
 			       struct drm_i915_gem_request *rq)
@@ -475,7 +418,7 @@ static void guc_wq_item_append(struct i915_guc_client *client,
 	struct guc_wq_item *wqi;
 	u32 freespace, tail, wq_off;
 
-	/* Free space is guaranteed, see i915_guc_wq_reserve() above */
+	/* Free space is guaranteed */
 	freespace = CIRC_SPACE(client->wq_tail, desc->head, client->wq_size);
 	GEM_BUG_ON(freespace < wqi_size);
 
@@ -491,14 +434,12 @@ static void guc_wq_item_append(struct i915_guc_client *client,
 	 * workqueue buffer dw by dw.
 	 */
 	BUILD_BUG_ON(wqi_size != 16);
-	GEM_BUG_ON(client->wq_rsvd < wqi_size);
 
 	/* postincrement WQ tail for next time */
 	wq_off = client->wq_tail;
 	GEM_BUG_ON(wq_off & (wqi_size - 1));
 	client->wq_tail += wqi_size;
 	client->wq_tail &= client->wq_size - 1;
-	client->wq_rsvd -= wqi_size;
 
 	/* WQ starts from the page after doorbell / process_desc */
 	wqi = client->vaddr + wq_off + GUC_DB_SIZE;
@@ -580,47 +521,43 @@ static int guc_ring_doorbell(struct i915_guc_client *client)
 }
 
 /**
- * __i915_guc_submit() - Submit commands through GuC
+ * i915_guc_submit() - Submit commands through GuC
  * @rq:		request associated with the commands
  *
- * The caller must have already called i915_guc_wq_reserve() above with
- * a result of 0 (success), guaranteeing that there is space in the work
- * queue for the new request, so enqueuing the item cannot fail.
- *
- * Bad Things Will Happen if the caller violates this protocol e.g. calls
- * submit() when _reserve() says there's no space, or calls _submit()
- * a different number of times from (successful) calls to _reserve().
- *
  * The only error here arises if the doorbell hardware isn't functioning
  * as expected, which really shouln't happen.
  */
-static void __i915_guc_submit(struct drm_i915_gem_request *rq)
+static void i915_guc_submit(struct intel_engine_cs *engine)
 {
-	struct drm_i915_private *dev_priv = rq->i915;
-	struct intel_engine_cs *engine = rq->engine;
-	unsigned int engine_id = engine->id;
-	struct intel_guc *guc = &rq->i915->guc;
+	struct drm_i915_private *dev_priv = engine->i915;
+	struct intel_guc *guc = &dev_priv->guc;
 	struct i915_guc_client *client = guc->execbuf_client;
+	struct execlist_port *port = engine->execlist_port;
+	unsigned int engine_id = engine->id;
+	unsigned int n;
 	unsigned long flags;
 
-	/* WA to flush out the pending GMADR writes to ring buffer. */
-	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
-		POSTING_READ_FW(GUC_STATUS);
+	for (n = 0; n < ARRAY_SIZE(engine->execlist_port); n++) {
+		struct drm_i915_gem_request *rq;
+		unsigned int count;
 
-	spin_lock_irqsave(&client->wq_lock, flags);
+		rq = port_unpack(&port[n], &count);
+		if (rq && count == 0) {
+			port_set(&port[n], port_pack(rq, ++count));
 
-	guc_wq_item_append(client, rq);
-	WARN_ON(guc_ring_doorbell(client));
+			if (i915_vma_is_map_and_fenceable(rq->ring->vma))
+				POSTING_READ_FW(GUC_STATUS);
 
-	client->submissions[engine_id] += 1;
+			spin_lock_irqsave(&client->wq_lock, flags);
 
-	spin_unlock_irqrestore(&client->wq_lock, flags);
-}
+			guc_wq_item_append(client, rq);
+			WARN_ON(guc_ring_doorbell(client));
 
-static void i915_guc_submit(struct drm_i915_gem_request *rq)
-{
-	__i915_gem_request_submit(rq);
-	__i915_guc_submit(rq);
+			client->submissions[engine_id] += 1;
+
+			spin_unlock_irqrestore(&client->wq_lock, flags);
+		}
+	}
 }
 
 static void nested_enable_signaling(struct drm_i915_gem_request *rq)
@@ -654,16 +591,19 @@ static void port_assign(struct execlist_port *port,
 	if (port_isset(port))
 		i915_gem_request_put(port_request(port));
 
-	port_set(port, i915_gem_request_get(rq));
+	port_set(port, port_pack(i915_gem_request_get(rq), port_count(port)));
 	nested_enable_signaling(rq);
 }
 
-static bool i915_guc_dequeue(struct intel_engine_cs *engine)
+static void i915_guc_dequeue(struct intel_engine_cs *engine)
 {
 	struct execlist_port *port = engine->execlist_port;
-	struct drm_i915_gem_request *last = port_request(port);
-	struct rb_node *rb;
+	struct drm_i915_gem_request *last = NULL;
 	bool submit = false;
+	struct rb_node *rb;
+
+	if (port_isset(port))
+		port++;
 
 	spin_lock_irq(&engine->timeline->lock);
 	rb = engine->execlist_first;
@@ -688,7 +628,7 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine)
 			INIT_LIST_HEAD(&rq->priotree.link);
 			rq->priotree.priority = INT_MAX;
 
-			i915_guc_submit(rq);
+			__i915_gem_request_submit(rq);
 			trace_i915_gem_request_in(rq, port_index(port, engine));
 			last = rq;
 			submit = true;
@@ -702,11 +642,11 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine)
 	}
 done:
 	engine->execlist_first = rb;
-	if (submit)
+	if (submit) {
 		port_assign(port, last);
+		i915_guc_submit(engine);
+	}
 	spin_unlock_irq(&engine->timeline->lock);
-
-	return submit;
 }
 
 static void i915_guc_irq_handler(unsigned long data)
@@ -714,24 +654,20 @@ static void i915_guc_irq_handler(unsigned long data)
 	struct intel_engine_cs *engine = (struct intel_engine_cs *)data;
 	struct execlist_port *port = engine->execlist_port;
 	struct drm_i915_gem_request *rq;
-	bool submit;
 
-	do {
-		rq = port_request(&port[0]);
-		while (rq && i915_gem_request_completed(rq)) {
-			trace_i915_gem_request_out(rq);
-			i915_gem_request_put(rq);
+	rq = port_request(&port[0]);
+	while (rq && i915_gem_request_completed(rq)) {
+		trace_i915_gem_request_out(rq);
+		i915_gem_request_put(rq);
 
-			port[0] = port[1];
-			memset(&port[1], 0, sizeof(port[1]));
+		port[0] = port[1];
+		memset(&port[1], 0, sizeof(port[1]));
 
-			rq = port_request(&port[0]);
-		}
+		rq = port_request(&port[0]);
+	}
 
-		submit = false;
-		if (!port_count(&port[1]))
-			submit = i915_guc_dequeue(engine);
-	} while (submit);
+	if (!port_isset(&port[1]))
+		i915_guc_dequeue(engine);
 }
 
 /*
@@ -1220,6 +1156,19 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
 	enum intel_engine_id id;
 	int err;
 
+	/*
+	 * We're using GuC work items for submitting work through GuC. Since
+	 * we're coalescing multiple requests from a single context into a
+	 * single work item prior to assigning it to execlist_port, we can
+	 * never have more work items than the total number of ports (for all
+	 * engines). The GuC firmware is controlling the HEAD of work queue,
+	 * and it is guaranteed that it will remove the work item from the
+	 * queue before our request is completed.
+	 */
+	BUILD_BUG_ON(ARRAY_SIZE(engine->execlist_port) *
+		     sizeof(struct guc_wq_item) *
+		     I915_NUM_ENGINES > GUC_WQ_SIZE);
+
 	if (!client) {
 		client = guc_client_alloc(dev_priv,
 					  INTEL_INFO(dev_priv)->ring_mask,
@@ -1247,9 +1196,6 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
 	guc_interrupts_capture(dev_priv);
 
 	for_each_engine(engine, dev_priv, id) {
-		const int wqi_size = sizeof(struct guc_wq_item);
-		struct drm_i915_gem_request *rq;
-
 		/* The tasklet was initialised by execlists, and may be in
 		 * a state of flux (across a reset) and so we just want to
 		 * take over the callback without changing any other state
@@ -1257,14 +1203,7 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
 		 */
 		engine->irq_tasklet.func = i915_guc_irq_handler;
 		clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted);
-
-		/* Replay the current set of previously submitted requests */
-		spin_lock_irq(&engine->timeline->lock);
-		list_for_each_entry(rq, &engine->timeline->requests, link) {
-			guc_client_update_wq_rsvd(client, wqi_size);
-			__i915_guc_submit(rq);
-		}
-		spin_unlock_irq(&engine->timeline->lock);
+		i915_guc_submit(engine);
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index d89e1b8e1cc5..5837b33f9705 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -914,27 +914,14 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request)
 	 */
 	request->reserved_space += EXECLISTS_REQUEST_SIZE;
 
-	if (i915.enable_guc_submission) {
-		/*
-		 * Check that the GuC has space for the request before
-		 * going any further, as the i915_add_request() call
-		 * later on mustn't fail ...
-		 */
-		ret = i915_guc_wq_reserve(request);
-		if (ret)
-			goto err;
-	}
-
 	cs = intel_ring_begin(request, 0);
-	if (IS_ERR(cs)) {
-		ret = PTR_ERR(cs);
-		goto err_unreserve;
-	}
+	if (IS_ERR(cs))
+		return PTR_ERR(cs);
 
 	if (!ce->initialised) {
 		ret = engine->init_context(request);
 		if (ret)
-			goto err_unreserve;
+			return ret;
 
 		ce->initialised = true;
 	}
@@ -948,12 +935,6 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request)
 
 	request->reserved_space -= EXECLISTS_REQUEST_SIZE;
 	return 0;
-
-err_unreserve:
-	if (i915.enable_guc_submission)
-		i915_guc_wq_unreserve(request);
-err:
-	return ret;
 }
 
 /*
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 69daf4c01cd0..d41051688221 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -52,13 +52,6 @@ struct drm_i915_gem_request;
  * GuC). The subsequent  pages of the client object constitute the work
  * queue (a circular array of work items), again described in the process
  * descriptor. Work queue pages are mapped momentarily as required.
- *
- * We also keep a few statistics on failures. Ideally, these should all
- * be zero!
- *   no_wq_space: times that the submission pre-check found no space was
- *                available in the work queue (note, the queue is shared,
- *                not per-engine). It is OK for this to be nonzero, but
- *                it should not be huge!
  */
 struct i915_guc_client {
 	struct i915_vma *vma;
@@ -79,8 +72,6 @@ struct i915_guc_client {
 	uint32_t wq_offset;
 	uint32_t wq_size;
 	uint32_t wq_tail;
-	uint32_t wq_rsvd;
-	uint32_t no_wq_space;
 
 	/* Per-engine counts of GuC submissions */
 	uint64_t submissions[I915_NUM_ENGINES];
@@ -246,8 +237,6 @@ u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
 /* i915_guc_submission.c */
 int i915_guc_submission_init(struct drm_i915_private *dev_priv);
 int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
-int i915_guc_wq_reserve(struct drm_i915_gem_request *rq);
-void i915_guc_wq_unreserve(struct drm_i915_gem_request *request);
 void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
 void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
 struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
-- 
2.13.5

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] drm/i915/guc: Make adding GuC work items lockless
  2017-09-12 12:47 [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
  2017-09-12 12:47 ` [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests Michał Winiarski
@ 2017-09-12 12:47 ` Michał Winiarski
  2017-09-12 13:40   ` Chris Wilson
  2017-09-12 12:47 ` [PATCH 4/4] HAX Enable GuC Submission for CI Michał Winiarski
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Michał Winiarski @ 2017-09-12 12:47 UTC (permalink / raw)
  To: intel-gfx

We can get rid of a spinlock by updating the tail directly using
cmpxchg. We can also put guc client on a diet by removing some constants
from the struct.
This causes a small change in one of GuC debugfs files.
We're no longer reporting constant values (which I don't think is a
problem), but we're also no longer reporting the tail (does anyone care?).

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Oscar Mateo <oscar.mateo@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c        |  2 --
 drivers/gpu/drm/i915/i915_guc_submission.c | 39 ++++++++++--------------------
 drivers/gpu/drm/i915/intel_uc.h            |  5 ----
 3 files changed, 13 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index f5fd00cfb3b0..e124e91aefcf 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2447,8 +2447,6 @@ static void i915_guc_client_info(struct seq_file *m,
 		client->priority, client->stage_id, client->proc_desc_offset);
 	seq_printf(m, "\tDoorbell id %d, offset: 0x%lx, cookie 0x%x\n",
 		client->doorbell_id, client->doorbell_offset, client->doorbell_cookie);
-	seq_printf(m, "\tWQ size %d, offset: 0x%x, tail %d\n",
-		client->wq_size, client->wq_offset, client->wq_tail);
 
 	for_each_engine(engine, dev_priv, id) {
 		u64 submissions = client->submissions[id];
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 6f0adcd2a058..3a8a77ae2af8 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -306,7 +306,7 @@ static void guc_proc_desc_init(struct intel_guc *guc,
 	desc->db_base_addr = 0;
 
 	desc->stage_id = client->stage_id;
-	desc->wq_size_bytes = client->wq_size;
+	desc->wq_size_bytes = GUC_WQ_SIZE;
 	desc->wq_status = WQ_STATUS_ACTIVE;
 	desc->priority = client->priority;
 }
@@ -391,8 +391,8 @@ static void guc_stage_desc_init(struct intel_guc *guc,
 	desc->db_trigger_cpu = (uintptr_t)__get_doorbell(client);
 	desc->db_trigger_uk = gfx_addr + client->doorbell_offset;
 	desc->process_desc = gfx_addr + client->proc_desc_offset;
-	desc->wq_addr = gfx_addr + client->wq_offset;
-	desc->wq_size = client->wq_size;
+	desc->wq_addr = gfx_addr + GUC_DB_SIZE;
+	desc->wq_size = GUC_WQ_SIZE;
 
 	desc->desc_private = (uintptr_t)client;
 }
@@ -416,15 +416,15 @@ static void guc_wq_item_append(struct i915_guc_client *client,
 	struct intel_engine_cs *engine = rq->engine;
 	struct guc_process_desc *desc = __get_process_desc(client);
 	struct guc_wq_item *wqi;
-	u32 freespace, tail, wq_off;
+	u32 freespace, ring_tail, wq_off, wq_next;
 
 	/* Free space is guaranteed */
-	freespace = CIRC_SPACE(client->wq_tail, desc->head, client->wq_size);
+	freespace = CIRC_SPACE(desc->tail, desc->head, GUC_WQ_SIZE);
 	GEM_BUG_ON(freespace < wqi_size);
 
 	/* The GuC firmware wants the tail index in QWords, not bytes */
-	tail = intel_ring_set_tail(rq->ring, rq->tail) >> 3;
-	GEM_BUG_ON(tail > WQ_RING_TAIL_MAX);
+	ring_tail = intel_ring_set_tail(rq->ring, rq->tail) >> 3;
+	GEM_BUG_ON(ring_tail > WQ_RING_TAIL_MAX);
 
 	/* For now workqueue item is 4 DWs; workqueue buffer is 2 pages. So we
 	 * should not have the case where structure wqi is across page, neither
@@ -435,11 +435,12 @@ static void guc_wq_item_append(struct i915_guc_client *client,
 	 */
 	BUILD_BUG_ON(wqi_size != 16);
 
-	/* postincrement WQ tail for next time */
-	wq_off = client->wq_tail;
+	/* Find our offset and postincrement WQ tail for next time */
+	do {
+		wq_off = desc->tail;
+		wq_next = (wq_off + wqi_size) & (GUC_WQ_SIZE - 1);
+	} while (cmpxchg(&desc->tail, wq_off, wq_next) != wq_off);
 	GEM_BUG_ON(wq_off & (wqi_size - 1));
-	client->wq_tail += wqi_size;
-	client->wq_tail &= client->wq_size - 1;
 
 	/* WQ starts from the page after doorbell / process_desc */
 	wqi = client->vaddr + wq_off + GUC_DB_SIZE;
@@ -453,7 +454,7 @@ static void guc_wq_item_append(struct i915_guc_client *client,
 	/* The GuC wants only the low-order word of the context descriptor */
 	wqi->context_desc = (u32)intel_lr_context_descriptor(rq->ctx, engine);
 
-	wqi->submit_element_info = tail << WQ_RING_TAIL_SHIFT;
+	wqi->submit_element_info = ring_tail << WQ_RING_TAIL_SHIFT;
 	wqi->fence_id = rq->global_seqno;
 }
 
@@ -463,20 +464,14 @@ static void guc_reset_wq(struct i915_guc_client *client)
 
 	desc->head = 0;
 	desc->tail = 0;
-
-	client->wq_tail = 0;
 }
 
 static int guc_ring_doorbell(struct i915_guc_client *client)
 {
-	struct guc_process_desc *desc = __get_process_desc(client);
 	union guc_doorbell_qw db_cmp, db_exc, db_ret;
 	union guc_doorbell_qw *db;
 	int attempt = 2, ret = -EAGAIN;
 
-	/* Update the tail so it is visible to GuC */
-	desc->tail = client->wq_tail;
-
 	/* current cookie */
 	db_cmp.db_status = GUC_DOORBELL_ENABLED;
 	db_cmp.cookie = client->doorbell_cookie;
@@ -535,7 +530,6 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
 	struct execlist_port *port = engine->execlist_port;
 	unsigned int engine_id = engine->id;
 	unsigned int n;
-	unsigned long flags;
 
 	for (n = 0; n < ARRAY_SIZE(engine->execlist_port); n++) {
 		struct drm_i915_gem_request *rq;
@@ -548,14 +542,10 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
 			if (i915_vma_is_map_and_fenceable(rq->ring->vma))
 				POSTING_READ_FW(GUC_STATUS);
 
-			spin_lock_irqsave(&client->wq_lock, flags);
-
 			guc_wq_item_append(client, rq);
 			WARN_ON(guc_ring_doorbell(client));
 
 			client->submissions[engine_id] += 1;
-
-			spin_unlock_irqrestore(&client->wq_lock, flags);
 		}
 	}
 }
@@ -848,9 +838,6 @@ guc_client_alloc(struct drm_i915_private *dev_priv,
 	client->engines = engines;
 	client->priority = priority;
 	client->doorbell_id = GUC_DOORBELL_INVALID;
-	client->wq_offset = GUC_DB_SIZE;
-	client->wq_size = GUC_WQ_SIZE;
-	spin_lock_init(&client->wq_lock);
 
 	ret = ida_simple_get(&guc->stage_ids, 0, GUC_MAX_STAGE_DESCRIPTORS,
 				GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index d41051688221..851b4f173781 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -68,11 +68,6 @@ struct i915_guc_client {
 	unsigned long doorbell_offset;
 	u32 doorbell_cookie;
 
-	spinlock_t wq_lock;
-	uint32_t wq_offset;
-	uint32_t wq_size;
-	uint32_t wq_tail;
-
 	/* Per-engine counts of GuC submissions */
 	uint64_t submissions[I915_NUM_ENGINES];
 };
-- 
2.13.5

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] HAX Enable GuC Submission for CI
  2017-09-12 12:47 [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
  2017-09-12 12:47 ` [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests Michał Winiarski
  2017-09-12 12:47 ` [PATCH 3/4] drm/i915/guc: Make adding GuC work items lockless Michał Winiarski
@ 2017-09-12 12:47 ` Michał Winiarski
  2017-09-12 13:12   ` Chris Wilson
  2017-09-12 13:22   ` [PATCH v2 " Michał Winiarski
  2017-09-12 14:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/guc: Remove obsolete comments and remove unused variable (rev2) Patchwork
  2017-09-12 14:17 ` [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Chris Wilson
  4 siblings, 2 replies; 13+ messages in thread
From: Michał Winiarski @ 2017-09-12 12:47 UTC (permalink / raw)
  To: intel-gfx

---
 drivers/gpu/drm/i915/i915_params.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 8ab003dca113..c9d72f1b8383 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -56,8 +56,8 @@ struct i915_params i915 __read_mostly = {
 	.verbose_state_checks = 1,
 	.nuclear_pageflip = 0,
 	.edp_vswing = 0,
-	.enable_guc_loading = 0,
-	.enable_guc_submission = 0,
+	.enable_guc_loading = 2,
+	.enable_guc_submission = 2,
 	.guc_log_level = -1,
 	.guc_firmware_path = NULL,
 	.huc_firmware_path = NULL,
-- 
2.13.5

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] HAX Enable GuC Submission for CI
  2017-09-12 12:47 ` [PATCH 4/4] HAX Enable GuC Submission for CI Michał Winiarski
@ 2017-09-12 13:12   ` Chris Wilson
  2017-09-12 13:22   ` [PATCH v2 " Michał Winiarski
  1 sibling, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2017-09-12 13:12 UTC (permalink / raw)
  To: Michał Winiarski, intel-gfx

Preface with a revert of 04f7b24eccdfae680a36e9825fe0d61dcd5ed528
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 4/4] HAX Enable GuC Submission for CI
  2017-09-12 12:47 ` [PATCH 4/4] HAX Enable GuC Submission for CI Michał Winiarski
  2017-09-12 13:12   ` Chris Wilson
@ 2017-09-12 13:22   ` Michał Winiarski
  1 sibling, 0 replies; 13+ messages in thread
From: Michał Winiarski @ 2017-09-12 13:22 UTC (permalink / raw)
  To: intel-gfx

Also:
Revert "drm/i915/guc: Assert that we switch between known ggtt->invalidate functions"

This reverts commit 04f7b24eccdfae680a36e9825fe0d61dcd5ed528.
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++------
 drivers/gpu/drm/i915/i915_params.c  | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 09e524dbc090..478a8d42aeb0 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3189,17 +3189,13 @@ int i915_ggtt_enable_hw(struct drm_i915_private *dev_priv)
 
 void i915_ggtt_enable_guc(struct drm_i915_private *i915)
 {
-	GEM_BUG_ON(i915->ggtt.invalidate != gen6_ggtt_invalidate);
-
 	i915->ggtt.invalidate = guc_ggtt_invalidate;
 }
 
 void i915_ggtt_disable_guc(struct drm_i915_private *i915)
 {
-	/* We should only be called after i915_ggtt_enable_guc() */
-	GEM_BUG_ON(i915->ggtt.invalidate != guc_ggtt_invalidate);
-
-	i915->ggtt.invalidate = gen6_ggtt_invalidate;
+	if (i915->ggtt.invalidate == guc_ggtt_invalidate)
+		i915->ggtt.invalidate = gen6_ggtt_invalidate;
 }
 
 void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 8ab003dca113..c9d72f1b8383 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -56,8 +56,8 @@ struct i915_params i915 __read_mostly = {
 	.verbose_state_checks = 1,
 	.nuclear_pageflip = 0,
 	.edp_vswing = 0,
-	.enable_guc_loading = 0,
-	.enable_guc_submission = 0,
+	.enable_guc_loading = 2,
+	.enable_guc_submission = 2,
 	.guc_log_level = -1,
 	.guc_firmware_path = NULL,
 	.huc_firmware_path = NULL,
-- 
2.13.5

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests
  2017-09-12 12:47 ` [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests Michał Winiarski
@ 2017-09-12 13:35   ` Chris Wilson
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2017-09-12 13:35 UTC (permalink / raw)
  To: Michał Winiarski, intel-gfx

Quoting Michał Winiarski (2017-09-12 13:47:24)
> To create an upper bound on number of GuC workitems, we need to change
> the way that requests are being submitted. Rather than submitting each
> request as an individual workitem, we can do coalescing in a similar way
> we're handlig execlist submission ports. We also need to stop pretending
> that we're doing "lite-restore" in GuC submission (we would create a
> workitem each time we hit this condition). This allows us to completely
> remove the reservation, replacing it with a compile time check.
> 
> v2: Also coalesce when replaying on reset (Daniele)
> v3: Consistent wq_resv - per-request (Daniele)
> v4: Squash removing wq_resv
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=101873
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Jeff McGee <jeff.mcgee@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Oscar Mateo <oscar.mateo@intel.com>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>

Matches my expectations,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Just pondering the interaction with gen8_cs_irq_handler(). Since we are
now tweaking port_count(), it is theoretically possible that we get a
cs-interrupt. That seems entirely harmless as the guc tasklet checks the
breadcrumb anyway. Just something to keep in the back of the mind when
reviewing the interactions between execlist.port[] and guc.

But I'm wondering if we should be masking the cs-interrupt on switching
to guc... I don't believe we are in gen9_enable_guc_interrupts().
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/4] drm/i915/guc: Make adding GuC work items lockless
  2017-09-12 12:47 ` [PATCH 3/4] drm/i915/guc: Make adding GuC work items lockless Michał Winiarski
@ 2017-09-12 13:40   ` Chris Wilson
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2017-09-12 13:40 UTC (permalink / raw)
  To: Michał Winiarski, intel-gfx

Quoting Michał Winiarski (2017-09-12 13:47:25)
> @@ -416,15 +416,15 @@ static void guc_wq_item_append(struct i915_guc_client *client,
>         struct intel_engine_cs *engine = rq->engine;
>         struct guc_process_desc *desc = __get_process_desc(client);
>         struct guc_wq_item *wqi;
> -       u32 freespace, tail, wq_off;
> +       u32 freespace, ring_tail, wq_off, wq_next;
>  
>         /* Free space is guaranteed */
> -       freespace = CIRC_SPACE(client->wq_tail, desc->head, client->wq_size);
> +       freespace = CIRC_SPACE(desc->tail, desc->head, GUC_WQ_SIZE);
>         GEM_BUG_ON(freespace < wqi_size);

Fwiw, I would move this to the cmpxchg loop.

GEM_BUG_ON(CIRC_SPACE(wq_off, READ_ONCE(desc->head), GUC_WQ_SIZE) < wqi_size);
>  
>         /* The GuC firmware wants the tail index in QWords, not bytes */
> -       tail = intel_ring_set_tail(rq->ring, rq->tail) >> 3;
> -       GEM_BUG_ON(tail > WQ_RING_TAIL_MAX);
> +       ring_tail = intel_ring_set_tail(rq->ring, rq->tail) >> 3;
> +       GEM_BUG_ON(ring_tail > WQ_RING_TAIL_MAX);
>  
>         /* For now workqueue item is 4 DWs; workqueue buffer is 2 pages. So we
>          * should not have the case where structure wqi is across page, neither
> @@ -435,11 +435,12 @@ static void guc_wq_item_append(struct i915_guc_client *client,
>          */
>         BUILD_BUG_ON(wqi_size != 16);
>  
> -       /* postincrement WQ tail for next time */
> -       wq_off = client->wq_tail;
> +       /* Find our offset and postincrement WQ tail for next time */
> +       do {
> +               wq_off = desc->tail;

wq_off = READ_ONCE(desc->tail);

> +               wq_next = (wq_off + wqi_size) & (GUC_WQ_SIZE - 1);
> +       } while (cmpxchg(&desc->tail, wq_off, wq_next) != wq_off);
>         GEM_BUG_ON(wq_off & (wqi_size - 1));
> -       client->wq_tail += wqi_size;
> -       client->wq_tail &= client->wq_size - 1;
>  
>         /* WQ starts from the page after doorbell / process_desc */
>         wqi = client->vaddr + wq_off + GUC_DB_SIZE;
> @@ -453,7 +454,7 @@ static void guc_wq_item_append(struct i915_guc_client *client,
>         /* The GuC wants only the low-order word of the context descriptor */
>         wqi->context_desc = (u32)intel_lr_context_descriptor(rq->ctx, engine);
>  
> -       wqi->submit_element_info = tail << WQ_RING_TAIL_SHIFT;
> +       wqi->submit_element_info = ring_tail << WQ_RING_TAIL_SHIFT;
>         wqi->fence_id = rq->global_seqno;
>  }
>  
> @@ -463,20 +464,14 @@ static void guc_reset_wq(struct i915_guc_client *client)
>  
>         desc->head = 0;
>         desc->tail = 0;
> -
> -       client->wq_tail = 0;
>  }
>  
>  static int guc_ring_doorbell(struct i915_guc_client *client)
>  {
> -       struct guc_process_desc *desc = __get_process_desc(client);
>         union guc_doorbell_qw db_cmp, db_exc, db_ret;
>         union guc_doorbell_qw *db;
>         int attempt = 2, ret = -EAGAIN;
>  
> -       /* Update the tail so it is visible to GuC */
> -       desc->tail = client->wq_tail;
> -
>         /* current cookie */
>         db_cmp.db_status = GUC_DOORBELL_ENABLED;
>         db_cmp.cookie = client->doorbell_cookie;
> @@ -535,7 +530,6 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
>         struct execlist_port *port = engine->execlist_port;
>         unsigned int engine_id = engine->id;
>         unsigned int n;
> -       unsigned long flags;
>  
>         for (n = 0; n < ARRAY_SIZE(engine->execlist_port); n++) {
>                 struct drm_i915_gem_request *rq;
> @@ -548,14 +542,10 @@ static void i915_guc_submit(struct intel_engine_cs *engine)
>                         if (i915_vma_is_map_and_fenceable(rq->ring->vma))
>                                 POSTING_READ_FW(GUC_STATUS);
>  
> -                       spin_lock_irqsave(&client->wq_lock, flags);
> -
>                         guc_wq_item_append(client, rq);
>                         WARN_ON(guc_ring_doorbell(client));
>  
>                         client->submissions[engine_id] += 1;

Per-engine, so this is actually serialized by the tasklet. Hmm, double
accounting after reset. But do I care? I consider it to be pointless
since we are counting at the wrong boundary.

I think we need the READ_ONCE to be clear to both the compiler and
ourselves that we are reading transient values shared with the guc. But
since that's the only issue I could see,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/guc: Remove obsolete comments and remove unused variable (rev2)
  2017-09-12 12:47 [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
                   ` (2 preceding siblings ...)
  2017-09-12 12:47 ` [PATCH 4/4] HAX Enable GuC Submission for CI Michał Winiarski
@ 2017-09-12 14:08 ` Patchwork
  2017-09-12 14:17 ` [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Chris Wilson
  4 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-09-12 14:08 UTC (permalink / raw)
  To: Michał Winiarski; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/guc: Remove obsolete comments and remove unused variable (rev2)
URL   : https://patchwork.freedesktop.org/series/30199/
State : failure

== Summary ==

Series 30199v2 series starting with [1/4] drm/i915/guc: Remove obsolete comments and remove unused variable
https://patchwork.freedesktop.org/api/1.0/series/30199/revisions/2/mbox/

Test chamelium:
        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514
Test debugfs_test:
        Subgroup read_all_entries:
                pass       -> SKIP       (fi-glk-2a)
Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> SKIP       (fi-glk-2a)
Test gem_busy:
        Subgroup basic-busy-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-hang-default:
                pass       -> SKIP       (fi-glk-2a)
Test gem_close_race:
        Subgroup basic-process:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-threads:
                pass       -> SKIP       (fi-glk-2a)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-2a)
Test gem_cs_tlb:
        Subgroup basic-default:
                pass       -> SKIP       (fi-glk-2a)
Test gem_ctx_create:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-files:
                pass       -> SKIP       (fi-glk-2a)
Test gem_ctx_exec:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-2a)
Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-default-heavy:
                pass       -> SKIP       (fi-glk-2a)
Test gem_exec_basic:
        Subgroup basic-blt:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-bsd:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-render:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-vebox:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup gtt-blt:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup gtt-bsd:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup gtt-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup gtt-render:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup gtt-vebox:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup readonly-blt:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup readonly-bsd:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup readonly-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup readonly-render:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup readonly-vebox:
                pass       -> SKIP       (fi-glk-2a)
Test gem_exec_create:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-2a)
Test gem_exec_fence:
        Subgroup basic-busy-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-wait-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-await-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup await-hang-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup nb-await-default:
                pass       -> SKIP       (fi-glk-2a)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-batch-kernel-default-wb:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-uc-pro-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-uc-prw-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-uc-ro-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-uc-rw-default:
                pass       -> SKIP       (fi-glk-2a)
        Subgroup basic-uc-set-default:
WARNING: Long output truncated

694f07d3df18c02da3f526ae0e1238eb12534e1e drm-tip: 2017y-09m-12d-09h-59m-00s UTC integration manifest
b8cba3de8452 HAX Enable GuC Submission for CI
faf07cd7d70a drm/i915/guc: Make adding GuC work items lockless
93e580d6a2ef drm/i915/guc: Submit GuC workitems containing coalesced requests
9c7c17d89787 drm/i915/guc: Remove obsolete comments and remove unused variable

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5658/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable
  2017-09-12 12:47 [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
                   ` (3 preceding siblings ...)
  2017-09-12 14:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/guc: Remove obsolete comments and remove unused variable (rev2) Patchwork
@ 2017-09-12 14:17 ` Chris Wilson
  2017-09-12 14:21   ` Chris Wilson
  4 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2017-09-12 14:17 UTC (permalink / raw)
  To: Michał Winiarski, intel-gfx

Quoting Michał Winiarski (2017-09-12 13:47:23)
> Originally removed in:
> c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
> f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")
> 
> Were accidentaly restored in:
> 925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")
> 
> We can also remove unused variable and replace it with a WARN.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
>  drivers/gpu/drm/i915/intel_uc.h            | 4 ----
>  2 files changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> index 48a1e9349a2c..8a550785b257 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -602,7 +602,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
>         struct intel_guc *guc = &rq->i915->guc;
>         struct i915_guc_client *client = guc->execbuf_client;
>         unsigned long flags;
> -       int b_ret;
>  
>         /* WA to flush out the pending GMADR writes to ring buffer. */
>         if (i915_vma_is_map_and_fenceable(rq->ring->vma))
> @@ -611,7 +610,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
>         spin_lock_irqsave(&client->wq_lock, flags);
>  
>         guc_wq_item_append(client, rq);
> -       b_ret = guc_ring_doorbell(client);
> +       WARN_ON(guc_ring_doorbell(client));

Hmm:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5658/fi-skl-6700k/igt@gem_exec_parallel@basic.html

Ok, time to dig.
-Chris
>  
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable
  2017-09-12 14:17 ` [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Chris Wilson
@ 2017-09-12 14:21   ` Chris Wilson
  2017-09-12 14:32     ` Chris Wilson
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2017-09-12 14:21 UTC (permalink / raw)
  To: Michał Winiarski, intel-gfx

Quoting Chris Wilson (2017-09-12 15:17:56)
> Quoting Michał Winiarski (2017-09-12 13:47:23)
> > Originally removed in:
> > c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
> > f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")
> > 
> > Were accidentaly restored in:
> > 925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")
> > 
> > We can also remove unused variable and replace it with a WARN.
> > 
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
> >  drivers/gpu/drm/i915/intel_uc.h            | 4 ----
> >  2 files changed, 1 insertion(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> > index 48a1e9349a2c..8a550785b257 100644
> > --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> > +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> > @@ -602,7 +602,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
> >         struct intel_guc *guc = &rq->i915->guc;
> >         struct i915_guc_client *client = guc->execbuf_client;
> >         unsigned long flags;
> > -       int b_ret;
> >  
> >         /* WA to flush out the pending GMADR writes to ring buffer. */
> >         if (i915_vma_is_map_and_fenceable(rq->ring->vma))
> > @@ -611,7 +610,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
> >         spin_lock_irqsave(&client->wq_lock, flags);
> >  
> >         guc_wq_item_append(client, rq);
> > -       b_ret = guc_ring_doorbell(client);
> > +       WARN_ON(guc_ring_doorbell(client));
> 
> Hmm:
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5658/fi-skl-6700k/igt@gem_exec_parallel@basic.html
> 
> Ok, time to dig.

Actually that's a compliment to your lockless implementation. We have
multiple threads competing to ring the doorbell. So one more patch
required...
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable
  2017-09-12 14:21   ` Chris Wilson
@ 2017-09-12 14:32     ` Chris Wilson
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2017-09-12 14:32 UTC (permalink / raw)
  To: Michał Winiarski, intel-gfx

Quoting Chris Wilson (2017-09-12 15:21:06)
> Quoting Chris Wilson (2017-09-12 15:17:56)
> > Quoting Michał Winiarski (2017-09-12 13:47:23)
> > > Originally removed in:
> > > c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
> > > f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")
> > > 
> > > Were accidentaly restored in:
> > > 925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")
> > > 
> > > We can also remove unused variable and replace it with a WARN.
> > > 
> > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > >  drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
> > >  drivers/gpu/drm/i915/intel_uc.h            | 4 ----
> > >  2 files changed, 1 insertion(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> > > index 48a1e9349a2c..8a550785b257 100644
> > > --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> > > +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> > > @@ -602,7 +602,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
> > >         struct intel_guc *guc = &rq->i915->guc;
> > >         struct i915_guc_client *client = guc->execbuf_client;
> > >         unsigned long flags;
> > > -       int b_ret;
> > >  
> > >         /* WA to flush out the pending GMADR writes to ring buffer. */
> > >         if (i915_vma_is_map_and_fenceable(rq->ring->vma))
> > > @@ -611,7 +610,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
> > >         spin_lock_irqsave(&client->wq_lock, flags);
> > >  
> > >         guc_wq_item_append(client, rq);
> > > -       b_ret = guc_ring_doorbell(client);
> > > +       WARN_ON(guc_ring_doorbell(client));
> > 
> > Hmm:
> > https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5658/fi-skl-6700k/igt@gem_exec_parallel@basic.html
> > 
> > Ok, time to dig.
> 
> Actually that's a compliment to your lockless implementation. We have
> multiple threads competing to ring the doorbell. So one more patch
> required...

I suggest another cmpxchg loop:

static void guc_ring_doorbell(struct i915_guc_client *client)
{
        struct guc_doorbell_info *db = __get_doorbell(client);
        u32 cookie;

        do {
                cookie = READ_ONCE(db->cookie);
        } while (cmpxchg(&db->cookie, cookie, cookie + 1) != cookie);
        GEM_BUG_ON(db->db_status != GUC_DOORBELL_ENABLED);
}

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable
@ 2017-09-13 11:06 Chris Wilson
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Wilson @ 2017-09-13 11:06 UTC (permalink / raw)
  To: intel-gfx

From: Michał Winiarski <michal.winiarski@intel.com>

Originally removed in:
c1adab970348 ("drm/i915/guc: Remove failed doorbell stat from debugfs")
f1448a62a103 ("drm/i915/guc: Remove last submission result from debugfs")

Were accidentaly restored in:
925344ccc91d ("BackMerge tag 'v4.12-rc5' into drm-next")

We can also remove unused variable and replace it with a WARN.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20170912124726.19689-1-michal.winiarski@intel.com
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 3 +--
 drivers/gpu/drm/i915/intel_uc.h            | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index 5c81d5f2353d..9828c77910b1 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -601,7 +601,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	struct intel_guc *guc = &rq->i915->guc;
 	struct i915_guc_client *client = guc->execbuf_client;
 	unsigned long flags;
-	int b_ret;
 
 	/* WA to flush out the pending GMADR writes to ring buffer. */
 	if (i915_vma_is_map_and_fenceable(rq->ring->vma))
@@ -610,7 +609,7 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
 	spin_lock_irqsave(&client->wq_lock, flags);
 
 	guc_wq_item_append(client, rq);
-	b_ret = guc_ring_doorbell(client);
+	WARN_ON(guc_ring_doorbell(client));
 
 	client->submissions[engine_id] += 1;
 
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 22ae52b17b0f..69daf4c01cd0 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -59,10 +59,6 @@ struct drm_i915_gem_request;
  *                available in the work queue (note, the queue is shared,
  *                not per-engine). It is OK for this to be nonzero, but
  *                it should not be huge!
- *   b_fail: failed to ring the doorbell. This should never happen, unless
- *           somehow the hardware misbehaves, or maybe if the GuC firmware
- *           crashes? We probably need to reset the GPU to recover.
- *   retcode: errno from last guc_submit()
  */
 struct i915_guc_client {
 	struct i915_vma *vma;
-- 
2.14.1

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-09-13 11:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 12:47 [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Michał Winiarski
2017-09-12 12:47 ` [PATCH 2/4] drm/i915/guc: Submit GuC workitems containing coalesced requests Michał Winiarski
2017-09-12 13:35   ` Chris Wilson
2017-09-12 12:47 ` [PATCH 3/4] drm/i915/guc: Make adding GuC work items lockless Michał Winiarski
2017-09-12 13:40   ` Chris Wilson
2017-09-12 12:47 ` [PATCH 4/4] HAX Enable GuC Submission for CI Michał Winiarski
2017-09-12 13:12   ` Chris Wilson
2017-09-12 13:22   ` [PATCH v2 " Michał Winiarski
2017-09-12 14:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915/guc: Remove obsolete comments and remove unused variable (rev2) Patchwork
2017-09-12 14:17 ` [PATCH 1/4] drm/i915/guc: Remove obsolete comments and remove unused variable Chris Wilson
2017-09-12 14:21   ` Chris Wilson
2017-09-12 14:32     ` Chris Wilson
2017-09-13 11:06 Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.