ckpt/powerpc: handle syscall restart
PATCH 1/1 ckpt/powerpc: handle syscall restart
If a task is checkpointed while servicing a restartable system call like nanosleep, we need to ensure that the syscall is restarted appropriately after a checkpoint/restart cycle. This gets cr_tests/sleeptest passing on powerpc.
Signed-off-by Nathan Lynch <[email protected]>
--- arch/powerpc/kernel/checkpoint.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
arch/powerpc/kernel/checkpoint.c +25 -0
@@ -307,6 +307,31 @@ static int restore_gprs(const struct ckpt_hdr_cpu *cpu_hdr, regs->orig_gpr3 = cpu_hdr->orig_gpr3; regs->msr =sanitize_msr (regs->msr); + +/* The normal servicing of the freezer's fake signal is +* short-circuited by checkpoint/restart. See +* arch/powerpc/kernel/signal.c::do_signal_pending(). +*/ +if (TRAP (regs) !=0x0C00 ) + goto out; +if (!(regs->ccr &0x10000000 )) + goto out; + +switch (regs->gpr[3 ]) { +case ERESTARTNOHAND : +case ERESTARTSYS : +case ERESTARTNOINTR : + regs->gpr[3 ] = regs->orig_gpr3; +break ; +case ERESTART_RESTARTBLOCK : + regs->gpr[0 ] = __NR_restart_syscall; +break ; +default : + goto out; + } + + regs->nip -=4 ; + regs->result =0 ; out:return rc; }
Signature · 1 line
1.6.0.6
A message that is not in the archive (sent off-list or not yet received): 1267214073-32348-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Oren Laadan
AppliedApplied, thanks.
Quoted 46 lines · Nathan Lynch
If a task is checkpointed while servicing a restartable system call like nanosleep, we need to ensure that the syscall is restarted appropriately after a checkpoint/restart cycle. This gets cr_tests/sleeptest passing on powerpc.
Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/kernel/checkpoint.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)arch/powerpc/kernel/checkpoint.c +25
-0@@ -307,6 +307,31 @@ static int restore_gprs(const struct ckpt_hdr_cpu *cpu_hdr, regs->orig_gpr3 = cpu_hdr->orig_gpr3; regs->msr =sanitize_msr (regs->msr); + +/* The normal servicing of the freezer's fake signal is +* short-circuited by checkpoint/restart. See +* arch/powerpc/kernel/signal.c::do_signal_pending(). +*/ +if (TRAP (regs) !=0x0C00 ) + goto out; +if (!(regs->ccr &0x10000000 )) + goto out; + +switch (regs->gpr[3 ]) { +case ERESTARTNOHAND : +case ERESTARTSYS : +case ERESTARTNOINTR : + regs->gpr[3 ] = regs->orig_gpr3; +break ; +case ERESTART_RESTARTBLOCK : + regs->gpr[0 ] = __NR_restart_syscall; +break ; +default : + goto out; + } + + regs->nip -=4 ; + regs->result =0 ; out:return rc; }