Skip to contentSkip to conversation

drm/atomic-helpers: Make nonblocking more resilient

PATCH In review Daniel Vetter 3 participants 3 messages Feb 28, 2017

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

PATCH 1/1 drm/atomic-helpers: Make nonblocking more resilient

We've switched to refcounting for the event completion, which means there's no risk for use-after free anymore after:

commit 24835e442f289813aa568d142a755672a740503c

Author: Daniel Vetter <[email protected]>
Date:   Wed Dec 21 11:23:30 2016 +0100
    drm: reference count event->completion

This should make the commit machinery a bit more resilient against drivers bugs. It won't fix any driver bugs of course.

References: https://bugs.freedesktop.org/show_bug.cgi?id=96781

---
 drivers/gpu/drm/drm_atomic_helper.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +5 -4
index 9203f3e933f7..f68181a92210 100644
@@ -1611,15 +1611,16 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
 
 		spin_unlock(&crtc->commit_lock);
 
-		/* We must wait for the vblank event to signal our completion
-		 * before releasing our reference, since the vblank work does
-		 * not hold a reference of its own. */
 		ret = wait_for_completion_timeout(&commit->flip_done,
 						  10*HZ);
-		if (ret == 0)
+		if (ret == 0) {
 			DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
 				  crtc->base.id, crtc->name);
 
+			/* Unblock at least subsequent commits */
+			complete_all(&commit->flip_done);
+		}
+
 		spin_lock(&crtc->commit_lock);
 del_commit:
 		list_del(&commit->commit_entry);
Signature · 6 lines
2.11.0

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

We've switched to refcounting for the event completion, which means there's no risk for use-after free anymore after:

commit 24835e442f289813aa568d142a755672a740503c

Author: Daniel Vetter <[email protected]>
Date:   Wed Dec 21 11:23:30 2016 +0100
Quoted 7 lines
    drm: reference count event->completion

This should make the commit machinery a bit more resilient against drivers bugs. It won't fix any driver bugs of course.

References: https://bugs.freedesktop.org/show_bug.cgi?id=96781

Regarding problems described on the bug tracker - it could be a blind guess, but you can check if events are not canceled meanwhile, if for some reason event responsible for page-flip is canceled completion is not called.

Regards
Andrzej

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

#2 lore raw

✗ Fi.CI.BAT: warning for drm/atomic-helpers: Make nonblocking more resilient

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: drm/atomic-helpers: Make nonblocking more resilient
URL : https://patchwork.freedesktop.org/series/20369/
State : warning

== Summary ==

Series 20369v1 drm/atomic-helpers: Make nonblocking more resilient
https://patchwork.freedesktop.org/api/1.0/series/20369/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-snb-2600)
                dmesg-warn -> PASS       (fi-ivb-3520m)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-snb-2600) fdo#99743
                pass       -> DMESG-WARN (fi-byt-n2820)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-ivb-3520m) fdo#99847
                dmesg-warn -> PASS       (fi-byt-n2820)

fdo#99743 https://bugs.freedesktop.org/show_bug.cgi?id=99743
fdo#99847 https://bugs.freedesktop.org/show_bug.cgi?id=99847

fi-bdw-5557u     total:278  pass:266  dwarn:1   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:278  pass:238  dwarn:1   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:278  pass:258  dwarn:1   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:108  pass:95   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:278  pass:250  dwarn:1   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:278  pass:246  dwarn:1   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:278  pass:261  dwarn:1   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:278  pass:261  dwarn:1   dfail:0   fail:0   skip:16 
fi-ilk-650       total:278  pass:227  dwarn:1   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:278  pass:260  dwarn:1   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:278  pass:249  dwarn:1   dfail:0   fail:0   skip:28 
fi-snb-2600      total:278  pass:247  dwarn:1   dfail:0   fail:1   skip:29 

22803b6e9ed7e05b03b6031a3d100c2ed3cce789 drm-tip: 2017y-02m-28d-10h-49m-08s UTC integration manifest f5f8609 drm/atomic-helpers: Make nonblocking more resilient

== Logs ==

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