From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
Date: Mon, 25 Nov 2019 13:07:32 +0000 [thread overview]
Message-ID: <9b9d0b30-16e6-ad91-74de-023d445e3c42@linux.intel.com> (raw)
In-Reply-To: <20191125112520.1760492-1-chris@chris-wilson.co.uk>
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
WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/execlists: Fixup cancel_port_requests()
Date: Mon, 25 Nov 2019 13:07:32 +0000 [thread overview]
Message-ID: <9b9d0b30-16e6-ad91-74de-023d445e3c42@linux.intel.com> (raw)
Message-ID: <20191125130732.4-rWw_BmJpX-0K7odIVR--8LyyfK3R2q_Yvwyi0N304@z> (raw)
In-Reply-To: <20191125112520.1760492-1-chris@chris-wilson.co.uk>
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
next prev parent reply other threads:[~2019-11-25 13:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2019-11-25 13:07 ` 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b9d0b30-16e6-ad91-74de-023d445e3c42@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox