From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail172.messagelabs.com (mail172.messagelabs.com [216.82.254.3]) by kanga.kvack.org (Postfix) with ESMTP id DF499620045 for ; Wed, 17 Mar 2010 12:29:18 -0400 (EDT) From: Oren Laadan Subject: [C/R v20][PATCH 90/96] powerpc: wire up checkpoint and restart syscalls Date: Wed, 17 Mar 2010 12:09:18 -0400 Message-Id: <1268842164-5590-91-git-send-email-orenl@cs.columbia.edu> In-Reply-To: <1268842164-5590-90-git-send-email-orenl@cs.columbia.edu> References: <1268842164-5590-1-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-2-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-3-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-4-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-5-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-6-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-7-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-8-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-9-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-10-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-11-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-12-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-13-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-14-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-15-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-16-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-17-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-18-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-19-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-20-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-21-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-22-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-23-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-24-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-25-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-26-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-27-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-28-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-29-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-30-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-31-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-32-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-33-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-34-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-35-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-36-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-37-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-38-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-39-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-40-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-41-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-42-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-43-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-44-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-45-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-46-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-47-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-48-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-49-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-50-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-51-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-52-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-53-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-54-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-55-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-56-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-57-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-58-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-59-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-60-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-61-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-62-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-63-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-64-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-65-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-66-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-67-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-68-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-69-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-70-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-71-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-72-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-73-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-74-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-75-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-76-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-77-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-78-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-79-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-80-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-81-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-82-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-83-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-84-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-85-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-86-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-87-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-88-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-89-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-90-git-send-email-orenl@cs.columbia.edu> Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Serge Hallyn , Ingo Molnar , containers@lists.linux-foundation.org, Nathan Lynch List-ID: From: Nathan Lynch Changelog [v19]: - checkpoint/powerpc: fix up checkpoint syscall, tidy restart Signed-off-by: Nathan Lynch Acked-by: Serge E. Hallyn --- arch/powerpc/include/asm/systbl.h | 2 ++ arch/powerpc/include/asm/unistd.h | 4 +++- arch/powerpc/kernel/entry_32.S | 23 +++++++++++++++++++++++ arch/powerpc/kernel/entry_64.S | 16 ++++++++++++++++ arch/powerpc/kernel/process.c | 19 +++++++++++++++++++ 5 files changed, 63 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index ee41254..2c1dd27 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h @@ -327,3 +327,5 @@ COMPAT_SYS_SPU(preadv) COMPAT_SYS_SPU(pwritev) COMPAT_SYS(rt_tgsigqueueinfo) PPC_SYS(eclone) +PPC_SYS(checkpoint) +PPC_SYS(restart) diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 37357a2..1551242 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -346,10 +346,12 @@ #define __NR_pwritev 321 #define __NR_rt_tgsigqueueinfo 322 #define __NR_eclone 323 +#define __NR_checkpoint 324 +#define __NR_restart 325 #ifdef __KERNEL__ -#define __NR_syscalls 324 +#define __NR_syscalls 326 #define __NR__exit __NR_exit #define NR_syscalls __NR_syscalls diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 579f1da..853814b 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -594,6 +594,29 @@ ppc_eclone: stw r0,_TRAP(r1) /* register set saved */ b sys_eclone +/* To handle self-checkpoint we must save nvpgprs */ + .globl ppc_checkpoint +ppc_checkpoint: + SAVE_NVGPRS(r1) + lwz r0,_TRAP(r1) + rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ + stw r0,_TRAP(r1) /* register set saved */ + b sys_checkpoint + +/* The full register set must be restored upon return from restart. + * Save nvgprs unconditionally so the caller's state is + * restored correctly in case of error. + */ + .globl ppc_restart +ppc_restart: + SAVE_NVGPRS(r1) + lwz r0,_TRAP(r1) + rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ + stw r0,_TRAP(r1) /* register set saved */ + bl sys_restart + REST_NVGPRS(r1) + b ret_from_syscall + .globl ppc_swapcontext ppc_swapcontext: SAVE_NVGPRS(r1) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 899f485..87ebb04 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -349,6 +349,22 @@ _GLOBAL(ppc_eclone) bl .sys_eclone b syscall_exit +/* To handle self-checkpoint we must save nvpgprs */ +_GLOBAL(ppc_checkpoint) + bl .save_nvgprs + bl .sys_checkpoint + b syscall_exit + +/* The full register set must be restored upon return from restart. + * Save nvgprs unconditionally so the caller's state is + * restored correctly in case of error. + */ +_GLOBAL(ppc_restart) + bl .save_nvgprs + bl .sys_restart + REST_NVGPRS(r1) + b syscall_exit + _GLOBAL(ppc32_swapcontext) bl .save_nvgprs bl .compat_sys_swapcontext diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 4bbc21f..6457530 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -978,6 +979,24 @@ out: return error; } +int sys_checkpoint(unsigned long pid, unsigned long fd, unsigned long flags, + unsigned long logfd, unsigned long p5, unsigned long p6, + struct pt_regs *regs) +{ + CHECK_FULL_REGS(regs); + + return do_sys_checkpoint(pid, fd, flags, logfd); +} + +int sys_restart(unsigned long pid, unsigned long fd, unsigned long flags, + unsigned long logfd, unsigned long p5, unsigned long p6, + struct pt_regs *regs) +{ + CHECK_FULL_REGS(regs); + + return do_sys_restart(pid, fd, flags, logfd); +} + #ifdef CONFIG_IRQSTACKS static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, unsigned long nbytes) -- 1.6.3.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org