public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: "linux-pm" <linux-pm@lists.linux-foundation.org>,
	"linux-acpi" <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Zhang Rui <rui.zhang@intel.com>, Len Brown <lenb@kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [RFC][PATCH 1/3] PM: Asynchronous resume of devices
Date: Sat, 15 Aug 2009 22:59:18 +0200	[thread overview]
Message-ID: <200908152259.18417.rjw@sisk.pl> (raw)
In-Reply-To: <20090814163328.GF1626@ucw.cz>

On Friday 14 August 2009, Pavel Machek wrote:
> > The patch below introduces a mechanism allowing some devices to be
> > resumed asynchronously, using completions with the following rules:
> > (1) There is a completion, dev->power.comp, for each device object.
> > (2) All of these completions are reset before suspend as well as
> >     each resume stage (dpm_resume_noirq(), dpm_resume()).
> > (3) If dev->power.async_suspend is set for dev or for its parent, the
> >     PM core waits for the parent's completion before attempting to
> >     run the resume callbacks, appropriate for this particular stage
> >     of resume, for dev.
> 
> at least this needs to go in as a comment.

OK, this is a prototype patch, still under discussion.

> > (4) dev->power.comp is completed for each device after running its
> > @@ -411,9 +412,12 @@ struct dev_pm_info {
> >  	pm_message_t		power_state;
> >  	unsigned int		can_wakeup:1;
> >  	unsigned int		should_wakeup:1;
> > +	unsigned		async_suspend:1;
> >  	enum dpm_state		status;		/* Owned by the PM core */
> 
> unsigned int? Or bool?

unsigned means 'unsigned int'.  I should have added 'int', but again, this is
a prototype patch.

> Should it go under config_pm_sleep?

Not necessaily.  'status' is not there as well.

> >  #ifdef CONFIG_PM_SLEEP
> >  	struct list_head	entry;
> > +	struct completion	comp;
> > +	pm_message_t		async_state;
> >  #endif
> >  }
> >  
> > +static inline void device_enable_async_suspend(struct device *dev, bool enable)
> > +{
> > +	if (dev->power.status == DPM_ON)
> > +		dev->power.async_suspend = enable;
> > +}
> > +
> > @@ -163,6 +166,34 @@ void device_pm_move_last(struct device *
> >  	list_move_tail(&dev->power.entry, &dpm_list);
> >  }
> >  
> > +static void dpm_synchronize_noirq(void)
> > +{
> > +	struct device *dev;
> > +
> > +	async_synchronize_full();
> > +
> > +	list_for_each_entry(dev, &dpm_list, power.entry)
> > +		INIT_COMPLETION(dev->power.comp);
> > +}
> > +
> > +static void dpm_synchronize(void)
> > +{
> > +	struct device *dev;
> > +
> > +	async_synchronize_full();
> > +
> > +	mutex_lock(&dpm_list_mtx);
> > +	list_for_each_entry(dev, &dpm_list, power.entry)
> > +		INIT_COMPLETION(dev->power.comp);
> > +	mutex_unlock(&dpm_list_mtx);
> > +}
> 
> Why is it ok to avoid locking in noirq case?

It's not, but we hold dpm_list_mtx throughout the entire noirq suspend.

> Do we really need async for noirq handlers?

Yes, we do.  Specifically, for PCI.

> >  /**
> > - *	device_resume_noirq - Power on one device (early resume).
> > - *	@dev:	Device.
> > - *	@state: PM transition of the system being carried out.
> > + * __device_resume_noirq - Execute an "early resume" callback for given device.
> > + * @dev: Device to resume.
> > + * @state: PM transition of the system being carried out.
> >   *
> > - *	Must be called with interrupts disabled.
> > + * The driver of the device won't receive interrupts while this function is
> > + * being executed.
> >   */
> 
> You still want it called with interrupts disabled, right?

No.  It's not called with interrupts off now.

Thanks,
Rafael

  reply	other threads:[~2009-08-15 20:58 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12 20:18 [RFC][PATCH 0/3] PM: Asynchronous suspend and resume Rafael J. Wysocki
2009-08-12 20:20 ` [RFC][PATCH 1/3] PM: Asynchronous resume of devices Rafael J. Wysocki
2009-08-14 16:33   ` Pavel Machek
2009-08-15 20:59     ` Rafael J. Wysocki [this message]
2009-08-22  9:24       ` Pavel Machek
2009-08-22 21:45         ` Rafael J. Wysocki
2009-08-12 20:21 ` [RFC][PATCH 2/3] PM: Asynchronous suspend " Rafael J. Wysocki
2009-08-14 16:35   ` Pavel Machek
2009-08-15 21:04     ` Rafael J. Wysocki
2009-08-22  9:25       ` Pavel Machek
2009-08-22 21:46         ` Rafael J. Wysocki
2009-08-12 20:22 ` [RFC][PATCH 3/3] PM: Asynchronous suspend and resume for ACPI battery Rafael J. Wysocki
2009-08-12 21:12 ` [RFC][PATCH 0/3] PM: Asynchronous suspend and resume Alan Stern
2009-08-12 21:43   ` Rafael J. Wysocki
2009-08-13  8:18     ` Zhang Rui
2009-08-13 18:08       ` Rafael J. Wysocki
2009-08-14  3:24         ` Zhang Rui
2009-08-14 11:58           ` Rafael J. Wysocki
2009-08-13 14:45     ` Alan Stern
2009-08-13 18:28       ` Rafael J. Wysocki
2009-08-13 18:39         ` Alan Stern
2009-08-13 21:10           ` Rafael J. Wysocki
2009-08-13 21:53     ` Rafael J. Wysocki
2009-08-14 14:45       ` Alan Stern
2009-08-14 19:12         ` Rafael J. Wysocki
2009-08-14 21:21           ` Alan Stern
2009-08-14 21:31             ` Rafael J. Wysocki
2009-08-14 21:37               ` Alan Stern
2009-08-16 10:29               ` [linux-pm] " Rafael J. Wysocki
2009-08-14 16:33 ` Pavel Machek
2009-08-15 21:00   ` Rafael J. Wysocki
2009-08-17  0:15 ` [RFC][PATCH 0/7] PM: Asynchronous suspend and resume (updated) Rafael J. Wysocki
2009-08-17  0:16   ` [RFC][PATCH 1/7] PM: Update kerneldoc comments in drivers/base/power/main.c Rafael J. Wysocki
2009-08-19 21:57     ` Rafael J. Wysocki
2009-08-19 22:00       ` Randy Dunlap
2009-08-19 22:06       ` Greg KH
2009-08-19 22:28       ` Alan Stern
2009-08-19 23:14         ` Rafael J. Wysocki
2009-08-20 14:00           ` Alan Stern
2009-08-26 15:44     ` Pavel Machek
2009-08-17  0:17   ` [RFC][PATCH 2/7] PM: Framework for representing PM links between devices Rafael J. Wysocki
2009-08-21 22:27     ` [RFC][PATCH 2/7 update] " Rafael J. Wysocki
2009-08-17  0:18   ` [RFC][PATCH 3/7] PM: Asynchronous resume of I/O devices Rafael J. Wysocki
2009-08-23 22:09     ` [RFC][PATCH 3/7 updated] " Rafael J. Wysocki
2009-08-17  0:19   ` [RFC][PATCH 4/7] PM: Asynchronous suspend " Rafael J. Wysocki
2009-08-17  0:20   ` [RFC][PATCH 5/7] PM: Asynchronous suspend and resume of PCI devices Rafael J. Wysocki
2009-08-18  6:57     ` Zhang Rui
2009-08-18 13:47       ` Alan Stern
2009-08-17  0:20   ` [RFC][PATCH 6/7] PM: Asynchronous suspend and resume of ACPI devices Rafael J. Wysocki
2009-08-17  0:21   ` [RFC][PATCH 7/7] PM: Asynchronous suspend and resume of i8042 Rafael J. Wysocki
2009-08-18  7:03     ` Zhang Rui
2009-08-18 19:57       ` Rafael J. Wysocki
2009-08-18 23:40         ` Rafael J. Wysocki
2009-08-26 15:43       ` Pavel Machek
2009-08-18  1:59   ` [RFC][PATCH 0/7] PM: Asynchronous suspend and resume (updated) Zhang Rui
2009-08-18  7:16   ` Zhang Rui
2009-08-18 20:01     ` Rafael J. Wysocki
2009-08-18 23:58       ` Rafael J. Wysocki
2009-08-19  1:05         ` Zhang Rui
2009-08-19 21:02           ` Rafael J. Wysocki
2009-08-21  7:40             ` Zhang Rui
2009-08-26 15:44     ` Pavel Machek
2009-08-18 14:04   ` Alan Stern
2009-08-18 19:56     ` Rafael J. Wysocki
2009-08-18 20:22       ` Alan Stern
2009-08-18 22:33         ` Rafael J. Wysocki
2009-08-19 14:07           ` Alan Stern
2009-08-19 21:17             ` Rafael J. Wysocki
2009-08-19 22:34               ` Alan Stern
2009-08-20 15:56                 ` Rafael J. Wysocki
2009-08-26 13:20     ` Pavel Machek

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=200908152259.18417.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=arjan@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@ucw.cz \
    --cc=rui.zhang@intel.com \
    --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