2005-01-03 12:32:06

by Hu Gang

[permalink] [raw]
Subject: [[email protected]: [PATH]software suspend for ppc.]

----- Forwarded message from [email protected] -----

Date: Mon, 3 Jan 2005 20:25:57 +0800
To: [email protected]
Subject: [PATH]software suspend for ppc.

Hi Benjamin Herrenschmidt:

Here is a patch to make ppc32 support suspend, Test passed in my
PowerBook, against with 2.6.10-mm1. Have a look. :)

I'm also someone can do more test with it.

thanks.

--- 2.6.10-mm1/arch/ppc/Kconfig 2005-01-03 18:53:25.000000000 +0800
+++ 2.6.10-mm1-swsusp//arch/ppc/Kconfig 2005-01-03 19:00:44.000000000 +0800
@@ -1062,6 +1062,8 @@ config PROC_HARDWARE

source "drivers/zorro/Kconfig"

+source "kernel/power/Kconfig"
+
endmenu

menu "Bus options"
--- 2.6.10-mm1/arch/ppc/kernel/Makefile 2005-01-03 18:53:25.000000000 +0800
+++ 2.6.10-mm1-swsusp//arch/ppc/kernel/Makefile 2005-01-03 19:16:34.000000000 +0800
@@ -16,6 +16,7 @@ obj-y := entry.o traps.o irq.o idle.o
semaphore.o syscalls.o setup.o \
cputable.o ppc_htab.o perfmon.o
obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
+obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
obj-$(CONFIG_POWER4) += cpu_setup_power4.o
obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
--- 2.6.10-mm1/arch/ppc/kernel/signal.c 2005-01-03 18:53:25.000000000 +0800
+++ 2.6.10-mm1-swsusp//arch/ppc/kernel/signal.c 2005-01-03 19:03:39.000000000 +0800
@@ -28,6 +28,7 @@
#include <linux/elf.h>
#include <linux/tty.h>
#include <linux/binfmts.h>
+#include <linux/suspend.h>
#include <asm/ucontext.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -704,6 +705,14 @@ int do_signal(sigset_t *oldset, struct p
unsigned long frame, newsp;
int signr, ret;

+ if (current->flags & PF_FREEZE) {
+ refrigerator(PF_FREEZE);
+ signr = 0;
+ ret = regs->gpr[3];
+ if (!signal_pending(current))
+ goto no_signal;
+ }
+
if (!oldset)
oldset = &current->blocked;

@@ -726,6 +735,7 @@ int do_signal(sigset_t *oldset, struct p
regs->gpr[3] = EINTR;
/* note that the cr0.SO bit is already set */
} else {
+no_signal:
regs->nip -= 4; /* Back up & retry system call */
regs->result = 0;
regs->trap = 0;
--- /dev/null 2004-06-07 18:45:47.000000000 +0800
+++ 2.6.10-mm1-swsusp//arch/ppc/kernel/swsusp.c 2005-01-03 20:15:06.000000000 +0800
@@ -0,0 +1,88 @@
+/*
+ * Written by Hu Gang ([email protected])
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/spinlock.h>
+#include <linux/poll.h>
+#include <linux/delay.h>
+#include <linux/sysrq.h>
+#include <linux/proc_fs.h>
+#include <linux/irq.h>
+#include <linux/pm.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
+#include <linux/pmu.h>
+#include <linux/device.h>
+#include <linux/suspend.h>
+#include <asm/mmu_context.h>
+#include <asm/uaccess.h>
+#include <asm/suspend.h>
+
+#include "cpu_context.h"
+
+extern suspend_pagedir_t *pagedir_nosave __nosavedata;
+extern int nr_copy_pages __nosavedata;
+
+extern asmlinkage int swsusp_save(void);
+
+static void inline do_swsusp_copyback(void)
+{
+ register int i = 0;
+
+ for (i = 0; i < nr_copy_pages; i++) {
+ register int loop;
+ register unsigned long *orig, *copy;
+
+ copy = (unsigned long *)pagedir_nosave[i].address;
+ orig = (unsigned long *)pagedir_nosave[i].orig_address;
+
+ for (loop = 0;
+ loop < (PAGE_SIZE / sizeof(unsigned long));
+ loop ++)
+ *(orig + loop) = *(copy + loop);
+ }
+}
+
+static struct saved_context swsusp_saved_context;
+
+void save_processor_state(void)
+{
+ __save_processor_state(&swsusp_saved_context);
+}
+
+void restore_processor_state(void)
+{
+ __restore_processor_state(&swsusp_saved_context);
+}
+
+void __flush_tlb_global(void)
+{
+ /* do nothing */
+}
+
+static struct saved_context saved_context;
+
+void swsusp_arch_suspend(void)
+{
+ save_context();
+ __save_processor_state(&saved_context);
+ swsusp_save();
+}
+
+void swsusp_arch_resume(void)
+{
+ save_context();
+ do_swsusp_copyback();
+ __restore_processor_state(&saved_context);
+ restore_context();
+}
--- /dev/null 2004-06-07 18:45:47.000000000 +0800
+++ 2.6.10-mm1-swsusp//arch/ppc/kernel/cpu_context.h 2005-01-03 20:16:09.000000000 +0800
@@ -0,0 +1,89 @@
+/*
+ * Written by Hu Gang ([email protected])
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+void inline __save_processor_state(struct saved_context *s)
+{
+ /*asm volatile ("mflr 0; stw 0,%0" : "=m" (s->lr));*/
+ asm volatile ("mfcr 0; stw 0,%0" : "=m" (s->cr));
+ asm volatile ("stw 1,%0" : "=m" (s->sp));
+ asm volatile ("stw 2,%0" : "=m" (s->r2));
+ asm volatile ("stmw 12,%0" : "=m" (s->r12));
+
+ /* Save MSR & SDR1 */
+ asm volatile ("mfmsr 4; stw 4,%0" : "=m" (s->msr));
+ asm volatile ("mfsdr1 4; stw 4,%0": "=m" (s->sdr1));
+
+ /* Get a stable timebase and save it */
+ asm volatile ("1:\n"
+ "mftbu 4;stw 4,%0\n"
+ "mftb 5;stw 5,%1\n"
+ "mftbu 3\n"
+ "cmpw 3,4;\n"
+ "bne 1b" :
+ "=m" (s->tb1),
+ "=m" (s->tb2));
+
+ /* Save SPRGs */
+ asm volatile ("mfsprg 4,0; stw 4,%0 " : "=m" (s->sprg[0]));
+ asm volatile ("mfsprg 4,1; stw 4,%0 " : "=m" (s->sprg[1]));
+ asm volatile ("mfsprg 4,2; stw 4,%0 " : "=m" (s->sprg[2]));
+ asm volatile ("mfsprg 4,3; stw 4,%0 " : "=m" (s->sprg[3]));
+}
+
+void inline __restore_processor_state(struct saved_context *s)
+{
+ /* Restore the BATs, and SDR1 */
+ asm volatile ("lwz 4,%0; mtsdr1 4" : "=m" (s->sdr1));
+ /* asm volatile ("lwz 3,%0" : "=m" (saved_context.msr)); */
+
+ asm volatile ("lwz 4,%0; mtsprg 0,4": "=m" (s->sprg[0]));
+ asm volatile ("lwz 4,%0; mtsprg 1,4": "=m" (s->sprg[1]));
+ asm volatile ("lwz 4,%0; mtsprg 2,4": "=m" (s->sprg[2]));
+ asm volatile ("lwz 4,%0; mtsprg 3,4": "=m" (s->sprg[3]));
+
+ /* Restore TB */
+ asm volatile ("li 3,0; mttbl 3; \n"
+ "lwz 3,%0\n; lwz 4,%1\n"
+ "mttbu 3; mttbl 4" :
+ "=m" (s->tb1),
+ "=m" (s->tb2));
+
+ /* Restore the callee-saved registers and return */
+ asm volatile ("lmw 12,%0" : "=m" (s->r12));
+ asm volatile ("lwz 2,%0" : "=m" (s->r2));
+ asm volatile ("lwz 1,%0" : "=m" (s->sp));
+ asm volatile ("lwz 0,%0; mtcr 0" : "=m" (s->cr));
+ /*asm volatile ("lwz 0,%0; mtlr 0" : "=m" (s->lr));*/
+}
+
+static inline void save_context(void)
+{
+ pmu_suspend();
+}
+
+extern void enable_kernel_altivec(void);
+
+static inline void restore_context(void)
+{
+ printk("set context: <%p>\n", current);
+ set_context(current->active_mm->context,
+ current->active_mm->pgd);
+
+ printk("pmu_resume\n");
+ pmu_resume();
+
+#ifdef CONFIG_ALTIVEC
+ if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC) {
+ printk("enable altivec\n");
+ enable_kernel_altivec();
+ }
+#endif
+ printk("enable fp\n");
+ enable_kernel_fp();
+}
--- 2.6.10-mm1/arch/ppc/kernel/vmlinux.lds.S 2004-12-30 14:55:39.000000000 +0800
+++ 2.6.10-mm1-swsusp//arch/ppc/kernel/vmlinux.lds.S 2005-01-03 19:04:05.000000000 +0800
@@ -74,6 +74,12 @@ SECTIONS
CONSTRUCTORS
}

+ . = ALIGN(4096);
+ __nosave_begin = .;
+ .data_nosave : { *(.data.nosave) }
+ . = ALIGN(4096);
+ __nosave_end = .;
+
. = ALIGN(32);
.data.cacheline_aligned : { *(.data.cacheline_aligned) }

--- /dev/null 2004-06-07 18:45:47.000000000 +0800
+++ 2.6.10-mm1-swsusp//include/asm-ppc/suspend.h 2005-01-03 19:35:02.000000000 +0800
@@ -0,0 +1,28 @@
+/*
+ * Written by Hu Gang ([email protected])
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _ASM_PPC_SUSPEND_H_
+#define _ASM_PPC_SUSPEND_H_
+
+static inline int
+arch_prepare_suspend(void)
+{
+
+ return 0;
+}
+
+/* image of the saved processor states */
+struct saved_context {
+ u32 lr, cr, sp, r2;
+ u64 r12;
+ u32 sprg[4];
+ u32 msr, sdr1, tb1, tb2;
+} __attribute__((packed));
+
+#endif
--- 2.6.10-mm1/include/linux/suspend.h 2005-01-03 18:53:51.000000000 +0800
+++ 2.6.10-mm1-swsusp//include/linux/suspend.h 2005-01-03 19:32:29.000000000 +0800
@@ -1,7 +1,7 @@
#ifndef _LINUX_SWSUSP_H
#define _LINUX_SWSUSP_H

-#if defined(CONFIG_X86) || defined(CONFIG_FRV)
+#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
#include <asm/suspend.h>
#endif
#include <linux/swap.h>
--
Hu Gang .-.
/v\
// \\
Linux User /( )\ [204016]
GPG Key ID ^^-^^ http://soulinfo.com/~hugang/hugang.asc

----- End forwarded message -----

--
Hu Gang .-.
/v\
// \\
Linux User /( )\ [204016]
GPG Key ID ^^-^^ http://soulinfo.com/~hugang/hugang.asc


2005-01-03 22:25:34

by Pavel Machek

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

Hi!

> Date: Mon, 3 Jan 2005 20:25:57 +0800
> To: [email protected]
> Subject: [PATH]software suspend for ppc.
>
> Hi Benjamin Herrenschmidt:
>
> Here is a patch to make ppc32 support suspend, Test passed in my
> PowerBook, against with 2.6.10-mm1. Have a look. :)
>
> I'm also someone can do more test with it.

swsusp_arch_{suspend,resume} should really be written in
assembly. Just compile this, disassemble it and put it into source
file. Otherwise it looks OK.
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

2005-01-04 02:34:09

by Nigel Cunningham

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

Hi Steve.

I'll use this to get Suspend2 PPC going again, if you don't mind.

Regards,

Nigel

On Mon, 2005-01-03 at 23:26, [email protected] wrote:
> ----- Forwarded message from [email protected] -----
>
> Date: Mon, 3 Jan 2005 20:25:57 +0800
> To: [email protected]
> Subject: [PATH]software suspend for ppc.
>
> Hi Benjamin Herrenschmidt:
>
> Here is a patch to make ppc32 support suspend, Test passed in my
> PowerBook, against with 2.6.10-mm1. Have a look. :)
>
> I'm also someone can do more test with it.
>
> thanks.
>
> --- 2.6.10-mm1/arch/ppc/Kconfig 2005-01-03 18:53:25.000000000 +0800
> +++ 2.6.10-mm1-swsusp//arch/ppc/Kconfig 2005-01-03 19:00:44.000000000 +0800
> @@ -1062,6 +1062,8 @@ config PROC_HARDWARE
>
> source "drivers/zorro/Kconfig"
>
> +source "kernel/power/Kconfig"
> +
> endmenu
>
> menu "Bus options"
> --- 2.6.10-mm1/arch/ppc/kernel/Makefile 2005-01-03 18:53:25.000000000 +0800
> +++ 2.6.10-mm1-swsusp//arch/ppc/kernel/Makefile 2005-01-03 19:16:34.000000000 +0800
> @@ -16,6 +16,7 @@ obj-y := entry.o traps.o irq.o idle.o
> semaphore.o syscalls.o setup.o \
> cputable.o ppc_htab.o perfmon.o
> obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
> +obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
> obj-$(CONFIG_POWER4) += cpu_setup_power4.o
> obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
> obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
> --- 2.6.10-mm1/arch/ppc/kernel/signal.c 2005-01-03 18:53:25.000000000 +0800
> +++ 2.6.10-mm1-swsusp//arch/ppc/kernel/signal.c 2005-01-03 19:03:39.000000000 +0800
> @@ -28,6 +28,7 @@
> #include <linux/elf.h>
> #include <linux/tty.h>
> #include <linux/binfmts.h>
> +#include <linux/suspend.h>
> #include <asm/ucontext.h>
> #include <asm/uaccess.h>
> #include <asm/pgtable.h>
> @@ -704,6 +705,14 @@ int do_signal(sigset_t *oldset, struct p
> unsigned long frame, newsp;
> int signr, ret;
>
> + if (current->flags & PF_FREEZE) {
> + refrigerator(PF_FREEZE);
> + signr = 0;
> + ret = regs->gpr[3];
> + if (!signal_pending(current))
> + goto no_signal;
> + }
> +
> if (!oldset)
> oldset = &current->blocked;
>
> @@ -726,6 +735,7 @@ int do_signal(sigset_t *oldset, struct p
> regs->gpr[3] = EINTR;
> /* note that the cr0.SO bit is already set */
> } else {
> +no_signal:
> regs->nip -= 4; /* Back up & retry system call */
> regs->result = 0;
> regs->trap = 0;
> --- /dev/null 2004-06-07 18:45:47.000000000 +0800
> +++ 2.6.10-mm1-swsusp//arch/ppc/kernel/swsusp.c 2005-01-03 20:15:06.000000000 +0800
> @@ -0,0 +1,88 @@
> +/*
> + * Written by Hu Gang ([email protected])
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/config.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/types.h>
> +#include <linux/spinlock.h>
> +#include <linux/poll.h>
> +#include <linux/delay.h>
> +#include <linux/sysrq.h>
> +#include <linux/proc_fs.h>
> +#include <linux/irq.h>
> +#include <linux/pm.h>
> +#include <linux/adb.h>
> +#include <linux/cuda.h>
> +#include <linux/pmu.h>
> +#include <linux/device.h>
> +#include <linux/suspend.h>
> +#include <asm/mmu_context.h>
> +#include <asm/uaccess.h>
> +#include <asm/suspend.h>
> +
> +#include "cpu_context.h"
> +
> +extern suspend_pagedir_t *pagedir_nosave __nosavedata;
> +extern int nr_copy_pages __nosavedata;
> +
> +extern asmlinkage int swsusp_save(void);
> +
> +static void inline do_swsusp_copyback(void)
> +{
> + register int i = 0;
> +
> + for (i = 0; i < nr_copy_pages; i++) {
> + register int loop;
> + register unsigned long *orig, *copy;
> +
> + copy = (unsigned long *)pagedir_nosave[i].address;
> + orig = (unsigned long *)pagedir_nosave[i].orig_address;
> +
> + for (loop = 0;
> + loop < (PAGE_SIZE / sizeof(unsigned long));
> + loop ++)
> + *(orig + loop) = *(copy + loop);
> + }
> +}
> +
> +static struct saved_context swsusp_saved_context;
> +
> +void save_processor_state(void)
> +{
> + __save_processor_state(&swsusp_saved_context);
> +}
> +
> +void restore_processor_state(void)
> +{
> + __restore_processor_state(&swsusp_saved_context);
> +}
> +
> +void __flush_tlb_global(void)
> +{
> + /* do nothing */
> +}
> +
> +static struct saved_context saved_context;
> +
> +void swsusp_arch_suspend(void)
> +{
> + save_context();
> + __save_processor_state(&saved_context);
> + swsusp_save();
> +}
> +
> +void swsusp_arch_resume(void)
> +{
> + save_context();
> + do_swsusp_copyback();
> + __restore_processor_state(&saved_context);
> + restore_context();
> +}
> --- /dev/null 2004-06-07 18:45:47.000000000 +0800
> +++ 2.6.10-mm1-swsusp//arch/ppc/kernel/cpu_context.h 2005-01-03 20:16:09.000000000 +0800
> @@ -0,0 +1,89 @@
> +/*
> + * Written by Hu Gang ([email protected])
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +void inline __save_processor_state(struct saved_context *s)
> +{
> + /*asm volatile ("mflr 0; stw 0,%0" : "=m" (s->lr));*/
> + asm volatile ("mfcr 0; stw 0,%0" : "=m" (s->cr));
> + asm volatile ("stw 1,%0" : "=m" (s->sp));
> + asm volatile ("stw 2,%0" : "=m" (s->r2));
> + asm volatile ("stmw 12,%0" : "=m" (s->r12));
> +
> + /* Save MSR & SDR1 */
> + asm volatile ("mfmsr 4; stw 4,%0" : "=m" (s->msr));
> + asm volatile ("mfsdr1 4; stw 4,%0": "=m" (s->sdr1));
> +
> + /* Get a stable timebase and save it */
> + asm volatile ("1:\n"
> + "mftbu 4;stw 4,%0\n"
> + "mftb 5;stw 5,%1\n"
> + "mftbu 3\n"
> + "cmpw 3,4;\n"
> + "bne 1b" :
> + "=m" (s->tb1),
> + "=m" (s->tb2));
> +
> + /* Save SPRGs */
> + asm volatile ("mfsprg 4,0; stw 4,%0 " : "=m" (s->sprg[0]));
> + asm volatile ("mfsprg 4,1; stw 4,%0 " : "=m" (s->sprg[1]));
> + asm volatile ("mfsprg 4,2; stw 4,%0 " : "=m" (s->sprg[2]));
> + asm volatile ("mfsprg 4,3; stw 4,%0 " : "=m" (s->sprg[3]));
> +}
> +
> +void inline __restore_processor_state(struct saved_context *s)
> +{
> + /* Restore the BATs, and SDR1 */
> + asm volatile ("lwz 4,%0; mtsdr1 4" : "=m" (s->sdr1));
> + /* asm volatile ("lwz 3,%0" : "=m" (saved_context.msr)); */
> +
> + asm volatile ("lwz 4,%0; mtsprg 0,4": "=m" (s->sprg[0]));
> + asm volatile ("lwz 4,%0; mtsprg 1,4": "=m" (s->sprg[1]));
> + asm volatile ("lwz 4,%0; mtsprg 2,4": "=m" (s->sprg[2]));
> + asm volatile ("lwz 4,%0; mtsprg 3,4": "=m" (s->sprg[3]));
> +
> + /* Restore TB */
> + asm volatile ("li 3,0; mttbl 3; \n"
> + "lwz 3,%0\n; lwz 4,%1\n"
> + "mttbu 3; mttbl 4" :
> + "=m" (s->tb1),
> + "=m" (s->tb2));
> +
> + /* Restore the callee-saved registers and return */
> + asm volatile ("lmw 12,%0" : "=m" (s->r12));
> + asm volatile ("lwz 2,%0" : "=m" (s->r2));
> + asm volatile ("lwz 1,%0" : "=m" (s->sp));
> + asm volatile ("lwz 0,%0; mtcr 0" : "=m" (s->cr));
> + /*asm volatile ("lwz 0,%0; mtlr 0" : "=m" (s->lr));*/
> +}
> +
> +static inline void save_context(void)
> +{
> + pmu_suspend();
> +}
> +
> +extern void enable_kernel_altivec(void);
> +
> +static inline void restore_context(void)
> +{
> + printk("set context: <%p>\n", current);
> + set_context(current->active_mm->context,
> + current->active_mm->pgd);
> +
> + printk("pmu_resume\n");
> + pmu_resume();
> +
> +#ifdef CONFIG_ALTIVEC
> + if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC) {
> + printk("enable altivec\n");
> + enable_kernel_altivec();
> + }
> +#endif
> + printk("enable fp\n");
> + enable_kernel_fp();
> +}
> --- 2.6.10-mm1/arch/ppc/kernel/vmlinux.lds.S 2004-12-30 14:55:39.000000000 +0800
> +++ 2.6.10-mm1-swsusp//arch/ppc/kernel/vmlinux.lds.S 2005-01-03 19:04:05.000000000 +0800
> @@ -74,6 +74,12 @@ SECTIONS
> CONSTRUCTORS
> }
>
> + . = ALIGN(4096);
> + __nosave_begin = .;
> + .data_nosave : { *(.data.nosave) }
> + . = ALIGN(4096);
> + __nosave_end = .;
> +
> . = ALIGN(32);
> .data.cacheline_aligned : { *(.data.cacheline_aligned) }
>
> --- /dev/null 2004-06-07 18:45:47.000000000 +0800
> +++ 2.6.10-mm1-swsusp//include/asm-ppc/suspend.h 2005-01-03 19:35:02.000000000 +0800
> @@ -0,0 +1,28 @@
> +/*
> + * Written by Hu Gang ([email protected])
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#ifndef _ASM_PPC_SUSPEND_H_
> +#define _ASM_PPC_SUSPEND_H_
> +
> +static inline int
> +arch_prepare_suspend(void)
> +{
> +
> + return 0;
> +}
> +
> +/* image of the saved processor states */
> +struct saved_context {
> + u32 lr, cr, sp, r2;
> + u64 r12;
> + u32 sprg[4];
> + u32 msr, sdr1, tb1, tb2;
> +} __attribute__((packed));
> +
> +#endif
> --- 2.6.10-mm1/include/linux/suspend.h 2005-01-03 18:53:51.000000000 +0800
> +++ 2.6.10-mm1-swsusp//include/linux/suspend.h 2005-01-03 19:32:29.000000000 +0800
> @@ -1,7 +1,7 @@
> #ifndef _LINUX_SWSUSP_H
> #define _LINUX_SWSUSP_H
>
> -#if defined(CONFIG_X86) || defined(CONFIG_FRV)
> +#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
> #include <asm/suspend.h>
> #endif
> #include <linux/swap.h>
> --
> Hu Gang .-.
> /v\
> // \\
> Linux User /( )\ [204016]
> GPG Key ID ^^-^^ http://soulinfo.com/~hugang/hugang.asc
>
> ----- End forwarded message -----
--
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com

Ph: +61 (2) 6292 8028 Mob: +61 (417) 100 574

2005-01-06 16:03:55

by Hu Gang

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

On Mon, Jan 03, 2005 at 11:17:18PM +0100, Pavel Machek wrote:
> Hi!
>
...
>
> swsusp_arch_{suspend,resume} should really be written in
> assembly. Just compile this, disassemble it and put it into source
> file. Otherwise it looks OK.
> Pavel

After do more test, I have to drop my last patch, That's unstable.
Current I using this one from
http://honk.physik.uni-konstanz.de/~agx/linux-ppc/kernel/

Here is another patch try make software suspend work well. This idea
base on swsusp2.

adding a option to freeze/thaw_processes, first freeze all user
processess, from now only kernel processess running, Now we can shrink
more memory than current version, after that freeze all processes.
that's mean if your swap space enough, swsusp will not fail.

--- 2.6.10-mm1/include/linux/sched.h 2005-01-03 18:53:51.000000000 +0800
+++ 2.6.10-mm1-swsusp//include/linux/sched.h 2005-01-03 22:33:37.000000000 +0800
@@ -1172,8 +1172,8 @@ extern void normalize_rt_tasks(void);
*/
#ifdef CONFIG_PM
extern void refrigerator(unsigned long);
-extern int freeze_processes(void);
-extern void thaw_processes(void);
+extern int freeze_processes(int);
+extern void thaw_processes(int);

static inline int try_to_freeze(unsigned long refrigerator_flags)
{
--- 2.6.10-mm1/kernel/power/disk.c 2004-12-30 14:49:03.000000000 +0800
+++ 2.6.10-mm1-swsusp//kernel/power/disk.c 2005-01-03 22:53:11.000000000 +0800
@@ -116,7 +116,7 @@ static void finish(void)
device_resume();
platform_finish();
enable_nonboot_cpus();
- thaw_processes();
+ thaw_processes(1);
pm_restore_console();
}

@@ -128,7 +128,7 @@ static int prepare(void)
pm_prepare_console();

sys_sync();
- if (freeze_processes()) {
+ if (freeze_processes(0)) {
error = -EBUSY;
goto Thaw;
}
@@ -142,6 +142,8 @@ static int prepare(void)

/* Free memory before shutting down devices. */
free_some_memory();
+
+ freeze_processes(1);

disable_nonboot_cpus();
if ((error = device_suspend(PM_SUSPEND_DISK)))
@@ -152,7 +154,7 @@ static int prepare(void)
platform_finish();
Thaw:
enable_nonboot_cpus();
- thaw_processes();
+ thaw_processes(1);
pm_restore_console();
return error;
}
--- 2.6.10-mm1/kernel/power/main.c 2004-12-30 14:49:02.000000000 +0800
+++ 2.6.10-mm1-swsusp//kernel/power/main.c 2005-01-03 22:39:53.000000000 +0800
@@ -55,7 +55,7 @@ static int suspend_prepare(suspend_state

pm_prepare_console();

- if (freeze_processes()) {
+ if (freeze_processes(1)) {
error = -EAGAIN;
goto Thaw;
}
@@ -72,7 +72,7 @@ static int suspend_prepare(suspend_state
if (pm_ops->finish)
pm_ops->finish(state);
Thaw:
- thaw_processes();
+ thaw_processes(1);
pm_restore_console();
return error;
}
@@ -107,7 +107,7 @@ static void suspend_finish(suspend_state
device_resume();
if (pm_ops && pm_ops->finish)
pm_ops->finish(state);
- thaw_processes();
+ thaw_processes(1);
pm_restore_console();
}

--- 2.6.10-mm1/kernel/power/power.h 2004-12-30 14:49:02.000000000 +0800
+++ 2.6.10-mm1-swsusp//kernel/power/power.h 2005-01-03 22:39:24.000000000 +0800
@@ -45,8 +45,5 @@ static struct subsys_attribute _name##_a

extern struct subsystem power_subsys;

-extern int freeze_processes(void);
-extern void thaw_processes(void);
-
extern int pm_prepare_console(void);
extern void pm_restore_console(void);
--- 2.6.10-mm1/kernel/power/process.c 2004-12-30 14:49:02.000000000 +0800
+++ 2.6.10-mm1-swsusp//kernel/power/process.c 2005-01-03 22:34:50.000000000 +0800
@@ -19,7 +19,7 @@
#define TIMEOUT (6 * HZ)


-static inline int freezeable(struct task_struct * p)
+static inline int freezeable(struct task_struct * p, int all)
{
if ((p == current) ||
(p->flags & PF_NOFREEZE) ||
@@ -28,6 +28,8 @@ static inline int freezeable(struct task
(p->state == TASK_STOPPED) ||
(p->state == TASK_TRACED))
return 0;
+ if (all == 0 && p->mm == NULL)
+ return 0;
return 1;
}

@@ -55,7 +57,7 @@ void refrigerator(unsigned long flag)
}

/* 0 = success, else # of processes that we failed to stop */
-int freeze_processes(void)
+int freeze_processes(int all)
{
int todo;
unsigned long start_time;
@@ -68,7 +70,7 @@ int freeze_processes(void)
read_lock(&tasklist_lock);
do_each_thread(g, p) {
unsigned long flags;
- if (!freezeable(p))
+ if (!freezeable(p, all))
continue;
if ((p->flags & PF_FROZEN) ||
(p->state == TASK_TRACED) ||
@@ -97,14 +99,14 @@ int freeze_processes(void)
return 0;
}

-void thaw_processes(void)
+void thaw_processes(int all)
{
struct task_struct *g, *p;

printk( "Restarting tasks..." );
read_lock(&tasklist_lock);
do_each_thread(g, p) {
- if (!freezeable(p))
+ if (!freezeable(p, all))
continue;
if (p->flags & PF_FROZEN) {
p->flags &= ~PF_FROZEN;

--
Hu Gang .-.
/v\
// \\
Linux User /( )\ [204016]
GPG Key ID ^^-^^ http://soulinfo.com/~hugang/hugang.asc

2005-01-06 22:41:17

by Pavel Machek

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

Hi!

> > swsusp_arch_{suspend,resume} should really be written in
> > assembly. Just compile this, disassemble it and put it into source
> > file. Otherwise it looks OK.
> > Pavel
>
> After do more test, I have to drop my last patch, That's unstable.
> Current I using this one from
> http://honk.physik.uni-konstanz.de/~agx/linux-ppc/kernel/
>
> Here is another patch try make software suspend work well. This idea
> base on swsusp2.
>
> adding a option to freeze/thaw_processes, first freeze all user
> processess, from now only kernel processess running, Now we can shrink
> more memory than current version, after that freeze all processes.
> that's mean if your swap space enough, swsusp will not fail.

Thanks for the port... ...what is the test case this fixes?

Patch is pretty pretty simple, that's good...

Pavel



> --- 2.6.10-mm1/include/linux/sched.h 2005-01-03 18:53:51.000000000 +0800
> +++ 2.6.10-mm1-swsusp//include/linux/sched.h 2005-01-03 22:33:37.000000000 +0800
> @@ -1172,8 +1172,8 @@ extern void normalize_rt_tasks(void);
> */
> #ifdef CONFIG_PM
> extern void refrigerator(unsigned long);
> -extern int freeze_processes(void);
> -extern void thaw_processes(void);
> +extern int freeze_processes(int);
> +extern void thaw_processes(int);
>
> static inline int try_to_freeze(unsigned long refrigerator_flags)
> {
> --- 2.6.10-mm1/kernel/power/disk.c 2004-12-30 14:49:03.000000000 +0800
> +++ 2.6.10-mm1-swsusp//kernel/power/disk.c 2005-01-03 22:53:11.000000000 +0800
> @@ -116,7 +116,7 @@ static void finish(void)
> device_resume();
> platform_finish();
> enable_nonboot_cpus();
> - thaw_processes();
> + thaw_processes(1);
> pm_restore_console();
> }
>
> @@ -128,7 +128,7 @@ static int prepare(void)
> pm_prepare_console();
>
> sys_sync();
> - if (freeze_processes()) {
> + if (freeze_processes(0)) {
> error = -EBUSY;
> goto Thaw;
> }
> @@ -142,6 +142,8 @@ static int prepare(void)
>
> /* Free memory before shutting down devices. */
> free_some_memory();
> +
> + freeze_processes(1);
>
> disable_nonboot_cpus();
> if ((error = device_suspend(PM_SUSPEND_DISK)))
> @@ -152,7 +154,7 @@ static int prepare(void)
> platform_finish();
> Thaw:
> enable_nonboot_cpus();
> - thaw_processes();
> + thaw_processes(1);
> pm_restore_console();
> return error;
> }
> --- 2.6.10-mm1/kernel/power/main.c 2004-12-30 14:49:02.000000000 +0800
> +++ 2.6.10-mm1-swsusp//kernel/power/main.c 2005-01-03 22:39:53.000000000 +0800
> @@ -55,7 +55,7 @@ static int suspend_prepare(suspend_state
>
> pm_prepare_console();
>
> - if (freeze_processes()) {
> + if (freeze_processes(1)) {
> error = -EAGAIN;
> goto Thaw;
> }
> @@ -72,7 +72,7 @@ static int suspend_prepare(suspend_state
> if (pm_ops->finish)
> pm_ops->finish(state);
> Thaw:
> - thaw_processes();
> + thaw_processes(1);
> pm_restore_console();
> return error;
> }
> @@ -107,7 +107,7 @@ static void suspend_finish(suspend_state
> device_resume();
> if (pm_ops && pm_ops->finish)
> pm_ops->finish(state);
> - thaw_processes();
> + thaw_processes(1);
> pm_restore_console();
> }
>
> --- 2.6.10-mm1/kernel/power/power.h 2004-12-30 14:49:02.000000000 +0800
> +++ 2.6.10-mm1-swsusp//kernel/power/power.h 2005-01-03 22:39:24.000000000 +0800
> @@ -45,8 +45,5 @@ static struct subsys_attribute _name##_a
>
> extern struct subsystem power_subsys;
>
> -extern int freeze_processes(void);
> -extern void thaw_processes(void);
> -
> extern int pm_prepare_console(void);
> extern void pm_restore_console(void);
> --- 2.6.10-mm1/kernel/power/process.c 2004-12-30 14:49:02.000000000 +0800
> +++ 2.6.10-mm1-swsusp//kernel/power/process.c 2005-01-03 22:34:50.000000000 +0800
> @@ -19,7 +19,7 @@
> #define TIMEOUT (6 * HZ)
>
>
> -static inline int freezeable(struct task_struct * p)
> +static inline int freezeable(struct task_struct * p, int all)
> {
> if ((p == current) ||
> (p->flags & PF_NOFREEZE) ||
> @@ -28,6 +28,8 @@ static inline int freezeable(struct task
> (p->state == TASK_STOPPED) ||
> (p->state == TASK_TRACED))
> return 0;
> + if (all == 0 && p->mm == NULL)
> + return 0;
> return 1;
> }
>
> @@ -55,7 +57,7 @@ void refrigerator(unsigned long flag)
> }
>
> /* 0 = success, else # of processes that we failed to stop */
> -int freeze_processes(void)
> +int freeze_processes(int all)
> {
> int todo;
> unsigned long start_time;
> @@ -68,7 +70,7 @@ int freeze_processes(void)
> read_lock(&tasklist_lock);
> do_each_thread(g, p) {
> unsigned long flags;
> - if (!freezeable(p))
> + if (!freezeable(p, all))
> continue;
> if ((p->flags & PF_FROZEN) ||
> (p->state == TASK_TRACED) ||
> @@ -97,14 +99,14 @@ int freeze_processes(void)
> return 0;
> }
>
> -void thaw_processes(void)
> +void thaw_processes(int all)
> {
> struct task_struct *g, *p;
>
> printk( "Restarting tasks..." );
> read_lock(&tasklist_lock);
> do_each_thread(g, p) {
> - if (!freezeable(p))
> + if (!freezeable(p, all))
> continue;
> if (p->flags & PF_FROZEN) {
> p->flags &= ~PF_FROZEN;
>

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

2005-01-07 01:45:57

by Hu Gang

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

On Thu, Jan 06, 2005 at 11:31:32PM +0100, Pavel Machek wrote:
> Hi!
>
> > adding a option to freeze/thaw_processes, first freeze all user
> > processess, from now only kernel processess running, Now we can shrink
> > more memory than current version, after that freeze all processes.
> > that's mean if your swap space enough, swsusp will not fail.
>
> Thanks for the port... ...what is the test case this fixes?
>
> Patch is pretty pretty simple, that's good...

# free
....
Mem: 256368 198148
...
Swap: 524280 140108

# ./eatmem 256

now do swsusp, the current swsusp will fail, with the patch it works.


--
Hu Gang .-.
/v\
// \\
Linux User /( )\ [204016]
GPG Key ID ^^-^^ http://soulinfo.com/~hugang/hugang.asc


Attachments:
(No filename) (783.00 B)
eatmem.c (376.00 B)
Download all attachments

2005-01-06 23:03:46

by Nigel Cunningham

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

Hi.

On Fri, 2005-01-07 at 09:31, Pavel Machek wrote:
> Hi!
>
> > > swsusp_arch_{suspend,resume} should really be written in
> > > assembly. Just compile this, disassemble it and put it into source
> > > file. Otherwise it looks OK.
> > > Pavel
> >
> > After do more test, I have to drop my last patch, That's unstable.
> > Current I using this one from
> > http://honk.physik.uni-konstanz.de/~agx/linux-ppc/kernel/
> >
> > Here is another patch try make software suspend work well. This idea
> > base on swsusp2.
> >
> > adding a option to freeze/thaw_processes, first freeze all user
> > processess, from now only kernel processess running, Now we can shrink
> > more memory than current version, after that freeze all processes.
> > that's mean if your swap space enough, swsusp will not fail.
>
> Thanks for the port... ...what is the test case this fixes?

I don't know what Steve wants it for, but I use it for freezing
userspace, then syncing, then freezing kernelspace.. and I use a couple
of #defines to make the argument more readable.

Regards,

Nigel

> Patch is pretty pretty simple, that's good...
>
> Pavel
>
>
>
> > --- 2.6.10-mm1/include/linux/sched.h 2005-01-03 18:53:51.000000000 +0800
> > +++ 2.6.10-mm1-swsusp//include/linux/sched.h 2005-01-03 22:33:37.000000000 +0800
> > @@ -1172,8 +1172,8 @@ extern void normalize_rt_tasks(void);
> > */
> > #ifdef CONFIG_PM
> > extern void refrigerator(unsigned long);
> > -extern int freeze_processes(void);
> > -extern void thaw_processes(void);
> > +extern int freeze_processes(int);
> > +extern void thaw_processes(int);
> >
> > static inline int try_to_freeze(unsigned long refrigerator_flags)
> > {
> > --- 2.6.10-mm1/kernel/power/disk.c 2004-12-30 14:49:03.000000000 +0800
> > +++ 2.6.10-mm1-swsusp//kernel/power/disk.c 2005-01-03 22:53:11.000000000 +0800
> > @@ -116,7 +116,7 @@ static void finish(void)
> > device_resume();
> > platform_finish();
> > enable_nonboot_cpus();
> > - thaw_processes();
> > + thaw_processes(1);
> > pm_restore_console();
> > }
> >
> > @@ -128,7 +128,7 @@ static int prepare(void)
> > pm_prepare_console();
> >
> > sys_sync();
> > - if (freeze_processes()) {
> > + if (freeze_processes(0)) {
> > error = -EBUSY;
> > goto Thaw;
> > }
> > @@ -142,6 +142,8 @@ static int prepare(void)
> >
> > /* Free memory before shutting down devices. */
> > free_some_memory();
> > +
> > + freeze_processes(1);
> >
> > disable_nonboot_cpus();
> > if ((error = device_suspend(PM_SUSPEND_DISK)))
> > @@ -152,7 +154,7 @@ static int prepare(void)
> > platform_finish();
> > Thaw:
> > enable_nonboot_cpus();
> > - thaw_processes();
> > + thaw_processes(1);
> > pm_restore_console();
> > return error;
> > }
> > --- 2.6.10-mm1/kernel/power/main.c 2004-12-30 14:49:02.000000000 +0800
> > +++ 2.6.10-mm1-swsusp//kernel/power/main.c 2005-01-03 22:39:53.000000000 +0800
> > @@ -55,7 +55,7 @@ static int suspend_prepare(suspend_state
> >
> > pm_prepare_console();
> >
> > - if (freeze_processes()) {
> > + if (freeze_processes(1)) {
> > error = -EAGAIN;
> > goto Thaw;
> > }
> > @@ -72,7 +72,7 @@ static int suspend_prepare(suspend_state
> > if (pm_ops->finish)
> > pm_ops->finish(state);
> > Thaw:
> > - thaw_processes();
> > + thaw_processes(1);
> > pm_restore_console();
> > return error;
> > }
> > @@ -107,7 +107,7 @@ static void suspend_finish(suspend_state
> > device_resume();
> > if (pm_ops && pm_ops->finish)
> > pm_ops->finish(state);
> > - thaw_processes();
> > + thaw_processes(1);
> > pm_restore_console();
> > }
> >
> > --- 2.6.10-mm1/kernel/power/power.h 2004-12-30 14:49:02.000000000 +0800
> > +++ 2.6.10-mm1-swsusp//kernel/power/power.h 2005-01-03 22:39:24.000000000 +0800
> > @@ -45,8 +45,5 @@ static struct subsys_attribute _name##_a
> >
> > extern struct subsystem power_subsys;
> >
> > -extern int freeze_processes(void);
> > -extern void thaw_processes(void);
> > -
> > extern int pm_prepare_console(void);
> > extern void pm_restore_console(void);
> > --- 2.6.10-mm1/kernel/power/process.c 2004-12-30 14:49:02.000000000 +0800
> > +++ 2.6.10-mm1-swsusp//kernel/power/process.c 2005-01-03 22:34:50.000000000 +0800
> > @@ -19,7 +19,7 @@
> > #define TIMEOUT (6 * HZ)
> >
> >
> > -static inline int freezeable(struct task_struct * p)
> > +static inline int freezeable(struct task_struct * p, int all)
> > {
> > if ((p == current) ||
> > (p->flags & PF_NOFREEZE) ||
> > @@ -28,6 +28,8 @@ static inline int freezeable(struct task
> > (p->state == TASK_STOPPED) ||
> > (p->state == TASK_TRACED))
> > return 0;
> > + if (all == 0 && p->mm == NULL)
> > + return 0;
> > return 1;
> > }
> >
> > @@ -55,7 +57,7 @@ void refrigerator(unsigned long flag)
> > }
> >
> > /* 0 = success, else # of processes that we failed to stop */
> > -int freeze_processes(void)
> > +int freeze_processes(int all)
> > {
> > int todo;
> > unsigned long start_time;
> > @@ -68,7 +70,7 @@ int freeze_processes(void)
> > read_lock(&tasklist_lock);
> > do_each_thread(g, p) {
> > unsigned long flags;
> > - if (!freezeable(p))
> > + if (!freezeable(p, all))
> > continue;
> > if ((p->flags & PF_FROZEN) ||
> > (p->state == TASK_TRACED) ||
> > @@ -97,14 +99,14 @@ int freeze_processes(void)
> > return 0;
> > }
> >
> > -void thaw_processes(void)
> > +void thaw_processes(int all)
> > {
> > struct task_struct *g, *p;
> >
> > printk( "Restarting tasks..." );
> > read_lock(&tasklist_lock);
> > do_each_thread(g, p) {
> > - if (!freezeable(p))
> > + if (!freezeable(p, all))
> > continue;
> > if (p->flags & PF_FROZEN) {
> > p->flags &= ~PF_FROZEN;
> >
--
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com

Ph: +61 (2) 6292 8028 Mob: +61 (417) 100 574

2005-01-07 09:53:36

by Pavel Machek

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

Hi!

> > > adding a option to freeze/thaw_processes, first freeze all user
> > > processess, from now only kernel processess running, Now we can shrink
> > > more memory than current version, after that freeze all processes.
> > > that's mean if your swap space enough, swsusp will not fail.
> >
> > Thanks for the port... ...what is the test case this fixes?
> >
> > Patch is pretty pretty simple, that's good...
>
> # free
> ....
> Mem: 256368 198148
> ...
> Swap: 524280 140108
>
> # ./eatmem 256
>
> now do swsusp, the current swsusp will fail, with the patch it works.

It worked here:

pavel@amd:~/misc$ gcc eatmem.c -o eatmem
eatmem.c: In function `do_malloc':
eatmem.c:10: warning: assignment makes pointer from integer without a
cast
pavel@amd:~/misc$ cat /proc/swaps
Filename Type Size Used
Priority
/dev/hda1 partition 1953464 0
-2
pavel@amd:~/misc$ free
total used free shared buffers
cached
Mem: 1031568 989672 41896 0 34340
788156
-/+ buffers/cache: 167176 864392
Swap: 1953464 0 1953464
pavel@amd:~/misc$ ./eatmem 1024
1023

(When it was printing around 900, I switched to another console and
tried swsusp (worked ok), then tried again when it printed 1023).

I'm using patched kernel, however, and this patch might be
relevant. Can you try to apply it and see if problem goes away? [This
patch is ugly hack, but if it helps, we'll simply ask akpm to fix
free_some_memory :-)].

Pavel

--- clean/kernel/power/disk.c 2004-12-25 13:35:03.000000000 +0100
+++ linux/kernel/power/disk.c 2004-12-25 13:05:45.000000000 +0100
@@ -86,23 +86,25 @@

static void free_some_memory(void)
{
- unsigned int i = 0;
- unsigned int tmp;
- unsigned long pages = 0;
- char *p = "-\\|/";
-
- printk("Freeing memory... ");
- while ((tmp = shrink_all_memory(10000))) {
- pages += tmp;
- printk("\b%c", p[i]);
- i++;
- if (i > 3)
- i = 0;
+ int i;
+ for (i=0; i<5; i++) {
+ int i = 0, tmp;
+ long pages = 0;
+ char *p = "-\\|/";
+
+ printk("Freeing memory... ");
+ while ((tmp = shrink_all_memory(10000))) {
+ pages += tmp;
+ printk("\b%c", p[i]);
+ i++;
+ if (i > 3)
+ i = 0;
+ }
+ printk("\bdone (%li pages freed)\n", pages);
+ msleep_interruptible(200);
}
- printk("\bdone (%li pages freed)\n", pages);
}

-
static inline void platform_finish(void)
{
if (pm_disk_mode == PM_DISK_PLATFORM) {


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

2005-01-07 13:26:04

by Pavel Machek

[permalink] [raw]
Subject: Re: [[email protected]: [PATH]software suspend for ppc.]

Hi!

> > (When it was printing around 900, I switched to another console and
> > tried swsusp (worked ok), then tried again when it printed 1023).
> >
> > I'm using patched kernel, however, and this patch might be
> > relevant. Can you try to apply it and see if problem goes away? [This
> > patch is ugly hack, but if it helps, we'll simply ask akpm to fix
> > free_some_memory :-)].
>
> Yes, It works. :)
> 36880 * 4096 ~151MB
>
> Stopping tasks: ==========================================|
> Freeing memory... done (36880 pages freed)
> Freeing memory... done (5720 pages freed)
> Freeing memory... done (2816 pages freed)
> Freeing memory... done (1999 pages freed)
> Freeing memory... done (1954 pages freed)

Okay, so we have to fix free_some_memory, instead of hacking
refrigerator. Sorry.
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!