From: Lukas Wunner <lukas@wunner.de>
To: Imre Deak <imre.deak@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
intel-gfx@lists.freedesktop.org,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 1/2] PCI / PM: Add needs_resume flag to avoid suspend complete optimization
Date: Tue, 25 Apr 2017 11:46:42 +0200 [thread overview]
Message-ID: <20170425094642.GA10128@wunner.de> (raw)
In-Reply-To: <20170425085507.GA3719@ideak-desk.fi.intel.com>
On Tue, Apr 25, 2017 at 11:55:07AM +0300, Imre Deak wrote:
> On Tue, Apr 25, 2017 at 08:21:49AM +0200, Lukas Wunner wrote:
> > On Mon, Apr 24, 2017 at 10:56:40PM +0200, Rafael J. Wysocki wrote:
> > > 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.
> >
> > Okay, understood.
> >
> > However in the absence of a device_link from the HDA device (consumer)
> > to the GPU (supplier), there's no guarantee that the GPU is resumed
> > when the HDA device needs it due to the asynchronous invocation of
> > the ->suspend hooks. This is assuming that the HDA device already
> > needs the GPU during ->suspend phase.
>
> i915 has ->resume_early and ->suspend_late hooks that provides the above
> guarantee.
Employing device links is preferable IMO:
* Less code. Just find the HDA device in your ->probe hook and call
device_link_add(). Alternatively do it from the HDA driver. Even
adding the link from both drivers should be fine. I can provide
you with an evaluation patch if you'd like.
* Avoidance of doing things behind the PM core's back.
* Takes care of more stuff than just system sleep (e.g. shutdown ordering).
Thanks,
Lukas
WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: Imre Deak <imre.deak@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v2 1/2] PCI / PM: Add needs_resume flag to avoid suspend complete optimization
Date: Tue, 25 Apr 2017 11:46:42 +0200 [thread overview]
Message-ID: <20170425094642.GA10128@wunner.de> (raw)
In-Reply-To: <20170425085507.GA3719@ideak-desk.fi.intel.com>
On Tue, Apr 25, 2017 at 11:55:07AM +0300, Imre Deak wrote:
> On Tue, Apr 25, 2017 at 08:21:49AM +0200, Lukas Wunner wrote:
> > On Mon, Apr 24, 2017 at 10:56:40PM +0200, Rafael J. Wysocki wrote:
> > > 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.
> >
> > Okay, understood.
> >
> > However in the absence of a device_link from the HDA device (consumer)
> > to the GPU (supplier), there's no guarantee that the GPU is resumed
> > when the HDA device needs it due to the asynchronous invocation of
> > the ->suspend hooks. This is assuming that the HDA device already
> > needs the GPU during ->suspend phase.
>
> i915 has ->resume_early and ->suspend_late hooks that provides the above
> guarantee.
Employing device links is preferable IMO:
* Less code. Just find the HDA device in your ->probe hook and call
device_link_add(). Alternatively do it from the HDA driver. Even
adding the link from both drivers should be fine. I can provide
you with an evaluation patch if you'd like.
* Avoidance of doing things behind the PM core's back.
* Takes care of more stuff than just system sleep (e.g. shutdown ordering).
Thanks,
Lukas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-04-25 9:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 14:27 [PATCH v2 1/2] PCI / PM: Add needs_resume flag to avoid suspend complete optimization Imre Deak
2017-04-24 14:27 ` Imre Deak
2017-04-24 14:27 ` [PATCH v2 2/2] drm/i915: Prevent the system " Imre Deak
2017-04-24 14:27 ` Imre Deak
2017-04-24 20:16 ` Lukas Wunner
2017-04-25 10:28 ` Imre Deak
2017-04-25 10:28 ` Imre Deak
2017-04-27 14:17 ` Lofstedt, Marta
2017-04-24 14:45 ` ✓ Fi.CI.BAT: success for series starting with [v2,1/2] PCI / PM: Add needs_resume flag to avoid " Patchwork
2017-04-24 20:02 ` [PATCH v2 1/2] " Lukas Wunner
2017-04-24 20:02 ` Lukas Wunner
2017-04-24 20:42 ` Lukas Wunner
2017-04-24 20:42 ` Lukas Wunner
2017-04-24 20:56 ` Rafael J. Wysocki
2017-04-25 6:21 ` Lukas Wunner
2017-04-25 6:21 ` Lukas Wunner
2017-04-25 8:55 ` Imre Deak
2017-04-25 9:46 ` Lukas Wunner [this message]
2017-04-25 9:46 ` Lukas Wunner
2017-04-25 10:22 ` Imre Deak
2017-04-25 10:22 ` Imre Deak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170425094642.GA10128@wunner.de \
--to=lukas@wunner.de \
--cc=bhelgaas@google.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.