Skip to contentSkip to conversation

checkpoint/powerpc: fixes etc

PATCH In review Nathan Lynch 2 participants 5 messages Dec 5, 2009 – Dec 6, 2009 1 message not in the archive PowerPC

lore
Share & tools
lore
#0 lore raw

cover checkpoint/powerpc: fixes etc

Hi Oren,

Here are a few patches against ckpt-v19-rc2 that improve the state of checkpoint/restart on powerpc. Please feel free to fold them into the powerpc portion of the patchset.

Nathan Lynch (3):
checkpoint/powerpc: fix 32-bit build checkpoint/powerpc: save and restore nvgprs for checkpoint/restart checkpoint/powerpc: warn if full register state unavailable

 arch/powerpc/include/asm/systbl.h |    4 ++--
 arch/powerpc/kernel/entry_32.S    |   23 +++++++++++++++++++++++
 arch/powerpc/kernel/entry_64.S    |   16 ++++++++++++++++
 arch/powerpc/kernel/process.c     |    4 ++--
 arch/powerpc/mm/checkpoint.c      |    2 ++
 5 files changed, 45 insertions(+), 4 deletions(-)

A message that is not in the archive (sent off-list or not yet received): 1259981307-24936-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/3 checkpoint/powerpc: fix 32-bit build

Need to cast u64 to unsigned long before casting it to a pointer type.

---
 arch/powerpc/kernel/process.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/process.c +2 -2
index c1900b3..457c269 100644
@@ -939,8 +939,8 @@ int sys_eclone(unsigned long clone_flags_low,
 
 	nr_pids = kclone_args.nr_pids;
 
-	parent_tidp = (int __user *)kclone_args.parent_tid_ptr;
-	child_tidp = (int __user *)kclone_args.child_tid_ptr;
+	parent_tidp = (int __user *)(unsigned long)kclone_args.parent_tid_ptr;
+	child_tidp = (int __user *)(unsigned long)kclone_args.child_tid_ptr;
 
 #ifdef CONFIG_PPC64
 	if (test_thread_flag(TIF_32BIT)) {
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH 2/3 checkpoint/powerpc: save and restore nvgprs for checkpoint/restart

In reply to a message not in the archive

On system call entry, powerpc explicitly saves and restores the full user register state for only a few "special" system calls (fork, clone, etc). The checkpoint and restart syscalls need this treatment too.

---
 arch/powerpc/include/asm/systbl.h |    4 ++--
 arch/powerpc/kernel/entry_32.S    |   23 +++++++++++++++++++++++
 arch/powerpc/kernel/entry_64.S    |   16 ++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/systbl.h +2 -2
index c374cb7..76924b3 100644
@@ -327,5 +327,5 @@ COMPAT_SYS_SPU(preadv)
 COMPAT_SYS_SPU(pwritev)
 COMPAT_SYS(rt_tgsigqueueinfo)
 PPC_SYS(eclone)
-SYSCALL(checkpoint)
-SYSCALL(restart)
+PPC_SYS(checkpoint)
+PPC_SYS(restart)
arch/powerpc/kernel/entry_32.S +23 -0
index 579f1da..853814b 100644
@@ -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)
arch/powerpc/kernel/entry_64.S +16 -0
index febdca1..6b50a8c 100644
@@ -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
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH 3/3 checkpoint/powerpc: warn if full register state unavailable

In reply to a message not in the archive

Emit a warning if we attempt to checkpoint a task for which the user nonvolatile register state (r13-r31) has not been saved. This should not ever happen.

---
 arch/powerpc/mm/checkpoint.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/mm/checkpoint.c +2 -0
index de18467..2634011 100644
@@ -107,6 +107,8 @@ static void checkpoint_gprs(struct ckpt_hdr_cpu *cpu_hdr,
 
 	cpu_hdr->pt_regs_size = sizeof(*pt_regs);
 	pt_regs = task_pt_regs(task);
+	WARN_ON(!FULL_REGS(pt_regs));
+
 	cpu_hdr->pt_regs = *pt_regs;
 
 	if (task == current)
Signature · 1 line
1.6.0.6
#5 lore raw
In reply to a message not in the archive

Will fold into ckpt-v19-rc3.

Thanks,

Oren.

Quoted 19 lines · Nathan Lynch

Hi Oren,

Here are a few patches against ckpt-v19-rc2 that improve the state of checkpoint/restart on powerpc. Please feel free to fold them into the powerpc portion of the patchset.

Nathan Lynch (3):
checkpoint/powerpc: fix 32-bit build checkpoint/powerpc: save and restore nvgprs for checkpoint/restart checkpoint/powerpc: warn if full register state unavailable

 arch/powerpc/include/asm/systbl.h |    4 ++--
 arch/powerpc/kernel/entry_32.S    |   23 +++++++++++++++++++++++
 arch/powerpc/kernel/entry_64.S    |   16 ++++++++++++++++
 arch/powerpc/kernel/process.c     |    4 ++--
 arch/powerpc/mm/checkpoint.c      |    2 ++
 5 files changed, 45 insertions(+), 4 deletions(-)