All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Nigel Cunningham <ncunningham@crca.org.au>,
	Greg KH <gregkh@suse.de>, Linux SCSI <linux-scsi@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	James Bottomley <James.Bottomley@suse.de>,
	pm list <linux-pm@lists.linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: [PATCH 2/8] PM: Asynchronous suspend and resume of devices
Date: Sun, 24 Jan 2010 11:37:14 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1001241128250.28594-100000__31859.3048993082$1264351097$gmane$org@netrider.rowland.org> (raw)
In-Reply-To: <201001240035.37550.rjw@sisk.pl>

On Sun, 24 Jan 2010, Rafael J. Wysocki wrote:

> The async threads started for different devices as a result of
> calling async_schedule() are synchronized with each other and with
> the main suspend/resume thread with the help of completions, in the
> following way:
> (1) There is a completion, power.completion, for each device object.
> (2) Each device's completion is reset before calling async_schedule()
>     for the device or, in the case of devices with the
>     power.async_suspend flags unset, before executing the device's
>     suspend and resume callbacks.
> (3) During suspend, right before running the bus type, device type
>     and device class suspend callbacks for the device, the PM core
>     waits for the completions of all the device's children to be
>     completed.
> (4) During resume, right before running the bus type, device type and
>     device class resume callbacks for the device, the PM core waits
>     for the completion of the device's parent to be completed.
> (5) The PM core completes power.completion for each device right
>     after the bus type, device type and device class suspend (or
>     resume) callbacks executed for the device have returned.

...

>  /**
> + * dpm_wait - Wait for a PM operation to complete.
> + * @dev: Device to wait for.
> + * @async: If unset, wait only if the device's power.async_suspend flag is set.
> + */
> +static void dpm_wait(struct device *dev, bool async)
> +{
> +	if (!dev)
> +		return;
> +
> +	if (async || dev->power.async_suspend)
> +		wait_for_completion(&dev->power.completion);
> +}

There needs to be a public interface to this function available for 
drivers that have non-tree constraints.  The arguments should be the 
device to wait for and the device doing the waiting (needed only to 
determine whether the caller is running synchronously or not).

This will be necessary for USB.  In fact, your current code (with patch 
7/8 applied) is subject to a race that will sometimes cause a 
non-high-speed USB device to fail to resume from hibernation.

Alan Stern

  reply	other threads:[~2010-01-24 16:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-23 23:33 [PATCH 0/8] PM: Asynchronous suspen and resume Rafael J. Wysocki
2010-01-23 23:34 ` [PATCH 1/8] PM: Add parent information to timing messages Rafael J. Wysocki
2010-01-23 23:34   ` Rafael J. Wysocki
2010-02-25  7:01   ` Pavel Machek
2010-02-25  7:01   ` Pavel Machek
2010-01-23 23:35 ` [PATCH 2/8] PM: Asynchronous suspend and resume of devices Rafael J. Wysocki
2010-01-24 16:37   ` Alan Stern [this message]
2010-01-24 16:37   ` Alan Stern
2010-01-24 16:37     ` Alan Stern
2010-01-24 20:09     ` Rafael J. Wysocki
2010-01-24 22:30       ` Alan Stern
2010-01-24 23:27         ` Rafael J. Wysocki
2010-01-25  3:12           ` Alan Stern
2010-01-25  3:12           ` Alan Stern
2010-01-25 21:26             ` Rafael J. Wysocki
2010-01-25 22:04               ` Alan Stern
2010-01-25 22:04               ` Alan Stern
2010-02-01 21:00               ` [PATCH] USB: implement non-tree resume ordering constraints for PCI host controllers Alan Stern
2010-01-25 21:26             ` [PATCH 2/8] PM: Asynchronous suspend and resume of devices Rafael J. Wysocki
2010-01-24 23:27         ` Rafael J. Wysocki
2010-01-24 22:30       ` Alan Stern
2010-01-24 20:09     ` Rafael J. Wysocki
2010-01-23 23:35 ` Rafael J. Wysocki
2010-01-23 23:36 ` [PATCH 3/8] PM: Add a switch for disabling/enabling asynchronous suspend/resume Rafael J. Wysocki
2010-01-23 23:36 ` Rafael J. Wysocki
2010-01-23 23:38 ` [PATCH 4/8] PM: Add facility for advanced testing of async suspend/resume Rafael J. Wysocki
2010-01-23 23:38 ` Rafael J. Wysocki
2010-01-23 23:38 ` [PATCH 5/8] PM: Start asynchronous resume threads upfront Rafael J. Wysocki
2010-01-23 23:38 ` Rafael J. Wysocki
2010-01-23 23:39 ` [PATCH 6/8] PM: Allow PCI devices to suspend/resume asynchronously Rafael J. Wysocki
2010-01-23 23:39 ` Rafael J. Wysocki
2010-01-23 23:40 ` [PATCH 7/8] PM: Allow USB " Rafael J. Wysocki
2010-01-23 23:40 ` Rafael J. Wysocki
2010-01-23 23:41 ` [PATCH 8/8] PM: Allow SCSI " Rafael J. Wysocki
2010-01-23 23:41 ` 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='Pine.LNX.4.44L0.1001241128250.28594-100000__31859.3048993082$1264351097$gmane$org@netrider.rowland.org' \
    --to=stern@rowland.harvard.edu \
    --cc=James.Bottomley@suse.de \
    --cc=arjan@infradead.org \
    --cc=gregkh@suse.de \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ncunningham@crca.org.au \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    /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.