Received: by 10.223.185.116 with SMTP id b49csp712208wrg; Wed, 14 Feb 2018 05:58:33 -0800 (PST) X-Google-Smtp-Source: AH8x226kcw3l2j8wySl1pPNQQdfFXygj3dGV97xB3/55/qIYBYQqaF8P+TW8qn7p50mV4KeyWfHB X-Received: by 10.101.89.6 with SMTP id f6mr4018058pgu.22.1518616713833; Wed, 14 Feb 2018 05:58:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518616713; cv=none; d=google.com; s=arc-20160816; b=Lr3DiItboO6j84oZglinK5G21TUypTag05tvFj/nyAd8Dvg1Ski0qF85TMSQiPkg/i JbClyqAHYk7jajrcVyneyU2ZDveXj/1l8fr3CsFKpt7zIGAby8vY4Xcn2WOyl5PzTkVy vTRyz2K2/imM5qihb+l81TsZK/IsdeAOrrI+NrZCSR/LE0MwFA7mS8yzFvbg2Z43feCP OcZukSEZvCK3wuXEsc49YKK3V4ug3xk7Vdxk4DSbzD87kWPIDY2OlrHjmQYSJNyT9dAN SWpZTcBNwMGVVoIW88UxE+8/zx04T6lkb/4hQ7uXqTiFtegNim+rdGOECiKQaVMrXidg GzmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6VfOeopgKVQOJ0+43xHiwk8B3SBmv9Y85fumFpTOTY0=; b=FT7BI7BkvlOUp4CHzrsOO9lXN4v3E9cE5xojaLdLw7u296ZYJbZXYvKWVdhlvn0Tb2 1D0jvtK29xvB+Av0tF65PUs+gn3WUY9h18BAIup9NI4iFXFM3ABtExdFEsvyZloc4eil gGnLS+ECRN3oxPTmx69+R/iMUhDz6by1iNJBSTmsVcFCXZzRNxEUW/Q9Iirh7DEObNxg iRBFIteEPgYflc2Ew1wWfIMsiL5o5kJQnrMNqUsBQ1nyLSYKGuyxNxIunW2fFFzmLA/s yXN4280HHVgZW/yMKOFnCbj2mCLiEy8avzPyIvfJzSk3vK/onFm5xDqn1dOtf5+dk2zf ZS9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 199si1522873pfy.92.2018.02.14.05.58.19; Wed, 14 Feb 2018 05:58:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030605AbeBNN5P (ORCPT + 99 others); Wed, 14 Feb 2018 08:57:15 -0500 Received: from mailout3.hostsharing.net ([176.9.242.54]:59369 "EHLO mailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030221AbeBNN5O (ORCPT ); Wed, 14 Feb 2018 08:57:14 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by mailout3.hostsharing.net (Postfix) with ESMTPS id 2C0D9100AF492; Wed, 14 Feb 2018 14:57:12 +0100 (CET) Received: from localhost (p4FC5F26C.dip0.t-ipconnect.de [79.197.242.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id B6282603E059; Wed, 14 Feb 2018 14:57:11 +0100 (CET) Date: Wed, 14 Feb 2018 14:57:11 +0100 From: Lukas Wunner To: Liviu Dudau Cc: Tejun Heo , Lai Jiangshan , Alex Deucher , Dave Airlie , Ben Skeggs , dri-devel@lists.freedesktop.org, Peter Wu , nouveau@lists.freedesktop.org, Lyude Paul , Hans de Goede , Pierre Moreau , linux-kernel@vger.kernel.org, Ismo Toijala , intel-gfx@lists.freedesktop.org, Archit Taneja Subject: Re: [PATCH 0/5] Fix deadlock on runtime suspend in DRM drivers Message-ID: <20180214135711.vg7ht2htlprypmie@wunner.de> References: <20180213105506.GF9111@e110455-lin.cambridge.arm.com> <20180213115206.GA16075@wunner.de> <20180213154608.GI9111@e110455-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180213154608.GI9111@e110455-lin.cambridge.arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 13, 2018 at 03:46:08PM +0000, Liviu Dudau wrote: > On Tue, Feb 13, 2018 at 12:52:06PM +0100, Lukas Wunner wrote: > > On Tue, Feb 13, 2018 at 10:55:06AM +0000, Liviu Dudau wrote: > > > On Sun, Feb 11, 2018 at 10:38:28AM +0100, Lukas Wunner wrote: > > > > DRM drivers poll connectors in 10 sec intervals. The poll worker is > > > > stopped on ->runtime_suspend with cancel_delayed_work_sync(). However > > > > the poll worker invokes the DRM drivers' ->detect callbacks, which call > > > > pm_runtime_get_sync(). If the poll worker starts after runtime suspend > > > > has begun, pm_runtime_get_sync() will wait for runtime suspend to finish > > > > with the intention of runtime resuming the device afterwards. The result > > > > is a circular wait between poll worker and autosuspend worker. > > > > > > I think I understand the problem you are trying to solve, but I'm > > > struggling to understand where malidp makes any specific mistakes. First > > > of all, malidp is only a display engine, so there is no GPU attached to > > > it, but that is only a small clarification. Second, malidp doesn't use > > > directly any of the callbacks that you are referring to, it uses the > > > drm_cma_xxxx() API plus the generic drm_xxxx() call. So if there are any > > > issues there (as they might well be) I think they would apply to a lot > > > more drivers and the fix will involve more than just malidp, i915 and > > > msm. [snip] > > There are no ->detect hooks declared > > in drivers/gpu/drm/arm/, so it's unclear to me whether you're able to probe > > during runtime suspend. > > That's because the drivers in drivers/gpu/drm/arm do not have > connectors, they are only the CRTC part of the driver. Both hdlcd and > mali-dp use the component framework to locate an encoder in device tree > that will then provide the connectors. > > > > > hdlcd_drv.c and malidp_drv.c both enable output polling. Output polling > > is only necessary if you don't get HPD interrupts. > > That's right, hdlcd and mali-dp don't receive HPD interrupts because > they don't have any. And because we don't know ahead of time which > encoder/connector will be paired with the driver, we enable polling as a > safe fallback. > Looking e.g. at inno_hdmi.c (used by rk3036.dtsi), this calls drm_helper_hpd_irq_event() on receiving an HPD interrupt, and that function returns immediately if polling is not enabled. So you *have* to enable polling to receive HPD events. You seem to keep the crtc runtime active as long as it's bound to an encoder. If you do not ever intend to runtime suspend the crtc while an encoder is attached, you don't need to keep polling enabled during runtime suspend (because there's nothing to poll), but it shouldn't hurt either. If you would runtime suspend while an encoder is attached, then you would only runtime resume every 10 sec (upon polling) if the encoder was a child of the crtc and would support runtime suspend as well. That's because the PM core wakes the parent by default when a child runtime resumes. However in the DT's I've looked at, the encoder is never a child of the crtc and at least inno_hdmi.c doesn't use runtime suspend. So I think you're all green, I can't spot any grave issues here. Just be aware of the above-mentioned constraints. Thanks, Lukas