Skip to contentSkip to conversation

drm/atomic-helper: Complete fake_commit->flip_done potentially earlier

PATCH In review Ville Syrjala 3 participants 5 messages Nov 22, 2018

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

PATCH 1/2 drm/atomic-helper: Complete fake_commit->flip_done potentially earlier

From: Ville Syrjälä <[email protected]>

Consider the following scenario:
1. nonblocking enable crtc
2. wait for the event
3. nonblocking disable crtc

On i915 this can lead to a spurious -EBUSY from step 3 on account of non-enabled planes getting the fake_commit in step 1 and we don't complete the fake_commit-> flip_done until drm_atomic_helper_commit_hw_done() which can happen a long time after the flip event was sent out.

This will become somewhat easy to hit on SKL+ once we start to add all the planes for the crtc to every modeset commit for the purposes of forcing a watermark register programming [1].

To make the race a little less pronounced let's complete fake_commit->flip_done after drm_atomic_helper_wait_for_flip_done(). For the single crtc case this should make the race quite theoretical, assuming drm_atomic_helper_wait_for_flip_done() actually has to wait for the real commit flip_done. In case the real commit flip_done gets completed singificantly before drm_atomic_helper_wait_for_flip_done(), or we are dealing with multiple crtcs whose vblanks don't line up nicely the race still exists.

[1] https://patchwork.freedesktop.org/patch/262670/

Cc Maarten Lankhorst <[email protected]>
Fixes 080de2e5be2d ("drm/atomic: Check for busy planes/connectors before setting the commit")

Testcase: igt/kms_cursor_legacy/*nonblocking-modeset-vs-cursor-atomic

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +3 -0
index fa95f9974f6d..47398662b895 100644
@@ -1460,6 +1460,9 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
 			DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
 				  crtc->base.id, crtc->name);
 	}
+
+	if (old_state->fake_commit)
+		complete_all(&old_state->fake_commit->flip_done);
 }
 EXPORT_SYMBOL(drm_atomic_helper_wait_for_flip_done);
 
Signature · 6 lines
2.18.1

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

PATCH 2/2 drm/atomic-helper: WARN if fake_commit->hw_done is not completed as expected

From: Ville Syrjälä <[email protected]>

For real commits we WARN if ->hw_done hasn't been completed by the time drm_atomic_helper_commit_cleanup_done() is called. Let's do the same for the fake commit.

---
 drivers/gpu/drm/drm_atomic_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +3 -1
index 47398662b895..bc9fc9665614 100644
@@ -2220,8 +2220,10 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
 		spin_unlock(&crtc->commit_lock);
 	}
 
-	if (old_state->fake_commit)
+	if (old_state->fake_commit) {
 		complete_all(&old_state->fake_commit->cleanup_done);
+		WARN_ON(!try_wait_for_completion(&old_state->fake_commit->hw_done));
+	}
 }
 EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
 
Signature · 6 lines
2.18.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/2
#2 lore raw
In reply to Ville Syrjala

Op 22-11-18 om 15:34 schreef Ville Syrjala:

Quoted 43 lines

From: Ville Syrjälä <[email protected]>

Consider the following scenario:
1. nonblocking enable crtc
2. wait for the event
3. nonblocking disable crtc

On i915 this can lead to a spurious -EBUSY from step 3 on account of non-enabled planes getting the fake_commit in step 1 and we don't complete the fake_commit-> flip_done until drm_atomic_helper_commit_hw_done() which can happen a long time after the flip event was sent out.

This will become somewhat easy to hit on SKL+ once we start to add all the planes for the crtc to every modeset commit for the purposes of forcing a watermark register programming [1].

To make the race a little less pronounced let's complete fake_commit->flip_done after drm_atomic_helper_wait_for_flip_done(). For the single crtc case this should make the race quite theoretical, assuming drm_atomic_helper_wait_for_flip_done() actually has to wait for the real commit flip_done. In case the real commit flip_done gets completed singificantly before drm_atomic_helper_wait_for_flip_done(), or we are dealing with multiple crtcs whose vblanks don't line up nicely the race still exists.

[1] https://patchwork.freedesktop.org/patch/262670/

Cc Maarten Lankhorst <[email protected]>
Fixes 080de2e5be2d ("drm/atomic: Check for busy planes/connectors before setting the commit")

Testcase: igt/kms_cursor_legacy/*nonblocking-modeset-vs-cursor-atomic

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +0 -0
index fa95f9974f6d..47398662b895 100644

drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, · line 1468

Quoted 9 lines
drivers/gpu/drm/drm_atomic_helper.c +3 -0
@@ -1460,6 +1460,9 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
 			DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
 				  crtc->base.id, crtc->name);
 	}
+
+	if (old_state->fake_commit)
+		complete_all(&old_state->fake_commit->flip_done);
 }
 EXPORT_SYMBOL(drm_atomic_helper_wait_for_flip_done);
 

Yeah as long as we don't enable hw_done sooner, this should be fine.

For both patches:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/atomic-helper: Complete fake_commit->flip_done potentially earlier

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/atomic-helper: Complete fake_commit->flip_done potentially earlier
URL : https://patchwork.freedesktop.org/series/52882/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5189 -> Patchwork_10885 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/52882/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_10885 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_ctx_create@basic-files:
      fi-bsw-n3050:       PASS -> FAIL (fdo#108656)

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       PASS -> DMESG-WARN (fdo#102614)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    igt@pm_rpm@module-reload:
      fi-skl-6600u:       PASS -> INCOMPLETE (fdo#107807)

    {igt@runner@aborted}:
      {fi-icl-y}:         NOTRUN -> FAIL (fdo#108070)

    
    ==== Possible fixes ====

    igt@i915_module_load@reload:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

    igt@i915_selftest@live_coherency:
      fi-gdg-551:         DMESG-FAIL (fdo#107164) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#108070 https://bugs.freedesktop.org/show_bug.cgi?id=108070
fdo#108656 https://bugs.freedesktop.org/show_bug.cgi?id=108656

== Participating hosts (50 -> 44) ==

Additional (1): fi-icl-y
Missing (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-icl-u3

== Build changes ==

* Linux: CI_DRM_5189 -> Patchwork_10885

CI_DRM_5189: 98966a91be483a9a681adc3a110877fe7ced049e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4725: 9dc7c41d1c600133d6e3e63f1941c2e75d23bd3b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10885: b67b3a1e1d92c9a6198b2e4756432822c86ab6c9 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

b67b3a1e1d92 drm/atomic-helper: WARN if fake_commit->hw_done is not completed as expected 384656c5015e drm/atomic-helper: Complete fake_commit->flip_done potentially earlier

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10885/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for series starting with [1/2] drm/atomic-helper: Complete fake_commit->flip_done potentially earlier

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/atomic-helper: Complete fake_commit->flip_done potentially earlier
URL : https://patchwork.freedesktop.org/series/52882/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5189_full -> Patchwork_10885_full =

== Summary - SUCCESS ==

No regressions found.

== Known issues ==

Here are the changes found in Patchwork_10885_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_cpu_reloc@full:
      shard-skl:          PASS -> INCOMPLETE (fdo#108073)

    igt@gem_ctx_isolation@vecs0-s3:
      shard-skl:          NOTRUN -> INCOMPLETE (fdo#104108, fdo#107773)

    igt@gem_exec_schedule@pi-ringfull-bsd:
      shard-skl:          NOTRUN -> FAIL (fdo#103158)

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-skl:          NOTRUN -> TIMEOUT (fdo#108039)

    igt@gem_softpin@noreloc-s3:
      shard-skl:          PASS -> INCOMPLETE (fdo#104108, fdo#107773)

    igt@gem_userptr_blits@readonly-unsync:
      {shard-iclb}:       PASS -> INCOMPLETE (fdo#108342)

    igt@kms_chv_cursor_fail@pipe-a-128x128-left-edge:
      shard-skl:          PASS -> FAIL (fdo#104671)

    igt@kms_chv_cursor_fail@pipe-c-64x64-right-edge:
      shard-skl:          NOTRUN -> FAIL (fdo#104671)

    igt@kms_color@pipe-a-ctm-blue-to-red:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103558, fdo#105602) +26

    igt@kms_color@pipe-a-ctm-negative:
      shard-skl:          PASS -> FAIL (fdo#107361)

    igt@kms_cursor_crc@cursor-128x42-random:
      shard-glk:          PASS -> FAIL (fdo#103232) +2

    igt@kms_cursor_crc@cursor-256x256-random:
      {shard-iclb}:       NOTRUN -> FAIL (fdo#103232)

    igt@kms_cursor_crc@cursor-256x256-sliding:
      shard-skl:          NOTRUN -> FAIL (fdo#103232)

    igt@kms_cursor_crc@cursor-256x256-suspend:
      shard-apl:          PASS -> FAIL (fdo#103191, fdo#103232)

    igt@kms_cursor_crc@cursor-64x21-random:
      shard-apl:          PASS -> FAIL (fdo#103232) +3

    igt@kms_fbcon_fbt@psr-suspend:
      shard-skl:          NOTRUN -> FAIL (fdo#107882)

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#105363)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
      shard-apl:          PASS -> FAIL (fdo#103167) +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
      {shard-iclb}:       PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-mmap-cpu:
      shard-glk:          PASS -> FAIL (fdo#103167) +4

    igt@kms_frontbuffer_tracking@fbc-farfromfence:
      shard-skl:          NOTRUN -> FAIL (fdo#105682) +1

    igt@kms_frontbuffer_tracking@fbc-rgb565-draw-mmap-wc:
      shard-skl:          PASS -> FAIL (fdo#105682)

    igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-blt:
      shard-skl:          NOTRUN -> FAIL (fdo#103167) +2

    igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-render:
      {shard-iclb}:       NOTRUN -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@psr-rgb565-draw-mmap-wc:
      shard-skl:          PASS -> FAIL (fdo#103167) +2

    igt@kms_plane@pixel-format-pipe-b-planes:
      shard-skl:          NOTRUN -> DMESG-WARN (fdo#106885)

    igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
      shard-skl:          NOTRUN -> FAIL (fdo#107815, fdo#108145)

    igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
      shard-skl:          NOTRUN -> FAIL (fdo#108145) +1

    igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
      shard-skl:          PASS -> FAIL (fdo#107815)

    igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
      shard-apl:          PASS -> FAIL (fdo#103166)

    igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
      shard-skl:          NOTRUN -> FAIL (fdo#107815, fdo#103166)

    igt@kms_psr@no_drrs:
      {shard-iclb}:       PASS -> FAIL (fdo#108341)

    igt@kms_rotation_crc@primary-rotation-180:
      shard-skl:          NOTRUN -> FAIL (fdo#107815, fdo#103925)

    igt@kms_setmode@basic:
      shard-hsw:          PASS -> FAIL (fdo#99912)

    igt@pm_rpm@fences-dpms:
      shard-skl:          PASS -> INCOMPLETE (fdo#107807)

    igt@pm_rps@waitboost:
      shard-skl:          PASS -> FAIL (fdo#102250)

    
    ==== Possible fixes ====

    igt@gem_exec_schedule@preempt-hang-render:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
      shard-glk:          FAIL (fdo#108145) -> PASS

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-glk:          FAIL (fdo#103232) -> PASS +3

    igt@kms_cursor_crc@cursor-256x256-random:
      shard-apl:          FAIL (fdo#103232) -> PASS +5

    igt@kms_cursor_crc@cursor-64x64-suspend:
      shard-apl:          FAIL (fdo#103191, fdo#103232) -> PASS

    igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
      shard-glk:          FAIL (fdo#106509, fdo#105454) -> PASS

    igt@kms_cursor_legacy@cursor-vs-flip-atomic:
      shard-hsw:          FAIL (fdo#103355) -> PASS

    igt@kms_flip@2x-dpms-vs-vblank-race-interruptible:
      shard-hsw:          DMESG-FAIL (fdo#102614, fdo#103060) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_flip@flip-vs-expired-vblank:
      shard-snb:          FAIL (fdo#105363) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
      shard-apl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-blt:
      shard-glk:          FAIL (fdo#103167) -> PASS +3

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-shrfb-draw-render:
      shard-hsw:          DMESG-WARN (fdo#102614) -> PASS +1

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-wc:
      shard-hsw:          DMESG-FAIL (fdo#103167, fdo#102614) -> PASS

    igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-wc:
      {shard-iclb}:       FAIL (fdo#103167) -> PASS +1

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-glk:          FAIL (fdo#103166) -> PASS +1

    igt@kms_plane_multiple@atomic-pipe-b-tiling-yf:
      {shard-iclb}:       FAIL (fdo#103166) -> PASS +3

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

    igt@pm_backlight@basic-brightness:
      {shard-iclb}:       DMESG-WARN (fdo#107724) -> PASS +2

    igt@pm_rpm@dpms-mode-unset-non-lpsp:
      shard-skl:          INCOMPLETE (fdo#107807) -> SKIP

    
    ==== Warnings ====

    igt@kms_cursor_crc@cursor-128x128-random:
      shard-kbl:          FAIL (fdo#103232) -> DMESG-FAIL (fdo#103232, fdo#103558, fdo#105602)

    igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
      shard-kbl:          FAIL (fdo#108590, fdo#108145) -> DMESG-FAIL (fdo#103558, fdo#105602, fdo#108145)

    igt@pm_backlight@fade_with_suspend:
      {shard-iclb}:       DMESG-FAIL (fdo#107724) -> FAIL (fdo#107847)

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#102250 https://bugs.freedesktop.org/show_bug.cgi?id=102250
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104671 https://bugs.freedesktop.org/show_bug.cgi?id=104671
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105454 https://bugs.freedesktop.org/show_bug.cgi?id=105454
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#105682 https://bugs.freedesktop.org/show_bug.cgi?id=105682
fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
fdo#106885 https://bugs.freedesktop.org/show_bug.cgi?id=106885
fdo#107361 https://bugs.freedesktop.org/show_bug.cgi?id=107361
fdo#107724 https://bugs.freedesktop.org/show_bug.cgi?id=107724
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#107847 https://bugs.freedesktop.org/show_bug.cgi?id=107847
fdo#107882 https://bugs.freedesktop.org/show_bug.cgi?id=107882
fdo#108039 https://bugs.freedesktop.org/show_bug.cgi?id=108039
fdo#108073 https://bugs.freedesktop.org/show_bug.cgi?id=108073
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108341 https://bugs.freedesktop.org/show_bug.cgi?id=108341
fdo#108342 https://bugs.freedesktop.org/show_bug.cgi?id=108342
fdo#108590 https://bugs.freedesktop.org/show_bug.cgi?id=108590
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (7 -> 7) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_5189 -> Patchwork_10885

CI_DRM_5189: 98966a91be483a9a681adc3a110877fe7ced049e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4725: 9dc7c41d1c600133d6e3e63f1941c2e75d23bd3b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10885: b67b3a1e1d92c9a6198b2e4756432822c86ab6c9 @ 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_10885/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx