* [PATCH] drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
@ 2016-05-03 9:12 Maarten Lankhorst
2016-05-03 9:47 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-05-03 12:36 ` [Intel-gfx] [PATCH] " Daniel Vetter
0 siblings, 2 replies; 3+ messages in thread
From: Maarten Lankhorst @ 2016-05-03 9:12 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
When I was writing an atomic wrapper for rmfb, I ran into the
following backtrace from lockdep:
=============================================
[ INFO: possible recursive locking detected ]
4.5.0-patser+ #4696 Tainted: G U
---------------------------------------------
kworker/2:2/2608 is trying to acquire lock:
(crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffc00c9ddc>] drm_modeset_lock+0x7c/0x120 [drm]
but task is already holding lock:
(crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffc00c98cd>] modeset_backoff+0x8d/0x220 [drm]
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(crtc_ww_class_mutex);
lock(crtc_ww_class_mutex);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by kworker/2:2/2608:
#0: ("events"){.+.+.+}, at: [<ffffffff810a5eea>] process_one_work+0x15a/0x6c0
#1: ((&arg.work)){+.+.+.}, at: [<ffffffff810a5eea>] process_one_work+0x15a/0x6c0
#2: (crtc_ww_class_acquire){+.+.+.}, at: [<ffffffffc004532a>] drm_atomic_helper_remove_fb+0x4a/0x1d0 [drm_kms_helper]
#3: (crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffc00c98cd>] modeset_backoff+0x8d/0x220 [drm]
While lockdep probably catches this bug when it happens, it's better
to explicitly warn when state->acquire_ctx is not set.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
drivers/gpu/drm/drm_atomic.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 0b526423f19f..69adcf3944cc 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -263,6 +263,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
int ret, index = drm_crtc_index(crtc);
struct drm_crtc_state *crtc_state;
+ WARN_ON(!state->acquire_ctx);
+
crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
if (crtc_state)
return crtc_state;
@@ -622,6 +624,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
int ret, index = drm_plane_index(plane);
struct drm_plane_state *plane_state;
+ WARN_ON(!state->acquire_ctx);
+
plane_state = drm_atomic_get_existing_plane_state(state, plane);
if (plane_state)
return plane_state;
@@ -890,6 +894,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
struct drm_mode_config *config = &connector->dev->mode_config;
struct drm_connector_state *connector_state;
+ WARN_ON(!state->acquire_ctx);
+
ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
if (ret)
return ERR_PTR(ret);
--
2.5.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* ✓ Fi.CI.BAT: success for drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
2016-05-03 9:12 [PATCH] drm/atomic: Add WARN_ON when state->acquire_ctx is not set Maarten Lankhorst
@ 2016-05-03 9:47 ` Patchwork
2016-05-03 12:36 ` [Intel-gfx] [PATCH] " Daniel Vetter
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2016-05-03 9:47 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
URL : https://patchwork.freedesktop.org/series/6650/
State : success
== Summary ==
Series 6650v1 drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
http://patchwork.freedesktop.org/api/1.0/series/6650/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-uc-pro-default:
fail -> PASS (byt-nuc)
Test kms_force_connector_basic:
Subgroup force-load-detect:
skip -> PASS (snb-x220t)
Subgroup prune-stale-modes:
skip -> PASS (snb-x220t)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-c:
incomplete -> PASS (hsw-gt2)
bdw-nuci7-2 total:221 pass:209 dwarn:0 dfail:0 fail:0 skip:12
bdw-ultra total:221 pass:196 dwarn:0 dfail:0 fail:0 skip:25
byt-nuc total:220 pass:177 dwarn:0 dfail:0 fail:2 skip:41
hsw-brixbox total:221 pass:195 dwarn:0 dfail:0 fail:0 skip:26
hsw-gt2 total:221 pass:199 dwarn:0 dfail:0 fail:1 skip:21
ilk-hp8440p total:221 pass:158 dwarn:0 dfail:0 fail:2 skip:61
ivb-t430s total:221 pass:190 dwarn:0 dfail:0 fail:0 skip:31
skl-i7k-2 total:221 pass:194 dwarn:0 dfail:0 fail:0 skip:27
skl-nuci5 total:221 pass:210 dwarn:0 dfail:0 fail:0 skip:11
snb-dellxps total:221 pass:179 dwarn:0 dfail:0 fail:0 skip:42
snb-x220t total:221 pass:179 dwarn:0 dfail:0 fail:1 skip:41
Results at /archive/results/CI_IGT_test/Patchwork_2127/
4c6b0d9cea0a81653fc290fe64d5c43e7d5c5762 drm-intel-nightly: 2016y-05m-03d-08h-18m-32s UTC integration manifest
e0334a1 drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
2016-05-03 9:12 [PATCH] drm/atomic: Add WARN_ON when state->acquire_ctx is not set Maarten Lankhorst
2016-05-03 9:47 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2016-05-03 12:36 ` Daniel Vetter
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2016-05-03 12:36 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx, dri-devel
On Tue, May 03, 2016 at 11:12:31AM +0200, Maarten Lankhorst wrote:
> When I was writing an atomic wrapper for rmfb, I ran into the
> following backtrace from lockdep:
>
> =============================================
> [ INFO: possible recursive locking detected ]
> 4.5.0-patser+ #4696 Tainted: G U
> ---------------------------------------------
> kworker/2:2/2608 is trying to acquire lock:
> (crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffc00c9ddc>] drm_modeset_lock+0x7c/0x120 [drm]
>
> but task is already holding lock:
> (crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffc00c98cd>] modeset_backoff+0x8d/0x220 [drm]
>
> other info that might help us debug this:
> Possible unsafe locking scenario:
>
> CPU0
> ----
> lock(crtc_ww_class_mutex);
> lock(crtc_ww_class_mutex);
>
> *** DEADLOCK ***
>
> May be due to missing lock nesting notation
>
> 4 locks held by kworker/2:2/2608:
> #0: ("events"){.+.+.+}, at: [<ffffffff810a5eea>] process_one_work+0x15a/0x6c0
> #1: ((&arg.work)){+.+.+.}, at: [<ffffffff810a5eea>] process_one_work+0x15a/0x6c0
> #2: (crtc_ww_class_acquire){+.+.+.}, at: [<ffffffffc004532a>] drm_atomic_helper_remove_fb+0x4a/0x1d0 [drm_kms_helper]
> #3: (crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffc00c98cd>] modeset_backoff+0x8d/0x220 [drm]
>
> While lockdep probably catches this bug when it happens, it's better
> to explicitly warn when state->acquire_ctx is not set.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Yeah, because of the automagic fallback to normal mutex semantics when
acquire_ctx == NULL in ww_mutex_lock this can go boom, and the lockdep
splat is pretty hard to read. Makes sense to have an explicit WARN_ON
about it.
Applied to drm-misc, thanks.
-Daniel
> ---
> drivers/gpu/drm/drm_atomic.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 0b526423f19f..69adcf3944cc 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -263,6 +263,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
> int ret, index = drm_crtc_index(crtc);
> struct drm_crtc_state *crtc_state;
>
> + WARN_ON(!state->acquire_ctx);
> +
> crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
> if (crtc_state)
> return crtc_state;
> @@ -622,6 +624,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
> int ret, index = drm_plane_index(plane);
> struct drm_plane_state *plane_state;
>
> + WARN_ON(!state->acquire_ctx);
> +
> plane_state = drm_atomic_get_existing_plane_state(state, plane);
> if (plane_state)
> return plane_state;
> @@ -890,6 +894,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
> struct drm_mode_config *config = &connector->dev->mode_config;
> struct drm_connector_state *connector_state;
>
> + WARN_ON(!state->acquire_ctx);
> +
> ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
> if (ret)
> return ERR_PTR(ret);
> --
> 2.5.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-03 12:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03 9:12 [PATCH] drm/atomic: Add WARN_ON when state->acquire_ctx is not set Maarten Lankhorst
2016-05-03 9:47 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-05-03 12:36 ` [Intel-gfx] [PATCH] " Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox