2002-07-25 12:40:51

by Craig Kulesa

[permalink] [raw]
Subject: [PATCH] Fix complile warnings in suspend.c, 2.5.28



This fixes some compile time warnings in suspend.c. Look sensible?
It's tested, even with full rmap and slab-on-LRU patches. Even worked
when suspending from X!

--- linux-2.5.28-rmap-slablru/kernel/suspend.c~ Wed Jul 24 20:56:59 2002
+++ linux-2.5.28-rmap-slablru/kernel/suspend.c Wed Jul 24 21:05:21 2002
@@ -66,6 +66,7 @@
#include <linux/swapops.h>

extern void signal_wake_up(struct task_struct *t);
+asmlinkage void sys_sync(void); /* it's really int */

unsigned char software_suspend_enabled = 0;

@@ -1004,8 +1005,9 @@

static int bdev_write_page(struct block_device *bdev, long pos, void *buf)
{
- struct buffer_head *bh;
#if 0
+ struct buffer_head *bh;
+
BUG_ON (pos%PAGE_SIZE);
bh = __bread(bdev, pos/PAGE_SIZE, PAGE_SIZE);
if (!bh || (!bh->b_data)) {


Craig Kulesa
Steward Obs.
Univ. of Arizona


2002-07-25 21:49:56

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] Fix complile warnings in suspend.c, 2.5.28

Hi!

> This fixes some compile time warnings in suspend.c. Look sensible?
> It's tested, even with full rmap and slab-on-LRU patches. Even worked
> when suspending from X!

Does it work for you? I get reboot after S4 on 2.5.28. Can you mail me
diff between clean and your tree?
Pavel
--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.

2002-07-25 22:49:04

by Craig Kulesa

[permalink] [raw]
Subject: Re: [PATCH] Fix compile warnings in suspend.c, 2.5.28


On Thu, 25 Jul 2002, Pavel Machek wrote:

> Does it work for you? I get reboot after S4 on 2.5.28. Can you mail me
> diff between clean and your tree?

Isn't the 'reboot after S4' due to #define TEST_SWSUSP 1? I set it
to 0 and it shuts down properly for me. I'm not sure why rebooting should
be the default behavior, actually -- it seems a bit strange.

My laptop's at home, but I applied the following patches from:
http://loke.as.arizona.edu/~ckulesa/kernel/rmap-vm/2.5.28/

I applied the 2 rmap-related patches in order, then the remaining patches
(which are trivial cleanups and compile-fixes) in no special order.
2.5.28-swsusp is the patch in this thread. This won't change the "reboot
after S4" behavior without the additional change to TEST_SWSUSP, above.

Side note:
The only change to suspend.c that I made which isn't covered by
the patch in this thread, is the try_to_free_pages() line --
but this is specific to the "full rmap-VM for 2.5". The big rmap patch
(2.5.28-rmap-1-rmap13b) makes this single alteration.

Second side note:
For the vanilla 2.5 classzone VM, I don't honestly understand why we're
only looking at &contig_page_data.node_zones[ZONE_HIGHMEM] in
try_to_free_pages(). On the other hand, I don't see how it would break
swsusp.

And a note of appreciation: :)
This was the very first time I tried ACPI and swsusp! I had been using
APM before, but had no hibernation capability (my BIOS only worked
properly with suspend to RAM in Linux). This is really a nice feature!

But now I have to figure out how to teach acpid to do useful stuff, like
throttle the CPU and try to S4 on lid close and such. :)

Craig Kulesa
Steward Obs.
Univ. of Arizona

2002-07-26 09:55:42

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] Fix compile warnings in suspend.c, 2.5.28

Hi!

> > Does it work for you? I get reboot after S4 on 2.5.28. Can you mail me
> > diff between clean and your tree?
>
> Isn't the 'reboot after S4' due to #define TEST_SWSUSP 1? I set it
> to 0 and it shuts down properly for me. I'm not sure why rebooting should
> be the default behavior, actually -- it seems a bit strange.

Actually, I get two reboots. One expected after suspend and one
unexpected after resume.

TEST_SWSUSP is one so I can test it properly. I want to be Linus's
swsusp same as mine for 2.5. TEST_SWSUSP is going to be 0 at 2.6.

> My laptop's at home, but I applied the following patches from:
> http://loke.as.arizona.edu/~ckulesa/kernel/rmap-vm/2.5.28/
>
> I applied the 2 rmap-related patches in order, then the remaining patches
> (which are trivial cleanups and compile-fixes) in no special order.
> 2.5.28-swsusp is the patch in this thread. This won't change the "reboot
> after S4" behavior without the additional change to TEST_SWSUSP,
> above.

Can you do multiple S4 enters/leaves? Good test is to make bzImage
while doing while true; do echo 4 > /proc/acpi/sleep; sleep 30; done.

> Side note:
> The only change to suspend.c that I made which isn't covered by
> the patch in this thread, is the try_to_free_pages() line --
> but this is specific to the "full rmap-VM for 2.5". The big rmap patch
> (2.5.28-rmap-1-rmap13b) makes this single alteration.

Okay.

> Second side note:
> For the vanilla 2.5 classzone VM, I don't honestly understand why we're
> only looking at &contig_page_data.node_zones[ZONE_HIGHMEM] in
> try_to_free_pages(). On the other hand, I don't see how it would break
> swsusp.

I don't understand that line, either. Andrea told me to write it like
that, IIRC ;-).

> And a note of appreciation: :)
> This was the very first time I tried ACPI and swsusp! I had been using
> APM before, but had no hibernation capability (my BIOS only worked
> properly with suspend to RAM in Linux). This is really a nice feature!
>
> But now I have to figure out how to teach acpid to do useful stuff, like
> throttle the CPU and try to S4 on lid close and such. :)

Throttling the CPU should be pretty easy [see
/proc/acpi/processor/0/*], and it should already enter sleep modes for
you.

Pavel
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

2002-07-26 10:31:45

by Craig Kulesa

[permalink] [raw]
Subject: Re: [PATCH] Fix compile warnings in suspend.c, 2.5.28


On Fri, 26 Jul 2002, Pavel Machek wrote:

> Actually, I get two reboots. One expected after suspend and one
> unexpected after resume.

I see. I'm only getting the single, expected, reboot. I have found that
if I mess with the contents of /proc/acpi after resuming, the system
freezes solid within a few seconds. I see a patch in Linus' BK tree that
looks like a possible fix for ACPI. I'll test that in 2.5.29. In the
meantime, I can suspend to disk just fine however.

> TEST_SWSUSP is one so I can test it properly. I want to be Linus's
> swsusp same as mine for 2.5. TEST_SWSUSP is going to be 0 at 2.6.

Sounds fair. At least I can change it for my own use. :)

> Can you do multiple S4 enters/leaves? Good test is to make bzImage
> while doing while true; do echo 4 > /proc/acpi/sleep; sleep 30; done.

Yes. Once memory fills up, I can't get enough free pages, but running a
userspace "eatmem" program in the script before suspending fixes that just
fine. That also speeds up the suspnd/resume time. The calls to
try_to_free_pages() don't go nearly far enough since the rmap VM stops
freeing memory once *it thinks* there are enough free pages. Being able to
tell it to ignore it's internal watermarks would fix this.

> Throttling the CPU should be pretty easy [see
> /proc/acpi/processor/0/*], and it should already enter sleep modes for
> you.

Neat, thanks!

Regards,

Craig Kulesa
Steward Obs.
Univ. of Arizona