From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH 01/20] drm/i915/gt: Mark up the racy read of execlists->context_tag
Date: Mon, 11 May 2020 12:07:52 +0300 [thread overview]
Message-ID: <878shy4z6f.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200511075722.13483-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> Since we are using bitops on context_tag to allow us to reserve and
> release inflight tags concurrently, the scan for the next bit is
> intentionally racy.
Now it truely sinks in why you started with a full mask.
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
-Mika
>
> [ 516.446854] BUG: KCSAN: data-race in execlists_schedule_in.isra.0 [i915] / execlists_schedule_out [i915]
> [ 516.446874]
> [ 516.446886] write (marked) to 0xffff8881f7644048 of 8 bytes by interrupt on cpu 2:
> [ 516.447076] execlists_schedule_out+0x538/0x6a0 [i915]
> [ 516.447263] process_csb+0x10b/0x3d0 [i915]
> [ 516.447449] execlists_submission_tasklet+0x30/0x170 [i915]
> [ 516.447468] tasklet_action_common.isra.0+0x42/0x90
> [ 516.447484] __do_softirq+0xc8/0x206
> [ 516.447498] irq_exit+0xcd/0xe0
> [ 516.447516] do_IRQ+0x44/0xc0
> [ 516.447535] ret_from_intr+0x0/0x1c
> [ 516.447550] cpuidle_enter_state+0x199/0x400
> [ 516.447572] cpuidle_enter+0x50/0x90
> [ 516.447587] do_idle+0x197/0x1e0
> [ 516.447600] cpu_startup_entry+0x14/0x20
> [ 516.447619] start_secondary+0xf9/0x130
> [ 516.447643] secondary_startup_64+0xa4/0xb0
> [ 516.447655]
> [ 516.447671] read to 0xffff8881f7644048 of 8 bytes by task 460 on cpu 1:
> [ 516.447863] execlists_schedule_in.isra.0+0x3cf/0x5a0 [i915]
> [ 516.448064] execlists_dequeue+0xf8f/0x1690 [i915]
> [ 516.448252] __execlists_submission_tasklet+0x48/0x60 [i915]
> [ 516.448440] execlists_submit_request+0x2e2/0x310 [i915]
> [ 516.448634] submit_notify+0x8f/0xc8 [i915]
> [ 516.448820] __i915_sw_fence_complete+0x61/0x420 [i915]
> [ 516.449005] i915_sw_fence_complete+0x58/0x80 [i915]
> [ 516.449208] i915_sw_fence_commit+0x16/0x20 [i915]
> [ 516.449399] __i915_request_queue+0x60/0x70 [i915]
> [ 516.449590] i915_gem_do_execbuffer+0x33f1/0x4a00 [i915]
> [ 516.449782] i915_gem_execbuffer2_ioctl+0x2a2/0x550 [i915]
> [ 516.449800] drm_ioctl_kernel+0xe9/0x130
> [ 516.449814] drm_ioctl+0x27d/0x45e
> [ 516.449827] ksys_ioctl+0x89/0xb0
> [ 516.449842] __x64_sys_ioctl+0x42/0x60
> [ 516.449864] do_syscall_64+0x6e/0x2c0
> [ 516.449878] entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gt/intel_lrc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index 8e254f639751..ed45fc40f884 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1367,7 +1367,7 @@ __execlists_schedule_in(struct i915_request *rq)
> ce->lrc.ccid = ce->tag;
> } else {
> /* We don't need a strict matching tag, just different values */
> - unsigned int tag = ffs(engine->context_tag);
> + unsigned int tag = ffs(READ_ONCE(engine->context_tag));
>
> GEM_BUG_ON(tag == 0 || tag >= BITS_PER_LONG);
> clear_bit(tag - 1, &engine->context_tag);
> --
> 2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2020-05-11 9:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 7:57 [Intel-gfx] [PATCH 01/20] drm/i915/gt: Mark up the racy read of execlists->context_tag Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 02/20] drm/i915/gt: Couple up old virtual breadcrumb on new sibling Chris Wilson
2020-05-12 8:41 ` Tvrtko Ursulin
2020-05-12 8:49 ` Chris Wilson
2020-05-12 10:12 ` Tvrtko Ursulin
2020-05-12 10:28 ` Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 03/20] dma-buf: Use atomic_fetch_add() for the context id Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 04/20] drm/i915: Mark the addition of the initial-breadcrumb in the request Chris Wilson
2020-05-11 11:21 ` Mika Kuoppala
2020-05-11 11:30 ` Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 05/20] drm/i915: Tidy awaiting on dma-fences Chris Wilson
2020-05-11 11:30 ` Mika Kuoppala
2020-05-11 7:57 ` [Intel-gfx] [PATCH 06/20] dma-buf: Proxy fence, an unsignaled fence placeholder Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 07/20] drm/syncobj: Allow use of dma-fence-proxy Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 08/20] drm/i915/gem: Teach execbuf how to wait on future syncobj Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 09/20] drm/i915/gem: Allow combining submit-fences with syncobj Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 10/20] drm/i915/gt: Declare when we enabled timeslicing Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 11/20] drm/i915/gem: Remove redundant exec_fence Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 12/20] drm/i915: Drop no-semaphore boosting Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 13/20] drm/i915: Move saturated workload detection back to the context Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 14/20] drm/i915: Remove the saturation backoff for HW semaphores Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 15/20] drm/i915/gt: Use built-in active intel_context reference Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 16/20] drm/i915: Drop I915_RESET_TIMEOUT and friends Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 17/20] drm/i915: Drop I915_IDLE_ENGINES_TIMEOUT Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 18/20] drm/i915/selftests: Always call the provided engine->emit_init_breadcrumb Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 19/20] drm/i915: Emit await(batch) before MI_BB_START Chris Wilson
2020-05-11 7:57 ` [Intel-gfx] [PATCH 20/20] drm/i915/selftests: Always flush before unpining after writing Chris Wilson
2020-05-11 8:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/20] drm/i915/gt: Mark up the racy read of execlists->context_tag Patchwork
2020-05-11 8:32 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-05-11 9:07 ` Mika Kuoppala [this message]
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=878shy4z6f.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 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.