From patchwork Mon Dec 12 11:26:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 87656 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp1590395obb; Mon, 12 Dec 2016 03:26:57 -0800 (PST) X-Received: by 10.99.158.18 with SMTP id s18mr108421670pgd.88.1481542017519; Mon, 12 Dec 2016 03:26:57 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id b139si43039637pfb.162.2016.12.12.03.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 03:26:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2729E6E054; Mon, 12 Dec 2016 11:26:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D6C66E054 for ; Mon, 12 Dec 2016 11:26:51 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id uBCBQnEZ031741; Mon, 12 Dec 2016 05:26:49 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id uBCBQmM2024096; Mon, 12 Dec 2016 05:26:48 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Mon, 12 Dec 2016 05:26:48 -0600 Received: from [10.1.3.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id uBCBQlfX018615; Mon, 12 Dec 2016 05:26:47 -0600 From: Jyri Sarha Subject: Re: tilcdc: vblank wait timed out To: Bartosz Golaszewski References: Message-ID: <1893554f-cdd7-4069-9b66-f47a155612e2@ti.com> Date: Mon, 12 Dec 2016 13:26:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Cc: Kevin Hilman , Sekhar Nori , linux-drm X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 12/05/16 19:07, Bartosz Golaszewski wrote: > 2016-12-05 12:01 GMT+01:00 Bartosz Golaszewski : >> Hi Jyri, >> >> I pulled your recent tilcdc pull request on top of v4.9 and Sekhar's >> davinci branch (+ vga dac DT)[1]. >> >> I'm getting "vblank wait timed out" errors when running simple modetest[2]. >> >> This error happened before with the drm_bridge series[3], but went >> away at one of the subsequent patch versions. >> >> Could you please verify that you see the same error and advise on what >> could be the reason? I'm investigating on my own as well. >> >> Best regards, >> Bartosz Golaszewski >> >> [1] https://github.com/brgl/linux/tree/tilcdc/modetest_error >> [2] http://pastebin.com/rCM44Uds >> [3] http://www.spinics.net/lists/dri-devel/msg123732.html > Sorry, I almost forgot about this problem. > This seems like some END_OF_FRAME0 interrupt-related race condition. I can not see any race related to vblank event sending. The drm_modeset_lock_crtc() is there exactly for all ongoing operations to complete before shutting down the crtc. I think the problem is a missing END_OF_FRAME0 interrupt when sync lost interrupt flood happens. > Increasing the timeout in drm_atomic_helper_wait_for_vblanks() from 50 > to 100 and dropping drm_modeset_lock_crtc()/drm_modeset_unlock_crtc() Not taking the lock causes drm_crtc_vblank_off() to be called in tilcdc_crtc_disable(), before the time out happens. However, this is racy because there is a pending commit still on going and executing in parallel with the recovery work. > in tilcdc_crtc_recover_work() makes the warning disappear. Also: > calling drm_crtc_vblank_off() additionally before locking the crtc in > tilcdc_crtc_recover_work() also seems to fix the issue 90% of times. I I wonder what happens in that 10% off the times when when that does not help... > have been unable to figure out a reliable solution today though. > Does the attached patch help with the issue? Best regards, Jyri >From 35957a10ed12188a3f8ed63c694929eb1bb3d9b6 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Mon, 12 Dec 2016 12:44:47 +0200 Subject: [PATCH] drm/tilcdc: Send pendig vblank event before recovery work Send the pending vblank event without waiting for the END_OF_FRAME0 interrupt. Sometimes the END_OF_FRAME0 interrupt does not come when LCDC suffers from the sync lost flood and this causes a nasty warning in drm_atomic_helper_wait_for_vblanks(). Signed-off-by: Jyri Sarha --- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 9942b05..00ce9d2 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -566,9 +566,19 @@ static void tilcdc_crtc_recover_work(struct work_struct *work) struct tilcdc_crtc *tilcdc_crtc = container_of(work, struct tilcdc_crtc, recover_work); struct drm_crtc *crtc = &tilcdc_crtc->base; + struct drm_device *dev = crtc->dev; + struct drm_pending_vblank_event *event; + unsigned long flags; dev_info(crtc->dev->dev, "%s: Reset CRTC", __func__); + spin_lock_irqsave(&dev->event_lock, flags); + event = tilcdc_crtc->event; + tilcdc_crtc->event = NULL; + if (event) + drm_crtc_send_vblank_event(crtc, event); + spin_unlock_irqrestore(&dev->event_lock, flags); + drm_modeset_lock_crtc(crtc, NULL); if (!tilcdc_crtc_is_on(crtc)) -- 1.9.1