From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/i915/execlists: Mark up data-races in virtual engines
Date: Tue, 10 Mar 2020 17:35:06 +0200 [thread overview]
Message-ID: <87d09k5il1.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200310141320.24149-3-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> The virtual engine passes tokens back and forth to its backing physical
> engines.
>
> [ 57.372993] BUG: KCSAN: data-race in execlists_dequeue [i915] / virtual_submission_tasklet [i915]
> [ 57.373012]
> [ 57.373023] write to 0xffff8881f47324c0 of 4 bytes by interrupt on cpu 2:
> [ 57.373241] execlists_dequeue+0x6fa/0x2150 [i915]
> [ 57.373458] __execlists_submission_tasklet+0x48/0x60 [i915]
> [ 57.373677] execlists_submission_tasklet+0xd3/0x170 [i915]
> [ 57.373694] tasklet_action_common.isra.0+0x42/0xa0
> [ 57.373709] __do_softirq+0xd7/0x2cd
> [ 57.373723] irq_exit+0xbe/0xe0
> [ 57.373735] do_IRQ+0x51/0x100
> [ 57.373748] ret_from_intr+0x0/0x1c
> [ 57.373963] engine_retire+0x89/0xe0 [i915]
> [ 57.373977] process_one_work+0x3b1/0x690
> [ 57.373990] worker_thread+0x80/0x670
> [ 57.374004] kthread+0x19a/0x1e0
> [ 57.374017] ret_from_fork+0x1f/0x30
> [ 57.374027]
> [ 57.374038] read to 0xffff8881f47324c0 of 4 bytes by interrupt on cpu 3:
> [ 57.374256] virtual_submission_tasklet+0x27/0x5a0 [i915]
> [ 57.374273] tasklet_action_common.isra.0+0x42/0xa0
> [ 57.374288] __do_softirq+0xd7/0x2cd
> [ 57.374302] run_ksoftirqd+0x15/0x20
> [ 57.374315] smpboot_thread_fn+0x1ab/0x300
> [ 57.374329] kthread+0x19a/0x1e0
> [ 57.374342] ret_from_fork+0x1f/0x30
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_lrc.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index 15b81be08fcc..8122f4bc2e90 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1004,7 +1004,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
> i915_request_cancel_breadcrumb(rq);
> spin_unlock(&rq->lock);
> }
> - rq->engine = owner;
> + WRITE_ONCE(rq->engine, owner);
> owner->submit_request(rq);
> active = NULL;
> }
> @@ -2023,13 +2023,14 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
> "",
> yesno(engine != ve->siblings[0]));
>
> - ve->request = NULL;
> - ve->base.execlists.queue_priority_hint = INT_MIN;
> + WRITE_ONCE(ve->request, NULL);
> + WRITE_ONCE(ve->base.execlists.queue_priority_hint,
> + INT_MIN);
> rb_erase_cached(rb, &execlists->virtual);
> RB_CLEAR_NODE(rb);
>
> GEM_BUG_ON(!(rq->execution_mask & engine->mask));
> - rq->engine = engine;
> + WRITE_ONCE(rq->engine, engine);
>
> if (engine != ve->siblings[0]) {
> u32 *regs = ve->context.lrc_reg_state;
> @@ -4934,7 +4935,7 @@ static intel_engine_mask_t virtual_submission_mask(struct virtual_engine *ve)
> static void virtual_submission_tasklet(unsigned long data)
> {
> struct virtual_engine * const ve = (struct virtual_engine *)data;
> - const int prio = ve->base.execlists.queue_priority_hint;
> + const int prio = READ_ONCE(ve->base.execlists.queue_priority_hint);
> intel_engine_mask_t mask;
> unsigned int n;
>
> --
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-03-10 15:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 14:13 [Intel-gfx] [PATCH 1/3] drm/i915/gt: Mark up racy reads for intel_context.inflight Chris Wilson
2020-03-10 14:13 ` [Intel-gfx] [PATCH 2/3] drm/i915: Mark up racy read of active rq->engine Chris Wilson
2020-03-10 14:24 ` [Intel-gfx] [PATCH v2] " Chris Wilson
2020-03-10 15:29 ` Mika Kuoppala
2020-03-10 14:13 ` [Intel-gfx] [PATCH 3/3] drm/i915/execlists: Mark up data-races in virtual engines Chris Wilson
2020-03-10 15:35 ` Mika Kuoppala [this message]
2020-03-10 15:01 ` [Intel-gfx] [PATCH 1/3] drm/i915/gt: Mark up racy reads for intel_context.inflight Mika Kuoppala
2020-03-11 8:40 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915/gt: Mark up racy reads for intel_context.inflight (rev2) Patchwork
2020-03-11 14:33 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=87d09k5il1.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@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