public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix failure to resume from initrds.
@ 2007-09-11  3:54 Nigel Cunningham
  2007-09-11 11:04 ` Rafael J. Wysocki
  0 siblings, 1 reply; 13+ messages in thread
From: Nigel Cunningham @ 2007-09-11  3:54 UTC (permalink / raw)
  To: LKML, Linus Torvalds, Rafael Wysocki

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11  3:54 [PATCH] Fix failure to resume from initrds Nigel Cunningham
@ 2007-09-11 11:04 ` Rafael J. Wysocki
  2007-09-11 11:27   ` Nigel Cunningham
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2007-09-11 11:04 UTC (permalink / raw)
  To: nigel; +Cc: LKML, Linus Torvalds

On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> 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.

Hm.

I use a resume from an initrd on a regular basis and it works without the patch
below.

I think we need to investigate what happens in your test case a bit.

> 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 "
> 

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 11:04 ` Rafael J. Wysocki
@ 2007-09-11 11:27   ` Nigel Cunningham
  2007-09-11 11:55     ` Rafael J. Wysocki
  0 siblings, 1 reply; 13+ messages in thread
From: Nigel Cunningham @ 2007-09-11 11:27 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: nigel, LKML, Linus Torvalds

Hi.

On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > 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.
> 
> Hm.
> 
> I use a resume from an initrd on a regular basis and it works without the 
patch
> below.
> 
> I think we need to investigate what happens in your test case a bit.

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 11:27   ` Nigel Cunningham
@ 2007-09-11 11:55     ` Rafael J. Wysocki
  2007-09-11 13:01       ` Nigel Cunningham
  2007-09-11 13:12       ` Rafael J. Wysocki
  0 siblings, 2 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2007-09-11 11:55 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: nigel, LKML, Linus Torvalds

On Tuesday, 11 September 2007 13:27, Nigel Cunningham wrote:
> Hi.
> 
> On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> > On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > > 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.
> > 
> > Hm.
> > 
> > I use a resume from an initrd on a regular basis and it works without the 
> patch
> > below.
> > 
> > I think we need to investigate what happens in your test case a bit.
> 
> 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.

Well, strange.  My x86_64 SMP machines don't need the patch too.

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 11:55     ` Rafael J. Wysocki
@ 2007-09-11 13:01       ` Nigel Cunningham
  2007-09-11 13:12       ` Rafael J. Wysocki
  1 sibling, 0 replies; 13+ messages in thread
From: Nigel Cunningham @ 2007-09-11 13:01 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: nigel, LKML, Linus Torvalds

Hi again.

On Tuesday 11 September 2007 21:55:06 Rafael J. Wysocki wrote:
> On Tuesday, 11 September 2007 13:27, Nigel Cunningham wrote:
> > Hi.
> > 
> > On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> > > On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > > > 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.
> > > 
> > > Hm.
> > > 
> > > I use a resume from an initrd on a regular basis and it works without 
the 
> > patch
> > > below.
> > > 
> > > I think we need to investigate what happens in your test case a bit.
> > 
> > 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.
> 
> Well, strange.  My x86_64 SMP machines don't need the patch too.

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 11:55     ` Rafael J. Wysocki
  2007-09-11 13:01       ` Nigel Cunningham
@ 2007-09-11 13:12       ` Rafael J. Wysocki
  2007-09-11 13:23         ` Rafael J. Wysocki
  1 sibling, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2007-09-11 13:12 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: nigel, LKML, Linus Torvalds, Pavel Machek

On Tuesday, 11 September 2007 13:55, Rafael J. Wysocki wrote:
> On Tuesday, 11 September 2007 13:27, Nigel Cunningham wrote:
> > Hi.
> > 
> > On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> > > On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > > > 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.
> > > 
> > > Hm.
> > > 
> > > I use a resume from an initrd on a regular basis and it works without the 
> > patch
> > > below.
> > > 
> > > I think we need to investigate what happens in your test case a bit.
> > 
> > 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.
> 
> Well, strange.  My x86_64 SMP machines don't need the patch too.

Anyway, yes, init is freezable, but should it be?

I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()?

Greetings,
Rafael

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 13:12       ` Rafael J. Wysocki
@ 2007-09-11 13:23         ` Rafael J. Wysocki
  2007-09-11 13:41           ` Nigel Cunningham
  2007-09-11 14:39           ` Linus Torvalds
  0 siblings, 2 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2007-09-11 13:23 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: nigel, LKML, Linus Torvalds, Pavel Machek, Andrew Morton

On Tuesday, 11 September 2007 15:12, Rafael J. Wysocki wrote:
> On Tuesday, 11 September 2007 13:55, Rafael J. Wysocki wrote:
> > On Tuesday, 11 September 2007 13:27, Nigel Cunningham wrote:
> > > Hi.
> > > 
> > > On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> > > > On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > > > > 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.
> > > > 
> > > > Hm.
> > > > 
> > > > I use a resume from an initrd on a regular basis and it works without the 
> > > patch
> > > > below.
> > > > 
> > > > I think we need to investigate what happens in your test case a bit.
> > > 
> > > 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.
> > 
> > Well, strange.  My x86_64 SMP machines don't need the patch too.
> 
> Anyway, yes, init is freezable, but should it be?
> 
> I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()?

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);

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 13:23         ` Rafael J. Wysocki
@ 2007-09-11 13:41           ` Nigel Cunningham
  2007-09-11 19:25             ` Rafael J. Wysocki
  2007-09-11 14:39           ` Linus Torvalds
  1 sibling, 1 reply; 13+ messages in thread
From: Nigel Cunningham @ 2007-09-11 13:41 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: nigel, LKML, Linus Torvalds, Pavel Machek, Andrew Morton

Hi.

On Tuesday 11 September 2007 23:23:32 Rafael J. Wysocki wrote:
> On Tuesday, 11 September 2007 15:12, Rafael J. Wysocki wrote:
> > On Tuesday, 11 September 2007 13:55, Rafael J. Wysocki wrote:
> > > On Tuesday, 11 September 2007 13:27, Nigel Cunningham wrote:
> > > > Hi.
> > > > 
> > > > On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> > > > > On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > > > > > 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.
> > > > > 
> > > > > Hm.
> > > > > 
> > > > > I use a resume from an initrd on a regular basis and it works 
without the 
> > > > patch
> > > > > below.
> > > > > 
> > > > > I think we need to investigate what happens in your test case a bit.
> > > > 
> > > > 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.
> > > 
> > > Well, strange.  My x86_64 SMP machines don't need the patch too.
> > 
> > Anyway, yes, init is freezable, but should it be?
> > 
> > I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()?
> 
> 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().

Ah yeah. Sorry about that. Is there some reason I've forgotten that makes the 
order of try_to_freeze & yield in a loop like this matter?

By the way, I had a go at getting fuse processes frozen today. Seems to be 
doable if you take a freeze filesystems prior to processes approach. I've got 
a lot more testing and a bit of cleaning up to do before I'd want to show it 
to anyone, but did successfully do cycles with sshfs, fuseiso and curlftpfs. 
Of course I don't seriously expect it to get merged - everyone's too much in 
love with kexec at the moment :)

Regards,

Nigel
-- 
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 13:23         ` Rafael J. Wysocki
  2007-09-11 13:41           ` Nigel Cunningham
@ 2007-09-11 14:39           ` Linus Torvalds
  2007-09-11 16:27             ` Pavel Machek
  1 sibling, 1 reply; 13+ messages in thread
From: Linus Torvalds @ 2007-09-11 14:39 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Nigel Cunningham, nigel, LKML, Pavel Machek, Andrew Morton



On Tue, 11 Sep 2007, Rafael J. Wysocki wrote:
> > Anyway, yes, init is freezable, but should it be?
> > 
> > I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()?
> 
> Argh, no.  PF_NOFREEZE is inherited by the children.

Umm. All of this is __init code - why is freezability even an issue? We 
shouldn't be suspending at this point anyway afaik..

Is suspend2 perhaps doing something different here? 

		Linus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 14:39           ` Linus Torvalds
@ 2007-09-11 16:27             ` Pavel Machek
  0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2007-09-11 16:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rafael J. Wysocki, Nigel Cunningham, nigel, LKML, Andrew Morton

Hi!

> > > Anyway, yes, init is freezable, but should it be?
> > > 
> > > I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()?
> > 
> > Argh, no.  PF_NOFREEZE is inherited by the children.
> 
> Umm. All of this is __init code - why is freezability even an issue? We 
> shouldn't be suspending at this point anyway afaik..

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds.
  2007-09-11 13:41           ` Nigel Cunningham
@ 2007-09-11 19:25             ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2007-09-11 19:25 UTC (permalink / raw)
  To: nigel; +Cc: LKML, Linus Torvalds, Pavel Machek, Andrew Morton

On Tuesday, 11 September 2007 15:41, Nigel Cunningham wrote:
> Hi.
> 
> On Tuesday 11 September 2007 23:23:32 Rafael J. Wysocki wrote:
> > On Tuesday, 11 September 2007 15:12, Rafael J. Wysocki wrote:
> > > On Tuesday, 11 September 2007 13:55, Rafael J. Wysocki wrote:
> > > > On Tuesday, 11 September 2007 13:27, Nigel Cunningham wrote:
> > > > > Hi.
> > > > > 
> > > > > On Tuesday 11 September 2007 21:04:22 Rafael J. Wysocki wrote:
> > > > > > On Tuesday, 11 September 2007 05:54, Nigel Cunningham wrote:
> > > > > > > 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.
> > > > > > 
> > > > > > Hm.
> > > > > > 
> > > > > > I use a resume from an initrd on a regular basis and it works 
> without the 
> > > > > patch
> > > > > > below.
> > > > > > 
> > > > > > I think we need to investigate what happens in your test case a bit.
> > > > > 
> > > > > 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.
> > > > 
> > > > Well, strange.  My x86_64 SMP machines don't need the patch too.
> > > 
> > > Anyway, yes, init is freezable, but should it be?
> > > 
> > > I mean, shouldn't we rather add PF_NOFREEZE to kernel_init()?
> > 
> > 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().
> 
> Ah yeah. Sorry about that. Is there some reason I've forgotten that makes the 
> order of try_to_freeze & yield in a loop like this matter?

Technically it's not that important, but conceptually try_to_freeze() should
happen right after we've been woken up.

> By the way, I had a go at getting fuse processes frozen today. Seems to be 
> doable if you take a freeze filesystems prior to processes approach. I've got 
> a lot more testing and a bit of cleaning up to do before I'd want to show it 
> to anyone, but did successfully do cycles with sshfs, fuseiso and curlftpfs.

Sounds promising. :-)
 
> Of course I don't seriously expect it to get merged - everyone's too much in 
> love with kexec at the moment :)

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix failure to resume from initrds
  2007-09-14 12:22 Rafael J. Wysocki
@ 2007-09-14 12:20 ` Pavel Machek
  0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2007-09-14 12:20 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Andrew Morton, Nigel Cunningham, LKML

Hi!

> 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>
> Acked-by: Rafael J. Wysocki <rjw@sisk.pl>

ACK.
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] Fix failure to resume from initrds
@ 2007-09-14 12:22 Rafael J. Wysocki
  2007-09-14 12:20 ` Pavel Machek
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2007-09-14 12:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Nigel Cunningham, Pavel Machek, LKML

[Please consider as 2.6.23 material]
---
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>
Acked-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);

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-09-14 12:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11  3:54 [PATCH] Fix failure to resume from initrds Nigel Cunningham
2007-09-11 11:04 ` Rafael J. Wysocki
2007-09-11 11:27   ` Nigel Cunningham
2007-09-11 11:55     ` Rafael J. Wysocki
2007-09-11 13:01       ` Nigel Cunningham
2007-09-11 13:12       ` Rafael J. Wysocki
2007-09-11 13:23         ` Rafael J. Wysocki
2007-09-11 13:41           ` Nigel Cunningham
2007-09-11 19:25             ` Rafael J. Wysocki
2007-09-11 14:39           ` Linus Torvalds
2007-09-11 16:27             ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2007-09-14 12:22 Rafael J. Wysocki
2007-09-14 12:20 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox