Skip to contentSkip to conversation

resurrected powerpc checkpoint support

WIP Nathan Lynch 1 participant 1 message Jul 8, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is a delta against Oren's v17-rc1. The code is pretty much the same as it was in v15; I mostly cherry-picked the original commits and fixed the build breaks. Single-task checkpoint and restart of 32-bit bash works... sometimes. I think I may be seeing the same issue I reported for i386 here:

https://lists.linux-foundation.org/pipermail/containers/2009-June/018522.html

Note clone_with_pids is not implemented yet.

Tested with 64-bit kernel on Powerstation (970MP).

Comments welcome...

 arch/powerpc/Kconfig                      |    3 +
 arch/powerpc/include/asm/Kbuild           |    1 +
 arch/powerpc/include/asm/checkpoint_hdr.h |   13 +
 arch/powerpc/include/asm/ptrace.h         |    7 +
 arch/powerpc/include/asm/systbl.h         |    2 +
 arch/powerpc/include/asm/unistd.h         |    4 +-
 arch/powerpc/kernel/ptrace.c              |   88 ++++--
 arch/powerpc/mm/Makefile                  |    1 +
 arch/powerpc/mm/checkpoint.c              |  499 +++++++++++++++++++++++++++++
 checkpoint/process.c                      |   50 ---
 include/linux/Kbuild                      |    1 +
 include/linux/checkpoint_hdr.h            |    2 +
 12 files changed, 591 insertions(+), 80 deletions(-)
arch/powerpc/Kconfig +3 -0
index d00131c..2ca160e 100644
@@ -26,6 +26,9 @@ config MMU
 	bool
 	default y
 
+config CHECKPOINT_SUPPORT
+	def_bool y
+
 config GENERIC_CMOS_UPDATE
 	def_bool y
 
arch/powerpc/include/asm/Kbuild +1 -0
index 5ab7d7f..20379f1 100644
@@ -12,6 +12,7 @@ header-y += shmbuf.h
 header-y += socket.h
 header-y += termbits.h
 header-y += fcntl.h
+header-y += checkpoint_hdr.h
 header-y += poll.h
 header-y += sockios.h
 header-y += ucontext.h
arch/powerpc/include/asm/checkpoint_hdr.h new file +13 -0
new file mode 100644
index 0000000..2d454c6
@@ -0,0 +1,13 @@
+#ifndef __ASM_POWERPC_CKPT_HDR_H
+#define __ASM_POWERPC_CKPT_HDR_H
+
+/* This must match _NSIG in <asm/signal.h> */
+#define CKPT_ARCH_NSIG 64
+
+#ifdef __powerpc64__
+#define CKPT_ARCH_ID CKPT_ARCH_PPC64
+#else
+#define CKPT_ARCH_ID CKPT_ARCH_PPC32
+#endif
+
+#endif /* __ASM_POWERPC_CKPT_HDR_H */
arch/powerpc/include/asm/ptrace.h +7 -0
index 8c34149..c6cb2c6 100644
@@ -81,6 +81,8 @@ struct pt_regs {
 
 #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
 #define instruction_pointer(regs) ((regs)->nip)
 #define user_stack_pointer(regs) ((regs)->gpr[1])
 #define regs_return_value(regs) ((regs)->gpr[3])
@@ -140,6 +142,11 @@ extern void user_enable_single_step(struct task_struct *);
 extern void user_enable_block_step(struct task_struct *);
 extern void user_disable_single_step(struct task_struct *);
 
+/* for reprogramming DABR/DAC during restart of a checkpointed task */
+extern bool debugreg_valid(unsigned long val, unsigned int index);
+extern void debugreg_update(struct task_struct *task, unsigned long val,
+			    unsigned int index);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
arch/powerpc/include/asm/systbl.h +2 -0
index 370600c..3d44cf3 100644
@@ -326,3 +326,5 @@ SYSCALL_SPU(perf_counter_open)
 COMPAT_SYS_SPU(preadv)
 COMPAT_SYS_SPU(pwritev)
 COMPAT_SYS(rt_tgsigqueueinfo)
+SYSCALL(checkpoint)
+SYSCALL(restart)
arch/powerpc/include/asm/unistd.h +3 -1
index cef080b..ef41ebb 100644
@@ -345,10 +345,12 @@
 #define __NR_preadv		320
 #define __NR_pwritev		321
 #define __NR_rt_tgsigqueueinfo	322
+#define __NR_checkpoint		323
+#define __NR_restart		324
 
 #ifdef __KERNEL__
 
-#define __NR_syscalls		323
+#define __NR_syscalls		325
 
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
arch/powerpc/kernel/ptrace.c +59 -29

128 lines not on this page · raw message

arch/powerpc/mm/Makefile +1 -0
index 3e68363..aa8733c 100644
@@ -31,3 +31,4 @@ obj-$(CONFIG_HUGETLB_PAGE)	+= hugetlbpage.o
 obj-$(CONFIG_PPC_SUBPAGE_PROT)	+= subpage-prot.o
 obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
 obj-$(CONFIG_HIGHMEM)		+= highmem.o
+obj-$(CONFIG_CHECKPOINT)	+= checkpoint.o
arch/powerpc/mm/checkpoint.c new file +499 -0

499 lines not on this page · raw message

checkpoint/process.c +0 -50

62 lines not on this page · raw message

include/linux/Kbuild +1 -0
index 861c7fa..b6677b9 100644
@@ -46,6 +46,7 @@ header-y += can.h
 header-y += cdk.h
 header-y += checkpoint_types.h
 header-y += checkpoint_hdr.h
+header-y += checkpoint.h
 header-y += chio.h
 header-y += coda_psdev.h
 header-y += coff.h
include/linux/checkpoint_hdr.h +2 -0
index b5243e1..d999b5c 100644
@@ -98,6 +98,8 @@ enum {
 	/* do not change order (will break ABI) */
 	CKPT_ARCH_X86_32 = 1,
 	CKPT_ARCH_S390X,
+	CKPT_ARCH_PPC32,
+	CKPT_ARCH_PPC64,
 };
 
 /* shared objrects (objref) */