From: "Rafael J. Wysocki" Subject: Re: [PATCH v2 1/2] PCI / PM: Add needs_resume flag to avoid suspend complete optimization Date: Mon, 24 Apr 2017 22:56:40 +0200 Message-ID: <1741762.duLppskeDL@aspire.rjw.lan> References: <1493044063-2095-1-git-send-email-imre.deak@intel.com> <20170424200230.GA9910@wunner.de> <20170424204242.GA9933@wunner.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <20170424204242.GA9933@wunner.de> Sender: linux-pci-owner@vger.kernel.org To: Lukas Wunner Cc: Imre Deak , intel-gfx@lists.freedesktop.org, "Rafael J. Wysocki" , Bjorn Helgaas , linux-pci@vger.kernel.org List-Id: intel-gfx@lists.freedesktop.org On Monday, April 24, 2017 10:42:42 PM Lukas Wunner wrote: > On Mon, Apr 24, 2017 at 10:02:30PM +0200, Lukas Wunner wrote: > > On Mon, Apr 24, 2017 at 05:27:42PM +0300, Imre Deak wrote: > > > Some drivers - like i915 - may not support the system suspend direct > > > complete optimization due to differences in their runtime and system > > > suspend sequence. Add a flag that when set resumes the device before > > > calling the driver's system suspend handlers which effectively disables > > > the optimization. > > > > FWIW, there are at least two alternative solutions to this problem which > > do not require changes to the PCI core: > > > > (1) Add a ->prepare hook to i915_pm_ops which calls pm_runtime_get_sync() > > and a ->complete hook which calls pm_runtime_put(). > > Thinking a bit more about this, it's even simpler: The PM core acquires > a runtime PM ref in device_prepare() and releases it in device_complete(), > so it's sufficient to just call pm_runtime_resume() in a ->prepare hook > that's newly added to i915. No ->complete hook necessary. Tentative > patch below, based on drm-intel-fixes, would replace both of your patches. Calling it in ->prepare() means that everybody is now waiting for you to resume. Not quite optimal IMO. Thanks, Rafael