From: Pierre Ossman <drzeus-list@drzeus.cx>
To: Pavel Machek <pavel@ucw.cz>, LKML <linux-kernel@vger.kernel.org>,
linux-pm@osdl.org
Subject: swsusp doesn't suspend devices
Date: Wed, 07 Sep 2005 13:20:03 +0200 [thread overview]
Message-ID: <431ECCE3.8080408@drzeus.cx> (raw)
It would seem that swsusp doesn't properly suspend devices, or more
precisely it wakes them up again before suspending the machine.
The problem is in swsusp_suspend(). It is designed as if
swsusp_arch_suspend() would suspend the hardware, when in fact all it
does is prepare for a suspend. The effect is that devices are brought
back up because swsusp_suspend() believes it is resuming.
Below is a patch that uses the same system as kernel/power/disk.c to
determine if it's suspending or resuming. The patch brings up a new
problem though, disk writes generate a huge amount of "scheduling while
atomic".
---
Index: linux-wbsd/kernel/power/swsusp.c
===================================================================
--- linux-wbsd/kernel/power/swsusp.c (revision 165)
+++ linux-wbsd/kernel/power/swsusp.c (working copy)
@@ -84,6 +84,8 @@
/* Local variables that should not be affected by save */
static unsigned int nr_copy_pages __nosavedata = 0;
+static int in_suspend __nosavedata = 0;
+
/* Suspend pagedir is allocated before final copy, therefore it
must be freed after resume
@@ -897,15 +899,18 @@
return error;
}
+ in_suspend = 1;
save_processor_state();
if ((error = swsusp_arch_suspend()))
printk("Error %d suspending\n", error);
- /* Restore control flow magically appears here */
- restore_processor_state();
- BUG_ON (nr_copy_pages_check != nr_copy_pages);
- restore_highmem();
- device_power_up();
- local_irq_enable();
+ if (!in_suspend || error) {
+ /* Restore control flow magically appears here */
+ restore_processor_state();
+ BUG_ON (nr_copy_pages_check != nr_copy_pages);
+ restore_highmem();
+ device_power_up();
+ local_irq_enable();
+ }
return error;
}
next reply other threads:[~2005-09-07 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-07 11:20 Pierre Ossman [this message]
2005-09-07 20:03 ` swsusp doesn't suspend devices Rafael J. Wysocki
2005-09-07 20:17 ` Pierre Ossman
2005-09-07 20:40 ` Rafael J. Wysocki
2005-09-07 21:06 ` 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=431ECCE3.8080408@drzeus.cx \
--to=drzeus-list@drzeus.cx \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@osdl.org \
--cc=pavel@ucw.cz \
/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