Skip to contentSkip to conversation

swsusp: use non-contiguous memory

PATCH [email protected] 4 participants 8 messages Mar 7, 2005 – Mar 9, 2005 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · Rafael J. Wysocki

From: Hu Gang <[email protected]>

Subject: swsusp: use non-contiguous memory on resume - ppc support

This patch contains the architecture-dependent changes for ppc required for using a linklist instead of an array of page backup entries during resume.

...

Signature · 5 lines
Hu Gang       .-.
              /v\
             // \\ 
Linux User  /(   )\  [204016]
GPG Key ID   ^^-^^   http://soulinfo.com/~hugang/hugang.asc
#2 lore raw
Quoted 11 lines · On Monday, 7 of March 2005 07:41, [email protected] wrote:
Quoted 9 lines · Rafael J. Wysocki

From: Hu Gang <[email protected]>

Subject: swsusp: use non-contiguous memory on resume - ppc support

This patch contains the architecture-dependent changes for ppc required for using a linklist instead of an array of page backup entries during resume.

Yes, the Signed-off-by line was missing from the original patch. Andrew, should I resubmit it?

Rafael

Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
#3 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · On Monday, 7 of March 2005 07:41, [email protected] wrote:
Quoted 8 lines · Rafael J. Wysocki

From: Hu Gang <[email protected]>

Subject: swsusp: use non-contiguous memory on resume - ppc support

This patch contains the architecture-dependent changes for ppc required for using a linklist instead of an array of page backup entries during resume.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Yes, the Signed-off-by line was missing from the original patch. Andrew, should I resubmit it?

I dropped lots of those swsusp patches due to various bit of breakage. Pavel will be redoing all of them sometime, hopefully.

#4 lore raw
Quoted 13 lines · Andrew Morton
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · On Monday, 7 of March 2005 07:41, [email protected] wrote:
Quoted 9 lines · Rafael J. Wysocki

From: Hu Gang <[email protected]>

Subject: swsusp: use non-contiguous memory on resume - ppc support

This patch contains the architecture-dependent changes for ppc required for using a linklist instead of an array of page backup entries during resume.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Yes, the Signed-off-by line was missing from the original patch. Andrew, should I resubmit it?

I dropped lots of those swsusp patches due to various bit of breakage. Pavel will be redoing all of them sometime, hopefully.

These patches are a "redone version" of the patch that Pavel submitted before and Pavel has acked them already.

I did my best not to break them, but if they are broken, could you please tell me what's wrong with them so that I can fix it?

Rafael

Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
#5 lore raw
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Andrew Morton
Quoted 4 lines · Rafael J. Wysocki

Yes, the Signed-off-by line was missing from the original patch. Andrew, should I resubmit it?

Quoted 8 lines
Quoted 2 lines

I dropped lots of those swsusp patches due to various bit of breakage. Pavel will be redoing all of them sometime, hopefully.

These patches are a "redone version" of the patch that Pavel submitted before and Pavel has acked them already.

I did my best not to break them, but if they are broken, could you please tell me what's wrong with them so that I can fix it?

Just bad timing, I guess. I sent wrong patches, and andrew reacted by simply waiting for me to catch up with right tree (which is okay, it was big and not critical).

Now, akpm sent all (?) swsusp updates to Linus, so it should appear in bk tree later today. If you could regenerate the patches (1/3 will no longer be needed) and send them to me & l-k. I'll then forward them to akpm. [He seems to prefer patches to come from my email address :-)]

Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#6 lore raw

Hi,

Quoted 17 lines · Pavel Machek
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Andrew Morton
Quoted 4 lines · Rafael J. Wysocki

Yes, the Signed-off-by line was missing from the original patch. Andrew, should I resubmit it?

Quoted 8 lines
Quoted 2 lines

I dropped lots of those swsusp patches due to various bit of breakage. Pavel will be redoing all of them sometime, hopefully.

These patches are a "redone version" of the patch that Pavel submitted before and Pavel has acked them already.

I did my best not to break them, but if they are broken, could you please tell me what's wrong with them so that I can fix it?

Quoted 8 lines

Just bad timing, I guess. I sent wrong patches, and andrew reacted by simply waiting for me to catch up with right tree (which is okay, it was big and not critical).

Now, akpm sent all (?) swsusp updates to Linus, so it should appear in bk tree later today. If you could regenerate the patches (1/3 will no longer be needed) and send them to me & l-k. I'll then forward them to akpm. [He seems to prefer patches to come from my email address :-)]

OK

Here's the 2/3 one (ie the main resume part). Do you need the summary?

Rafael

arch/i386/kernel/asm-offsets.c +6 -0
diff -Nru linux-2.6.11-a/arch/i386/kernel/asm-offsets.c linux-2.6.11-b/arch/i386/kernel/asm-offsets.c
@@ -7,6 +7,7 @@
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <linux/personality.h>
+#include <linux/suspend.h>
 #include <asm/ucontext.h>
 #include "sigframe.h"
 #include <asm/fixmap.h>
@@ -56,6 +57,11 @@
 
 	OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
 	OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
+	BLANK();
+
+	OFFSET(pbe_address, pbe, address);
+	OFFSET(pbe_orig_address, pbe, orig_address);
+	OFFSET(pbe_next, pbe, next);
 
 	/* Offset from the sysenter stack to tss.esp0 */
 	DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, esp0) -
arch/i386/power/swsusp.S +12 -11
diff -Nru linux-2.6.11-a/arch/i386/power/swsusp.S linux-2.6.11-b/arch/i386/power/swsusp.S
@@ -12,6 +12,7 @@
 #include <linux/linkage.h>
 #include <asm/segment.h>
 #include <asm/page.h>
+#include <asm/asm_offsets.h>
 
 	.text
 
@@ -28,28 +29,28 @@
 	ret
 
 ENTRY(swsusp_arch_resume)
-	movl $swsusp_pg_dir-__PAGE_OFFSET,%ecx
-	movl %ecx,%cr3
+	movl	$swsusp_pg_dir-__PAGE_OFFSET, %ecx
+	movl	%ecx, %cr3
 
-	movl	pagedir_nosave, %ebx
-	xorl	%eax, %eax
-	xorl	%edx, %edx
+	movl	pagedir_nosave, %edx
 	.p2align 4,,7
 
 copy_loop:
-	movl	4(%ebx,%edx),%edi
-	movl	(%ebx,%edx),%esi
+	testl	%edx, %edx
+	jz	done
+
+	movl	pbe_address(%edx), %esi
+	movl	pbe_orig_address(%edx), %edi
 
 	movl	$1024, %ecx
 	rep
 	movsl
 
-	incl	%eax
-	addl	$16, %edx
-	cmpl	nr_copy_pages,%eax
-	jb copy_loop
+	movl	pbe_next(%edx), %edx
+	jmp	copy_loop
 	.p2align 4,,7
 
+done:
 	movl saved_context_esp, %esp
 	movl saved_context_ebp, %ebp
 	movl saved_context_ebx, %ebx
arch/x86_64/kernel/asm-offsets.c +1 -1
diff -Nru linux-2.6.11-a/arch/x86_64/kernel/asm-offsets.c linux-2.6.11-b/arch/x86_64/kernel/asm-offsets.c
@@ -62,8 +62,8 @@
 	       offsetof (struct rt_sigframe32, uc.uc_mcontext));
 	BLANK();
 #endif
-	DEFINE(SIZEOF_PBE, sizeof(struct pbe));
 	DEFINE(pbe_address, offsetof(struct pbe, address));
 	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
+	DEFINE(pbe_next, offsetof(struct pbe, next));
 	return 0;
 }
arch/x86_64/kernel/suspend_asm.S +5 -12
diff -Nru linux-2.6.11-a/arch/x86_64/kernel/suspend_asm.S linux-2.6.11-b/arch/x86_64/kernel/suspend_asm.S
@@ -54,16 +54,10 @@
 	movq	%rax, %cr4;  # turn PGE back on
 
 	movq	pagedir_nosave(%rip), %rdx
-	/* compute the limit */
-	movl	nr_copy_pages(%rip), %eax
-	testl	%eax, %eax
-	jz	done
-	movq	%rdx,%r8
-	movl	$SIZEOF_PBE,%r9d
-	mul		%r9  # with rax, clobbers rdx
-	movq 	%r8, %rdx
-	addq	%r8, %rax
 loop:
+	testq	%rdx, %rdx
+	jz	done
+
 	/* get addresses from the pbe and copy the page */
 	movq	pbe_address(%rdx), %rsi
 	movq	pbe_orig_address(%rdx), %rdi
@@ -72,9 +66,8 @@
 	movsq
 
 	/* progress to the next pbe */
-	addq	$SIZEOF_PBE, %rdx
-	cmpq	%rax, %rdx
-	jb	loop
+	movq	pbe_next(%rdx), %rdx
+	jmp	loop
 done:
 	movl	$24, %eax
 	movl	%eax, %ds
kernel/power/swsusp.c +239 -98

444 lines not on this page · raw message

Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
#7 lore raw

Hi,

Quoted 2 lines · Rafael J. Wysocki

Hi,

[-- snip --]

Quoted 4 lines
Quoted 4 lines

Just bad timing, I guess. I sent wrong patches, and andrew reacted by simply waiting for me to catch up with right tree (which is okay, it was big and not critical).

Quoted 8 lines
Quoted 4 lines

Now, akpm sent all (?) swsusp updates to Linus, so it should appear in bk tree later today. If you could regenerate the patches (1/3 will no longer be needed) and send them to me & l-k. I'll then forward them to akpm. [He seems to prefer patches to come from my email address :-)]

OK

Here's the 2/3 one (ie the main resume part). Do you need the summary?

Here's the 3/3 one (ie the ppc support from hugang).

The patches are against 2.6.11 + 1/3 (ie suspend part), but they should apply cleanly to the -bk w/ the suspend part as well.

Rafael

arch/ppc/Kconfig +2 -0
diff -Nru linux-2.6.11-a/arch/ppc/Kconfig linux-2.6.11-b/arch/ppc/Kconfig
@@ -1046,6 +1046,8 @@
 
 source "drivers/zorro/Kconfig"
 
+source kernel/power/Kconfig
+
 endmenu
 
 menu "Bus options"
arch/ppc/kernel/asm-offsets.c +5 -0
diff -Nru linux-2.6.11-a/arch/ppc/kernel/asm-offsets.c linux-2.6.11-b/arch/ppc/kernel/asm-offsets.c
@@ -16,6 +16,7 @@
 #include <linux/string.h>
 #include <linux/types.h>
 #include <linux/ptrace.h>
+#include <linux/suspend.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <asm/io.h>
@@ -136,6 +137,10 @@
 	DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
 	DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
 
+	DEFINE(pbe_address, offsetof(struct pbe, address));
+	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
+	DEFINE(pbe_next, offsetof(struct pbe, next));
+
 	DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
 	return 0;
 }
arch/ppc/kernel/Makefile +1 -0
diff -Nru linux-2.6.11-a/arch/ppc/kernel/Makefile linux-2.6.11-b/arch/ppc/kernel/Makefile
@@ -16,6 +16,7 @@
 					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
arch/ppc/kernel/signal.c +10 -0
diff -Nru linux-2.6.11-a/arch/ppc/kernel/signal.c linux-2.6.11-b/arch/ppc/kernel/signal.c
@@ -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 @@
 	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 @@
 			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;
arch/ppc/kernel/swsusp.S +349 -0

349 lines not on this page · raw message

arch/ppc/kernel/vmlinux.lds.S +6 -0
diff -Nru linux-2.6.11-a/arch/ppc/kernel/vmlinux.lds.S linux-2.6.11-b/arch/ppc/kernel/vmlinux.lds.S
@@ -74,6 +74,12 @@
     CONSTRUCTORS
   }
 
+  . = ALIGN(4096);
+  __nosave_begin = .;
+  .data_nosave : { *(.data.nosave) }
+  . = ALIGN(4096);
+  __nosave_end = .;
+
   . = ALIGN(32);
   .data.cacheline_aligned : { *(.data.cacheline_aligned) }
 
arch/ppc/platforms/pmac_setup.c +55 -0

77 lines not on this page · raw message

drivers/macintosh/via-pmu.c +84 -2

110 lines not on this page · raw message

include/asm-ppc/suspend.h +12 -0
diff -Nru linux-2.6.11-a/include/asm-ppc/suspend.h linux-2.6.11-b/include/asm-ppc/suspend.h
@@ -0,0 +1,12 @@
+static inline int arch_prepare_suspend(void)
+{
+	return 0;
+}
+
+static inline void save_processor_state(void)
+{
+}
+
+static inline void restore_processor_state(void)
+{
+}
include/linux/suspend.h +1 -1
diff -Nru linux-2.6.11-a/include/linux/suspend.h linux-2.6.11-b/include/linux/suspend.h
@@ -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>
Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"
#8 lore raw

Hi,

On Tuesday, 8 of March 2005 13:00, Rafael J. Wysocki wrote:
]-- snip --[

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Now, akpm sent all (?) swsusp updates to Linus, so it should appear in bk tree later today. If you could regenerate the patches (1/3 will no longer be needed) and send them to me & l-k. I'll then forward them to akpm. [He seems to prefer patches to come from my email address :-)]

Quoted 8 lines
Quoted 3 lines

OK

Here's the 2/3 one (ie the main resume part). Do you need the summary?

Here's the 3/3 one (ie the ppc support from hugang).

The patches are against 2.6.11 + 1/3 (ie suspend part), but they should apply cleanly to the -bk w/ the suspend part as well.

FYI, 2.6.11-kb5 is out and it contains the "suspend" patch. The patches that I have sent you apply to it cleanly.

Greets,
Rafael

Signature · 3 lines
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"