Bug 107365

Summary: [drm-tip][BISECT] drm_atomic_helper_wait_for_dependencies fails with flip_done timed out
Product: DRI Reporter: dmummenschanz <dmummenschanz>
Component: DRM/IntelAssignee: Intel GFX Bugs mailing list <intel-gfx-bugs>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: blocker    
Priority: highest CC: chris, intel-gfx-bugs, lyude, ville.syrjala
Version: DRI git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: KBL i915 features: display/DP MST
Attachments:
Description Flags
dmesg after startx none

Description dmummenschanz@web.de 2018-07-24 15:32:31 UTC
Created attachment 140808 [details]
dmesg after startx

Hi,

on my KBL Notebook with two connected connected monitors the latest drm-tip git fails to start Xorg and freezes with 

[   25.312146] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:69:pipe C] flip_done timed out
[   35.552145] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:102:DP-4] flip_done timed out
[   45.792134] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:56:plane 1C] flip_done timed out
[   56.032156] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:69:pipe C] flip_done timed out
[   66.272238] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:69:pipe C] flip_done timed out
[   76.512129] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:102:DP-4] flip_done timed out


Full dmesg drm.debug=0xe attached.

Regards
Dieter
Comment 1 Rodrigo Vivi 2018-08-28 20:19:36 UTC
Raising to highest. I believe this is related to some other MST regressions that are piling up.

Dieter, since you have a point in time where this regression started, could you please try a bisect?
Comment 2 dmummenschanz@web.de 2018-08-29 04:49:54 UTC
Updated with latest post on intel-gfx:


I have a Lenovo T470 notebook with a KBL (GT2) CPU connected to a docking station with two IPS monitors connected.
According to xrandr the primary laptop screen is connected to eDP-1 and the monitors are connected to DP-2-1 and DP-2-2.

This setup worked fine until kernel 4.19-rc1. After booting into the framebuffer console the screen connected to DP-2-2 won't come on. 

When I try to startx my system locks up!

I've cranked the debug level up to drm.debug=0xe. I'm not an expert but this looks suspicious:
...
[    4.465645] [drm:intel_mst_enable_dp [i915]] active links 2
[    4.465655] [drm:intel_dp_check_mst_status [i915]] got esi 02 00 00
[    4.466964] [drm:intel_mst_enable_dp [i915]] *ERROR* Timed out waiting for ACT sent
[    4.478043] [drm:drm_dp_check_act_status [drm_kms_helper]] failed to get ACT bit 1 after 30 retries
....
and later:
[   14.669161] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:69:pipe C] flip_done timed out
[   14.669269] [drm:verify_connector_state.isra.86 [i915]] [CONNECTOR:100:DP-3]
[   14.669328] [drm:intel_atomic_commit_tail [i915]] [CRTC:55:pipe B]
....
and finally after firing up X:
[   17.741227] [drm:edp_panel_vdd_off_sync [i915]] Turning eDP port A VDD off
[   17.741347] [drm:edp_panel_vdd_off_sync [i915]] PP_STATUS: 0x80000008 PP_CONTROL: 0x00000007
[   24.909159] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:69:pipe C] flip_done timed out

Full dmesg is provided here: https://pastebin.com/nDwvQPy6

Xorg.log doesn't reveal anything interesting. The last line in the log before freezing:
[    73.632] (II) xfree86: Adding drm device (/dev/dri/card0)

Full log: https://pastebin.com/9RaAYhjP

This is what xrandr shows with kernel 4.18 (with 4.19 I can't get that far):

https://pastebin.com/cYSf9CyS

I've tried various settings like switching monitors or switching the dockingstation nothing helps.
Comment 3 dmummenschanz@web.de 2018-08-30 04:54:31 UTC
So far I've failed to rollback my drm-tip branch to any of the commits I suspect - probably due to all this rebase during development. It seems I always end up in someone elses branch. I'm not an git expert and would apprechiate any hint or help on howto revert/rollback in drm-tip kernel tree.
Comment 4 Rodrigo Vivi 2018-08-30 14:27:33 UTC

ignore the rebasing nature of drm-tip and try to find a bad and a good commit..

bad: checkout/reset to a recent commit hash on drivers/gpu/drm/i915 and make sure it is bad...

good: checkout/reset to a commit hash that you think that is for sure good... in the past than you test and confirm it is indeed good. If not good keep going to the past directly on the hashes....

Then you start a git bisect
git bisect start
git bisect bad <bad hash>
git bisect good <good hash>
Comment 5 dmummenschanz@web.de 2018-08-31 09:55:08 UTC
Gotcha!

Found the bad commit (and got a nice learning curve in working with git and bisecting the kernel btw. =) )

https://cgit.freedesktop.org/drm-tip/commit/?id=afb2c4437daeed2d0c49e246ad1ad4def5d913cd
drm/i915/ddi: Push pipe clock enabling to encoders

Hope this helps.

If I can provide anything else plz let me know.

Regards
Comment 6 Imre Deak 2018-08-31 15:34:20 UTC
(In reply to dmummenschanz@web.de from comment #5)
> Gotcha!
> 
> Found the bad commit (and got a nice learning curve in working with git and
> bisecting the kernel btw. =) )
> 
> https://cgit.freedesktop.org/drm-tip/commit/
> ?id=afb2c4437daeed2d0c49e246ad1ad4def5d913cd
> drm/i915/ddi: Push pipe clock enabling to encoders
> 
> Hope this helps.
> 
> If I can provide anything else plz let me know.
> 
> Regards

Thanks for the bisect (also for Lyude). Could you try if the following solves it:

commit 2fe0c446f3468ca85055ec93dd9e2524844955cd
Author: Imre Deak <imre.deak@intel.com>
Date:   Fri Aug 31 18:28:31 2018 +0300

    drm/i915/dp_mst: Fix enabling pipe clock for all streams
    
    Signed-off-by: Imre Deak <imre.deak@intel.com>

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index f3b115ce4029..dcb1a98d624d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2912,7 +2912,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 
 	icl_enable_phy_clock_gating(dig_port);
 
-	intel_ddi_enable_pipe_clock(crtc_state);
+	if (!is_mst)
+		intel_ddi_enable_pipe_clock(crtc_state);
 }
 
 static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
@@ -3015,14 +3016,14 @@ static void intel_ddi_post_disable_dp(struct intel_encoder *encoder,
 	bool is_mst = intel_crtc_has_type(old_crtc_state,
 					  INTEL_OUTPUT_DP_MST);
 
-	intel_ddi_disable_pipe_clock(old_crtc_state);
-
-	/*
-	 * Power down sink before disabling the port, otherwise we end
-	 * up getting interrupts from the sink on detecting link loss.
-	 */
-	if (!is_mst)
+	if (!is_mst) {
+		intel_ddi_disable_pipe_clock(old_crtc_state);
+		/*
+		 * Power down sink before disabling the port, otherwise we end
+		 * up getting interrupts from the sink on detecting link loss.
+		 */
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	}
 
 	intel_disable_ddi_buf(encoder);
 
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 352e5216cc65..77920f1a3da1 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -166,6 +166,8 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
 	struct intel_connector *connector =
 		to_intel_connector(old_conn_state->connector);
 
+	intel_ddi_disable_pipe_clock(old_crtc_state);
+
 	/* this can fail */
 	drm_dp_check_act_status(&intel_dp->mst_mgr);
 	/* and this can also fail */
@@ -249,6 +251,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
 	I915_WRITE(DP_TP_STATUS(port), temp);
 
 	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr);
+
+	intel_ddi_enable_pipe_clock(pipe_config);
 }
 
 static void intel_mst_enable_dp(struct intel_encoder *encoder,
Comment 7 dmummenschanz@web.de 2018-08-31 17:22:34 UTC
Imre,

I've applied your patch to drm-tip HEAD and can confirm that it solves the problem! All screens are comming on and I can start X with all three screens active. No dmesg errors anymore.

Thank you very much for providing this fix! :)

Regards
Dieter
Comment 8 Imre Deak 2018-08-31 17:25:54 UTC
(In reply to dmummenschanz@web.de from comment #7)
> Imre,
> 
> I've applied your patch to drm-tip HEAD and can confirm that it solves the
> problem! All screens are comming on and I can start X with all three screens
> active. No dmesg errors anymore.
> 
> Thank you very much for providing this fix! :)
> 
> Regards
> Dieter

Thanks a lot for trying, will follow up with it. The "fix" just makes my original changes truly have no functional change :/
Comment 9 Imre Deak 2018-09-01 06:24:44 UTC
Fix merged to drm-tip:

commit 2b5cf4ef541f1b2facaca58cae5e8e0b5f19ad4c
Author: Imre Deak <imre.deak@intel.com>
Date:   Fri Aug 31 20:47:39 2018 +0300

    drm/i915/dp_mst: Fix enabling pipe clock for all streams
Comment 10 Lakshmi 2018-09-07 14:29:04 UTC
Closing as resolved/fixed.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.