2004-10-25 02:56:17

by Zhu Yi

[permalink] [raw]
Subject: [PATCH] [swsusp] print error message when swapping is disabled


Hi,

swsusp exits silently when swapping is disabled. This patch gives some
clues to
the user in this case. Please apply.

Thanks,
-yi

Signed-off-by: Zhu Yi <[email protected]>

--- linux-2.6.9-orig/kernel/power/swsusp.c 2004-10-24
16:16:41.000000000 +0800
+++ linux-2.6.9/kernel/power/swsusp.c 2004-10-24 16:15:06.000000000
+0800
@@ -843,8 +843,11 @@ asmlinkage int swsusp_save(void)
{
int error = 0;

- if ((error = swsusp_swap_check()))
+ if ((error = swsusp_swap_check())) {
+ printk(KERN_ERR "swsusp: FATAL: cannot find swap device,
try "
+ "swap -a!\n");
return error;
+ }
return suspend_prepare_image();
}


2004-10-25 10:27:23

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] [swsusp] print error message when swapping is disabled

Hi!

> swsusp exits silently when swapping is disabled. This patch gives some
> clues to
> the user in this case. Please apply.

Did you mean "swapon -a"? Otherwise approved, please send it to akpm
directly.

Pavel

> --- linux-2.6.9-orig/kernel/power/swsusp.c 2004-10-24
> 16:16:41.000000000 +0800
> +++ linux-2.6.9/kernel/power/swsusp.c 2004-10-24 16:15:06.000000000
> +0800
> @@ -843,8 +843,11 @@ asmlinkage int swsusp_save(void)
> {
> int error = 0;
>
> - if ((error = swsusp_swap_check()))
> + if ((error = swsusp_swap_check())) {
> + printk(KERN_ERR "swsusp: FATAL: cannot find swap device,
> try "
> + "swap -a!\n");
> return error;
> + }
> return suspend_prepare_image();
> }
>

--
Boycott Kodak -- for their patent abuse against Java.

2004-10-26 10:16:33

by Shaohua Li

[permalink] [raw]
Subject: RE: [PATCH] [swsusp] print error message when swapping is disabled

>
>Hi!
>
>> swsusp exits silently when swapping is disabled. This patch gives
some
>> clues to
>> the user in this case. Please apply.
>
>Did you mean "swapon -a"? Otherwise approved, please send it to akpm
>directly.
Another case is PSE disabled. Should notify this to user also.

Thanks,
Shaohua

2004-10-29 07:27:30

by Zhu Yi

[permalink] [raw]
Subject: RE: [PATCH] [swsusp] print error message when swapping is disabled

On Tue, 26 Oct 2004, Li, Shaohua wrote:

> Another case is PSE disabled. Should notify this to user also.

Here is a patch to address it.

Thanks,
-yi


Signed-off-by: Zhu Yi <[email protected]>

diff -urp linux-2.6.10-rc1-orig/include/asm-i386/suspend.h linux-2.6.10-rc1/include/asm-i386/suspend.h
--- linux-2.6.10-rc1-orig/include/asm-i386/suspend.h 2004-10-29 14:11:44.000000000 +0800
+++ linux-2.6.10-rc1/include/asm-i386/suspend.h 2004-10-29 14:14:41.000000000 +0800
@@ -12,8 +12,11 @@ arch_prepare_suspend(void)
/* If you want to make non-PSE machine work, turn off paging
in do_magic. swsusp_pg_dir should have identity mapping, so
it could work... */
- if (!cpu_has_pse)
+ if (!cpu_has_pse) {
+ printk(KERN_ERR "swsusp: FATAL: PSE is not availiable or "
+ "disabled on your system!\n");
return -EPERM;
+ }
return 0;
}


2004-10-29 09:11:41

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] [swsusp] print error message when swapping is disabled

Hi!

> > Another case is PSE disabled. Should notify this to user also.
>
> Here is a patch to address it.

Patch is okay (but I rararely see this kind of failure in
wild). Please submit via akpm.

Anyway, the most common problem these days is that one of devices
vetoes the suspend. In such case code does the right thing, but
without any message to the user... and that is kind of confusing.

Patch printing "swsusp failed because device XXXX vetoed it" would be
very welcome.

Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

2004-10-29 09:56:41

by Shaohua Li

[permalink] [raw]
Subject: RE: [PATCH] [swsusp] print error message when swapping is disabled

>
>> > Another case is PSE disabled. Should notify this to user also.
>>
>> Here is a patch to address it.
>
>Patch is okay (but I rararely see this kind of failure in
>wild). Please submit via akpm.
>
Enable DEBUG_PAGEALLOC will disable PSE.
Possibly a stupid question, why swsusp need PSE? I didn't see any
relationship between the two.

Thanks,
Shaohua

2004-10-29 10:00:11

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] [swsusp] print error message when swapping is disabled

Hi!

> >> > Another case is PSE disabled. Should notify this to user also.
> >>
> >> Here is a patch to address it.
> >
> >Patch is okay (but I rararely see this kind of failure in
> >wild). Please submit via akpm.
> >
> Enable DEBUG_PAGEALLOC will disable PSE.
> Possibly a stupid question, why swsusp need PSE? I didn't see any
> relationship between the two.

swsusp relies on fact that kernel 1:1 mapping is self-contained in
top-level pagedir. That is not true without PSE, right?

[Hmm, probably bigger comment explaining this would be nice...]

Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

2004-10-29 19:57:48

by Nigel Cunningham

[permalink] [raw]
Subject: RE: [PATCH] [swsusp] print error message when swapping is disabled

Hi.

On Fri, 2004-10-29 at 19:54, Li, Shaohua wrote:
> Enable DEBUG_PAGEALLOC will disable PSE.
> Possibly a stupid question, why swsusp need PSE? I didn't see any
> relationship between the two.

I have suspend2 working with DEBUG_PAGEALLOC. I just had to add code to
map the original pages before making the atomic copy, so that resume
will work (and unmap them afterwards, of course).

Regards,

Nigel
--
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

Everyone lives by faith. Some people just don't believe it.
Want proof? Try to prove that the theory of evolution is true.