diff mbox

drm/i915: add schedule out notification of completed request during unwind

Message ID 1518052679-8845-1-git-send-email-weinan.z.li@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li, Weinan Z Feb. 8, 2018, 1:17 a.m. UTC
There is one corner case missing schedule out notification for GVT-g in
__unwind_incomplete_requests, it may cause vgpu no response. Add
notification when ensure one request has been completed during doing
unwind.

Signed-off-by: Weinan Li <weinan.z.li@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 63 ++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 31 deletions(-)

Comments

Chris Wilson Feb. 8, 2018, 7:36 a.m. UTC | #1
Quoting Weinan Li (2018-02-08 01:17:59)
> There is one corner case missing schedule out notification for GVT-g in
> __unwind_incomplete_requests, it may cause vgpu no response. Add
> notification when ensure one request has been completed during doing
> unwind.

You never get the schedule-in for those, only ELSP.
-Chris
Li, Weinan Z Feb. 8, 2018, 8:23 a.m. UTC | #2
-----Original Message-----
From: Chris Wilson [mailto:chris@chris-wilson.co.uk] 

Sent: Thursday, February 8, 2018 3:37 PM
To: Li, Weinan Z <weinan.z.li@intel.com>; intel-gfx@lists.freedesktop.org
Cc: intel-gvt-dev@lists.freedesktop.org; Li, Weinan Z <weinan.z.li@intel.com>; Zhenyu Wang <zhenyuw@linux.intel.com>
Subject: Re: [PATCH] drm/i915: add schedule out notification of completed request during unwind

Quoting Weinan Li (2018-02-08 01:17:59)
> There is one corner case missing schedule out notification for GVT-g 

> in __unwind_incomplete_requests, it may cause vgpu no response. Add 

> notification when ensure one request has been completed during doing 

> unwind.


You never get the schedule-in for those, only ELSP.
-Chris

@@ -285,9 +314,10 @@ static void __unwind_incomplete_requests(struct intel_engine_cs *engine)
 	list_for_each_entry_safe_reverse(rq, rn,
 					 &engine->timeline->requests,
 					 link) {
-		if (i915_gem_request_completed(rq))
+		if (i915_gem_request_completed(rq)) {
Thanks Chris, Do you mean it won't run to here, I am not sure but I indeed found notification missing in GVT-g with linux guest.
+			execlists_context_schedule_out(rq);
 			return;
-
+		}
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index deeedfc..5b937d3 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -274,6 +274,35 @@  static void unwind_wa_tail(struct drm_i915_gem_request *rq)
 	assert_ring_tail_valid(rq->ring, rq->tail);
 }
 
+static inline void
+execlists_context_status_change(struct drm_i915_gem_request *rq,
+				unsigned long status)
+{
+	/*
+	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
+	 * The compiler should eliminate this function as dead-code.
+	 */
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+		return;
+
+	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
+				   status, rq);
+}
+
+static inline void
+execlists_context_schedule_in(struct drm_i915_gem_request *rq)
+{
+	execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
+	intel_engine_context_in(rq->engine);
+}
+
+static inline void
+execlists_context_schedule_out(struct drm_i915_gem_request *rq)
+{
+	intel_engine_context_out(rq->engine);
+	execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
+}
+
 static void __unwind_incomplete_requests(struct intel_engine_cs *engine)
 {
 	struct drm_i915_gem_request *rq, *rn;
@@ -285,9 +314,10 @@  static void __unwind_incomplete_requests(struct intel_engine_cs *engine)
 	list_for_each_entry_safe_reverse(rq, rn,
 					 &engine->timeline->requests,
 					 link) {
-		if (i915_gem_request_completed(rq))
+		if (i915_gem_request_completed(rq)) {
+			execlists_context_schedule_out(rq);
 			return;
-
+		}
 		__i915_gem_request_unsubmit(rq);
 		unwind_wa_tail(rq);
 
@@ -316,35 +346,6 @@  static void __unwind_incomplete_requests(struct intel_engine_cs *engine)
 	spin_unlock_irq(&engine->timeline->lock);
 }
 
-static inline void
-execlists_context_status_change(struct drm_i915_gem_request *rq,
-				unsigned long status)
-{
-	/*
-	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
-	 * The compiler should eliminate this function as dead-code.
-	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
-		return;
-
-	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
-				   status, rq);
-}
-
-static inline void
-execlists_context_schedule_in(struct drm_i915_gem_request *rq)
-{
-	execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
-	intel_engine_context_in(rq->engine);
-}
-
-static inline void
-execlists_context_schedule_out(struct drm_i915_gem_request *rq)
-{
-	intel_engine_context_out(rq->engine);
-	execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
-}
-
 static void
 execlists_update_context_pdps(struct i915_hw_ppgtt *ppgtt, u32 *reg_state)
 {