All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 11:25 ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2019-11-25 11:25 UTC (permalink / raw)
  To: intel-gfx

I rushed a last minute correction to cancel_port_requests() to prevent
the snooping of *execlists->active as the inflight array was being
updated, without noticing we iterated the inflight array starting from
active! Oops.

Fixes: 331bf9059157 ("drm/i915/gt: Mark the execlists->active as the primary volatile access")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index e533ff7ba334..6090357a00fa 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -2007,19 +2007,17 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 static void
 cancel_port_requests(struct intel_engine_execlists * const execlists)
 {
-	struct i915_request * const *port, *rq;
+	struct i915_request * const *port;
 
-	for (port = execlists->pending; (rq = *port); port++)
-		execlists_schedule_out(rq);
+	for (port = execlists->pending; *port; port++)
+		execlists_schedule_out(*port);
 	memset(execlists->pending, 0, sizeof(execlists->pending));
 
 	/* Mark the end of active before we overwrite *active */
-	WRITE_ONCE(execlists->active, execlists->pending);
-
-	for (port = execlists->active; (rq = *port); port++)
-		execlists_schedule_out(rq);
-	execlists->active =
-		memset(execlists->inflight, 0, sizeof(execlists->inflight));
+	for (port = xchg(&execlists->active, execlists->pending); *port; port++)
+		execlists_schedule_out(*port);
+	WRITE_ONCE(execlists->active,
+		   memset(execlists->inflight, 0, sizeof(execlists->inflight)));
 }
 
 static inline void
-- 
2.24.0

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

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

* [Intel-gfx] [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 11:25 ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2019-11-25 11:25 UTC (permalink / raw)
  To: intel-gfx

I rushed a last minute correction to cancel_port_requests() to prevent
the snooping of *execlists->active as the inflight array was being
updated, without noticing we iterated the inflight array starting from
active! Oops.

Fixes: 331bf9059157 ("drm/i915/gt: Mark the execlists->active as the primary volatile access")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index e533ff7ba334..6090357a00fa 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -2007,19 +2007,17 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
 static void
 cancel_port_requests(struct intel_engine_execlists * const execlists)
 {
-	struct i915_request * const *port, *rq;
+	struct i915_request * const *port;
 
-	for (port = execlists->pending; (rq = *port); port++)
-		execlists_schedule_out(rq);
+	for (port = execlists->pending; *port; port++)
+		execlists_schedule_out(*port);
 	memset(execlists->pending, 0, sizeof(execlists->pending));
 
 	/* Mark the end of active before we overwrite *active */
-	WRITE_ONCE(execlists->active, execlists->pending);
-
-	for (port = execlists->active; (rq = *port); port++)
-		execlists_schedule_out(rq);
-	execlists->active =
-		memset(execlists->inflight, 0, sizeof(execlists->inflight));
+	for (port = xchg(&execlists->active, execlists->pending); *port; port++)
+		execlists_schedule_out(*port);
+	WRITE_ONCE(execlists->active,
+		   memset(execlists->inflight, 0, sizeof(execlists->inflight)));
 }
 
 static inline void
-- 
2.24.0

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

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

* Re: [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 13:07   ` Tvrtko Ursulin
  0 siblings, 0 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2019-11-25 13:07 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx


On 25/11/2019 11:25, Chris Wilson wrote:
> I rushed a last minute correction to cancel_port_requests() to prevent
> the snooping of *execlists->active as the inflight array was being
> updated, without noticing we iterated the inflight array starting from
> active! Oops.
> 
> Fixes: 331bf9059157 ("drm/i915/gt: Mark the execlists->active as the primary volatile access")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_lrc.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index e533ff7ba334..6090357a00fa 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -2007,19 +2007,17 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>   static void
>   cancel_port_requests(struct intel_engine_execlists * const execlists)
>   {
> -	struct i915_request * const *port, *rq;
> +	struct i915_request * const *port;
>   
> -	for (port = execlists->pending; (rq = *port); port++)
> -		execlists_schedule_out(rq);
> +	for (port = execlists->pending; *port; port++)
> +		execlists_schedule_out(*port);
>   	memset(execlists->pending, 0, sizeof(execlists->pending));
>   
>   	/* Mark the end of active before we overwrite *active */
> -	WRITE_ONCE(execlists->active, execlists->pending);
> -
> -	for (port = execlists->active; (rq = *port); port++)
> -		execlists_schedule_out(rq);
> -	execlists->active =
> -		memset(execlists->inflight, 0, sizeof(execlists->inflight));
> +	for (port = xchg(&execlists->active, execlists->pending); *port; port++)
> +		execlists_schedule_out(*port);
> +	WRITE_ONCE(execlists->active,
> +		   memset(execlists->inflight, 0, sizeof(execlists->inflight)));
>   }
>   
>   static inline void
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

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

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

* Re: [Intel-gfx] [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 13:07   ` Tvrtko Ursulin
  0 siblings, 0 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2019-11-25 13:07 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx


On 25/11/2019 11:25, Chris Wilson wrote:
> I rushed a last minute correction to cancel_port_requests() to prevent
> the snooping of *execlists->active as the inflight array was being
> updated, without noticing we iterated the inflight array starting from
> active! Oops.
> 
> Fixes: 331bf9059157 ("drm/i915/gt: Mark the execlists->active as the primary volatile access")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_lrc.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index e533ff7ba334..6090357a00fa 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -2007,19 +2007,17 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>   static void
>   cancel_port_requests(struct intel_engine_execlists * const execlists)
>   {
> -	struct i915_request * const *port, *rq;
> +	struct i915_request * const *port;
>   
> -	for (port = execlists->pending; (rq = *port); port++)
> -		execlists_schedule_out(rq);
> +	for (port = execlists->pending; *port; port++)
> +		execlists_schedule_out(*port);
>   	memset(execlists->pending, 0, sizeof(execlists->pending));
>   
>   	/* Mark the end of active before we overwrite *active */
> -	WRITE_ONCE(execlists->active, execlists->pending);
> -
> -	for (port = execlists->active; (rq = *port); port++)
> -		execlists_schedule_out(rq);
> -	execlists->active =
> -		memset(execlists->inflight, 0, sizeof(execlists->inflight));
> +	for (port = xchg(&execlists->active, execlists->pending); *port; port++)
> +		execlists_schedule_out(*port);
> +	WRITE_ONCE(execlists->active,
> +		   memset(execlists->inflight, 0, sizeof(execlists->inflight)));
>   }
>   
>   static inline void
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

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

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

* Re: [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 13:13   ` Andi Shyti
  0 siblings, 0 replies; 8+ messages in thread
From: Andi Shyti @ 2019-11-25 13:13 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

Hi Chris,

>  	/* Mark the end of active before we overwrite *active */
> -	WRITE_ONCE(execlists->active, execlists->pending);
> -
> -	for (port = execlists->active; (rq = *port); port++)
> -		execlists_schedule_out(rq);
> -	execlists->active =
> -		memset(execlists->inflight, 0, sizeof(execlists->inflight));
> +	for (port = xchg(&execlists->active, execlists->pending); *port; port++)
> +		execlists_schedule_out(*port);
> +	WRITE_ONCE(execlists->active,
> +		   memset(execlists->inflight, 0, sizeof(execlists->inflight)));

Reviewed-by: Andi Shyti <andi.shyti@intel.com>

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

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

* Re: [Intel-gfx] [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 13:13   ` Andi Shyti
  0 siblings, 0 replies; 8+ messages in thread
From: Andi Shyti @ 2019-11-25 13:13 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

Hi Chris,

>  	/* Mark the end of active before we overwrite *active */
> -	WRITE_ONCE(execlists->active, execlists->pending);
> -
> -	for (port = execlists->active; (rq = *port); port++)
> -		execlists_schedule_out(rq);
> -	execlists->active =
> -		memset(execlists->inflight, 0, sizeof(execlists->inflight));
> +	for (port = xchg(&execlists->active, execlists->pending); *port; port++)
> +		execlists_schedule_out(*port);
> +	WRITE_ONCE(execlists->active,
> +		   memset(execlists->inflight, 0, sizeof(execlists->inflight)));

Reviewed-by: Andi Shyti <andi.shyti@intel.com>

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

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

* ✗ Fi.CI.BAT: failure for drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 14:34   ` Patchwork
  0 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2019-11-25 14:34 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/execlists: Fixup cancel_port_requests()
URL   : https://patchwork.freedesktop.org/series/69978/
State : failure

== Summary ==

Applying: drm/i915/execlists: Fixup cancel_port_requests()
Using index info to reconstruct a base tree...
M	drivers/gpu/drm/i915/gt/intel_lrc.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/intel_lrc.c
No changes -- Patch already applied.

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

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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/execlists: Fixup cancel_port_requests()
@ 2019-11-25 14:34   ` Patchwork
  0 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2019-11-25 14:34 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/execlists: Fixup cancel_port_requests()
URL   : https://patchwork.freedesktop.org/series/69978/
State : failure

== Summary ==

Applying: drm/i915/execlists: Fixup cancel_port_requests()
Using index info to reconstruct a base tree...
M	drivers/gpu/drm/i915/gt/intel_lrc.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/intel_lrc.c
No changes -- Patch already applied.

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

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

end of thread, other threads:[~2019-11-25 14:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 11:25 [PATCH] drm/i915/execlists: Fixup cancel_port_requests() Chris Wilson
2019-11-25 11:25 ` [Intel-gfx] " Chris Wilson
2019-11-25 13:07 ` Tvrtko Ursulin
2019-11-25 13:07   ` [Intel-gfx] " Tvrtko Ursulin
2019-11-25 13:13 ` Andi Shyti
2019-11-25 13:13   ` [Intel-gfx] " Andi Shyti
2019-11-25 14:34 ` ✗ Fi.CI.BAT: failure for " Patchwork
2019-11-25 14:34   ` [Intel-gfx] " Patchwork

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.