Skip to contentSkip to conversation

drm/i915/execlists: Tweak virtual unsubmission

PATCH In review Chris Wilson 4 participants 11 messages Oct 13, 2019 – Oct 14, 2019

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

PATCH 1/1 drm/i915/execlists: Tweak virtual unsubmission

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
 drivers/gpu/drm/i915/i915_request.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +3 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 	list_for_each_entry_safe_reverse(rq, rn,
 					 &engine->active.requests,
 					 sched.link) {
-		struct intel_engine_cs *owner;
 
 		if (i915_request_completed(rq))
 			continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 		 * engine so that it can be moved across onto another physical
 		 * engine as load dictates.
 		 */
-		owner = rq->hw_context->engine;
-		if (likely(owner == engine)) {
+		if (likely(rq->execution_mask == engine->mask)) {
 			GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
 			if (rq_prio(rq) != prio) {
 				prio = rq_prio(rq);
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 			list_move(&rq->sched.link, pl);
 			active = rq;
 		} else {
+			struct intel_engine_cs *owner = rq->hw_context->engine;
+
 			/*
 			 * Decouple the virtual breadcrumb before moving it
 			 * back to the virtual engine -- we don't want the
drivers/gpu/drm/i915/i915_request.c +1 -1
index 437f9fc6282e..b8a54572a4f8 100644
@@ -649,6 +649,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
 	rq->gem_context = ce->gem_context;
 	rq->engine = ce->engine;
 	rq->ring = ce->ring;
+	rq->execution_mask = ce->engine->mask;
 
 	rcu_assign_pointer(rq->timeline, tl);
 	rq->hwsp_seqno = tl->hwsp_seqno;
@@ -671,7 +672,6 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
 	rq->batch = NULL;
 	rq->capture_list = NULL;
 	rq->flags = 0;
-	rq->execution_mask = ALL_ENGINES;
 
 	INIT_LIST_HEAD(&rq->execute_cb);
 
Signature · 6 lines
2.23.0

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

✗ Fi.CI.CHECKPATCH: warning for drm/i915/execlists: Tweak virtual unsubmission

== Series Details ==

== Series Details ==

Series: drm/i915/execlists: Tweak virtual unsubmission
URL : https://patchwork.freedesktop.org/series/67958/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
3b2b0acd537f drm/i915/execlists: Tweak virtual unsubmission
-:14: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#14: 
References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

-:14: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")' #14:
References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

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

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Chris Wilson
Quoted 9 lines · Chris Wilson

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Chris,

Based on what i understood here, change looks good to me.

If it helps, please use

Quoted 65 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
 drivers/gpu/drm/i915/i915_request.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +3 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 	list_for_each_entry_safe_reverse(rq, rn,
 					 &engine->active.requests,
 					 sched.link) {
-		struct intel_engine_cs *owner;
 
 		if (i915_request_completed(rq))
 			continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 		 * engine so that it can be moved across onto another physical
 		 * engine as load dictates.
 		 */
-		owner = rq->hw_context->engine;
-		if (likely(owner == engine)) {
+		if (likely(rq->execution_mask == engine->mask)) {
 			GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
 			if (rq_prio(rq) != prio) {
 				prio = rq_prio(rq);
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
 			list_move(&rq->sched.link, pl);
 			active = rq;
 		} else {
+			struct intel_engine_cs *owner = rq->hw_context->engine;
+
 			/*
 			 * Decouple the virtual breadcrumb before moving it
 			 * back to the virtual engine -- we don't want the
drivers/gpu/drm/i915/i915_request.c +1 -1
index 437f9fc6282e..b8a54572a4f8 100644
@@ -649,6 +649,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
 	rq->gem_context = ce->gem_context;
 	rq->engine = ce->engine;
 	rq->ring = ce->ring;
+	rq->execution_mask = ce->engine->mask;
 
 	rcu_assign_pointer(rq->timeline, tl);
 	rq->hwsp_seqno = tl->hwsp_seqno;
@@ -671,7 +672,6 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
 	rq->batch = NULL;
 	rq->capture_list = NULL;
 	rq->flags = 0;
-	rq->execution_mask = ALL_ENGINES;
 
 	INIT_LIST_HEAD(&rq->execute_cb);
 
Signature · 6 lines
2.23.0

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

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

#3 lore raw

Quoting Ramalingam C (2019-10-14 10:28:18)

Quoted 9 lines · Chris Wilson
Quoted 8 lines

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

Quoted 7 lines
Quoted 1 line

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Chris,

Based on what i understood here, change looks good to me.

If it helps, please use

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

#4 lore raw
In reply to Chris Wilson
Quoted 39 lines · Chris Wilson

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
  drivers/gpu/drm/i915/i915_request.c | 2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
  	list_for_each_entry_safe_reverse(rq, rn,
  					 &engine->active.requests,
  					 sched.link) {
-		struct intel_engine_cs *owner;
 
  		if (i915_request_completed(rq))
  			continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
  		 * engine so that it can be moved across onto another physical
  		 * engine as load dictates.
  		 */
-		owner = rq->hw_context->engine;
-		if (likely(owner == engine)) {
+		if (likely(rq->execution_mask == engine->mask)) {
  			GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
  			if (rq_prio(rq) != prio) {
  				prio = rq_prio(rq);

drivers/gpu/drm/i915/gt/intel_lrc.c __unwind_incomplete_requests(struct intel_engine_cs *engine) · line 923

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
  			list_move(&rq->sched.link, pl);
  			active = rq;
  		} else {
+			struct intel_engine_cs *owner = rq->hw_context->engine;

I guess there is some benefit in doing fewer operations as long as we are fixing the engine anyway (at the moment at least).

However on this branch here the concern was request completion racing with preemption handling and with this change the breadcrumb will not get canceled any longer and may get signaled on the virtual engine. Which then leads to the explosion this branch fixed. At least that's what I remembered in combination with the comment below..

Regards,

Tvrtko

Quoted 18 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
+
  			/*
  			 * Decouple the virtual breadcrumb before moving it
  			 * back to the virtual engine -- we don't want the
drivers/gpu/drm/i915/i915_request.c +1 -0
index 437f9fc6282e..b8a54572a4f8 100644
@@ -649,6 +649,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
  	rq->gem_context = ce->gem_context;
  	rq->engine = ce->engine;
  	rq->ring = ce->ring;
+	rq->execution_mask = ce->engine->mask;
 
  	rcu_assign_pointer(rq->timeline, tl);
  	rq->hwsp_seqno = tl->hwsp_seqno;

drivers/gpu/drm/i915/i915_request.c __i915_request_create(struct intel_context *ce, gfp_t gfp) · line 677

Quoted 7 lines
drivers/gpu/drm/i915/i915_request.c +0 -1
@@ -671,7 +672,6 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
  	rq->batch = NULL;
  	rq->capture_list = NULL;
  	rq->flags = 0;
-	rq->execution_mask = ALL_ENGINES;
 
  	INIT_LIST_HEAD(&rq->execute_cb);
 

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

#5 lore raw

Quoting Tvrtko Ursulin (2019-10-14 10:34:31)

Quoted 49 lines · Chris Wilson
Quoted 39 lines

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
  drivers/gpu/drm/i915/i915_request.c | 2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
      list_for_each_entry_safe_reverse(rq, rn,
                                       &engine->active.requests,
                                       sched.link) {
-             struct intel_engine_cs *owner;
 
              if (i915_request_completed(rq))
                      continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
               * engine so that it can be moved across onto another physical
               * engine as load dictates.
               */
-             owner = rq->hw_context->engine;
-             if (likely(owner == engine)) {
+             if (likely(rq->execution_mask == engine->mask)) {
                      GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
                      if (rq_prio(rq) != prio) {
                              prio = rq_prio(rq);

drivers/gpu/drm/i915/gt/intel_lrc.c __unwind_incomplete_requests(struct intel_engine_cs *engine) · line 923

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                      list_move(&rq->sched.link, pl);
                      active = rq;
              } else {
+                     struct intel_engine_cs *owner = rq->hw_context->engine;

I guess there is some benefit in doing fewer operations as long as we are fixing the engine anyway (at the moment at least).

Quoted 5 lines

However on this branch here the concern was request completion racing with preemption handling and with this change the breadcrumb will not get canceled any longer and may get signaled on the virtual engine. Which then leads to the explosion this branch fixed. At least that's what I remembered in combination with the comment below..

No, we don't change back to the virtual engine, so that is not an issue. The problem was only because of the rq->engine = owner where the breadcrumbs were still on the previous engine lists and assumed to be under that engine->breadcrumbs.lock (but would in future be assumed to be under rq->engine->breadcrumbs.lock).
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 56 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-10-14 10:34:31)

Quoted 49 lines · Chris Wilson
Quoted 39 lines

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
   drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
   drivers/gpu/drm/i915/i915_request.c | 2 +-
   2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
       list_for_each_entry_safe_reverse(rq, rn,
                                        &engine->active.requests,
                                        sched.link) {
-             struct intel_engine_cs *owner;
 
               if (i915_request_completed(rq))
                       continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                * engine so that it can be moved across onto another physical
                * engine as load dictates.
                */
-             owner = rq->hw_context->engine;
-             if (likely(owner == engine)) {
+             if (likely(rq->execution_mask == engine->mask)) {
                       GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
                       if (rq_prio(rq) != prio) {
                               prio = rq_prio(rq);

drivers/gpu/drm/i915/gt/intel_lrc.c __unwind_incomplete_requests(struct intel_engine_cs *engine) · line 923

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                       list_move(&rq->sched.link, pl);
                       active = rq;
               } else {
+                     struct intel_engine_cs *owner = rq->hw_context->engine;

I guess there is some benefit in doing fewer operations as long as we are fixing the engine anyway (at the moment at least).

Quoted 5 lines

However on this branch here the concern was request completion racing with preemption handling and with this change the breadcrumb will not get canceled any longer and may get signaled on the virtual engine. Which then leads to the explosion this branch fixed. At least that's what I remembered in combination with the comment below..

Quoted 5 lines

No, we don't change back to the virtual engine, so that is not an issue. The problem was only because of the rq->engine = owner where the breadcrumbs were still on the previous engine lists and assumed to be under that engine->breadcrumbs.lock (but would in future be assumed to be under rq->engine->breadcrumbs.lock).

Breadcrumb signaling can only be set up on the physical engine? Hm, must be fine since without preemption that would be the scenario exactly. Okay, I see there is r-b from Ram already so no need for another one.

Regards,

Tvrtko

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

#7 lore raw

Quoting Tvrtko Ursulin (2019-10-14 10:50:25)

Quoted 64 lines · Chris Wilson
Quoted 56 lines

Quoting Tvrtko Ursulin (2019-10-14 10:34:31)

Quoted 49 lines · Chris Wilson
Quoted 39 lines

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
   drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
   drivers/gpu/drm/i915/i915_request.c | 2 +-
   2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
       list_for_each_entry_safe_reverse(rq, rn,
                                        &engine->active.requests,
                                        sched.link) {
-             struct intel_engine_cs *owner;
 
               if (i915_request_completed(rq))
                       continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                * engine so that it can be moved across onto another physical
                * engine as load dictates.
                */
-             owner = rq->hw_context->engine;
-             if (likely(owner == engine)) {
+             if (likely(rq->execution_mask == engine->mask)) {
                       GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
                       if (rq_prio(rq) != prio) {
                               prio = rq_prio(rq);

drivers/gpu/drm/i915/gt/intel_lrc.c __unwind_incomplete_requests(struct intel_engine_cs *engine) · line 923

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                       list_move(&rq->sched.link, pl);
                       active = rq;
               } else {
+                     struct intel_engine_cs *owner = rq->hw_context->engine;

I guess there is some benefit in doing fewer operations as long as we are fixing the engine anyway (at the moment at least).

Quoted 5 lines

However on this branch here the concern was request completion racing with preemption handling and with this change the breadcrumb will not get canceled any longer and may get signaled on the virtual engine. Which then leads to the explosion this branch fixed. At least that's what I remembered in combination with the comment below..

Quoted 5 lines

No, we don't change back to the virtual engine, so that is not an issue. The problem was only because of the rq->engine = owner where the breadcrumbs were still on the previous engine lists and assumed to be under that engine->breadcrumbs.lock (but would in future be assumed to be under rq->engine->breadcrumbs.lock).

Quoted 3 lines

Breadcrumb signaling can only be set up on the physical engine? Hm, must be fine since without preemption that would be the scenario exactly. Okay, I see there is r-b from Ram already so no need for another one.

With no disrespect to Ram, as the expert you raised a technical point that I would be happier to record as resolved with an r-b from yourself. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#8 lore raw
Quoted 65 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-10-14 10:50:25)

Quoted 64 lines · Chris Wilson
Quoted 61 lines

Quoting Tvrtko Ursulin (2019-10-14 10:34:31)

Quoted 49 lines · Chris Wilson
Quoted 39 lines

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
    drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
    drivers/gpu/drm/i915/i915_request.c | 2 +-
    2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
        list_for_each_entry_safe_reverse(rq, rn,
                                         &engine->active.requests,
                                         sched.link) {
-             struct intel_engine_cs *owner;
 
                if (i915_request_completed(rq))
                        continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                 * engine so that it can be moved across onto another physical
                 * engine as load dictates.
                 */
-             owner = rq->hw_context->engine;
-             if (likely(owner == engine)) {
+             if (likely(rq->execution_mask == engine->mask)) {
                        GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
                        if (rq_prio(rq) != prio) {
                                prio = rq_prio(rq);

drivers/gpu/drm/i915/gt/intel_lrc.c __unwind_incomplete_requests(struct intel_engine_cs *engine) · line 923

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                        list_move(&rq->sched.link, pl);
                        active = rq;
                } else {
+                     struct intel_engine_cs *owner = rq->hw_context->engine;

I guess there is some benefit in doing fewer operations as long as we are fixing the engine anyway (at the moment at least).

Quoted 5 lines

However on this branch here the concern was request completion racing with preemption handling and with this change the breadcrumb will not get canceled any longer and may get signaled on the virtual engine. Which then leads to the explosion this branch fixed. At least that's what I remembered in combination with the comment below..

No, we don't change back to the virtual engine, so that is not an issue. The problem was only because of the rq->engine = owner where the breadcrumbs were still on the previous engine lists and assumed to be under that engine->breadcrumbs.lock (but would in future be assumed to be under rq->engine->breadcrumbs.lock).

Quoted 6 lines
Quoted 3 lines

Breadcrumb signaling can only be set up on the physical engine? Hm, must be fine since without preemption that would be the scenario exactly. Okay, I see there is r-b from Ram already so no need for another one.

With no disrespect to Ram, as the expert you raised a technical point that I would be happier to record as resolved with an r-b from yourself.

I went back to the patch I reviewed in July and it checks out.

Regards,

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

#9 lore raw
In reply to Tvrtko Ursulin

Quoting Tvrtko Ursulin (2019-10-14 10:34:31)

Quoted 40 lines · Chris Wilson
Quoted 38 lines

Since commit e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption") we have restricted requests to run on their chosen engine across preemption events. We can take this restriction into account to know that we will want to resubmit those requests onto the same physical engine, and so can shortcircuit the virtual engine selection process and keep the request on the same engine during unwind.

References: e2144503bf3b ("drm/i915: Prevent bonded requests from overtaking each other on preemption")

Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/gt/intel_lrc.c | 6 +++---
  drivers/gpu/drm/i915/i915_request.c | 2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -3
index e6bf633b48d5..03732e3f5ec7 100644
@@ -895,7 +895,6 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
      list_for_each_entry_safe_reverse(rq, rn,
                                       &engine->active.requests,
                                       sched.link) {
-             struct intel_engine_cs *owner;
 
              if (i915_request_completed(rq))
                      continue; /* XXX */
@@ -910,8 +909,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
               * engine so that it can be moved across onto another physical
               * engine as load dictates.
               */
-             owner = rq->hw_context->engine;
-             if (likely(owner == engine)) {
+             if (likely(rq->execution_mask == engine->mask)) {
                      GEM_BUG_ON(rq_prio(rq) == I915_PRIORITY_INVALID);
                      if (rq_prio(rq) != prio) {
                              prio = rq_prio(rq);
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_lrc.c __unwind_incomplete_requests(struct intel_engine_cs *engine) · line 923

Quoted 5 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +1 -0
@@ -922,6 +920,8 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
                      list_move(&rq->sched.link, pl);
                      active = rq;
              } else {
+                     struct intel_engine_cs *owner = rq->hw_context->engine;

I guess there is some benefit in doing fewer operations as long as we are fixing the engine anyway (at the moment at least).

It also added a bit of consistency to how we detect virtual engine during i915_request construction (e.g. __i915_request_add_to_timeline), I liked that.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

✗ Fi.CI.BUILD: failure for drm/i915/execlists: Tweak virtual unsubmission

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915/execlists: Tweak virtual unsubmission
URL : https://patchwork.freedesktop.org/series/67958/
State : failure

== Summary ==

Applying: drm/i915/execlists: Tweak virtual unsubmission
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/gt/intel_lrc.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 drm/i915/execlists: Tweak virtual unsubmission When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

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