2007-05-26 09:29:21

by Maximilian Engelhardt

[permalink] [raw]
Subject: software suspend doesn't work with 2.6.22-rc3

Hello,

When I try software suspend on my laptop it always returns to my running
system after some time.
This is what's logged by the kernel:

swsusp: Basic memory bitmaps created
Stopping tasks ...
Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
freeze):
cryptd
Restarting tasks ... done.
swsusp: Basic memory bitmaps freed

I have no idea what's the problem, but if you tell me what I should do I can
create debugging information and/or test patches.

I have my config attached, the kernel is 2.6.22-rc3

Maxi


Attachments:
(No filename) (0.00 B)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-05-26 09:54:00

by Nigel Cunningham

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

Hi.

On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> Hello,
>
> When I try software suspend on my laptop it always returns to my running
> system after some time.
> This is what's logged by the kernel:
>
> swsusp: Basic memory bitmaps created
> Stopping tasks ...
> Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> freeze):
> cryptd
> Restarting tasks ... done.
> swsusp: Basic memory bitmaps freed
>
> I have no idea what's the problem, but if you tell me what I should do I can
> create debugging information and/or test patches.

Could you try this patch, please? It should help.

Herbert, is this right? If cryptd is going to be used for block devs,
the task should probably be PF_NOFREEZE (or whatever it is today)
instead.

Regards,

Nigel

crypto/cryptd.c | 1 +
include/linux/freezer.h | 3 +++
kernel/power/process.c | 2 +-
3 files changed, 5 insertions(+), 1 deletion(-)
diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c 991-fix-cryptd.patch-new/crypto/cryptd.c
--- 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19 18:16:47.000000000 +1000
+++ 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26 19:45:42.000000000 +1000
@@ -341,6 +341,7 @@ static int cryptd_thread(void *data)

mutex_unlock(&state->mutex);

+ try_to_freeze();
schedule();
} while (!stop);



Attachments:
signature.asc (189.00 B)
This is a digitally signed message part

2007-05-26 11:08:41

by Herbert Xu

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Sat, May 26, 2007 at 07:53:53PM +1000, Nigel Cunningham wrote:
>
> Herbert, is this right? If cryptd is going to be used for block devs,
> the task should probably be PF_NOFREEZE (or whatever it is today)
> instead.

Probably. However, I don't think this is responsible for the reported
problem because the code to use cryptd in dm-crypt hasn't been merged
yet :)

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2007-05-26 11:14:16

by Nigel Cunningham

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

Hi.

On Sat, 2007-05-26 at 21:08 +1000, Herbert Xu wrote:
> On Sat, May 26, 2007 at 07:53:53PM +1000, Nigel Cunningham wrote:
> >
> > Herbert, is this right? If cryptd is going to be used for block devs,
> > the task should probably be PF_NOFREEZE (or whatever it is today)
> > instead.
>
> Probably. However, I don't think this is responsible for the reported
> problem because the code to use cryptd in dm-crypt hasn't been merged
> yet :)

You have the cryptd Kconfig option in (at least in rc3) - presumably
Maximillian has been too keen and turned it on before you were ready :)
It does make sense for it to be the problem. Without PF_NOFREEZE set,
the refrigerator code will try to get it to enter the freezer, and
without the try_to_freeze(), it will just loop and freezing will fail.

Regards,

Nigel


Attachments:
signature.asc (189.00 B)
This is a digitally signed message part

2007-05-26 11:55:29

by Herbert Xu

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Sat, May 26, 2007 at 09:14:00PM +1000, Nigel Cunningham wrote:
>
> You have the cryptd Kconfig option in (at least in rc3) - presumably
> Maximillian has been too keen and turned it on before you were ready :)
> It does make sense for it to be the problem. Without PF_NOFREEZE set,
> the refrigerator code will try to get it to enter the freezer, and
> without the try_to_freeze(), it will just loop and freezing will fail.

OK that makes sense. I'll apply your patch.

Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2007-05-26 12:49:36

by Maximilian Engelhardt

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Saturday 26 May 2007, Nigel Cunningham wrote:
> Hi.
>
> On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > Hello,
> >
> > When I try software suspend on my laptop it always returns to my running
> > system after some time.
> > This is what's logged by the kernel:
> >
> > swsusp: Basic memory bitmaps created
> > Stopping tasks ...
> > Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> > freeze):
> > cryptd
> > Restarting tasks ... done.
> > swsusp: Basic memory bitmaps freed
> >
> > I have no idea what's the problem, but if you tell me what I should do I
> > can create debugging information and/or test patches.
>
> Could you try this patch, please? It should help.
>
> Herbert, is this right? If cryptd is going to be used for block devs,
> the task should probably be PF_NOFREEZE (or whatever it is today)
> instead.
>
> Regards,
>
> Nigel
>
> crypto/cryptd.c | 1 +
> include/linux/freezer.h | 3 +++
> kernel/power/process.c | 2 +-
> 3 files changed, 5 insertions(+), 1 deletion(-)
> diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19 18:16:47.000000000
> +1000 +++ 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int cryptd_thread(void
> *data)
>
> mutex_unlock(&state->mutex);
>
> + try_to_freeze();
> schedule();
> } while (!stop);

I tried your patch, but when I apply it my kernel doesn't compile any more. I
get these warnings/errors:

[...]
CC crypto/cryptd.o
crypto/cryptd.c: In function ‘cryptd_thread’:
crypto/cryptd.c:344: warning: implicit declaration of function ‘try_to_freeze’
[...]
LD init/built-in.o
LD .tmp_vmlinux1
crypto/built-in.o: In function `cryptd_thread':
cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
make: *** [.tmp_vmlinux1] Error 1

Maxi


Attachments:
(No filename) (1.91 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-05-26 20:15:16

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Saturday, 26 May 2007 14:49, Maximilian Engelhardt wrote:
> On Saturday 26 May 2007, Nigel Cunningham wrote:
> > Hi.
> >
> > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > Hello,
> > >
> > > When I try software suspend on my laptop it always returns to my running
> > > system after some time.
> > > This is what's logged by the kernel:
> > >
> > > swsusp: Basic memory bitmaps created
> > > Stopping tasks ...
> > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> > > freeze):
> > > cryptd
> > > Restarting tasks ... done.
> > > swsusp: Basic memory bitmaps freed
> > >
> > > I have no idea what's the problem, but if you tell me what I should do I
> > > can create debugging information and/or test patches.
> >
> > Could you try this patch, please? It should help.
> >
> > Herbert, is this right? If cryptd is going to be used for block devs,
> > the task should probably be PF_NOFREEZE (or whatever it is today)
> > instead.
> >
> > Regards,
> >
> > Nigel
> >
> > crypto/cryptd.c | 1 +
> > include/linux/freezer.h | 3 +++
> > kernel/power/process.c | 2 +-
> > 3 files changed, 5 insertions(+), 1 deletion(-)
> > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19 18:16:47.000000000
> > +1000 +++ 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int cryptd_thread(void
> > *data)
> >
> > mutex_unlock(&state->mutex);
> >
> > + try_to_freeze();
> > schedule();
> > } while (!stop);
>
> I tried your patch, but when I apply it my kernel doesn't compile any more. I
> get these warnings/errors:

You need to add '#include <freezer.h>' to crypto/cryptd.c .

Greetings,
Rafael

2007-05-26 20:18:14

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Saturday, 26 May 2007 13:55, Herbert Xu wrote:
> On Sat, May 26, 2007 at 09:14:00PM +1000, Nigel Cunningham wrote:
> >
> > You have the cryptd Kconfig option in (at least in rc3) - presumably
> > Maximillian has been too keen and turned it on before you were ready :)
> > It does make sense for it to be the problem. Without PF_NOFREEZE set,
> > the refrigerator code will try to get it to enter the freezer, and
> > without the try_to_freeze(), it will just loop and freezing will fail.
>
> OK that makes sense. I'll apply your patch.

Please add '#include <freezer.h>' to crypto/cryptd.c for the patch to
compile.

FYI, I'm going to post a patch that will make this try_to_freeze() unnecessary,
but I don't think it'll make it into 2.6.22.

Greetings,
Rafael

2007-05-26 21:33:48

by Nigel Cunningham

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

Hi.

On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> On Saturday 26 May 2007, Nigel Cunningham wrote:
> > Hi.
> >
> > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > Hello,
> > >
> > > When I try software suspend on my laptop it always returns to my running
> > > system after some time.
> > > This is what's logged by the kernel:
> > >
> > > swsusp: Basic memory bitmaps created
> > > Stopping tasks ...
> > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> > > freeze):
> > > cryptd
> > > Restarting tasks ... done.
> > > swsusp: Basic memory bitmaps freed
> > >
> > > I have no idea what's the problem, but if you tell me what I should do I
> > > can create debugging information and/or test patches.
> >
> > Could you try this patch, please? It should help.
> >
> > Herbert, is this right? If cryptd is going to be used for block devs,
> > the task should probably be PF_NOFREEZE (or whatever it is today)
> > instead.
> >
> > Regards,
> >
> > Nigel
> >
> > crypto/cryptd.c | 1 +
> > include/linux/freezer.h | 3 +++
> > kernel/power/process.c | 2 +-
> > 3 files changed, 5 insertions(+), 1 deletion(-)
> > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19 18:16:47.000000000
> > +1000 +++ 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int cryptd_thread(void
> > *data)
> >
> > mutex_unlock(&state->mutex);
> >
> > + try_to_freeze();
> > schedule();
> > } while (!stop);
>
> I tried your patch, but when I apply it my kernel doesn't compile any more. I
> get these warnings/errors:
>
> [...]
> CC crypto/cryptd.o
> crypto/cryptd.c: In function ?cryptd_thread?:
> crypto/cryptd.c:344: warning: implicit declaration of function ?try_to_freeze?
> [...]
> LD init/built-in.o
> LD .tmp_vmlinux1
> crypto/built-in.o: In function `cryptd_thread':
> cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> make: *** [.tmp_vmlinux1] Error 1

Ah. You'll need to add #include <linux/freezer.h> near that start of
crypto/cryptd.c. Sorry for forgetting that.

Nigel


Attachments:
signature.asc (189.00 B)
This is a digitally signed message part

2007-05-27 16:02:20

by Maximilian Engelhardt

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Saturday 26 May 2007, Nigel Cunningham wrote:
> Hi.
>
> On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > Hi.
> > >
> > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > Hello,
> > > >
> > > > When I try software suspend on my laptop it always returns to my
> > > > running system after some time.
> > > > This is what's logged by the kernel:
> > > >
> > > > swsusp: Basic memory bitmaps created
> > > > Stopping tasks ...
> > > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing
> > > > to freeze):
> > > > cryptd
> > > > Restarting tasks ... done.
> > > > swsusp: Basic memory bitmaps freed
> > > >
> > > > I have no idea what's the problem, but if you tell me what I should
> > > > do I can create debugging information and/or test patches.
> > >
> > > Could you try this patch, please? It should help.
> > >
> > > Herbert, is this right? If cryptd is going to be used for block devs,
> > > the task should probably be PF_NOFREEZE (or whatever it is today)
> > > instead.
> > >
> > > Regards,
> > >
> > > Nigel
> > >
> > > crypto/cryptd.c | 1 +
> > > include/linux/freezer.h | 3 +++
> > > kernel/power/process.c | 2 +-
> > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19 18:16:47.000000000
> > > +1000 +++ 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > cryptd_thread(void *data)
> > >
> > > mutex_unlock(&state->mutex);
> > >
> > > + try_to_freeze();
> > > schedule();
> > > } while (!stop);
> >
> > I tried your patch, but when I apply it my kernel doesn't compile any
> > more. I get these warnings/errors:
> >
> > [...]
> > CC crypto/cryptd.o
> > crypto/cryptd.c: In function ‘cryptd_thread’:
> > crypto/cryptd.c:344: warning: implicit declaration of function
> > ‘try_to_freeze’ [...]
> > LD init/built-in.o
> > LD .tmp_vmlinux1
> > crypto/built-in.o: In function `cryptd_thread':
> > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > make: *** [.tmp_vmlinux1] Error 1
>
> Ah. You'll need to add #include <linux/freezer.h> near that start of
> crypto/cryptd.c. Sorry for forgetting that.
>
> Nigel

I added the include line and now I could compile the kernel, but suspending
still doesn't work.

swsusp: Basic memory bitmaps created
Stopping tasks ...
Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
freeze):
cryptd
Restarting tasks ... done.
swsusp: Basic memory bitmaps freed

Maxi


Attachments:
(No filename) (2.69 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-05-27 18:14:14

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> On Saturday 26 May 2007, Nigel Cunningham wrote:
> > Hi.
> >
> > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > Hi.
> > > >
> > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > > Hello,
> > > > >
> > > > > When I try software suspend on my laptop it always returns to my
> > > > > running system after some time.
> > > > > This is what's logged by the kernel:
> > > > >
> > > > > swsusp: Basic memory bitmaps created
> > > > > Stopping tasks ...
> > > > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing
> > > > > to freeze):
> > > > > cryptd
> > > > > Restarting tasks ... done.
> > > > > swsusp: Basic memory bitmaps freed
> > > > >
> > > > > I have no idea what's the problem, but if you tell me what I should
> > > > > do I can create debugging information and/or test patches.
> > > >
> > > > Could you try this patch, please? It should help.
> > > >
> > > > Herbert, is this right? If cryptd is going to be used for block devs,
> > > > the task should probably be PF_NOFREEZE (or whatever it is today)
> > > > instead.
> > > >
> > > > Regards,
> > > >
> > > > Nigel
> > > >
> > > > crypto/cryptd.c | 1 +
> > > > include/linux/freezer.h | 3 +++
> > > > kernel/power/process.c | 2 +-
> > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19 18:16:47.000000000
> > > > +1000 +++ 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > cryptd_thread(void *data)
> > > >
> > > > mutex_unlock(&state->mutex);
> > > >
> > > > + try_to_freeze();
> > > > schedule();
> > > > } while (!stop);
> > >
> > > I tried your patch, but when I apply it my kernel doesn't compile any
> > > more. I get these warnings/errors:
> > >
> > > [...]
> > > CC crypto/cryptd.o
> > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > crypto/cryptd.c:344: warning: implicit declaration of function
> > > ‘try_to_freeze’ [...]
> > > LD init/built-in.o
> > > LD .tmp_vmlinux1
> > > crypto/built-in.o: In function `cryptd_thread':
> > > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > > make: *** [.tmp_vmlinux1] Error 1
> >
> > Ah. You'll need to add #include <linux/freezer.h> near that start of
> > crypto/cryptd.c. Sorry for forgetting that.
> >
> > Nigel
>
> I added the include line and now I could compile the kernel, but suspending
> still doesn't work.
>
> swsusp: Basic memory bitmaps created
> Stopping tasks ...
> Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> freeze):
> cryptd
> Restarting tasks ... done.
> swsusp: Basic memory bitmaps freed

OK, this means that cryptd doesn't execute the try_to_freeze() for some
reason.

Please apply the appended patch on top of 2.6.22-rc3 and see if that helps.

Greetings,
Rafael

---
crypto/cryptd.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.22-rc3/crypto/cryptd.c
===================================================================
--- linux-2.6.22-rc3.orig/crypto/cryptd.c
+++ linux-2.6.22-rc3/crypto/cryptd.c
@@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
struct cryptd_state *state = data;
int stop;

+ current->flags |= PF_NOFREEZE;
do {
struct crypto_async_request *req, *backlog;

2007-05-27 20:42:19

by Maximilian Engelhardt

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > Hi.
> > >
> > > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > Hi.
> > > > >
> > > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > > > Hello,
> > > > > >
> > > > > > When I try software suspend on my laptop it always returns to my
> > > > > > running system after some time.
> > > > > > This is what's logged by the kernel:
> > > > > >
> > > > > > swsusp: Basic memory bitmaps created
> > > > > > Stopping tasks ...
> > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks
> > > > > > refusing to freeze):
> > > > > > cryptd
> > > > > > Restarting tasks ... done.
> > > > > > swsusp: Basic memory bitmaps freed
> > > > > >
> > > > > > I have no idea what's the problem, but if you tell me what I
> > > > > > should do I can create debugging information and/or test patches.
> > > > >
> > > > > Could you try this patch, please? It should help.
> > > > >
> > > > > Herbert, is this right? If cryptd is going to be used for block
> > > > > devs, the task should probably be PF_NOFREEZE (or whatever it is
> > > > > today) instead.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Nigel
> > > > >
> > > > > crypto/cryptd.c | 1 +
> > > > > include/linux/freezer.h | 3 +++
> > > > > kernel/power/process.c | 2 +-
> > > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19
> > > > > 18:16:47.000000000 +1000 +++
> > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > > cryptd_thread(void *data)
> > > > >
> > > > > mutex_unlock(&state->mutex);
> > > > >
> > > > > + try_to_freeze();
> > > > > schedule();
> > > > > } while (!stop);
> > > >
> > > > I tried your patch, but when I apply it my kernel doesn't compile any
> > > > more. I get these warnings/errors:
> > > >
> > > > [...]
> > > > CC crypto/cryptd.o
> > > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > > crypto/cryptd.c:344: warning: implicit declaration of function
> > > > ‘try_to_freeze’ [...]
> > > > LD init/built-in.o
> > > > LD .tmp_vmlinux1
> > > > crypto/built-in.o: In function `cryptd_thread':
> > > > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > > > make: *** [.tmp_vmlinux1] Error 1
> > >
> > > Ah. You'll need to add #include <linux/freezer.h> near that start of
> > > crypto/cryptd.c. Sorry for forgetting that.
> > >
> > > Nigel
> >
> > I added the include line and now I could compile the kernel, but
> > suspending still doesn't work.
> >
> > swsusp: Basic memory bitmaps created
> > Stopping tasks ...
> > Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> > freeze):
> > cryptd
> > Restarting tasks ... done.
> > swsusp: Basic memory bitmaps freed
>
> OK, this means that cryptd doesn't execute the try_to_freeze() for some
> reason.
>
> Please apply the appended patch on top of 2.6.22-rc3 and see if that helps.
>
> Greetings,
> Rafael
>
> ---
> crypto/cryptd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Index: linux-2.6.22-rc3/crypto/cryptd.c
> ===================================================================
> --- linux-2.6.22-rc3.orig/crypto/cryptd.c
> +++ linux-2.6.22-rc3/crypto/cryptd.c
> @@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
> struct cryptd_state *state = data;
> int stop;
>
> + current->flags |= PF_NOFREEZE;
> do {
> struct crypto_async_request *req, *backlog;

Even with this patch suspending doesn't work, dmesg shows the same error
message.
I also did build a kernel without cryptd and suspending does work there.

Maxi


Attachments:
(No filename) (3.92 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-05-27 21:00:46

by Pavel Machek

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

Hi!

> When I try software suspend on my laptop it always returns to my running
> system after some time.
> This is what's logged by the kernel:
>
> swsusp: Basic memory bitmaps created
> Stopping tasks ...
> Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> freeze):
> cryptd
> Restarting tasks ... done.

Is cryptd a kernel thread? It is probably missing try_to_freeze(). If
it is userland app, try stopping it before suspend.

Pavel


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

2007-05-27 21:22:08

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Sunday, 27 May 2007 22:41, Maximilian Engelhardt wrote:
> On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > Hi.
> > > >
> > > > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > Hi.
> > > > > >
> > > > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > > > > Hello,
> > > > > > >
> > > > > > > When I try software suspend on my laptop it always returns to my
> > > > > > > running system after some time.
> > > > > > > This is what's logged by the kernel:
> > > > > > >
> > > > > > > swsusp: Basic memory bitmaps created
> > > > > > > Stopping tasks ...
> > > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks
> > > > > > > refusing to freeze):
> > > > > > > cryptd
> > > > > > > Restarting tasks ... done.
> > > > > > > swsusp: Basic memory bitmaps freed
> > > > > > >
> > > > > > > I have no idea what's the problem, but if you tell me what I
> > > > > > > should do I can create debugging information and/or test patches.
> > > > > >
> > > > > > Could you try this patch, please? It should help.
> > > > > >
> > > > > > Herbert, is this right? If cryptd is going to be used for block
> > > > > > devs, the task should probably be PF_NOFREEZE (or whatever it is
> > > > > > today) instead.
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > Nigel
> > > > > >
> > > > > > crypto/cryptd.c | 1 +
> > > > > > include/linux/freezer.h | 3 +++
> > > > > > kernel/power/process.c | 2 +-
> > > > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19
> > > > > > 18:16:47.000000000 +1000 +++
> > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > > > cryptd_thread(void *data)
> > > > > >
> > > > > > mutex_unlock(&state->mutex);
> > > > > >
> > > > > > + try_to_freeze();
> > > > > > schedule();
> > > > > > } while (!stop);
> > > > >
> > > > > I tried your patch, but when I apply it my kernel doesn't compile any
> > > > > more. I get these warnings/errors:
> > > > >
> > > > > [...]
> > > > > CC crypto/cryptd.o
> > > > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > > > crypto/cryptd.c:344: warning: implicit declaration of function
> > > > > ‘try_to_freeze’ [...]
> > > > > LD init/built-in.o
> > > > > LD .tmp_vmlinux1
> > > > > crypto/built-in.o: In function `cryptd_thread':
> > > > > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > > > > make: *** [.tmp_vmlinux1] Error 1
> > > >
> > > > Ah. You'll need to add #include <linux/freezer.h> near that start of
> > > > crypto/cryptd.c. Sorry for forgetting that.
> > > >
> > > > Nigel
> > >
> > > I added the include line and now I could compile the kernel, but
> > > suspending still doesn't work.
> > >
> > > swsusp: Basic memory bitmaps created
> > > Stopping tasks ...
> > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing to
> > > freeze):
> > > cryptd
> > > Restarting tasks ... done.
> > > swsusp: Basic memory bitmaps freed
> >
> > OK, this means that cryptd doesn't execute the try_to_freeze() for some
> > reason.
> >
> > Please apply the appended patch on top of 2.6.22-rc3 and see if that helps.
> >
> > Greetings,
> > Rafael
> >
> > ---
> > crypto/cryptd.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > Index: linux-2.6.22-rc3/crypto/cryptd.c
> > ===================================================================
> > --- linux-2.6.22-rc3.orig/crypto/cryptd.c
> > +++ linux-2.6.22-rc3/crypto/cryptd.c
> > @@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
> > struct cryptd_state *state = data;
> > int stop;
> >
> > + current->flags |= PF_NOFREEZE;
> > do {
> > struct crypto_async_request *req, *backlog;
>
> Even with this patch suspending doesn't work, dmesg shows the same error
> message.
> I also did build a kernel without cryptd and suspending does work there.

Well, that's strange, because in that case the freezer shouldn't even wait
for cryptd.

Can you please try the patch at http://lkml.org/lkml/2007/5/26/169 ?

Greetings,
Rafael

2007-05-28 00:22:22

by Maximilian Engelhardt

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> On Sunday, 27 May 2007 22:41, Maximilian Engelhardt wrote:
> > On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > > On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > Hi.
> > > > >
> > > > > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > > Hi.
> > > > > > >
> > > > > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > When I try software suspend on my laptop it always returns to
> > > > > > > > my running system after some time.
> > > > > > > > This is what's logged by the kernel:
> > > > > > > >
> > > > > > > > swsusp: Basic memory bitmaps created
> > > > > > > > Stopping tasks ...
> > > > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks
> > > > > > > > refusing to freeze):
> > > > > > > > cryptd
> > > > > > > > Restarting tasks ... done.
> > > > > > > > swsusp: Basic memory bitmaps freed
> > > > > > > >
> > > > > > > > I have no idea what's the problem, but if you tell me what I
> > > > > > > > should do I can create debugging information and/or test
> > > > > > > > patches.
> > > > > > >
> > > > > > > Could you try this patch, please? It should help.
> > > > > > >
> > > > > > > Herbert, is this right? If cryptd is going to be used for block
> > > > > > > devs, the task should probably be PF_NOFREEZE (or whatever it
> > > > > > > is today) instead.
> > > > > > >
> > > > > > > Regards,
> > > > > > >
> > > > > > > Nigel
> > > > > > >
> > > > > > > crypto/cryptd.c | 1 +
> > > > > > > include/linux/freezer.h | 3 +++
> > > > > > > kernel/power/process.c | 2 +-
> > > > > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19
> > > > > > > 18:16:47.000000000 +1000 +++
> > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > > > > cryptd_thread(void *data)
> > > > > > >
> > > > > > > mutex_unlock(&state->mutex);
> > > > > > >
> > > > > > > + try_to_freeze();
> > > > > > > schedule();
> > > > > > > } while (!stop);
> > > > > >
> > > > > > I tried your patch, but when I apply it my kernel doesn't compile
> > > > > > any more. I get these warnings/errors:
> > > > > >
> > > > > > [...]
> > > > > > CC crypto/cryptd.o
> > > > > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > > > > crypto/cryptd.c:344: warning: implicit declaration of function
> > > > > > ‘try_to_freeze’ [...]
> > > > > > LD init/built-in.o
> > > > > > LD .tmp_vmlinux1
> > > > > > crypto/built-in.o: In function `cryptd_thread':
> > > > > > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > > > > > make: *** [.tmp_vmlinux1] Error 1
> > > > >
> > > > > Ah. You'll need to add #include <linux/freezer.h> near that start
> > > > > of crypto/cryptd.c. Sorry for forgetting that.
> > > > >
> > > > > Nigel
> > > >
> > > > I added the include line and now I could compile the kernel, but
> > > > suspending still doesn't work.
> > > >
> > > > swsusp: Basic memory bitmaps created
> > > > Stopping tasks ...
> > > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing
> > > > to freeze):
> > > > cryptd
> > > > Restarting tasks ... done.
> > > > swsusp: Basic memory bitmaps freed
> > >
> > > OK, this means that cryptd doesn't execute the try_to_freeze() for some
> > > reason.
> > >
> > > Please apply the appended patch on top of 2.6.22-rc3 and see if that
> > > helps.
> > >
> > > Greetings,
> > > Rafael
> > >
> > > ---
> > > crypto/cryptd.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > Index: linux-2.6.22-rc3/crypto/cryptd.c
> > > ===================================================================
> > > --- linux-2.6.22-rc3.orig/crypto/cryptd.c
> > > +++ linux-2.6.22-rc3/crypto/cryptd.c
> > > @@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
> > > struct cryptd_state *state = data;
> > > int stop;
> > >
> > > + current->flags |= PF_NOFREEZE;
> > > do {
> > > struct crypto_async_request *req, *backlog;
> >
> > Even with this patch suspending doesn't work, dmesg shows the same error
> > message.
> > I also did build a kernel without cryptd and suspending does work there.
>
> Well, that's strange, because in that case the freezer shouldn't even wait
> for cryptd.
>
> Can you please try the patch at http://lkml.org/lkml/2007/5/26/169 ?

With this patch applied suspend does work fine.

Maxi


Attachments:
(No filename) (4.70 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-05-28 08:07:11

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Monday, 28 May 2007 02:21, Maximilian Engelhardt wrote:
> On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > On Sunday, 27 May 2007 22:41, Maximilian Engelhardt wrote:
> > > On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > > > On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > Hi.
> > > > > >
> > > > > > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > > > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > > > Hi.
> > > > > > > >
> > > > > > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > > > > > > Hello,
> > > > > > > > >
> > > > > > > > > When I try software suspend on my laptop it always returns to
> > > > > > > > > my running system after some time.
> > > > > > > > > This is what's logged by the kernel:
> > > > > > > > >
> > > > > > > > > swsusp: Basic memory bitmaps created
> > > > > > > > > Stopping tasks ...
> > > > > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks
> > > > > > > > > refusing to freeze):
> > > > > > > > > cryptd
> > > > > > > > > Restarting tasks ... done.
> > > > > > > > > swsusp: Basic memory bitmaps freed
> > > > > > > > >
> > > > > > > > > I have no idea what's the problem, but if you tell me what I
> > > > > > > > > should do I can create debugging information and/or test
> > > > > > > > > patches.
> > > > > > > >
> > > > > > > > Could you try this patch, please? It should help.
> > > > > > > >
> > > > > > > > Herbert, is this right? If cryptd is going to be used for block
> > > > > > > > devs, the task should probably be PF_NOFREEZE (or whatever it
> > > > > > > > is today) instead.
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > Nigel
> > > > > > > >
> > > > > > > > crypto/cryptd.c | 1 +
> > > > > > > > include/linux/freezer.h | 3 +++
> > > > > > > > kernel/power/process.c | 2 +-
> > > > > > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > > > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > > > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19
> > > > > > > > 18:16:47.000000000 +1000 +++
> > > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > > > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > > > > > cryptd_thread(void *data)
> > > > > > > >
> > > > > > > > mutex_unlock(&state->mutex);
> > > > > > > >
> > > > > > > > + try_to_freeze();
> > > > > > > > schedule();
> > > > > > > > } while (!stop);
> > > > > > >
> > > > > > > I tried your patch, but when I apply it my kernel doesn't compile
> > > > > > > any more. I get these warnings/errors:
> > > > > > >
> > > > > > > [...]
> > > > > > > CC crypto/cryptd.o
> > > > > > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > > > > > crypto/cryptd.c:344: warning: implicit declaration of function
> > > > > > > ‘try_to_freeze’ [...]
> > > > > > > LD init/built-in.o
> > > > > > > LD .tmp_vmlinux1
> > > > > > > crypto/built-in.o: In function `cryptd_thread':
> > > > > > > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > > > > > > make: *** [.tmp_vmlinux1] Error 1
> > > > > >
> > > > > > Ah. You'll need to add #include <linux/freezer.h> near that start
> > > > > > of crypto/cryptd.c. Sorry for forgetting that.
> > > > > >
> > > > > > Nigel
> > > > >
> > > > > I added the include line and now I could compile the kernel, but
> > > > > suspending still doesn't work.
> > > > >
> > > > > swsusp: Basic memory bitmaps created
> > > > > Stopping tasks ...
> > > > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing
> > > > > to freeze):
> > > > > cryptd
> > > > > Restarting tasks ... done.
> > > > > swsusp: Basic memory bitmaps freed
> > > >
> > > > OK, this means that cryptd doesn't execute the try_to_freeze() for some
> > > > reason.
> > > >
> > > > Please apply the appended patch on top of 2.6.22-rc3 and see if that
> > > > helps.
> > > >
> > > > Greetings,
> > > > Rafael
> > > >
> > > > ---
> > > > crypto/cryptd.c | 1 +
> > > > 1 file changed, 1 insertion(+)
> > > >
> > > > Index: linux-2.6.22-rc3/crypto/cryptd.c
> > > > ===================================================================
> > > > --- linux-2.6.22-rc3.orig/crypto/cryptd.c
> > > > +++ linux-2.6.22-rc3/crypto/cryptd.c
> > > > @@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
> > > > struct cryptd_state *state = data;
> > > > int stop;
> > > >
> > > > + current->flags |= PF_NOFREEZE;
> > > > do {
> > > > struct crypto_async_request *req, *backlog;
> > >
> > > Even with this patch suspending doesn't work, dmesg shows the same error
> > > message.
> > > I also did build a kernel without cryptd and suspending does work there.
> >
> > Well, that's strange, because in that case the freezer shouldn't even wait
> > for cryptd.
> >
> > Can you please try the patch at http://lkml.org/lkml/2007/5/26/169 ?
>
> With this patch applied suspend does work fine.

Hmm. IMO the patch is too intrusive for 2.6.22, but OTOH it's going into the
direction preferred by some prominent people. ;-)

Let's try to combine the two threads and see what results from that.

Greetings,
Rafael

2007-05-28 18:16:20

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Monday, 28 May 2007 09:59, Rafael J. Wysocki wrote:
> On Monday, 28 May 2007 02:21, Maximilian Engelhardt wrote:
> > On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > > On Sunday, 27 May 2007 22:41, Maximilian Engelhardt wrote:
> > > > On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > > > > On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> > > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > > Hi.
> > > > > > >
> > > > > > > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt wrote:
> > > > > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > > > > Hi.
> > > > > > > > >
> > > > > > > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt wrote:
> > > > > > > > > > Hello,
> > > > > > > > > >
> > > > > > > > > > When I try software suspend on my laptop it always returns to
> > > > > > > > > > my running system after some time.
> > > > > > > > > > This is what's logged by the kernel:
> > > > > > > > > >
> > > > > > > > > > swsusp: Basic memory bitmaps created
> > > > > > > > > > Stopping tasks ...
> > > > > > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks
> > > > > > > > > > refusing to freeze):
> > > > > > > > > > cryptd
> > > > > > > > > > Restarting tasks ... done.
> > > > > > > > > > swsusp: Basic memory bitmaps freed
> > > > > > > > > >
> > > > > > > > > > I have no idea what's the problem, but if you tell me what I
> > > > > > > > > > should do I can create debugging information and/or test
> > > > > > > > > > patches.
> > > > > > > > >
> > > > > > > > > Could you try this patch, please? It should help.
> > > > > > > > >
> > > > > > > > > Herbert, is this right? If cryptd is going to be used for block
> > > > > > > > > devs, the task should probably be PF_NOFREEZE (or whatever it
> > > > > > > > > is today) instead.
> > > > > > > > >
> > > > > > > > > Regards,
> > > > > > > > >
> > > > > > > > > Nigel
> > > > > > > > >
> > > > > > > > > crypto/cryptd.c | 1 +
> > > > > > > > > include/linux/freezer.h | 3 +++
> > > > > > > > > kernel/power/process.c | 2 +-
> > > > > > > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > > > > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > > > > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19
> > > > > > > > > 18:16:47.000000000 +1000 +++
> > > > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > > > > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > > > > > > cryptd_thread(void *data)
> > > > > > > > >
> > > > > > > > > mutex_unlock(&state->mutex);
> > > > > > > > >
> > > > > > > > > + try_to_freeze();
> > > > > > > > > schedule();
> > > > > > > > > } while (!stop);
> > > > > > > >
> > > > > > > > I tried your patch, but when I apply it my kernel doesn't compile
> > > > > > > > any more. I get these warnings/errors:
> > > > > > > >
> > > > > > > > [...]
> > > > > > > > CC crypto/cryptd.o
> > > > > > > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > > > > > > crypto/cryptd.c:344: warning: implicit declaration of function
> > > > > > > > ‘try_to_freeze’ [...]
> > > > > > > > LD init/built-in.o
> > > > > > > > LD .tmp_vmlinux1
> > > > > > > > crypto/built-in.o: In function `cryptd_thread':
> > > > > > > > cryptd.c:(.text+0xd7f5): undefined reference to `try_to_freeze'
> > > > > > > > make: *** [.tmp_vmlinux1] Error 1
> > > > > > >
> > > > > > > Ah. You'll need to add #include <linux/freezer.h> near that start
> > > > > > > of crypto/cryptd.c. Sorry for forgetting that.
> > > > > > >
> > > > > > > Nigel
> > > > > >
> > > > > > I added the include line and now I could compile the kernel, but
> > > > > > suspending still doesn't work.
> > > > > >
> > > > > > swsusp: Basic memory bitmaps created
> > > > > > Stopping tasks ...
> > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks refusing
> > > > > > to freeze):
> > > > > > cryptd
> > > > > > Restarting tasks ... done.
> > > > > > swsusp: Basic memory bitmaps freed
> > > > >
> > > > > OK, this means that cryptd doesn't execute the try_to_freeze() for some
> > > > > reason.
> > > > >
> > > > > Please apply the appended patch on top of 2.6.22-rc3 and see if that
> > > > > helps.
> > > > >
> > > > > Greetings,
> > > > > Rafael
> > > > >
> > > > > ---
> > > > > crypto/cryptd.c | 1 +
> > > > > 1 file changed, 1 insertion(+)
> > > > >
> > > > > Index: linux-2.6.22-rc3/crypto/cryptd.c
> > > > > ===================================================================
> > > > > --- linux-2.6.22-rc3.orig/crypto/cryptd.c
> > > > > +++ linux-2.6.22-rc3/crypto/cryptd.c
> > > > > @@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
> > > > > struct cryptd_state *state = data;
> > > > > int stop;
> > > > >
> > > > > + current->flags |= PF_NOFREEZE;
> > > > > do {
> > > > > struct crypto_async_request *req, *backlog;
> > > >
> > > > Even with this patch suspending doesn't work, dmesg shows the same error
> > > > message.
> > > > I also did build a kernel without cryptd and suspending does work there.
> > >
> > > Well, that's strange, because in that case the freezer shouldn't even wait
> > > for cryptd.
> > >
> > > Can you please try the patch at http://lkml.org/lkml/2007/5/26/169 ?
> >
> > With this patch applied suspend does work fine.
>
> Hmm. IMO the patch is too intrusive for 2.6.22, but OTOH it's going into the
> direction preferred by some prominent people. ;-)
>
> Let's try to combine the two threads and see what results from that.

Well, it looks like we have to fix this one separately.

Can you please tell me what to do to make cryptd run?

Rafael

2007-05-28 21:02:57

by Maximilian Engelhardt

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Monday 28 May 2007, Rafael J. Wysocki wrote:
> On Monday, 28 May 2007 09:59, Rafael J. Wysocki wrote:
> > On Monday, 28 May 2007 02:21, Maximilian Engelhardt wrote:
> > > On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > > > On Sunday, 27 May 2007 22:41, Maximilian Engelhardt wrote:
> > > > > On Sunday 27 May 2007, Rafael J. Wysocki wrote:
> > > > > > On Sunday, 27 May 2007 18:01, Maximilian Engelhardt wrote:
> > > > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > > > Hi.
> > > > > > > >
> > > > > > > > On Sat, 2007-05-26 at 14:49 +0200, Maximilian Engelhardt
wrote:
> > > > > > > > > On Saturday 26 May 2007, Nigel Cunningham wrote:
> > > > > > > > > > Hi.
> > > > > > > > > >
> > > > > > > > > > On Sat, 2007-05-26 at 11:28 +0200, Maximilian Engelhardt
wrote:
> > > > > > > > > > > Hello,
> > > > > > > > > > >
> > > > > > > > > > > When I try software suspend on my laptop it always
> > > > > > > > > > > returns to my running system after some time.
> > > > > > > > > > > This is what's logged by the kernel:
> > > > > > > > > > >
> > > > > > > > > > > swsusp: Basic memory bitmaps created
> > > > > > > > > > > Stopping tasks ...
> > > > > > > > > > > Stopping kernel threads timed out after 20 seconds (1
> > > > > > > > > > > tasks refusing to freeze):
> > > > > > > > > > > cryptd
> > > > > > > > > > > Restarting tasks ... done.
> > > > > > > > > > > swsusp: Basic memory bitmaps freed
> > > > > > > > > > >
> > > > > > > > > > > I have no idea what's the problem, but if you tell me
> > > > > > > > > > > what I should do I can create debugging information
> > > > > > > > > > > and/or test patches.
> > > > > > > > > >
> > > > > > > > > > Could you try this patch, please? It should help.
> > > > > > > > > >
> > > > > > > > > > Herbert, is this right? If cryptd is going to be used for
> > > > > > > > > > block devs, the task should probably be PF_NOFREEZE (or
> > > > > > > > > > whatever it is today) instead.
> > > > > > > > > >
> > > > > > > > > > Regards,
> > > > > > > > > >
> > > > > > > > > > Nigel
> > > > > > > > > >
> > > > > > > > > > crypto/cryptd.c | 1 +
> > > > > > > > > > include/linux/freezer.h | 3 +++
> > > > > > > > > > kernel/power/process.c | 2 +-
> > > > > > > > > > 3 files changed, 5 insertions(+), 1 deletion(-)
> > > > > > > > > > diff -ruNp 991-fix-cryptd.patch-old/crypto/cryptd.c
> > > > > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c ---
> > > > > > > > > > 991-fix-cryptd.patch-old/crypto/cryptd.c 2007-05-19
> > > > > > > > > > 18:16:47.000000000 +1000 +++
> > > > > > > > > > 991-fix-cryptd.patch-new/crypto/cryptd.c 2007-05-26
> > > > > > > > > > 19:45:42.000000000 +1000 @@ -341,6 +341,7 @@ static int
> > > > > > > > > > cryptd_thread(void *data)
> > > > > > > > > >
> > > > > > > > > > mutex_unlock(&state->mutex);
> > > > > > > > > >
> > > > > > > > > > + try_to_freeze();
> > > > > > > > > > schedule();
> > > > > > > > > > } while (!stop);
> > > > > > > > >
> > > > > > > > > I tried your patch, but when I apply it my kernel doesn't
> > > > > > > > > compile any more. I get these warnings/errors:
> > > > > > > > >
> > > > > > > > > [...]
> > > > > > > > > CC crypto/cryptd.o
> > > > > > > > > crypto/cryptd.c: In function ‘cryptd_thread’:
> > > > > > > > > crypto/cryptd.c:344: warning: implicit declaration of
> > > > > > > > > function ‘try_to_freeze’ [...]
> > > > > > > > > LD init/built-in.o
> > > > > > > > > LD .tmp_vmlinux1
> > > > > > > > > crypto/built-in.o: In function `cryptd_thread':
> > > > > > > > > cryptd.c:(.text+0xd7f5): undefined reference to
> > > > > > > > > `try_to_freeze' make: *** [.tmp_vmlinux1] Error 1
> > > > > > > >
> > > > > > > > Ah. You'll need to add #include <linux/freezer.h> near that
> > > > > > > > start of crypto/cryptd.c. Sorry for forgetting that.
> > > > > > > >
> > > > > > > > Nigel
> > > > > > >
> > > > > > > I added the include line and now I could compile the kernel,
> > > > > > > but suspending still doesn't work.
> > > > > > >
> > > > > > > swsusp: Basic memory bitmaps created
> > > > > > > Stopping tasks ...
> > > > > > > Stopping kernel threads timed out after 20 seconds (1 tasks
> > > > > > > refusing to freeze):
> > > > > > > cryptd
> > > > > > > Restarting tasks ... done.
> > > > > > > swsusp: Basic memory bitmaps freed
> > > > > >
> > > > > > OK, this means that cryptd doesn't execute the try_to_freeze()
> > > > > > for some reason.
> > > > > >
> > > > > > Please apply the appended patch on top of 2.6.22-rc3 and see if
> > > > > > that helps.
> > > > > >
> > > > > > Greetings,
> > > > > > Rafael
> > > > > >
> > > > > > ---
> > > > > > crypto/cryptd.c | 1 +
> > > > > > 1 file changed, 1 insertion(+)
> > > > > >
> > > > > > Index: linux-2.6.22-rc3/crypto/cryptd.c
> > > > > > =================================================================
> > > > > >== --- linux-2.6.22-rc3.orig/crypto/cryptd.c
> > > > > > +++ linux-2.6.22-rc3/crypto/cryptd.c
> > > > > > @@ -316,6 +316,7 @@ static int cryptd_thread(void *data)
> > > > > > struct cryptd_state *state = data;
> > > > > > int stop;
> > > > > >
> > > > > > + current->flags |= PF_NOFREEZE;
> > > > > > do {
> > > > > > struct crypto_async_request *req, *backlog;
> > > > >
> > > > > Even with this patch suspending doesn't work, dmesg shows the same
> > > > > error message.
> > > > > I also did build a kernel without cryptd and suspending does work
> > > > > there.
> > > >
> > > > Well, that's strange, because in that case the freezer shouldn't even
> > > > wait for cryptd.
> > > >
> > > > Can you please try the patch at http://lkml.org/lkml/2007/5/26/169 ?
> > >
> > > With this patch applied suspend does work fine.
> >
> > Hmm. IMO the patch is too intrusive for 2.6.22, but OTOH it's going into
> > the direction preferred by some prominent people. ;-)
> >
> > Let's try to combine the two threads and see what results from that.
>
> Well, it looks like we have to fix this one separately.
>
> Can you please tell me what to do to make cryptd run?

Well, there really isn't much I do. When I switched from 2.6.21 to 2.6.22-rc2
I did a 'make oldconfig' and I enabled CONFIG_CRYPTO_CRYPTD because I thought
it would be a good idea. I don't need cryptd,  I just enabled it. Now when I
boot this kernel it seems like cryptd is automatically started.

I also tried building a kernel where CONFIG_CRYPTO_CRYPTD is disabled and
there suspending does work fine.

Maxi


Attachments:
(No filename) (6.32 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-05-29 00:41:19

by Herbert Xu

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Mon, May 28, 2007 at 08:21:29PM +0200, Rafael J. Wysocki wrote:
>
> Well, it looks like we have to fix this one separately.
>
> Can you please tell me what to do to make cryptd run?

If you build it as a module then just loading it should be sufficient.
If you have it built-in then it should always be there.

Let me know when you guys have a final patch.

Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2007-05-29 11:56:21

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Tuesday, 29 May 2007 02:39, Herbert Xu wrote:
> On Mon, May 28, 2007 at 08:21:29PM +0200, Rafael J. Wysocki wrote:
> >
> > Well, it looks like we have to fix this one separately.
> >
> > Can you please tell me what to do to make cryptd run?
>
> If you build it as a module then just loading it should be sufficient.
> If you have it built-in then it should always be there.

Thanks.

> Let me know when you guys have a final patch.

OK

Greetings,
Rafael

2007-05-31 06:49:41

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Tuesday, 29 May 2007 02:39, Herbert Xu wrote:
> On Mon, May 28, 2007 at 08:21:29PM +0200, Rafael J. Wysocki wrote:
> >
> > Well, it looks like we have to fix this one separately.
> >
> > Can you please tell me what to do to make cryptd run?
>
> If you build it as a module then just loading it should be sufficient.
> If you have it built-in then it should always be there.
>
> Let me know when you guys have a final patch.

The problem is more serious than I thought:

kthread_create() in crypto/cryptd.c line 302 doesn't return, so cryptd is stuck
in TASK_UNINTERRUPTIBLE all the time and it doesn't even execute one
instruction from cryptd_thread() [this happens on x86_64].

I've investigated this for a while, but I don't know why it happens.

Greetings,
Rafael

2007-05-31 06:59:11

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Thursday, 31 May 2007 08:54, Rafael J. Wysocki wrote:
> On Tuesday, 29 May 2007 02:39, Herbert Xu wrote:
> > On Mon, May 28, 2007 at 08:21:29PM +0200, Rafael J. Wysocki wrote:
> > >
> > > Well, it looks like we have to fix this one separately.
> > >
> > > Can you please tell me what to do to make cryptd run?
> >
> > If you build it as a module then just loading it should be sufficient.
> > If you have it built-in then it should always be there.
> >
> > Let me know when you guys have a final patch.
>
> The problem is more serious than I thought:
>
> kthread_create() in crypto/cryptd.c line 302 doesn't return, so cryptd is stuck
> in TASK_UNINTERRUPTIBLE all the time and it doesn't even execute one
> instruction from cryptd_thread() [this happens on x86_64].

Sorry, I was wrong.

kthread_create() returns, but cryptd_thread() is not executed and the cryptd
process is stuck in TASK_UNINTERRUPTIBLE.

Greetings,
Rafael

2007-05-31 07:08:27

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Thursday, 31 May 2007 09:04, Rafael J. Wysocki wrote:
> On Thursday, 31 May 2007 08:54, Rafael J. Wysocki wrote:
> > On Tuesday, 29 May 2007 02:39, Herbert Xu wrote:
> > > On Mon, May 28, 2007 at 08:21:29PM +0200, Rafael J. Wysocki wrote:
> > > >
> > > > Well, it looks like we have to fix this one separately.
> > > >
> > > > Can you please tell me what to do to make cryptd run?
> > >
> > > If you build it as a module then just loading it should be sufficient.
> > > If you have it built-in then it should always be there.
> > >
> > > Let me know when you guys have a final patch.
> >
> > The problem is more serious than I thought:
> >
> > kthread_create() in crypto/cryptd.c line 302 doesn't return, so cryptd is stuck
> > in TASK_UNINTERRUPTIBLE all the time and it doesn't even execute one
> > instruction from cryptd_thread() [this happens on x86_64].
>
> Sorry, I was wrong.
>
> kthread_create() returns, but cryptd_thread() is not executed and the cryptd
> process is stuck in TASK_UNINTERRUPTIBLE.

It can be fixed by replacing the kthread_create() with kthread_run(). Patch
follows.

Greetings,
Rafael

---
From: Rafael J. Wysocki <[email protected]>

Make cryptd actually run and mark it as nonfreezable.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
crypto/cryptd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.22-rc3/crypto/cryptd.c
===================================================================
--- linux-2.6.22-rc3.orig/crypto/cryptd.c 2007-05-26 22:08:07.000000000 +0200
+++ linux-2.6.22-rc3/crypto/cryptd.c 2007-05-31 09:13:38.000000000 +0200
@@ -298,7 +298,7 @@ static inline int cryptd_create_thread(s
mutex_init(&state->mutex);
crypto_init_queue(&state->queue, CRYPTD_MAX_QLEN);

- state->task = kthread_create(fn, state, name);
+ state->task = kthread_run(fn, state, name);
if (IS_ERR(state->task))
return PTR_ERR(state->task);

@@ -316,6 +316,8 @@ static int cryptd_thread(void *data)
struct cryptd_state *state = data;
int stop;

+ current->flags |= PF_NOFREEZE;
+
do {
struct crypto_async_request *req, *backlog;

2007-05-31 08:09:41

by Herbert Xu

[permalink] [raw]
Subject: Re: software suspend doesn't work with 2.6.22-rc3

On Thu, May 31, 2007 at 09:13:44AM +0200, Rafael J. Wysocki wrote:
>
> From: Rafael J. Wysocki <[email protected]>
>
> Make cryptd actually run and mark it as nonfreezable.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>

Patch applied. Thanks a lot!
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt