Received: by 10.223.185.116 with SMTP id b49csp3658825wrg; Mon, 19 Feb 2018 03:59:17 -0800 (PST) X-Google-Smtp-Source: AH8x227w6FhGTAVo91ZVtVmudMZQKd86bBD+4LtDKyZQZEh67/nlOCPH+CyaXBFJTAd6la6oEFIg X-Received: by 10.99.5.197 with SMTP id 188mr12107891pgf.196.1519041557062; Mon, 19 Feb 2018 03:59:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519041557; cv=none; d=google.com; s=arc-20160816; b=rEHLVSsRnNCEARIZXFoDQ6w2tH2ace/fYmLvsnMMTyHnD7XadB4TyQuAo+MNmANiHD nr4YQzEsTUW+jhPhi5bXNxOIZlguMOo/mol39airMlGS0XSOGI6NC9rZ1Wf4Di6BJ6Ux 5+V4KsF0kfl5a3zAggpAjjc4APuziYU3qD7cd6p490/JLyZ85xocR0cbEqnOez5EoAVr n/oD0FjOY2nJASjR6py7PvU2oBN40thupq/n2A3GBlyy0uWd8CtjGk+hDplJcZc6UnuO mIRyArmOnsp9w52eGrzDSUp1yxp48X7CNmiYB9GRQE/f6vukizce3RkR56OAoLaZm5dB xBWg== 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:to :from:date:arc-authentication-results; bh=jGE5auVuwlPdOv9QLqzYz4To0OalDZ6U/uXQttrP94c=; b=dFufWSWPsF5ddZVGO2dU2gjFrbtoTebPI65NAE2vRyWADME+pIPmkgOLtEW/ubdB7X C2U7s18kQKRtu2nvNjaBeKfWJeGmNi2V/IVmjdiqoJfignv2v3T5Prl7N1wSBfoFC0Z+ UbSyXwSa7KOkBPkJSeE6KhEUsvoqS9vVdDtT9tivPStCzPX80j5EBYvaxQcZDBj8F0JO Z6mMhjVpc2FqONaWhQMP0AXSXYDGsw+60aXPLCsfOULfN+CCUi9HeqrC66p6gdMugCWI yUMnM3FsMjmH/VTcSXd6YuPJxNkdAfTWVkdZBBzsQ2+iWzRTMqOV/PgMa8uKFa/ZqHbU fjng== 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 m18si4330427pfi.280.2018.02.19.03.59.01; Mon, 19 Feb 2018 03:59:17 -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 S1752651AbeBSL6V (ORCPT + 99 others); Mon, 19 Feb 2018 06:58:21 -0500 Received: from mailout3.hostsharing.net ([176.9.242.54]:49711 "EHLO mailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbeBSL6U (ORCPT ); Mon, 19 Feb 2018 06:58:20 -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 B9F62100F00CE; Mon, 19 Feb 2018 12:58:18 +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 45390603E059; Mon, 19 Feb 2018 12:58:18 +0100 (CET) Date: Mon, 19 Feb 2018 12:58:17 +0100 From: Lukas Wunner To: Tejun Heo , Lai Jiangshan , Alex Deucher , Dave Airlie , Ben Skeggs , Archit Taneja , Ismo Toijala , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Liviu Dudau , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Hans de Goede Subject: Re: [Nouveau] [PATCH 0/5] Fix deadlock on runtime suspend in DRM drivers Message-ID: <20180219115817.4e5ml4jdh22kbvs4@wunner.de> References: <20180219113443.GU22199@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180219113443.GU22199@phenom.ffwll.local> 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 Mon, Feb 19, 2018 at 12:34:43PM +0100, Daniel Vetter wrote: > On Sun, Feb 11, 2018 at 10:38:28AM +0100, Lukas Wunner wrote: > > Fix a deadlock on hybrid graphics laptops that's been present since 2013: > > > > 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. > > Don't shut down the poll worker when runtime suspending, that' doesn't > work. If you need the poll work, then that means waking up the gpu every > few seconds. If you don't need it, then make sure the DRM_CONNECTOR_POLL > flags are set correctly (you can update them at runtime, the poll worker > will pick that up). > > That should fix the deadlock, and it's how we do it in i915 (where igt in > CI totally hammers the runtime pm support, and it seems to hold up). It would fix the deadlock but it's not an option on dual GPU laptops. Power consumption of the discrete GPU is massive (9 W on my machine). > > i915, malidp and msm "solved" this issue by not stopping the poll worker > > on runtime suspend. But this results in the GPU bouncing back and forth > > between D0 and D3 continuously. That's a total no-go for GPUs which > > runtime suspend to D3cold since every suspend/resume cycle costs a > > significant amount of time and energy. (i915 and malidp do not seem > > to acquire a runtime PM ref in the ->detect callbacks, which seems > > questionable. msm however does and would also deadlock if it disabled > > the poll worker on runtime suspend. cc += Archit, Liviu, intel-gfx) > > Well, userspace expects hotplug events, even when we runtime suspend > stuff. Hence waking shit up with polling. Imo ignoring hotplug events is a > pretty serious policy decision which is ok in the context of > vga_switcheroo, but not really as an automatic thing. E.g. usb also wakes > up if you plug something in, even with all the runtime pm stuff enabled. > Same for sata and everything else. On the MacBook Pro, the HPD pin of external DP and HDMI ports goes into the gmux controller, which sends an interrupt on hotplug even if the GPU is powered down. Apparently Optimus has a similar functionality, cf. 3a6536c51d5d. For the rare cases where an external VGA or DVI-A port is present, I guess it's reasonable to have the user wake up the machine manually. I'm not sure why nouveau polls ports on my laptop, the GK107 only has an LVDS and three DP ports, need to investigate. Thanks, Lukas