Skip to contentSkip to conversation

drm: Fix locking in drm_atomic_helper_resume

PATCH In review Daniel Vetter 3 participants 3 messages May 29, 2017 – May 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Fix locking in drm_atomic_helper_resume

In the conversion to drop drm_modeset_lock_all and the magic implicit context I failed to realize that _resume starts out with a pile of state copies, but not with the locks. And hence drm_atomic_commit won't grab these for us.

Cc Jyri Sarha <[email protected]>
Fixes a5b8444e289c ("drm/atomic-helper: remove modeset_lock_all from helper_resume")
Cc Maarten Lankhorst <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>

---
Needs to be applied to drm-misc-fixes for 4.12.
-Daniel

---
 drivers/gpu/drm/drm_atomic_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +5 -0
index af07368846e0..a61291c29567 100644
@@ -2669,7 +2669,12 @@ int drm_atomic_helper_resume(struct drm_device *dev,
 
 	drm_modeset_acquire_init(&ctx, 0);
 	while (1) {
+		err = drm_modeset_lock_all_ctx(dev, &ctx);
+		if (err)
+			goto out;
+
 		err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
+out:
 		if (err != -EDEADLK)
 			break;
 
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm: Fix locking in drm_atomic_helper_resume

== Series Details ==

== Series Details ==

Series: drm: Fix locking in drm_atomic_helper_resume
URL : https://patchwork.freedesktop.org/series/25018/
State : success

== Summary ==

Series 25018v1 drm: Fix locking in drm_atomic_helper_resume
https://patchwork.freedesktop.org/api/1.0/series/25018/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test kms_busy:
        Subgroup basic-flip-default-a:
                dmesg-warn -> PASS       (fi-skl-6700hq) fdo#101144 +3
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                fail       -> PASS       (fi-skl-6700hq) fdo#101154 +7

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fdo#101154 https://bugs.freedesktop.org/show_bug.cgi?id=101154

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:448s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:430s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:566s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:510s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:485s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:483s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:430s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:416s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:421s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:486s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:474s
fi-kbl-7500u     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18  time:463s
fi-kbl-7560u     total:278  pass:263  dwarn:5   dfail:0   fail:0   skip:10  time:565s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:455s
fi-skl-6700hq    total:278  pass:239  dwarn:0   dfail:1   fail:17  skip:21  time:430s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:469s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:494s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:438s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:741s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:402s

afd6d4ac7d9c06649fe00300dd608bccc189ca22 drm-tip: 2017y-05m-29d-19h-12m-29s UTC integration manifest a72293f drm: Fix locking in drm_atomic_helper_resume

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4828/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter

Hey,

Op 29-05-17 om 21:34 schreef Daniel Vetter:

Quoted 26 lines

In the conversion to drop drm_modeset_lock_all and the magic implicit context I failed to realize that _resume starts out with a pile of state copies, but not with the locks. And hence drm_atomic_commit won't grab these for us.

Cc Jyri Sarha <[email protected]>
Fixes a5b8444e289c ("drm/atomic-helper: remove modeset_lock_all from helper_resume")
Cc Maarten Lankhorst <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>

---
Needs to be applied to drm-misc-fixes for 4.12.

(quoted diff) +0 -2
-Daniel
---
 drivers/gpu/drm/drm_atomic_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +0 -0
index af07368846e0..a61291c29567 100644
@@ -2669,7 +2669,12 @@ int drm_atomic_helper_resume(struct drm_device *dev,
 
 	drm_modeset_acquire_init(&ctx, 0);

drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_resume(struct drm_device *dev, · line 2680

Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +5 -0
 	while (1) {
+		err = drm_modeset_lock_all_ctx(dev, &ctx);
+		if (err)
+			goto out;
+
 		err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
+out:
 		if (err != -EDEADLK)
 			break;
 

This either needs a WARN somewhere to make sure we trip this in the core, or a big scary comment on why this is needed.

If fixed,

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx