Hi all.
Commit 831441862956fffa17b9801db37e6ea1650b0f69 (Freezer: make kernel threads
nonfreezable by default) breaks freezing when attempting to resume from an
initrd, because the init (which is freezeable) spins while waiting for another
thread to run /linuxrc, but doesn't check whether it has been told to enter
the refrigerator. The original patch replaced a call to try_to_freeze() with a
call to yield(). I believe a simple reversion is wrong because
if !CONFIG_PM_SLEEP, try_to_freeze() is a noop. It should still yield.
Signed-off-by: Nigel Cunningham <nigel@nigel.suspend2.net>
do_mounts_initrd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -ruNp 952-fix-initrd-resume.patch-old/init/do_mounts_initrd.c 952-fix-initrd-resume.patch-new/init/do_mounts_initrd.c
--- 952-fix-initrd-resume.patch-old/init/do_mounts_initrd.c 2007-09-11 13:43:31.000000000 +1000
+++ 952-fix-initrd-resume.patch-new/init/do_mounts_initrd.c 2007-09-11 13:19:50.000000000 +1000
@@ -58,8 +58,10 @@ static void __init handle_initrd(void)
pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
if (pid > 0)
- while (pid != sys_wait4(-1, NULL, 0, NULL))
+ while (pid != sys_wait4(-1, NULL, 0, NULL)) {
yield();
+ try_to_freeze();
+ }
if (!resume_attempted)
printk(KERN_ERR "Suspend2: No attempt was made to resume from "
--
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.
-
Hm. I use a resume from an initrd on a regular basis and it works without the patch below. Greetings, Rafael -
Hi. Ah. That makes me realise that I see that too - my AMD64 uniprocessor laptop didn't need the patch (guess that's why I didn't notice the need and ack'd the patch). But my x86 SMP machine... it needs this. I'll see if they're running on different processors. Regards, Nigel -- Nigel Cunningham Christian Reformed Church of Cobden 103 Curdie Street, Cobden 3266, Victoria, Australia Ph. +61 3 5595 1185 / +61 417 100 574 Communal Worship: 11 am Sunday. -
Well, strange. My x86_64 SMP machines don't need the patch too. Greetings, Rafael -
Anyway, yes, init is freezable, but should it be? I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()? Greetings, Rafael -
Argh, no. PF_NOFREEZE is inherited by the children.
So, I think that your patch is correct, but there's some suspend2-specific
stuff in it. I've rediffed it against 2.6.23-rc6 and moved try_to_freeze()
before yield().
---
From: Nigel Cunningham <nigel@nigel.suspend2.net>
Commit 831441862956fffa17b9801db37e6ea1650b0f69 (Freezer: make kernel threads
nonfreezable by default) breaks freezing when attempting to resume from an
initrd, because the init (which is freezeable) spins while waiting for another
thread to run /linuxrc, but doesn't check whether it has been told to enter
the refrigerator. The original patch replaced a call to try_to_freeze() with a
call to yield(). I believe a simple reversion is wrong because
if !CONFIG_PM_SLEEP, try_to_freeze() is a noop. It should still yield.
Signed-off-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
init/do_mounts_initrd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: linux-2.6.23-rc6/init/do_mounts_initrd.c
===================================================================
--- linux-2.6.23-rc6.orig/init/do_mounts_initrd.c
+++ linux-2.6.23-rc6/init/do_mounts_initrd.c
@@ -57,8 +57,10 @@ static void __init handle_initrd(void)
pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
if (pid > 0)
- while (pid != sys_wait4(-1, NULL, 0, NULL))
+ while (pid != sys_wait4(-1, NULL, 0, NULL)) {
+ try_to_freeze();
yield();
+ }
/* move initrd to rootfs' /old */
sys_fchdir(old_fd);
-
Technically it's not that important, but conceptually try_to_freeze() should Well, I guess it'll take some time to get that work reliable and it would be nice to have a fix before it's ready. Greetings, Rafael -
We want to do resume sometime around here, and resume wants to run with userspace frozen, as does suspend. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -
Hi again. Oh well. I'm probably doing something wrong then and haven't clicked yet. Regards, Nigel -- See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info. -
