intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/execlists: Mark up the racy access to switch_priority_hint
@ 2020-03-09 14:42 Chris Wilson
  2020-03-09 15:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2020-03-09 14:42 UTC (permalink / raw)
  To: intel-gfx

[ 7534.150687] BUG: KCSAN: data-race in __execlists_submission_tasklet [i915] / process_csb [i915]
[ 7534.150706]
[ 7534.150717] write to 0xffff8881f1bc24b4 of 4 bytes by task 24404 on cpu 3:
[ 7534.150925]  __execlists_submission_tasklet+0x1158/0x2780 [i915]
[ 7534.151133]  execlists_submit_request+0x2e8/0x2f0 [i915]
[ 7534.151348]  submit_notify+0x8f/0xc0 [i915]
[ 7534.151549]  __i915_sw_fence_complete+0x5d/0x3e0 [i915]
[ 7534.151753]  i915_sw_fence_complete+0x58/0x80 [i915]
[ 7534.151963]  i915_sw_fence_commit+0x16/0x20 [i915]
[ 7534.152179]  __i915_request_queue+0x60/0x70 [i915]
[ 7534.152388]  i915_gem_do_execbuffer+0x3997/0x4c20 [i915]
[ 7534.152598]  i915_gem_execbuffer2_ioctl+0x2c3/0x580 [i915]
[ 7534.152615]  drm_ioctl_kernel+0xe4/0x120
[ 7534.152629]  drm_ioctl+0x297/0x4c7
[ 7534.152642]  ksys_ioctl+0x89/0xb0
[ 7534.152654]  __x64_sys_ioctl+0x42/0x60
[ 7534.152667]  do_syscall_64+0x6e/0x2c0
[ 7534.152681]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 7534.152693]
[ 7534.152703] read to 0xffff8881f1bc24b4 of 4 bytes by interrupt on cpu 2:
[ 7534.152914]  process_csb+0xe7c/0x10a0 [i915]
[ 7534.153120]  execlists_submission_tasklet+0x30/0x170 [i915]
[ 7534.153138]  tasklet_action_common.isra.0+0x42/0xa0
[ 7534.153153]  __do_softirq+0xd7/0x2cd
[ 7534.153166]  run_ksoftirqd+0x15/0x20
[ 7534.153180]  smpboot_thread_fn+0x1ab/0x300
[ 7534.153194]  kthread+0x19a/0x1e0
[ 7534.153207]  ret_from_fork+0x1f/0x30

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 3eb7adc4e057..9890d248749e 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1792,12 +1792,13 @@ timeslice(const struct intel_engine_cs *engine)
 static unsigned long
 active_timeslice(const struct intel_engine_cs *engine)
 {
-	const struct i915_request *rq = *engine->execlists.active;
+	const struct intel_engine_execlists *execlists = &engine->execlists;
+	const struct i915_request *rq = *execlists->active;
 
 	if (!rq || i915_request_completed(rq))
 		return 0;
 
-	if (engine->execlists.switch_priority_hint < effective_prio(rq))
+	if (READ_ONCE(execlists->switch_priority_hint) < effective_prio(rq))
 		return 0;
 
 	return timeslice(engine);
@@ -1814,8 +1815,11 @@ static void set_timeslice(struct intel_engine_cs *engine)
 static void start_timeslice(struct intel_engine_cs *engine)
 {
 	struct intel_engine_execlists *execlists = &engine->execlists;
+	int prio = queue_prio(execlists);
 
-	execlists->switch_priority_hint = execlists->queue_priority_hint;
+	WRITE_ONCE(execlists->switch_priority_hint, prio);
+	if (prio == INT_MIN)
+		return;
 
 	if (timer_pending(&execlists->timer))
 		return;
@@ -5342,10 +5346,10 @@ void intel_execlists_show_requests(struct intel_engine_cs *engine,
 
 	if (execlists->switch_priority_hint != INT_MIN)
 		drm_printf(m, "\t\tSwitch priority hint: %d\n",
-			   execlists->switch_priority_hint);
+			   READ_ONCE(execlists->switch_priority_hint));
 	if (execlists->queue_priority_hint != INT_MIN)
 		drm_printf(m, "\t\tQueue priority hint: %d\n",
-			   execlists->queue_priority_hint);
+			   READ_ONCE(execlists->queue_priority_hint));
 
 	last = NULL;
 	count = 0;
-- 
2.20.1

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

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

* [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/execlists: Mark up the racy access to switch_priority_hint
  2020-03-09 14:42 [Intel-gfx] [PATCH] drm/i915/execlists: Mark up the racy access to switch_priority_hint Chris Wilson
@ 2020-03-09 15:58 ` Patchwork
  2020-03-09 17:01 ` [Intel-gfx] [PATCH] " Mika Kuoppala
  2020-03-09 23:07 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-03-09 15:58 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/execlists: Mark up the racy access to switch_priority_hint
URL   : https://patchwork.freedesktop.org/series/74457/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8097 -> Patchwork_16883
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16883/index.html

Known issues
------------

  Here are the changes found in Patchwork_16883 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_frontbuffer_tracking@basic:
    - fi-hsw-peppy:       [PASS][1] -> [DMESG-WARN][2] ([i915#44])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8097/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16883/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@gem_contexts:
    - fi-skl-lmem:        [INCOMPLETE][3] ([i915#424]) -> [PASS][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8097/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16883/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html

  
  [i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
  [i915#44]: https://gitlab.freedesktop.org/drm/intel/issues/44


Participating hosts (46 -> 40)
------------------------------

  Additional (5): fi-glk-dsi fi-snb-2520m fi-elk-e7500 fi-bsw-kefka fi-tgl-y 
  Missing    (11): fi-ilk-m540 fi-bdw-5557u fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-apl-guc fi-ctg-p8600 fi-kbl-7560u fi-byt-clapper fi-bdw-samus fi-kbl-r 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_8097 -> Patchwork_16883

  CI-20190529: 20190529
  CI_DRM_8097: 2e46e269a2843c5d0b6c72bfb7fa9d9913c15415 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5499: 2e23cf6f63fc6ba1d9543f8327698d6f21813cec @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_16883: c44455523ac832672d86d46d40d2a71a550c6536 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

c44455523ac8 drm/i915/execlists: Mark up the racy access to switch_priority_hint

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16883/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH] drm/i915/execlists: Mark up the racy access to switch_priority_hint
  2020-03-09 14:42 [Intel-gfx] [PATCH] drm/i915/execlists: Mark up the racy access to switch_priority_hint Chris Wilson
  2020-03-09 15:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
@ 2020-03-09 17:01 ` Mika Kuoppala
  2020-03-09 23:07 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Mika Kuoppala @ 2020-03-09 17:01 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

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

> [ 7534.150687] BUG: KCSAN: data-race in __execlists_submission_tasklet [i915] / process_csb [i915]
> [ 7534.150706]
> [ 7534.150717] write to 0xffff8881f1bc24b4 of 4 bytes by task 24404 on cpu 3:
> [ 7534.150925]  __execlists_submission_tasklet+0x1158/0x2780 [i915]
> [ 7534.151133]  execlists_submit_request+0x2e8/0x2f0 [i915]
> [ 7534.151348]  submit_notify+0x8f/0xc0 [i915]
> [ 7534.151549]  __i915_sw_fence_complete+0x5d/0x3e0 [i915]
> [ 7534.151753]  i915_sw_fence_complete+0x58/0x80 [i915]
> [ 7534.151963]  i915_sw_fence_commit+0x16/0x20 [i915]
> [ 7534.152179]  __i915_request_queue+0x60/0x70 [i915]
> [ 7534.152388]  i915_gem_do_execbuffer+0x3997/0x4c20 [i915]
> [ 7534.152598]  i915_gem_execbuffer2_ioctl+0x2c3/0x580 [i915]
> [ 7534.152615]  drm_ioctl_kernel+0xe4/0x120
> [ 7534.152629]  drm_ioctl+0x297/0x4c7
> [ 7534.152642]  ksys_ioctl+0x89/0xb0
> [ 7534.152654]  __x64_sys_ioctl+0x42/0x60
> [ 7534.152667]  do_syscall_64+0x6e/0x2c0
> [ 7534.152681]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ 7534.152693]
> [ 7534.152703] read to 0xffff8881f1bc24b4 of 4 bytes by interrupt on cpu 2:
> [ 7534.152914]  process_csb+0xe7c/0x10a0 [i915]
> [ 7534.153120]  execlists_submission_tasklet+0x30/0x170 [i915]
> [ 7534.153138]  tasklet_action_common.isra.0+0x42/0xa0
> [ 7534.153153]  __do_softirq+0xd7/0x2cd
> [ 7534.153166]  run_ksoftirqd+0x15/0x20
> [ 7534.153180]  smpboot_thread_fn+0x1ab/0x300
> [ 7534.153194]  kthread+0x19a/0x1e0
> [ 7534.153207]  ret_from_fork+0x1f/0x30
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/intel_lrc.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index 3eb7adc4e057..9890d248749e 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1792,12 +1792,13 @@ timeslice(const struct intel_engine_cs *engine)
>  static unsigned long
>  active_timeslice(const struct intel_engine_cs *engine)
>  {
> -	const struct i915_request *rq = *engine->execlists.active;
> +	const struct intel_engine_execlists *execlists = &engine->execlists;
> +	const struct i915_request *rq = *execlists->active;
>  
>  	if (!rq || i915_request_completed(rq))
>  		return 0;
>  
> -	if (engine->execlists.switch_priority_hint < effective_prio(rq))
> +	if (READ_ONCE(execlists->switch_priority_hint) < effective_prio(rq))
>  		return 0;
>  
>  	return timeslice(engine);
> @@ -1814,8 +1815,11 @@ static void set_timeslice(struct intel_engine_cs *engine)
>  static void start_timeslice(struct intel_engine_cs *engine)
>  {
>  	struct intel_engine_execlists *execlists = &engine->execlists;
> +	int prio = queue_prio(execlists);

const would have suited in here.
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

>  
> -	execlists->switch_priority_hint = execlists->queue_priority_hint;
> +	WRITE_ONCE(execlists->switch_priority_hint, prio);
> +	if (prio == INT_MIN)
> +		return;
>  
>  	if (timer_pending(&execlists->timer))
>  		return;
> @@ -5342,10 +5346,10 @@ void intel_execlists_show_requests(struct intel_engine_cs *engine,
>  
>  	if (execlists->switch_priority_hint != INT_MIN)
>  		drm_printf(m, "\t\tSwitch priority hint: %d\n",
> -			   execlists->switch_priority_hint);
> +			   READ_ONCE(execlists->switch_priority_hint));
>  	if (execlists->queue_priority_hint != INT_MIN)
>  		drm_printf(m, "\t\tQueue priority hint: %d\n",
> -			   execlists->queue_priority_hint);
> +			   READ_ONCE(execlists->queue_priority_hint));
>  
>  	last = NULL;
>  	count = 0;
> -- 
> 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

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

* [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/execlists: Mark up the racy access to switch_priority_hint
  2020-03-09 14:42 [Intel-gfx] [PATCH] drm/i915/execlists: Mark up the racy access to switch_priority_hint Chris Wilson
  2020-03-09 15:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
  2020-03-09 17:01 ` [Intel-gfx] [PATCH] " Mika Kuoppala
@ 2020-03-09 23:07 ` Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-03-09 23:07 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/execlists: Mark up the racy access to switch_priority_hint
URL   : https://patchwork.freedesktop.org/series/74457/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8097_full -> Patchwork_16883_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16883/index.html


Changes
-------

  No changes found


Participating hosts (10 -> 8)
------------------------------

  Missing    (2): pig-skl-6260u pig-glk-j5005 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_8097 -> Patchwork_16883
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_8097: 2e46e269a2843c5d0b6c72bfb7fa9d9913c15415 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5499: 2e23cf6f63fc6ba1d9543f8327698d6f21813cec @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_16883: c44455523ac832672d86d46d40d2a71a550c6536 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16883/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2020-03-09 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 14:42 [Intel-gfx] [PATCH] drm/i915/execlists: Mark up the racy access to switch_priority_hint Chris Wilson
2020-03-09 15:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-03-09 17:01 ` [Intel-gfx] [PATCH] " Mika Kuoppala
2020-03-09 23:07 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).