suspend/resume timings

Marcelo Tosatti marcelo at kvack.org
Mon Apr 2 16:12:38 EDT 2007


On Sun, Apr 01, 2007 at 09:09:19PM +0200, Jens Axboe wrote:
> Hi,
> 
> I took a look at the time spent doing a suspend and resume cycle. In
> general things go pretty fast, most devices handle it really quickly.
> USB is a bit slow (~100 msec), but I ignored that since apparently there
> are already people working on fixing USB suspend (functionality, speed
> of course comes second).
> 
> The slowest parts are the keyboard and mouse. psmouse takes ~570 msec to
> resume alone, and the keyboard is no speed daemon at ~269 msecs. Looking
> at the psmouse first, by far the majority of the time is spend resetting
> the device (drivers/input/mouse/olpc.c:olpc_reconnect() ->
> psmouse_reset()). A quick test works fine for me without the reset, but
> that may not be a sound approach. Perhaps deferring a reset to IFF
> olpc_get_model() fails would be more safe?
> 
> I'll be playing some more with the timings and testing over the next
> week, do let me know if there's something more urgent in suspend/resume
> area that needs attention.
> 
> The kernel used was current olpc-2.6.

Jens,

What about this patch instead. It avoids the psmouse reconnect method
from being called (thus the ps2 command in olpc_get_model()), which
saves us a few more milliseconds.

Resume time is now at 660ms without modules loaded (however the resume
time varies a lot between runs, sometimes more than 200ms).



diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index a15e531..65064f7 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -78,15 +78,27 @@ static int serio_connect_driver(struct s
 	return retval;
 }
 
-static int serio_reconnect_driver(struct serio *serio)
+static int serio_reconnect_driver(struct serio *serio, int resume)
 {
 	int retval = -1;
 
 	mutex_lock(&serio->drv_mutex);
-	if (serio->drv && serio->drv->reconnect)
+	if (serio->drv && serio->drv->reconnect) {
+#ifdef CONFIG_OLPC
+		/* 
+		 * There's no need to resume the keyboard or touchpad
+		 * on OLPC since they live in a rail which is kept
+		 * powered on during resume cycles.
+		 */
+		if (resume) 
+			if (!strcmp(serio->drv->driver.name, "atkbd") ||
+			    !strcmp(serio->drv->driver.name, "psmouse"))
+				goto out;
+#endif
 		retval = serio->drv->reconnect(serio);
+	}
+out:
 	mutex_unlock(&serio->drv_mutex);
-
 	return retval;
 }
 
@@ -635,7 +647,7 @@ static void serio_destroy_port(struct se
 static void serio_reconnect_port(struct serio *serio)
 {
 	do {
-		if (serio_reconnect_driver(serio)) {
+		if (serio_reconnect_driver(serio, 0)) {
 			serio_disconnect_port(serio);
 			serio_find_driver(serio);
 			/* Ok, old children are now gone, we are done */
@@ -941,7 +953,7 @@ static int serio_resume(struct device *d
 	struct serio *serio = to_serio_port(dev);
 
 	if (dev->power.power_state.event != PM_EVENT_ON &&
-	    serio_reconnect_driver(serio)) {
+	    serio_reconnect_driver(serio, 1)) {
 		/*
 		 * Driver re-probing can take a while, so better let kseriod
 		 * deal with it.



More information about the Devel mailing list