[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-arm-kernel
Subject:    Re: Arm linux software suspend
From:       junjie cai <junjiec () gmail ! com>
Date:       2005-08-09 7:00:28
Message-ID: ca992f1105080900006278d0be () mail ! gmail ! com
[Download RAW message or body]

hi,
you mentioned that when the image got bigger(above 2000 page?), 
the resume failed even in simple case,
so just for curious ,i wrote a dummy application allocationg 8M memory
and printing, then do suspend-to-disk. after disabling free_some_memory,
the image is about 4200 pages and it worked just fine.

FYI, i did the test in a 
 2.6.10 kernel 
    + 
  swap partition on IDE 
    + 
   root fs on NFS
    +
  my local patches.

as you see, your patches are more mature
but just for your information.

thanks.

--- temp-alp-linux/arch/arm/Makefile	2005-03-01 19:21:16.000000000 +0900
+++ patch-alp-linux/arch/arm/Makefile	2005-04-20 14:39:04.000000000 +0900
@@ -150,6 +150,7 @@
 drivers-$(CONFIG_OPROFILE)      += arch/arm/oprofile/
 drivers-$(CONFIG_ARCH_CLPS7500)	+= drivers/acorn/char/
 drivers-$(CONFIG_ARCH_L7200)	+= drivers/acorn/char/
+drivers-$(CONFIG_PM)		+= arch/arm/power/
 
 libs-y				+= arch/arm/lib/
--- temp-alp-linux/arch/arm/power/cpu.c	1970-01-01 09:00:00.000000000 +0900
+++ patch-alp-linux/arch/arm/power/cpu.c	2005-04-22 14:31:21.000000000 +0900
@@ -0,0 +1,54 @@
+/*
+ * base on arch/i386/power/cpu.c
+ * junjie.cai@jp.sony.com
+ */
+
+#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/pm.h>
+#include <linux/device.h>
+#include <linux/suspend.h>
+#include <asm/suspend.h>
+
+static struct saved_context saved_context;
+
+unsigned long saved_context_sp;
+
+void save_processor_state(void)
+{
+	pr_debug("<");
+	asm volatile ("mrc p15, 0, %0, c3, c0, 0": "=r"(saved_context.domain_id));
+	asm volatile ("mrc p15, 0, %0, c2, c0, 0": "=r"(saved_context.pgd));
+	asm volatile ("mrc p15, 0, %0, c13, c0, 0": "=r"(saved_context.pid));
+	asm volatile ("mrc p15, 0, %0, c1, c0, 0": "=r"(saved_context.ctrl));
+
+	asm volatile ("mrs %0, CPSR": "=r"(saved_context.cpsr));
+	asm volatile ("mrs %0, SPSR": "=r"(saved_context.spsr));
+	pr_debug("%x>\n",saved_context.pgd);
+}
+
+void restore_processor_state(void)
+{
+	pr_debug("<:%x",saved_context.pgd);
+	asm volatile ("mcr p15, 0, %0, c3, c0, 0": : "r"(saved_context.domain_id));
+	asm volatile ("mcr p15, 0, %0, c2, c0, 0": : "r"(saved_context.pgd));
+	asm volatile ("mcr p15, 0, %0, c13, c0, 0": : "r"(saved_context.pid));
+	asm volatile ("mcr p15, 0, %0, c1, c0, 0": : "r"(saved_context.ctrl));
+
+	asm volatile ("msr CPSR_cxsf, %0": : "r"(saved_context.cpsr));
+	asm volatile ("msr SPSR_cxsf, %0": : "r"(saved_context.spsr));
+	pr_debug(">\n");
+}
+
+/* Needed by apm.c */
+EXPORT_SYMBOL(save_processor_state);
+EXPORT_SYMBOL(restore_processor_state);
+
diff -urN --exclude='*.rej' --exclude='*.orig' --exclude=CVS
temp-alp-linux/arch/arm/power/Makefile
patch-alp-linux/arch/arm/power/Makefile
--- temp-alp-linux/arch/arm/power/Makefile	1970-01-01 09:00:00.000000000 +0900
+++ patch-alp-linux/arch/arm/power/Makefile	2005-04-20 14:39:04.000000000 +0900
@@ -0,0 +1,2 @@
+obj-$(CONFIG_PM)		+= cpu.o
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o
diff -urN --exclude='*.rej' --exclude='*.orig' --exclude=CVS
temp-alp-linux/arch/arm/power/swsusp.S
patch-alp-linux/arch/arm/power/swsusp.S
--- temp-alp-linux/arch/arm/power/swsusp.S	1970-01-01 09:00:00.000000000 +0900
+++ patch-alp-linux/arch/arm/power/swsusp.S	2005-04-22 14:31:04.000000000 +0900
@@ -0,1 +1,55 @@
+.text
+
+/* base on arch/i386/power/swsusp.S
+ * junjie.cai@jp.sony.com
+ */
+
+#include <linux/linkage.h>
+#include <asm/segment.h>
+#include <asm/memory.h>
+
+	.text
+
+saved_context_sp:	
+	.word 0
+	
+ENTRY(swsusp_arch_suspend)
+	stmfd	sp!, {r4 - r12, lr}		@ save registers on stack
+		
+	ldr r0, =saved_context_sp
+	str sp, [r0]
+	
+	bl swsusp_save
+
+	ldmfd	sp!, {r4 - r12, pc}		@ return to caller
+
+ENTRY(swsusp_arch_resume)
+	stmfd	sp!, {r4 - r12, lr}		@ save registers on stack	
+
+	@ copy the saved pages
+	@ r8=source address, r9=destination address
+	ldr r4, =nr_copy_pages
+	ldr r4, [r4]
+	ldr r5, =pagedir_nosave
+	ldr r5, [r5]
+	mov r6, #0
+
+copy_out_loop:	
+	ldr r8, [r5], #4
+	ldr r9, [r5], #12
+	add r7, r8, #1024*4
+copy_in_loop:
+	ldr r10, [r8], #4
+	str r10, [r9], #4
+	cmp r7, r8
+	bne copy_in_loop
+	add r6, r6, #1
+	cmp r6, r4
+	bne copy_out_loop
+
+	ldr r0, =saved_context_sp
+	ldr sp, [r0]
+	
+	bl swsusp_restore
+	ldmfd	sp!, {r4 - r12, pc}		@ return to caller
--- temp-alp-linux/include/asm-arm/suspend.h	2005-03-01 18:16:43.000000000 +0900
+++ patch-alp-linux/include/asm-arm/suspend.h	2005-04-20
14:39:04.000000000 +0900
@@ -1,5 +1,19 @@
 #ifndef _ASMARM_SUSPEND_H
 #define _ASMARM_SUSPEND_H
 
+struct saved_context {
+	unsigned long domain_id;
+	unsigned long pgd;
+	unsigned long pid;
+	unsigned long ctrl;
+	unsigned long cpsr;
+	unsigned long spsr;
+} __attribute__((packed));
+
+static inline int
+arch_prepare_suspend(void) {
+  return 0;
+}
+
 #endif
 

On 8/9/05, Hiroki Kaminaga <kaminaga@sm.sony.co.jp> wrote:
> From: junjie cai <junjiec@gmail.com>
> Subject: Re: Arm linux software suspend
> Date: Tue, 9 Aug 2005 12:06:21 +0900
> 
> > sorry for not reading your patches carefully,
> > i think you have done that.
> > please just ignore my last message.
> 
> Yes, saving regs of cp15 is already there.
> 
> > but could you please provide more details about the oops?
> > for example where this oops came from ,etc.
> 
> Sure! attached is log of wakeup from software suspend while playing
> mplayer.
> 
> Pavel suggested me that disabling MMU would do, so I'm currentry
> working on it.
> 
> 
> HK.
> --
> 
> 
> 
> U-Boot 1.1.2 (Feb 22 2005 - 15:44:47)
> 
> U-Boot code: 11080000 -> 110956D4  BSS: -> 11099EA4
> RAM Configuration:
> Bank #0: 10000000 32 MB
> Micron StrataFlash MT28F128J3 device initialized
> Flash: 32 MB
> In:    serial
> Out:   serial
> Err:   serial
> Hit any key to stop autoboot: 10  9  8  7  6  5  4  3  2 \
>  1  0 ## Booting image at 10000000 ...
> Image Name:   Linux-2.6.11-alp
> Image Type:   ARM Linux Kernel Image (uncompressed)
> Data Size:    1128768 Bytes =  1.1 MB
> Load Address: 10008000
> Entry Point:  10008000
> Verifying Checksum ... OK
> OK
> 
> Starting kernel ...
> 
> Uncompressing Linux........................................................................... \
> done, booting the kernel. Linux version 2.6.11-alp (kaminaga@nscrel1) (gcc version \
>                 3.4.4) #20 Tue Aug 9 13:37:24 JST 2005
> CPU: ARM926EJ-Sid(wt) [41069263] revision 3 (ARMv5TEJ)
> CPU0: D VIVT write-back cache
> CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
> CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
> Machine: TI-OSK
> Memory policy: ECC disabled, Data cache writethrough
> OMAP_DIE_ID_0: 0x488e0419
> OMAP_DIE_ID_1: 0xb9058f79 DIE_REV: 2
> OMAP_PRODUCTION_ID_0: 0xc0aaaafc
> OMAP_PRODUCTION_ID_1: 0x00016b18 JTAG_ID: 0x6b18
> OMAP32_ID_0: 0x03320200
> OMAP32_ID_1: 0x2b58c02f
> JTAG_ID: 0xb58c DIE_REV: 2
> OMAP1611b revision 2 handled as 16xx id: b9058f79488e0419
> Built 1 zonelists
> Kernel command line: console=ttyS0,115200n8 ip=dhcp root=/dev/nfs \
> resume=/dev/mtdblock3 prsv-img Total of 128 interrupts in 4 interrupt banks
> OMAP GPIO hardware version 1.0
> MUX: initialized M7_1610_GPIO62
> PID hash table entries: 256 (order: 8, 4096 bytes)
> OMAP MPU timers initialized
> Console: colour dummy device 80x30
> Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
> Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
> Memory: 32MB = 32MB total
> Memory: 29952KB available (1893K code, 433K data, 108K init)
> Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
> CPU: Testing write buffer coherency: ok
> NET: Registered protocol family 16
> OMAP DMA hardware version 1
> DMA capabilities: 000c0000:00000000:01ff:003f:007f
> Initializing OMAP McBSP system
> USB: hmc 16, usb0 2 wires
> OMAP I2C: Driver ver. 1.3
> tps65010: version 20 Jan 2005
> MUX: initialized N14_1610_UWIRE_CS0
> MUX: initialized N15_1610_UWIRE_CS1
> OMAP OCPI interconnect driver loaded
> Power Management for TI OMAP.
> MUX: initialized T20_1610_LOW_PWR
> NetWinder Floating Point Emulator V0.97 (double precision)
> JFFS2 version 2.2. (C) 2001-2003 Red Hat, Inc.
> omapfb: configured for panel osk
> OMAP LCD controller initialized.
> MUX: initialized PWL
> Console: switching to colour frame buffer device 30x40
> OMAP framebuffer initialized vram=262144
> Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
> ttyS0 at MMIO 0xfffb0000 (irq = 46) is a ST16654
> ttyS1 at MMIO 0xfffb0800 (irq = 47) is a ST16654
> Trying to free nonexistent resource <fffb9800-fffb981f>
> io scheduler noop registered
> io scheduler anticipatory registered
> io scheduler deadline registered
> io scheduler cfq registered
> RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
> loop: loaded (max 8 devices)
> PPP generic driver version 2.4.2
> smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@cam.org>
> eth0: SMC91C94 (rev 9) at 0xc2852300 IRQ 160 [nowait]
> eth0: Ethernet addr: 00:0e:99:02:05:82
> i2c /dev entries driver
> omap_nor_cs3: Found 1 x16 devices at 0x0 in 16-bit bank
> omap_nor_cs3: Found 1 x16 devices at 0x1000000 in 16-bit bank
> Intel/Sharp Extended Query Table at 0x0031
> Using buffer write method
> cfi_cmdset_0001: Erase suspend on write enabled
> Creating 4 MTD partitions on "omap_nor_cs3":
> 0x00000000-0x00020000 : "bootloader"
> 0x00020000-0x00040000 : "params"
> 0x00040000-0x00240000 : "kernel"
> 0x00240000-0x02000000 : "filesystem"
> mice: PS/2 mouse device common for all mice
> OMAP Keypad Driver
> MUX: initialized P20_1610_GPIO4
> OMAP touchscreen driver initialized
> NET: Registered protocol family 2
> IP: routing cache hash table of 512 buckets, 4Kbytes
> TCP established hash table entries: 2048 (order: 2, 16384 bytes)
> TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
> TCP: Hash tables configured (established 2048 bind 2048)
> NET: Registered protocol family 1
> PM: Reading swsusp image.
> swsusp: Resume From Partition: /dev/mtdblock3
> swsusp: Signature found, resuming
> swsusp: Version: 132619
> swsusp: Num Pages: 8192
> swsusp: UTS Sys: Linux
> swsusp: UTS Node: 192.168.0.43
> swsusp: UTS Release: 2.6.11-alp
> swsusp: UTS Version: #20 Tue Aug 9 13:37:24 JST 2005
> swsusp: UTS Machine: armv5tejl
> swsusp: UTS Domain: (none)
> swsusp: CPUs: 1
> swsusp: Image: 2453 Pages
> swsusp: Pagedir: 1 Pages
> swsusp: Reading pagedir (10 Pages)
> swsusp_pagedir_relocate:begin:pagedir_nosave:c1cb0000
> Relocating pagedir ...:::|
> swsusp_pagedir_relocate:end:pagedir_nosave:c1cf0000
> Reading image data (2453 pages):       0%  1%  2%  3%  4%  \
> 5%  6%  7%  8%  9% 10% 11% 12% 13% 14% \
> 15% 16% 17% 18% 19% 20% 21% 22% 23% 24% \
> 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% \
> 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% \
> 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% \
> 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% \
> 65% 66% 67% 68% 69% 70% 71% 72% 73% 74% \
> 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% \
> 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% \
> 95% 96% 97% 98% 99%100%101%102% 2453 done. Reading \
>                 resume file was successful
> PM: Preparing system for restore.
> PM: prepare: Attempting to freeze processes.
> Stopping tasks: ==|
> Freeing memory...  done (0 pages freed)
> PM: prepare: OK.
> pagedir_nosave:c1cf0000
> PM: Restoring saved image.
> Unable to handle kernel paging request at virtual address 80000020
> pgd = c106c000
> [80000020] *pgd=00000000
> Internal error: Oops: 5 [#1]
> Modules linked in:
> CPU: 0
> PC is at rt_check_expire+0x6c/0x134
> LR is at run_timer_softirq+0x188/0x1f8
> pc : [<c017ca80>]    lr : [<c00445e0>]    Tainted: G
> sp : c18bfd94  ip : c18bfdc4  fp : c18bfdc0
> r10: 0000a52f  r9 : c0213568  r8 : 002ee000
> r7 : 00000068  r6 : c1c6a340  r5 : 00007530  r4 : 80000000
> r3 : 00000340  r2 : c1c6a000  r1 : c18bfdc4  r0 : 00000000
> Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  Segment user
> Control: 5317F  Table: 1106C000  DAC: 00000015
> Process sh (pid: 40, stack limit = 0xc18be198)
> Stack: (0xc18bfd94 to 0xc18c0000)
> fd80:                                              c18bfda0 c18be000 00000100
> fda0: c017ca14 00000000 c0253b1c c020129c c18bfdc4 c18bfdf8 c18bfdc4 c00445e0
> fdc0: c017ca24 c18bfdc4 c18bfdc4 c18be000 00000001 c02538b0 c18be000 0000000a
> fde0: c0253880 c18bff78 c0247c98 c18bfe1c c18bfdfc c00408b8 c0044468 c18be000
> fe00: fefecb00 ffffffff 00000004 c18bfe50 c18bfe4c c18bfe20 c0024688 c004086c
> fe20: 0000001b 00001674 ffffffff fefecb00 ffffffff 00000004 00000005 c0205240
> fe40: c18bfea8 c18bfe50 c0023360 c0024574 00000000 000016cc c020f438 60000013
> fe60: 00000000 00000000 c020523c 00000004 00000005 c18bff78 c0205240 c18bfea8
> fe80: c18bfe98 c18bfe98 c00565b0 c00565bc 60000013 ffffffff c0246000 c18bfec4
> fea0: c18bfeac c0056bd8 c0056574 c10ce000 c0205234 c025700c c18bfeec c18bfec8
> fec0: c00546b8 c0056b74 c10ce000 c0205234 00000004 00000004 00000005 c18fc660
> fee0: c18bff10 c18bfef0 c0054bac c0054648 00000005 0009f408 c1968c60 00000000
> ff00: c1968c74 c18bff20 c18bff14 c00a59c4 c0054b44 c18bff4c c18bff24 c00a5cbc
> ff20: c00a59a4 00000005 00000000 c18fc660 0009f408 c18be000 c18be000 c18bff78
> ff40: c18bff74 c18bff50 c00750ac c00a5bc4 c18fc684 c18fc660 c18bff78 00000000
> ff60: 00000000 4019c608 c18bffa4 c18bff78 c00751e4 c0074ffc 00000000 00000000
> ff80: 00000000 00000005 0009f408 4019abd4 00000004 c0023864 00000000 c18bffa8
> ffa0: c00236e0 c00751a8 00000005 c0029f4c 00000001 0009f408 00000005 00000000
> ffc0: 00000005 0009f408 4019abd4 00000000 00000005 00000000 4019c608 00000000
> ffe0: 00000000 befffae4 0000267c 4013ae10 60000010 00000001 c002331c c0029f4c
> Backtrace:
> [<c017ca14>] (rt_check_expire+0x0/0x134) from [<c00445e0>] \
> (run_timer_softirq+0x188/0x1f8) [<c0044458>] (run_timer_softirq+0x0/0x1f8) from \
> [<c00408b8>] (__do_softirq+0x5c/0xd0) [<c004085c>] (__do_softirq+0x0/0xd0) from \
> [<c0024688>] (asm_do_IRQ+0x124/0x140) r8 = C18BFE50  r7 = 00000004  r6 = FFFFFFFF  \
> r5 = FEFECB00 r4 = C18BE000
> [<c0024564>] (asm_do_IRQ+0x0/0x140) from [<c0023360>] (__irq_svc+0x20/0x80)
> [<c0056564>] (swsusp_suspend+0x0/0x60) from [<c0056bd8>] \
> (pm_suspend_disk+0x74/0x238) r4 = C0246000
> [<c0056b64>] (pm_suspend_disk+0x0/0x238) from [<c00546b8>] (enter_state+0x80/0x2c4)
> r6 = C025700C  r5 = C0205234  r4 = C10CE000
> [<c0054638>] (enter_state+0x0/0x2c4) from [<c0054bac>] (state_store+0x78/0x88)
> [<c0054b34>] (state_store+0x0/0x88) from [<c00a59c4>] (subsys_attr_store+0x30/0x3c)
> r8 = C1968C74  r7 = 00000000  r6 = C1968C60  r5 = 0009F408
> r4 = 00000005
> [<c00a5994>] (subsys_attr_store+0x0/0x3c) from [<c00a5cbc>] \
> (sysfs_write_file+0x108/0x14c) [<c00a5bb4>] (sysfs_write_file+0x0/0x14c) from \
> [<c00750ac>] (vfs_write+0xc0/0x138) [<c0074fec>] (vfs_write+0x0/0x138) from \
> [<c00751e4>] (sys_write+0x4c/0x74) [<c0075198>] (sys_write+0x0/0x74) from \
> [<c00236e0>] (ret_fast_syscall+0x0/0x2c) r8 = C0023864  r7 = 00000004  r6 = \
> 4019ABD4  r5 = 0009F408 r4 = 00000005
> Code: e7924003 e0826003 e3540000 0a000017 (e5943020)
> <0>Kernel panic - not syncing: Aiee, killing interrupt handler!
> 
> 
> 
> 

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic