From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Alan Stern <stern@rowland.harvard.edu>, Greg KH <gregkh@suse.de>,
LKML <linux-kernel@vger.kernel.org>,
"Linux-pm mailing list" <linux-pm@lists.linux-foundation.org>,
linux-pci@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [RFC] PCI: Runtime power management
Date: Sat, 15 Aug 2009 16:41:56 +0200 [thread overview]
Message-ID: <200908151641.56571.rjw@sisk.pl> (raw)
In-Reply-To: <20090814223013.GB20015@srcf.ucam.org>
On Saturday 15 August 2009, Matthew Garrett wrote:
> On Fri, Aug 14, 2009 at 11:22:27PM +0200, Rafael J. Wysocki wrote:
>
> > Do you have any prototypes for that? I started working on it some time ago,
> > but then I focused on the core runtime PM framework.
>
> The native PCIe PME code?
Yes.
> There's some in the final patchset at
> http://bugzilla.kernel.org/show_bug.cgi?id=6892
Well, I don't like that very much.
> but I haven't had time to look into merging that into the current kernel.
> I also don't have anything to test against, which makes life more awkward.
One of my AMD-based boxes should be suitable for that.
> > > +static int acpi_pci_runtime_wake(struct pci_dev *dev, bool enable)
> > > +{
> > > + acpi_status status;
> > > + acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
> > > + struct acpi_device *acpi_dev;
> > > +
> >
> > Hm, I'd move that into ACPI as
> >
> > int acp_runtime_wake_enable(acpi_handle handle, bool enable)
> >
> > in which form it could also be useful to non-PCI devices.
>
> Hm. Yeah, that's not too bad an idea.
>
> > > + acpi_disable_gpe(acpi_dev->wakeup.gpe_device,
> > > + acpi_dev->wakeup.gpe_number);
> > > + }
> > > + return 0;
> > > +}
> >
> > Ah, that's the part I've always been missing!
> >
> > How exactly do we figure out which GPE is a wake-up one for given device?
> > IOW, how are the wakeup.gpe_device and wakeup.gpe_number fields populated?
>
> There's a field in the ACPI device definition in the DSDT that defines
> the needed GPE and which runlevels it can resume from.
>
> > > + error = pci_pm_suspend(dev);
> >
> > This has a chance to be confusing IMO. pci_pm_suspend() calls the driver's
> > ->suspend() routine, which is specific to suspend to RAM. So, this means
> > that drivers are supposed to implement ->runtime_suspend() only if they
> > want to do something _in_ _addition_ to the things done by
> > ->suspend() and ->suspend_noirq().
>
> Yes, that was how I'd planned it. An alternative would be for
> runtime_suspend to return a negative value if there's an error, 0 if the
> bus code should continue or a positive value if the runtime_suspend()
> call handles all of it and the bus code should just return immediately?
I just don't think that the existing suspend-resume callbacks are suitable for
runtime PM.
For example, in the majority of cases the existing suspend callbacks put
devices into D3_hot (or into the deepest low power state allowed by the
platform and hardware), but that means 10 ms latency, also for the resume
part. Do we want that for runtime PM for all drivers?
Perhaps a more suitable model would be to put devices into D1 first, if
available, and then put them into D2 and D3 after specific delays? Currently
the core framework doesn't provide any tools for that, but it may be worth
extending it for this purpose.
Also, I think it should be impossible to use the "legacy" callbacks for runtime
PM. They surely are not designed with that in mind.
> > > + disable_irq(pci_dev->irq);
> >
> > I don't really think it's necessary to disable the interrupt here. We prevent
> > drivers from receiving interrupts while pci_pm_suspend_noirq() is being run
> > during system-wide power transitions to protect them from receiving "alien"
> > interrupts they might be unable to handle, but in the runtime case I think the
> > driver should take care of protecting itself from that.
>
> That sounds fine. I didn't want to take a risk in that respect, but if
> we should be safe here I can just drop that.
As far as the PCI PM core is concerned, we should.
> > > + if (!enable || pci_pme_capable(dev, PCI_D3hot)) {
> > > + pci_pme_active(dev, enable);
> > > + pme_done = true;
> > > + }
> >
> > I don't really follow your intention here. The condition means that PME is
> > going to be enabled unless 'enable' is set and the device is not capable
> > of generating PMEs. However, if 'enable' is unset, we're still going to try
> > to enable the PME, even if the device can't generate it. Shouldn't that
> > be
>
> Hmm. That was copied from pci_enable_wake() just above, but it does seem
> a little bit odd. I suspect that that needs some clarification as well.
Ah, OK. If 'enabled' is unset, we want to disable the PME for all states, so
we call pci_pm_active(dev, false) unconditionally in that case. If 'enable' is
set, we only want to enable the PME if it's supported in given state. Sorry
for the noise.
> > Also, that assumes the device is going to be put into D3_hot, but do we know
> > that for sure?
>
> I'd be surprised if there's any hardware that supports wakeups from D2
> but not D3hot, so I just kept the code simple for now.
OK
Thanks,
Rafael
next prev parent reply other threads:[~2009-08-15 14:41 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-08 14:25 [PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 14) Rafael J. Wysocki
2009-08-09 21:13 ` [PATCH update] PM: Introduce core framework for run-time PM of I/O devices (rev. 15) Rafael J. Wysocki
2009-08-12 10:37 ` Magnus Damm
2009-08-12 15:47 ` Alan Stern
2009-08-12 20:13 ` Rafael J. Wysocki
2009-08-13 0:29 ` [RFC] PCI: Runtime power management Matthew Garrett
2009-08-13 0:35 ` [RFC] usb: Add support for runtime power management of the hcd Matthew Garrett
2009-08-13 12:16 ` [linux-pm] " Oliver Neukum
2009-08-13 12:30 ` Matthew Garrett
2009-08-13 14:26 ` Oliver Neukum
2009-08-13 21:42 ` Matthew Garrett
2009-08-13 15:22 ` Alan Stern
2009-08-13 21:47 ` Matthew Garrett
2009-08-13 15:17 ` [RFC] PCI: Runtime power management Alan Stern
2009-08-13 21:47 ` Matthew Garrett
2009-08-14 12:30 ` [linux-pm] " Matthew Garrett
2009-08-14 14:43 ` Alan Stern
2009-08-14 17:05 ` Rafael J. Wysocki
2009-08-14 17:13 ` Rafael J. Wysocki
2009-08-14 19:01 ` Alan Stern
2009-08-14 20:05 ` Rafael J. Wysocki
2009-08-14 22:21 ` Matthew Garrett
2009-08-15 14:18 ` Rafael J. Wysocki
2009-08-15 15:53 ` Alan Stern
2009-08-15 20:54 ` Rafael J. Wysocki
2009-08-15 20:58 ` Matthew Garrett
2009-08-15 21:21 ` Rafael J. Wysocki
2009-08-15 21:27 ` Matthew Garrett
2009-08-15 21:44 ` Rafael J. Wysocki
2009-08-16 16:09 ` Alan Stern
2009-08-16 15:57 ` Alan Stern
2009-08-16 16:04 ` Matthew Garrett
2009-08-16 15:50 ` Alan Stern
2009-08-14 17:37 ` Jesse Barnes
2009-08-14 19:15 ` Rafael J. Wysocki
2009-08-14 21:22 ` Rafael J. Wysocki
2009-08-14 22:30 ` Matthew Garrett
2009-08-15 14:41 ` Rafael J. Wysocki [this message]
2009-08-15 15:24 ` Rafael J. Wysocki
2009-08-13 20:56 ` [PATCH update 2x] PM: Introduce core framework for run-time PM of I/O devices (rev. 16) Rafael J. Wysocki
2009-08-13 21:03 ` Paul Mundt
2009-08-13 21:14 ` Rafael J. Wysocki
2009-08-14 9:08 ` Magnus Damm
2009-08-14 17:19 ` Rafael J. Wysocki
2009-08-14 17:25 ` [PATCH update 3x] PM: Introduce core framework for run-time PM of I/O devices (rev. 17) Rafael J. Wysocki
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=200908151641.56571.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=stern@rowland.harvard.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox