From patchwork Tue Dec 4 09:46:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 10711409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B618109C for ; Tue, 4 Dec 2018 09:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E68D2B6D1 for ; Tue, 4 Dec 2018 09:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82EA22B74E; Tue, 4 Dec 2018 09:45:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F4E82B6D1 for ; Tue, 4 Dec 2018 09:45:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A680789FD4; Tue, 4 Dec 2018 09:45:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A79D89FD4 for ; Tue, 4 Dec 2018 09:45:48 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2018 01:45:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,313,1539673200"; d="scan'208";a="256647888" Received: from unknown (HELO sorvi.fi.intel.com) ([10.237.72.64]) by orsmga004.jf.intel.com with ESMTP; 04 Dec 2018 01:45:46 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Tue, 4 Dec 2018 11:46:39 +0200 Message-Id: <20181204094639.15856-1-mika.kahola@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATCH] drm/i915: Wait one vblank before sending hotplug event to userspace X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Occasionally, we get the following error in our CI runs [853.132830] Workqueue: events i915_hotplug_work_func [i915] [853.132844] RIP: 0010:drm_wait_one_vblank+0x19b/0x1b0 [853.132852] Code: fe ff ff e8 b7 4e a6 ff 48 89 e6 4c 89 ff e8 6c 5f ab ff 45 85 ed 0f 85 15 ff ff ff 89 ee 48 c7 c7 e8 03 10 82 e8 b5 4b a6 ff <0f> 0b e9 00 ff ff ff 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 8b [853.132859] RSP: 0018:ffffc9000146bca0 EFLAGS: 00010286 [853.132866] RAX: 0000000000000000 RBX: ffff88849ef00000 RCX: 0000000000000000 [853.132873] RDX: 0000000000000007 RSI: ffffffff820c6f58 RDI: 00000000ffffffff [853.132879] RBP: 0000000000000000 R08: 000000007ffc637a R09: 0000000000000000 [853.132884] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [853.132890] R13: 0000000000000000 R14: 000000000000d0c2 R15: ffff8884a491e680 [853.132897] FS: 0000000000000000(0000) GS:ffff8884afe80000(0000) knlGS:0000000000000000 [853.132904] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [853.132910] CR2: 00007f63bf0df000 CR3: 0000000005210006 CR4: 0000000000760ee0 [853.132916] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [853.132922] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [853.132927] PKRU: 55555554 [853.132932] Call Trace: [853.132949] ? wait_woken+0xa0/0xa0 [853.133068] intel_dp_retrain_link+0x130/0x190 [i915] [853.133176] intel_ddi_hotplug+0x54/0x2e0 [i915] [853.133298] i915_hotplug_work_func+0x1a9/0x240 [i915] [853.133324] process_one_work+0x262/0x630 [853.133349] worker_thread+0x37/0x380 [853.133365] ? process_one_work+0x630/0x630 [853.133373] kthread+0x119/0x130 [853.133383] ? kthread_park+0x80/0x80 [853.133400] ret_from_fork+0x3a/0x50 [853.133433] irq event stamp: 1426928 I suspect that this is caused by a racy condition when retraining the DisplayPort link. My proposal is to wait for one additional vblank event before we send out a hotplug event to userspace for reprobing. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108835 Cc: Manasi Navare Signed-off-by: Mika Kahola --- drivers/gpu/drm/i915/intel_dp.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a6907a1761ab..6ce7d54e49af 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -6746,6 +6746,10 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work) { struct intel_connector *intel_connector; struct drm_connector *connector; + struct drm_connector_state *conn_state; + struct drm_i915_private *dev_priv; + struct intel_crtc *crtc; + struct intel_crtc_state *crtc_state; intel_connector = container_of(work, typeof(*intel_connector), modeset_retry_work); @@ -6753,6 +6757,14 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work) DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); + dev_priv = to_i915(connector->dev); + conn_state = intel_connector->base.state; + + crtc = to_intel_crtc(conn_state->crtc); + crtc_state = to_intel_crtc_state(crtc->base.state); + + WARN_ON(!intel_crtc_has_dp_encoder(crtc_state)); + /* Grab the locks before changing connector property*/ mutex_lock(&connector->dev->mode_config.mutex); /* Set connector link status to BAD and send a Uevent to notify @@ -6761,6 +6773,21 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work) drm_connector_set_link_status_property(connector, DRM_MODE_LINK_STATUS_BAD); mutex_unlock(&connector->dev->mode_config.mutex); + + /* Suppress underruns caused by re-training */ + intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false); + if (crtc_state->has_pch_encoder) + intel_set_pch_fifo_underrun_reporting(dev_priv, + intel_crtc_pch_transcoder(crtc), false); + + /* Keep underrun reporting disabled until things are stable */ + intel_wait_for_vblank(dev_priv, crtc->pipe); + + intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, true); + if (crtc_state->has_pch_encoder) + intel_set_pch_fifo_underrun_reporting(dev_priv, + intel_crtc_pch_transcoder(crtc), true); + /* Send Hotplug uevent so userspace can reprobe */ drm_kms_helper_hotplug_event(connector->dev); }