public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: Async suspend-resume patch w/ completions (was: Re: Async suspend-resume patch w/ rwsems)
Date: Thu, 17 Dec 2009 02:49:00 +0100	[thread overview]
Message-ID: <200912170249.00676.rjw@sisk.pl> (raw)
In-Reply-To: <200912162257.00771.rjw@sisk.pl>

On Wednesday 16 December 2009, Rafael J. Wysocki wrote:
> On Wednesday 16 December 2009, Linus Torvalds wrote:
> > 
> > On Wed, 16 Dec 2009, Rafael J. Wysocki wrote:
> > > > 
> > > > Do you have any sample timing output with devices listed?
> > > 
> > > I'm going to generate one shortly.
> 
> I've just put the first set of data, for the HP nx6325 at:
> http://www.sisk.pl/kernel/data/nx6325/

As I said in a message to Alan, the data were incomplete, because the original
Arjan's patch only covers bus types and device classes converted to
dev_pm_ops, which I only noticed earlier today.  So I added the appended patch
on top of the async tree and I applied a one-liner adding the name of the
parent to each device line during (regular) suspend and resume.

The new data sets are at:

http://www.sisk.pl/kernel/data/nx6325/
http://www.sisk.pl/kernel/data/wind/

and the format is the same as described below.

> The *-dmesg.log files contain full dmesg outputs starting from a cold boot and
> including one suspend-resume cycle in each case, with debug_initcall enabled.
> 
> The *-suspend.log files are excerpts from the *-dmesg.log files containing
> the suspend messages only, and analogously for *-resume.log.
> 
> The *-times.txt files contain suspend/resume time for every device sorted
> in the decreasing order.
> 
> > From my bootup timings, I have this memory of SATA link bringup being 
> > noticeable. I wonder if that is the case on resume too...

That actually is correct.  On the nx6325 suspend is totally dominated by disk
spindown, almost everything else is negligible compared to it (well, except for
the audio), so we can't go down below 1 s during suspend on this box.

On the Wind, disk spindown time is comparable with serio suspend time,
so at least in principle we should be able to get .5 s suspend on this box - 
if the disk spindown in async.

In turn, the resume on the Wind is dominated by disk spinup, so we can't
go below 1.5 s on this box during resume (notice that the "async+extra"
approach brings us close to this limit, although we could save .5 s more in
principle by making more devices async).

Resume on the nx6325 is a different story, though, as it is dominated by USB
and PCI devices, so marking those as async would probably bring us close to
the limit.

[Surprisingly enough to me some ACPI devices appear to take quite noticeable
amounts of time to resume on both boxes.]

Tomorrow I'll try to mark as many devices as reasonably possible as async
and see how the total suspend-resume times change.

Rafael

---
 drivers/base/power/main.c |   97 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 77 insertions(+), 20 deletions(-)

Index: linux-2.6/drivers/base/power/main.c
===================================================================
--- linux-2.6.orig/drivers/base/power/main.c
+++ linux-2.6/drivers/base/power/main.c
@@ -165,6 +165,32 @@ void device_pm_move_last(struct device *
 	list_move_tail(&dev->power.entry, &dpm_list);
 }
 
+static ktime_t initcall_debug_start(struct device *dev)
+{
+	ktime_t calltime = ktime_set(0, 0);
+
+	if (initcall_debug) {
+		pr_info("calling  %s_i+ @ %i\n",
+				dev_name(dev), task_pid_nr(current));
+		calltime = ktime_get();
+	}
+
+	return calltime;
+}
+
+static void initcall_debug_report(struct device *dev, ktime_t calltime,
+				  int error)
+{
+	ktime_t delta, rettime;
+
+	if (initcall_debug) {
+		rettime = ktime_get();
+		delta = ktime_sub(rettime, calltime);
+		pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
+			error, (unsigned long long)ktime_to_ns(delta) >> 10);
+	}
+}
+
 /**
  * dpm_wait - Wait for a PM operation to complete.
  * @dev: Device to wait for.
@@ -201,13 +227,9 @@ static int pm_op(struct device *dev,
 		 pm_message_t state)
 {
 	int error = 0;
-	ktime_t calltime, delta, rettime;
+	ktime_t calltime;
 
-	if (initcall_debug) {
-		pr_info("calling  %s+ @ %i\n",
-				dev_name(dev), task_pid_nr(current));
-		calltime = ktime_get();
-	}
+	calltime = initcall_debug_start(dev);
 
 	switch (state.event) {
 #ifdef CONFIG_SUSPEND
@@ -256,12 +278,7 @@ static int pm_op(struct device *dev,
 		error = -EINVAL;
 	}
 
-	if (initcall_debug) {
-		rettime = ktime_get();
-		delta = ktime_sub(rettime, calltime);
-		pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
-			error, (unsigned long long)ktime_to_ns(delta) >> 10);
-	}
+	initcall_debug_report(dev, calltime, error);
 
 	return error;
 }
@@ -338,8 +355,9 @@ static int pm_noirq_op(struct device *de
 	if (initcall_debug) {
 		rettime = ktime_get();
 		delta = ktime_sub(rettime, calltime);
-		printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev),
-			error, (unsigned long long)ktime_to_ns(delta) >> 10);
+		printk("initcall %s_i+ returned %d after %Ld usecs\n",
+			dev_name(dev), error,
+			(unsigned long long)ktime_to_ns(delta) >> 10);
 	}
 
 	return error;
@@ -456,6 +474,26 @@ void dpm_resume_noirq(pm_message_t state
 EXPORT_SYMBOL_GPL(dpm_resume_noirq);
 
 /**
+ * legacy_resume - Execute a legacy (bus or class) resume callback for device.
+ * dev: Device to resume.
+ * cb: Resume callback to execute.
+ */
+static int legacy_resume(struct device *dev, int (*cb)(struct device *dev))
+{
+	int error;
+	ktime_t calltime;
+
+	calltime = initcall_debug_start(dev);
+
+	error = cb(dev);
+	suspend_report_result(cb, error);
+
+	initcall_debug_report(dev, calltime, error);
+
+	return error;
+}
+
+/**
  * __device_resume - Execute "resume" callbacks for given device.
  * @dev: Device to handle.
  * @state: PM transition of the system being carried out.
@@ -477,7 +515,7 @@ static int __device_resume(struct device
 			error = pm_op(dev, dev->bus->pm, state);
 		} else if (dev->bus->resume) {
 			pm_dev_dbg(dev, state, "legacy ");
-			error = dev->bus->resume(dev);
+			error = legacy_resume(dev, dev->bus->resume);
 		}
 		if (error)
 			goto End;
@@ -498,7 +536,7 @@ static int __device_resume(struct device
 			error = pm_op(dev, dev->class->pm, state);
 		} else if (dev->class->resume) {
 			pm_dev_dbg(dev, state, "legacy class ");
-			error = dev->class->resume(dev);
+			error = legacy_resume(dev, dev->class->resume);
 		}
 	}
  End:
@@ -734,6 +772,27 @@ EXPORT_SYMBOL_GPL(dpm_suspend_noirq);
 static int async_error;
 
 /**
+ * legacy_suspend - Execute a legacy (bus or class) suspend callback for device.
+ * dev: Device to suspend.
+ * cb: Suspend callback to execute.
+ */
+static int legacy_suspend(struct device *dev, pm_message_t state,
+			  int (*cb)(struct device *dev, pm_message_t state))
+{
+	int error;
+	ktime_t calltime;
+
+	calltime = initcall_debug_start(dev);
+
+	error = cb(dev, state);
+	suspend_report_result(cb, error);
+
+	initcall_debug_report(dev, calltime, error);
+
+	return error;
+}
+
+/**
  * device_suspend - Execute "suspend" callbacks for given device.
  * @dev: Device to handle.
  * @state: PM transition of the system being carried out.
@@ -755,8 +814,7 @@ static int __device_suspend(struct devic
 			error = pm_op(dev, dev->class->pm, state);
 		} else if (dev->class->suspend) {
 			pm_dev_dbg(dev, state, "legacy class ");
-			error = dev->class->suspend(dev, state);
-			suspend_report_result(dev->class->suspend, error);
+			error = legacy_suspend(dev, state, dev->class->suspend);
 		}
 		if (error)
 			goto End;
@@ -777,8 +835,7 @@ static int __device_suspend(struct devic
 			error = pm_op(dev, dev->bus->pm, state);
 		} else if (dev->bus->suspend) {
 			pm_dev_dbg(dev, state, "legacy ");
-			error = dev->bus->suspend(dev, state);
-			suspend_report_result(dev->bus->suspend, error);
+			error = legacy_suspend(dev, state, dev->bus->suspend);
 		}
 	}
 

  parent reply	other threads:[~2009-12-17  1:49 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.44L0.0912091729530.2672-100000@iolanthe.rowland.org>
2009-12-09 23:18 ` Async suspend-resume patch w/ completions (was: Re: Async suspend-resume patch w/ rwsems) Rafael J. Wysocki
     [not found] ` <200912100018.19723.rjw@sisk.pl>
2009-12-10  2:51   ` Linus Torvalds
2009-12-10 15:31   ` Alan Stern
     [not found]   ` <alpine.LFD.2.00.0912091835280.3560@localhost.localdomain>
2009-12-10 19:40     ` Rafael J. Wysocki
     [not found]     ` <200912102040.11063.rjw@sisk.pl>
2009-12-10 23:30       ` Linus Torvalds
     [not found]       ` <alpine.LFD.2.00.0912101507550.3560@localhost.localdomain>
2009-12-11  1:02         ` Rafael J. Wysocki
     [not found]         ` <200912110202.28536.rjw@sisk.pl>
2009-12-11  1:25           ` Linus Torvalds
     [not found]           ` <alpine.LFD.2.00.0912101713440.3560@localhost.localdomain>
2009-12-11  3:42             ` Alan Stern
2009-12-11 22:11             ` Rafael J. Wysocki
     [not found]             ` <200912112311.08548.rjw@sisk.pl>
2009-12-11 22:31               ` Linus Torvalds
     [not found]               ` <alpine.LFD.2.00.0912111415160.3922@localhost.localdomain>
2009-12-11 23:48                 ` Rafael J. Wysocki
     [not found]                 ` <200912120048.46180.rjw@sisk.pl>
2009-12-11 23:53                   ` Linus Torvalds
2009-12-12  0:43                   ` Alan Stern
     [not found]                   ` <alpine.LFD.2.00.0912111552330.3526@localhost.localdomain>
2009-12-12 17:48                     ` Rafael J. Wysocki
2009-12-12 18:54                       ` Linus Torvalds
2009-12-12 22:34                         ` Rafael J. Wysocki
2009-12-12 22:40                           ` Rafael J. Wysocki
2009-12-14 18:21                           ` Linus Torvalds
     [not found]                           ` <alpine.LFD.2.00.0912141015240.26135@localhost.localdomain>
2009-12-14 22:11                             ` Rafael J. Wysocki
     [not found]                             ` <200912142311.31658.rjw@sisk.pl>
2009-12-14 22:41                               ` Linus Torvalds
     [not found]                               ` <alpine.LFD.2.00.0912141416040.26135@localhost.localdomain>
2009-12-14 22:43                                 ` Linus Torvalds
2009-12-14 23:18                                 ` Rafael J. Wysocki
     [not found]                                 ` <200912150018.11837.rjw@sisk.pl>
2009-12-15  0:10                                   ` Linus Torvalds
     [not found]                                   ` <alpine.LFD.2.00.0912141609020.14385@localhost.localdomain>
2009-12-15  0:11                                     ` Linus Torvalds
2009-12-15 11:03                                     ` Rafael J. Wysocki
     [not found]                                     ` <alpine.LFD.2.00.0912141610460.14385@localhost.localdomain>
2009-12-15 11:14                                       ` Rafael J. Wysocki
     [not found]                                       ` <200912151214.10980.rjw@sisk.pl>
2009-12-15 15:31                                         ` Linus Torvalds
     [not found]                                     ` <200912151203.22916.rjw@sisk.pl>
2009-12-15 15:26                                       ` Linus Torvalds
     [not found]                                       ` <alpine.LFD.2.00.0912150722310.14385@localhost.localdomain>
2009-12-15 15:55                                         ` Alan Stern
2009-12-16  2:11                                         ` Rafael J. Wysocki
     [not found]                                         ` <200912160311.05915.rjw@sisk.pl>
2009-12-16  6:40                                           ` Dmitry Torokhov
2009-12-16 15:22                                           ` Alan Stern
2009-12-16 15:47                                           ` Linus Torvalds
2009-12-16 19:27                                             ` Rafael J. Wysocki
     [not found]                                             ` <200912162027.16574.rjw@sisk.pl>
2009-12-16 20:59                                               ` Linus Torvalds
     [not found]                                               ` <alpine.LFD.2.00.0912161255080.3556@localhost.localdomain>
2009-12-16 21:57                                                 ` Rafael J. Wysocki
     [not found]                                                 ` <200912162257.00771.rjw@sisk.pl>
2009-12-16 22:11                                                   ` Linus Torvalds
     [not found]                                                   ` <alpine.LFD.2.00.0912161410120.3556@localhost.localdomain>
2009-12-16 22:33                                                     ` Rafael J. Wysocki
2009-12-16 23:04                                                   ` Alan Stern
2009-12-17  1:49                                                   ` Rafael J. Wysocki [this message]
2009-12-17 20:06                                                     ` Alan Stern
2009-12-18  1:51                                                     ` Rafael J. Wysocki
     [not found]                                                     ` <200912180251.22655.rjw@sisk.pl>
2009-12-18 17:26                                                       ` Alan Stern
2009-12-18 23:42                                                       ` Rafael J. Wysocki
     [not found]                                           ` <20091216064025.GB2699@core.coreip.homeip.net>
2009-12-18 22:43                                             ` Rafael J. Wysocki
2009-12-19 19:59                                               ` Dmitry Torokhov
     [not found]                                               ` <20091219195935.GB4073@core.coreip.homeip.net>
2009-12-19 21:33                                                 ` Rafael J. Wysocki
     [not found]                                                 ` <200912192233.44575.rjw@sisk.pl>
2009-12-19 22:29                                                   ` Rafael J. Wysocki
     [not found]                                                   ` <200912192329.03251.rjw@sisk.pl>
2009-12-19 22:43                                                     ` Dmitry Torokhov
2009-12-19 22:47                                                   ` Dmitry Torokhov
     [not found]                                                   ` <A37A0A6F-3662-40C9-BE1F-B9F6A38CD80B@gmail.com>
2009-12-19 23:10                                                     ` Rafael J. Wysocki
     [not found]                                                     ` <200912200010.19899.rjw@sisk.pl>
2009-12-19 23:22                                                       ` Dmitry Torokhov
2009-12-19 23:23                                                       ` Linus Torvalds
     [not found]                                                       ` <43A402BB-6AB3-4127-A441-D53EDE09F22E@gmail.com>
2009-12-19 23:33                                                         ` Rafael J. Wysocki
     [not found]                                                       ` <alpine.LFD.2.00.0912191521180.3712@localhost.localdomain>
2009-12-19 23:40                                                         ` Rafael J. Wysocki
     [not found]                                                         ` <200912200040.18944.rjw@sisk.pl>
2009-12-19 23:46                                                           ` Linus Torvalds
     [not found]                                                           ` <alpine.LFD.2.00.0912191542570.3712@localhost.localdomain>
2009-12-19 23:47                                                             ` Linus Torvalds
2009-12-19 23:53                                                             ` Rafael J. Wysocki
     [not found]                                                             ` <alpine.LFD.2.00.0912191546250.3712@localhost.localdomain>
2009-12-19 23:54                                                               ` Rafael J. Wysocki
     [not found]                                                             ` <200912200053.45988.rjw@sisk.pl>
2009-12-20  0:09                                                               ` Linus Torvalds
     [not found]                                                               ` <alpine.LFD.2.00.0912191557320.3712@localhost.localdomain>
2009-12-20  0:35                                                                 ` Rafael J. Wysocki
2009-12-20  2:41                                                                 ` Dmitry Torokhov
     [not found]                                                                 ` <20091220024142.GC4073@core.coreip.homeip.net>
2009-12-20 19:25                                                                   ` Rafael J. Wysocki
     [not found]                                                                   ` <200912202025.25618.rjw@sisk.pl>
2009-12-21  7:39                                                                     ` Async suspend-resume patch w/ completions (was: Re: Async?suspend-resume " Dmitry Torokhov
     [not found]                                                                     ` <20091221073915.GC3234@core.coreip.homeip.net>
2009-12-21 11:20                                                                       ` Vojtech Pavlik
2009-12-20  2:45                                                               ` Async suspend-resume patch w/ completions (was: Re: Async suspend-resume " Dmitry Torokhov
2009-12-20  3:59                                                           ` Alan Stern
2009-12-13 13:08                         ` Rafael J. Wysocki
2009-12-13 17:30                         ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912101010090.2825-100000@iolanthe.rowland.org>
2009-12-10 15:45 ` Linus Torvalds
2009-12-10 21:14 ` Rafael J. Wysocki
     [not found] <alpine.LFD.2.00.0912100739260.3560@localhost.localdomain>
2009-12-10 18:37 ` Alan Stern
     [not found] <200912102214.40310.rjw@sisk.pl>
2009-12-10 22:17 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912101653120.2680-100000@iolanthe.rowland.org>
2009-12-10 23:45 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0912101321020.2680-100000@iolanthe.rowland.org>
2009-12-10 23:51 ` Linus Torvalds
     [not found] <Pine.LNX.4.44L0.0912102155390.12136-100000@netrider.rowland.org>
2009-12-11 22:17 ` Rafael J. Wysocki
     [not found] <200912112317.31668.rjw@sisk.pl>
2009-12-12  0:38 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912111938310.32493-100000@netrider.rowland.org>
2009-12-12 17:35 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0912131221210.1111-100000@netrider.rowland.org>
2009-12-13 19:02 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912151047410.3566-100000@iolanthe.rowland.org>
2009-12-15 16:28 ` Linus Torvalds
     [not found] ` <alpine.LFD.2.00.0912150803250.14385@localhost.localdomain>
2009-12-15 18:57   ` Linus Torvalds
2009-12-15 20:26   ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912151444010.2643-100000@iolanthe.rowland.org>
2009-12-15 21:26 ` Rafael J. Wysocki
2009-12-15 21:54 ` Linus Torvalds
     [not found] <200912152226.22578.rjw@sisk.pl>
2009-12-15 22:01 ` Alan Stern
     [not found] <alpine.LFD.2.00.0912151337350.14385@localhost.localdomain>
2009-12-15 22:27 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912161018100.2909-100000@iolanthe.rowland.org>
2009-12-16 19:26 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0912161753540.2643-100000@iolanthe.rowland.org>
2009-12-16 23:18 ` Rafael J. Wysocki
     [not found] ` <200912170018.05175.rjw@sisk.pl>
2009-12-17  1:30   ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0912171444040.2645-100000@iolanthe.rowland.org>
2009-12-17 20:36 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0912181205290.2987-100000@iolanthe.rowland.org>
2009-12-19 21:41 ` Rafael J. Wysocki
     [not found] <200912192241.03991.rjw@sisk.pl>
2009-12-20  3:48 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912192253200.6618-100000@netrider.rowland.org>
2009-12-20 12:52 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0912192232360.6618-100000@netrider.rowland.org>
2009-12-20 12:55 ` Rafael J. Wysocki
     [not found] <200912201352.07689.rjw@sisk.pl>
2009-12-20 17:12 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912201210300.24162-100000@netrider.rowland.org>
2009-12-20 18:10 ` Rafael J. Wysocki
     [not found] <200912201910.26895.rjw@sisk.pl>
2009-12-20 19:38 ` Alan Stern
     [not found] <Pine.LNX.4.44L0.0912201434340.27137-100000@netrider.rowland.org>
2009-12-20 19:51 ` 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=200912170249.00676.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox