drm: Fix deadlock retry loop in page_flip_ioctl
Subsystems (2)
PATCH 1/1 drm: Fix deadlock retry loop in page_flip_ioctl
I failed to properly onion-wrap the unwind code: We acquire the vblank reference before we start with the wait-wound locking dance, hence we must make sure we retry before we drop the reference. Oops.
--- drivers/gpu/drm/drm_plane.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_plane.c +5 -5
@@ -948,6 +948,11 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, } out: +if (ret == -EDEADLK ) { +drm_modeset_backoff (&ctx); + goto retry; + } +if (ret && crtc->funcs->page_flip_target)drm_crtc_vblank_put (crtc);if (fb)
@@ -956,11 +961,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,drm_framebuffer_put (crtc->primary->old_fb); crtc->primary->old_fb =NULL ; -if (ret == -EDEADLK ) { -drm_modeset_backoff (&ctx); - goto retry; - } -drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx);
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✓ Fi.CI.BAT: success for drm: Fix deadlock retry loop in page_flip_ioctl
== Series Details ==
== Series Details ==
Series: drm: Fix deadlock retry loop in page_flip_ioctl
URL : https://patchwork.freedesktop.org/series/24773/
State : success
== Summary ==
Series 24773v1 drm: Fix deadlock retry loop in page_flip_ioctl
https://patchwork.freedesktop.org/api/1.0/series/24773/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass -> FAIL (fi-snb-2600) fdo#100007fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:442s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:433s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:594s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:517s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:488s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:489s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:418s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:413s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:420s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:488s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:465s fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:467s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:466s fi-skl-6700hq total:278 pass:260 dwarn:1 dfail:0 fail:0 skip:17 time:573s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:470s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:506s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:437s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:536s fi-snb-2600 total:278 pass:248 dwarn:0 dfail:0 fail:1 skip:29 time:399s
721575dc73081f09673be35c8a7aa82224446cd1 drm-tip: 2017y-05m-22d-06h-50m-56s UTC integration manifest c8d911b drm: Fix deadlock retry loop in page_flip_ioctl
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4762/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 36 lines · Daniel Vetter
I failed to properly onion-wrap the unwind code: We acquire the vblank reference before we start with the wait-wound locking dance, hence we must make sure we retry before we drop the reference. Oops.
Fixes 29dc0d1de182 ("drm: Roll out acquire context for the page_flip ioctl")Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Reported-by Tommi Rantala <[email protected]>Cc Tommi Rantala <[email protected]>Cc Michel Dänzer <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_plane.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_plane.c +5
-0@@ -948,6 +948,11 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, } out: +if (ret == -EDEADLK ) { +drm_modeset_backoff (&ctx); + goto retry; + } +if (ret && crtc->funcs->page_flip_target)drm_crtc_vblank_put (crtc);if (fb)
drivers/gpu/drm/drm_plane.c int drm_mode_page_flip_ioctl(struct drm_device *dev, · line 962
Quoted 7 lines
drivers/gpu/drm/drm_plane.c +0
-4@@ -956,11 +961,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,drm_framebuffer_put (crtc->primary->old_fb); crtc->primary->old_fb =NULL ; -if (ret == -EDEADLK ) { -drm_modeset_backoff (&ctx); - goto retry; - }
I suspect the drm_framebuffer_put(fb) call still needs to happen before the retry?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: Fix deadlock retry loop in page_flip_ioctl
In reply to Daniel VetterI failed to properly onion-wrap the unwind code: We acquire the vblank reference before we start with the wait-wound locking dance, hence we must make sure we retry before we drop the reference. Oops.
v2: The vblank_put must be after the frambuffer_put (Michel). I suck at unwrapping code that doesn't use separate labels for each stage, but checks each pointer first ... While re-reading everything I also realized that we must clean up the fb refcounts, and specifically plane->old_fb before we drop the locks, either in the final unlocking, or in the w/w retry path. Hence the correct fix is to drop the vblank_put to the very bottom.
--- drivers/gpu/drm/drm_plane.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_plane.c +3 -2
@@ -948,8 +948,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, } out: -if (ret && crtc->funcs->page_flip_target) -drm_crtc_vblank_put (crtc);if (fb)drm_framebuffer_put (fb);if (crtc->primary->old_fb)
@@ -964,5 +962,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx); +if (ret && crtc->funcs->page_flip_target) +drm_crtc_vblank_put (crtc); +return ret; }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
2017-05-22 16:59 GMT+03:00 Daniel Vetter <[email protected]>:
Quoted 12 lines
I failed to properly onion-wrap the unwind code: We acquire the vblank reference before we start with the wait-wound locking dance, hence we must make sure we retry before we drop the reference. Oops.
v2: The
vblank_putmust be after theframbuffer_put(Michel). I suck at unwrapping code that doesn't use separate labels for each stage, but checks each pointer first ... While re-reading everything I also realized that we must clean up the fb refcounts, and specificallyplane->old_fbbefore we drop the locks, either in the final unlocking, or in the w/w retry path. Hence the correct fix is to drop thevblank_putto the very bottom.
Quoted 11 lines
Fixes 29dc0d1de182 ("drm: Roll out acquire context for the page_flip ioctl")Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Reported-by Tommi Rantala <[email protected]>Cc Tommi Rantala <[email protected]>Cc Michel Dänzer <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Thanks, confirmed that this fixes the warning that I was seeing!
Quoted 27 lines
--- drivers/gpu/drm/drm_plane.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_plane.c +3
-3@@ -948,8 +948,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, } out: -if (ret && crtc->funcs->page_flip_target) -drm_crtc_vblank_put (crtc);if (fb)drm_framebuffer_put (fb);if (crtc->primary->old_fb)@@ -964,5 +962,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx); +if (ret && crtc->funcs->page_flip_target) +drm_crtc_vblank_put (crtc); +return ret; } --
Quoted 2 lines
2.11.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 42 lines · Daniel Vetter
I failed to properly onion-wrap the unwind code: We acquire the vblank reference before we start with the wait-wound locking dance, hence we must make sure we retry before we drop the reference. Oops.
v2: The
vblank_putmust be after theframbuffer_put(Michel). I suck at unwrapping code that doesn't use separate labels for each stage, but checks each pointer first ... While re-reading everything I also realized that we must clean up the fb refcounts, and specificallyplane->old_fbbefore we drop the locks, either in the final unlocking, or in the w/w retry path. Hence the correct fix is to drop thevblank_putto the very bottom.Fixes 29dc0d1de182 ("drm: Roll out acquire context for the page_flip ioctl")Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Reported-by Tommi Rantala <[email protected]>Cc Tommi Rantala <[email protected]>Cc Michel Dänzer <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_plane.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_plane.c +0
-2@@ -948,8 +948,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, } out: -if (ret && crtc->funcs->page_flip_target) -drm_crtc_vblank_put (crtc);if (fb)drm_framebuffer_put (fb);if (crtc->primary->old_fb)
drivers/gpu/drm/drm_plane.c int drm_mode_page_flip_ioctl(struct drm_device *dev, · line 969
Quoted 8 lines
drivers/gpu/drm/drm_plane.c +3
-0@@ -964,5 +962,8 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx); +if (ret && crtc->funcs->page_flip_target) +drm_crtc_vblank_put (crtc); +return ret; }
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for drm: Fix deadlock retry loop in page_flip_ioctl (rev2)
In reply to Daniel Vetter== Series Details ==
== Series Details ==
Series: drm: Fix deadlock retry loop in page_flip_ioctl (rev2)
URL : https://patchwork.freedesktop.org/series/24773/
State : warning
== Summary ==
Series 24773v2 drm: Fix deadlock retry loop in page_flip_ioctl
https://patchwork.freedesktop.org/api/1.0/series/24773/revisions/2/mbox/
Test kms_busy:
Subgroup basic-flip-default-a:
pass -> DMESG-WARN (fi-skl-6700hq)
Test kms_flip:
Subgroup basic-flip-vs-wf_vblank:
fail -> PASS (fi-skl-6770hq) fdo#99739fdo#99739 https://bugs.freedesktop.org/show_bug.cgi?id=99739
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:454s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:438s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:580s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:516s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:488s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:484s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:418s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:408s 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:501s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:466s 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:576s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:459s fi-skl-6700hq total:278 pass:260 dwarn:1 dfail:0 fail:0 skip:17 time:577s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:464s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:508s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:436s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:534s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:411s
5c5ce2ab8183e4bd85a603169e260cc938837e2c drm-tip: 2017y-05m-22d-13h-42m-03s UTC integration manifest e8da648 drm: Fix deadlock retry loop in page_flip_ioctl
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4772/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx