* [Intel-gfx] [PATCH] drm/i915/gt: Mark up intel_rps.active for racy reads
@ 2020-03-09 11:36 Chris Wilson
2020-03-09 12:52 ` Mika Kuoppala
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2020-03-09 11:36 UTC (permalink / raw)
To: intel-gfx
We read the current state of intel_rps.active outside of the lock, so
mark up the racy access.
[ 525.037073] BUG: KCSAN: data-race in intel_rps_boost [i915] / intel_rps_park [i915]
[ 525.037091]
[ 525.037103] write to 0xffff8881f145efa1 of 1 bytes by task 192 on cpu 2:
[ 525.037331] intel_rps_park+0x72/0x230 [i915]
[ 525.037552] __gt_park+0x61/0xa0 [i915]
[ 525.037771] ____intel_wakeref_put_last+0x42/0x90 [i915]
[ 525.037991] __intel_wakeref_put_work+0xd3/0xf0 [i915]
[ 525.038008] process_one_work+0x3b1/0x690
[ 525.038022] worker_thread+0x80/0x670
[ 525.038037] kthread+0x19a/0x1e0
[ 525.038051] ret_from_fork+0x1f/0x30
[ 525.038062]
[ 525.038074] read to 0xffff8881f145efa1 of 1 bytes by task 733 on cpu 3:
[ 525.038304] intel_rps_boost+0x67/0x1f0 [i915]
[ 525.038535] i915_request_wait+0x562/0x5d0 [i915]
[ 525.038764] i915_gem_object_wait_fence+0x81/0xa0 [i915]
[ 525.038994] i915_gem_object_wait_reservation+0x489/0x520 [i915]
[ 525.039224] i915_gem_wait_ioctl+0x167/0x2b0 [i915]
[ 525.039241] drm_ioctl_kernel+0xe4/0x120
[ 525.039255] drm_ioctl+0x297/0x4c7
[ 525.039269] ksys_ioctl+0x89/0xb0
[ 525.039282] __x64_sys_ioctl+0x42/0x60
[ 525.039296] do_syscall_64+0x6e/0x2c0
[ 525.039311] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/gt/intel_rps.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 8794d399f5cd..506738dede16 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -644,7 +644,7 @@ void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive)
{
mutex_lock(&rps->power.mutex);
if (interactive) {
- if (!rps->power.interactive++ && rps->active)
+ if (!rps->power.interactive++ && READ_ONCE(rps->active))
rps_set_power(rps, HIGH_POWER);
} else {
GEM_BUG_ON(!rps->power.interactive);
@@ -721,11 +721,15 @@ void intel_rps_unpark(struct intel_rps *rps)
* performance, jump directly to RPe as our starting frequency.
*/
mutex_lock(&rps->lock);
- rps->active = true;
+
+ WRITE_ONCE(rps->active, true);
+
freq = max(rps->cur_freq, rps->efficient_freq),
freq = clamp(freq, rps->min_freq_softlimit, rps->max_freq_softlimit);
intel_rps_set(rps, freq);
+
rps->last_adj = 0;
+
mutex_unlock(&rps->lock);
if (INTEL_GEN(rps_to_i915(rps)) >= 6)
@@ -745,7 +749,7 @@ void intel_rps_park(struct intel_rps *rps)
if (INTEL_GEN(i915) >= 6)
rps_disable_interrupts(rps);
- rps->active = false;
+ WRITE_ONCE(rps->active, false);
if (rps->last_freq <= rps->idle_freq)
return;
@@ -772,7 +776,7 @@ void intel_rps_boost(struct i915_request *rq)
struct intel_rps *rps = &rq->engine->gt->rps;
unsigned long flags;
- if (i915_request_signaled(rq) || !rps->active)
+ if (i915_request_signaled(rq) || !READ_ONCE(rps->active))
return;
/* Serializes with i915_request_retire() */
--
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
* Re: [Intel-gfx] [PATCH] drm/i915/gt: Mark up intel_rps.active for racy reads
2020-03-09 11:36 [Intel-gfx] [PATCH] drm/i915/gt: Mark up intel_rps.active for racy reads Chris Wilson
@ 2020-03-09 12:52 ` Mika Kuoppala
2020-03-09 13:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-03-09 19:41 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Mika Kuoppala @ 2020-03-09 12:52 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
Chris Wilson <chris@chris-wilson.co.uk> writes:
> We read the current state of intel_rps.active outside of the lock, so
> mark up the racy access.
>
> [ 525.037073] BUG: KCSAN: data-race in intel_rps_boost [i915] / intel_rps_park [i915]
> [ 525.037091]
> [ 525.037103] write to 0xffff8881f145efa1 of 1 bytes by task 192 on cpu 2:
> [ 525.037331] intel_rps_park+0x72/0x230 [i915]
> [ 525.037552] __gt_park+0x61/0xa0 [i915]
> [ 525.037771] ____intel_wakeref_put_last+0x42/0x90 [i915]
> [ 525.037991] __intel_wakeref_put_work+0xd3/0xf0 [i915]
> [ 525.038008] process_one_work+0x3b1/0x690
> [ 525.038022] worker_thread+0x80/0x670
> [ 525.038037] kthread+0x19a/0x1e0
> [ 525.038051] ret_from_fork+0x1f/0x30
> [ 525.038062]
> [ 525.038074] read to 0xffff8881f145efa1 of 1 bytes by task 733 on cpu 3:
> [ 525.038304] intel_rps_boost+0x67/0x1f0 [i915]
> [ 525.038535] i915_request_wait+0x562/0x5d0 [i915]
> [ 525.038764] i915_gem_object_wait_fence+0x81/0xa0 [i915]
> [ 525.038994] i915_gem_object_wait_reservation+0x489/0x520 [i915]
> [ 525.039224] i915_gem_wait_ioctl+0x167/0x2b0 [i915]
> [ 525.039241] drm_ioctl_kernel+0xe4/0x120
> [ 525.039255] drm_ioctl+0x297/0x4c7
> [ 525.039269] ksys_ioctl+0x89/0xb0
> [ 525.039282] __x64_sys_ioctl+0x42/0x60
> [ 525.039296] do_syscall_64+0x6e/0x2c0
> [ 525.039311] 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_rps.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index 8794d399f5cd..506738dede16 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -644,7 +644,7 @@ void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive)
> {
> mutex_lock(&rps->power.mutex);
> if (interactive) {
> - if (!rps->power.interactive++ && rps->active)
> + if (!rps->power.interactive++ && READ_ONCE(rps->active))
> rps_set_power(rps, HIGH_POWER);
> } else {
> GEM_BUG_ON(!rps->power.interactive);
> @@ -721,11 +721,15 @@ void intel_rps_unpark(struct intel_rps *rps)
> * performance, jump directly to RPe as our starting frequency.
> */
> mutex_lock(&rps->lock);
> - rps->active = true;
> +
> + WRITE_ONCE(rps->active, true);
> +
> freq = max(rps->cur_freq, rps->efficient_freq),
> freq = clamp(freq, rps->min_freq_softlimit, rps->max_freq_softlimit);
> intel_rps_set(rps, freq);
> +
> rps->last_adj = 0;
> +
> mutex_unlock(&rps->lock);
>
> if (INTEL_GEN(rps_to_i915(rps)) >= 6)
> @@ -745,7 +749,7 @@ void intel_rps_park(struct intel_rps *rps)
> if (INTEL_GEN(i915) >= 6)
> rps_disable_interrupts(rps);
>
> - rps->active = false;
> + WRITE_ONCE(rps->active, false);
> if (rps->last_freq <= rps->idle_freq)
> return;
>
> @@ -772,7 +776,7 @@ void intel_rps_boost(struct i915_request *rq)
> struct intel_rps *rps = &rq->engine->gt->rps;
> unsigned long flags;
>
> - if (i915_request_signaled(rq) || !rps->active)
> + if (i915_request_signaled(rq) || !READ_ONCE(rps->active))
> return;
>
> /* Serializes with i915_request_retire() */
> --
> 2.20.1
_______________________________________________
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.BAT: success for drm/i915/gt: Mark up intel_rps.active for racy reads
2020-03-09 11:36 [Intel-gfx] [PATCH] drm/i915/gt: Mark up intel_rps.active for racy reads Chris Wilson
2020-03-09 12:52 ` Mika Kuoppala
@ 2020-03-09 13:16 ` Patchwork
2020-03-09 19:41 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-03-09 13:16 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/gt: Mark up intel_rps.active for racy reads
URL : https://patchwork.freedesktop.org/series/74448/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_8097 -> Patchwork_16879
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16879/index.html
Known issues
------------
Here are the changes found in Patchwork_16879 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@i915_selftest@live@gem_contexts:
- fi-skl-lmem: [INCOMPLETE][1] ([i915#424]) -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8097/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16879/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html
#### Warnings ####
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][3] ([fdo#111407]) -> [FAIL][4] ([fdo#111096] / [i915#323])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8097/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16879/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[i915#323]: https://gitlab.freedesktop.org/drm/intel/issues/323
[i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
Participating hosts (46 -> 43)
------------------------------
Additional (5): fi-glk-dsi fi-snb-2520m fi-elk-e7500 fi-bsw-kefka fi-tgl-y
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-skl-6770hq fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_8097 -> Patchwork_16879
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_16879: e3fe3d282bea9e1aff79c4bf0c0e2c513f94cbe6 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
e3fe3d282bea drm/i915/gt: Mark up intel_rps.active for racy reads
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16879/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
* [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/gt: Mark up intel_rps.active for racy reads
2020-03-09 11:36 [Intel-gfx] [PATCH] drm/i915/gt: Mark up intel_rps.active for racy reads Chris Wilson
2020-03-09 12:52 ` Mika Kuoppala
2020-03-09 13:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
@ 2020-03-09 19:41 ` Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-03-09 19:41 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/gt: Mark up intel_rps.active for racy reads
URL : https://patchwork.freedesktop.org/series/74448/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_8097_full -> Patchwork_16879_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
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_16879
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_16879: e3fe3d282bea9e1aff79c4bf0c0e2c513f94cbe6 @ 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_16879/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 19:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 11:36 [Intel-gfx] [PATCH] drm/i915/gt: Mark up intel_rps.active for racy reads Chris Wilson
2020-03-09 12:52 ` Mika Kuoppala
2020-03-09 13:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-03-09 19:41 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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).