Received: by 10.223.185.116 with SMTP id b49csp3788363wrg; Tue, 13 Feb 2018 07:47:42 -0800 (PST) X-Google-Smtp-Source: AH8x226VhD2wNVb0D1UL5PRkAxBpQoxanCxtE10iCieK7pxnxaqH/WXoljgXbqSoBaWxfQPGsRaK X-Received: by 10.99.107.198 with SMTP id g189mr1348023pgc.142.1518536861992; Tue, 13 Feb 2018 07:47:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518536861; cv=none; d=google.com; s=arc-20160816; b=o95KccEcccP+AyBEWZx91d5hDfwcPWYg1eqSuND/r1GjMHiwkGfA0evNvR9DBY/LLp Z318d347GkvJ4w8SUzP8xNA7p3lTa1ud+HKVCRu/9Zl3mO75AQQVPGm1F4NP3QIUm/pw jrB45f1GHzktNkSJK8eUHh725m4ueaiSIE/KdCoWVbtXVM4RQCet4CzqmgHb3jNnJgA0 WaGg6J2eMXbZMV6LtrUfNOin7ubs4AuyIsirpEwijh5YlGy5HhIBIVSkjx1n9qlIAc58 Zr+Wgyc+nxF1YWnNA03rtpS8LQ+1WcmjIYJu/cDGs+GQVlwcmqVYRqp0s5t2+kgrkxlH I0SA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=n0IzCRRFkMGrEoaFYE3ohUSbw5QvW2JbjKySvUiQYaY=; b=Wvozj55ygrocTt3jU0LdfCPSxI5FApKyiFj3FRHfLivZrrYYP+5kch8sYfRqFKbjS2 osvo2P0DskAPTLFo6VJxpu2H4OEuYZf4K4LCBj69/gyOwP61IzLWRtNjiqADHJP/0Oea XWhuiwT1DmfDGml41vOwvpPOF1LOlFG6GJ+hTIaKGl4Q+5kohuayfB6dI0dcdVUUQevZ m7WmdvMx6oYS7Epc6/+lpszLGC5o/GHqFo2SgXASYHtlvfweCrUWmTEiGZvbk0KSJx04 3g0ZmeWxMmvZBj0NfdAFhYhwBDtvRyRw9CHOCS6xJLNbhseMH4U7YJiZrghkXm4bjyrL PZJQ== 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 a23si1206948pgd.610.2018.02.13.07.47.27; Tue, 13 Feb 2018 07:47:41 -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 S934083AbeBMPqM (ORCPT + 99 others); Tue, 13 Feb 2018 10:46:12 -0500 Received: from foss.arm.com ([217.140.101.70]:59646 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751465AbeBMPqL (ORCPT ); Tue, 13 Feb 2018 10:46:11 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD0C81435; Tue, 13 Feb 2018 07:46:10 -0800 (PST) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8A8193F41F; Tue, 13 Feb 2018 07:46:10 -0800 (PST) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id E6434680211; Tue, 13 Feb 2018 15:46:08 +0000 (GMT) Date: Tue, 13 Feb 2018 15:46:08 +0000 From: Liviu Dudau To: Lukas Wunner 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: <20180213154608.GI9111@e110455-lin.cambridge.arm.com> References: <20180213105506.GF9111@e110455-lin.cambridge.arm.com> <20180213115206.GA16075@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180213115206.GA16075@wunner.de> User-Agent: Mutt/1.9.3 (2018-01-21) 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 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. > > I don't know if malidp makes any specific mistakes and didn't mean to > cast it in a negative light, sorry. I did not take what you've said as a negative thing, only wanted to understand how you came to your conclusions. > > So a lot of DRM drivers acquire a runtime PM ref in the connector ->detect > hook because they can't probe connectors while runtime suspended. > E.g. for a PCI device, probing might require mmio access, which isn't > possible outside of power state D0. 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. > > You're not disabling polling upon runtime suspend. Thus, if a runtime PM > ref is acquired during polling (such as in a ->detect hook), the GPU will > be runtime resumed every 10 secs. You may want to verify that's not the > case. If you decide that you do want to stop polling during runtime > suspend because it runtime resumes the GPU continuously, you'll need the > helper introduced in this series. So by cc'ing you I just wanted to keep > you in the loop about an issue that may potentially affect your driver. Again, we have no GPU linked to us and the polling during runtime suspend should be handled by the driver for the paired encoder, not by us. I understand the potential issue but I'm struggling to understand if it really applies to the drivers/gpu/drm/arm drivers other than in an abstract way. Best regards, Liviu > > Let me know if there are any questions. > > Thanks, > > Lukas -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯