All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/3] drm/i915/gt: Mark up racy reads for intel_context.inflight
Date: Tue, 10 Mar 2020 17:01:15 +0200	[thread overview]
Message-ID: <87tv2w1cg4.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200310141320.24149-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> When being used across multiple real engines inside a virtual engine,
> the intel_context.inflight is updated atomically, and so we must
> annotate the racy read from outside the owning context.
>
> [11142.482846] BUG: KCSAN: data-race in __execlists_submission_tasklet [i915] / __execlists_submission_tasklet [i915]
> [11142.482867]
> [11142.482878] write (marked) to 0xffff8881f257b5e0 of 8 bytes by interrupt on cpu 2:
> [11142.483107]  __execlists_submission_tasklet+0x1d33/0x2120 [i915]
> [11142.483336]  execlists_submission_tasklet+0xd3/0x170 [i915]
> [11142.483355]  tasklet_action_common.isra.0+0x42/0xa0
> [11142.483371]  __do_softirq+0xd7/0x2cd
> [11142.483384]  irq_exit+0xbe/0xe0
> [11142.483401]  do_IRQ+0x51/0x100
> [11142.483424]  ret_from_intr+0x0/0x1c
> [11142.483446]  do_idle+0x133/0x1f0
> [11142.483465]  cpu_startup_entry+0x14/0x16
> [11142.483483]  start_secondary+0x120/0x180
> [11142.483498]  secondary_startup_64+0xa4/0xb0
> [11142.483512]
> [11142.483528] read to 0xffff8881f257b5e0 of 8 bytes by interrupt on cpu 1:
> [11142.483755]  __execlists_submission_tasklet+0x14e/0x2120 [i915]
> [11142.483981]  execlists_submission_tasklet+0xd3/0x170 [i915]
> [11142.483999]  tasklet_action_common.isra.0+0x42/0xa0
> [11142.484014]  __do_softirq+0xd7/0x2cd
> [11142.484028]  do_softirq_own_stack+0x2a/0x40
> [11142.484046]  do_softirq.part.0+0x26/0x30
> [11142.484071]  __local_bh_enable_ip+0x46/0x50
> [11142.484299]  i915_gem_do_execbuffer+0x39c1/0x4e50 [i915]
> [11142.484528]  i915_gem_execbuffer2_ioctl+0x2c3/0x580 [i915]
> [11142.484546]  drm_ioctl_kernel+0xe4/0x120
> [11142.484559]  drm_ioctl+0x297/0x4c7
> [11142.484572]  ksys_ioctl+0x89/0xb0
> [11142.484586]  __x64_sys_ioctl+0x42/0x60
> [11142.484610]  do_syscall_64+0x6e/0x2c0
> [11142.484627]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
> 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_context_types.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_context_types.h b/drivers/gpu/drm/i915/gt/intel_context_types.h
> index 11278343b9b5..0f3b68b95c56 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_context_types.h
> @@ -45,8 +45,8 @@ struct intel_context {
>  
>  	struct intel_engine_cs *engine;
>  	struct intel_engine_cs *inflight;
> -#define intel_context_inflight(ce) ptr_mask_bits((ce)->inflight, 2)
> -#define intel_context_inflight_count(ce) ptr_unmask_bits((ce)->inflight, 2)
> +#define intel_context_inflight(ce) ptr_mask_bits(READ_ONCE((ce)->inflight), 2)
> +#define intel_context_inflight_count(ce) ptr_unmask_bits(READ_ONCE((ce)->inflight), 2)
>  
>  	struct i915_address_space *vm;
>  	struct i915_gem_context __rcu *gem_context;
> -- 
> 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

  parent reply	other threads:[~2020-03-10 15:11 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
2020-03-10 15:01 ` Mika Kuoppala [this message]
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=87tv2w1cg4.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.