* [PATCH 0/7] checkpoint: Kconfig cleanup, powerpc support
@ 2009-03-25 23:02 Nathan Lynch
[not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 22+ messages in thread
From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
The following series, based on Oren's ckpt-v14 branch, improves the
Kconfig situation wrt architecture support and adds the powerpc
implementation.
Nathan Lynch (7):
s390: enable checkpoint support in Kconfig
x86: enable checkpoint support in Kconfig
make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT
powerpc: provide APIs for validating and updating DABR
powerpc: checkpoint/restart implementation
powerpc: wire up checkpoint and restart syscalls
powerpc: enable checkpoint support in Kconfig
arch/powerpc/Kconfig | 3 +
arch/powerpc/include/asm/checkpoint_hdr.h | 15 +
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 | 481 +++++++++++++++++++++++++++++
arch/s390/Kconfig | 4 +
arch/x86/Kconfig | 4 +
checkpoint/Kconfig | 2 +-
11 files changed, 580 insertions(+), 31 deletions(-)
create mode 100644 arch/powerpc/include/asm/checkpoint_hdr.h
create mode 100644 arch/powerpc/mm/checkpoint.c
^ permalink raw reply [flat|nested] 22+ messages in thread[parent not found: <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>]
* [PATCH 1/7] s390: enable checkpoint support in Kconfig [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> @ 2009-03-25 23:02 ` Nathan Lynch [not found] ` <1238022166-13422-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> 2009-03-25 23:02 ` [PATCH 2/7] x86: " Nathan Lynch ` (6 subsequent siblings) 7 siblings, 1 reply; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg Only 64-bit kernels are supported. Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- arch/s390/Kconfig | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 6b0a353..98d339e 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -49,6 +49,10 @@ config GENERIC_TIME_VSYSCALL config GENERIC_CLOCKEVENTS def_bool y +config CHECKPOINT_SUPPORT + bool + default y if 64BIT + config GENERIC_BUG bool depends on BUG -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <1238022166-13422-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 1/7] s390: enable checkpoint support in Kconfig [not found] ` <1238022166-13422-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> @ 2009-03-25 23:26 ` Serge E. Hallyn 0 siblings, 0 replies; 22+ messages in thread From: Serge E. Hallyn @ 2009-03-25 23:26 UTC (permalink / raw) To: Nathan Lynch; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org): > Only 64-bit kernels are supported. > > Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> Acked-by: Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> > --- > arch/s390/Kconfig | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig > index 6b0a353..98d339e 100644 > --- a/arch/s390/Kconfig > +++ b/arch/s390/Kconfig > @@ -49,6 +49,10 @@ config GENERIC_TIME_VSYSCALL > config GENERIC_CLOCKEVENTS > def_bool y > > +config CHECKPOINT_SUPPORT > + bool > + default y if 64BIT > + > config GENERIC_BUG > bool > depends on BUG > -- > 1.6.0.6 > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/7] x86: enable checkpoint support in Kconfig [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> 2009-03-25 23:02 ` [PATCH 1/7] s390: enable checkpoint support in Kconfig Nathan Lynch @ 2009-03-25 23:02 ` Nathan Lynch [not found] ` <1238022166-13422-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> 2009-03-25 23:02 ` [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT Nathan Lynch ` (5 subsequent siblings) 7 siblings, 1 reply; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg For now, supported only for 32-bit kernels. Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- arch/x86/Kconfig | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index bc2fbad..246e26b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -71,6 +71,10 @@ config STACKTRACE_SUPPORT config HAVE_LATENCYTOP_SUPPORT def_bool y +config CHECKPOINT_SUPPORT + bool + default y if X86_32 + config FAST_CMPXCHG_LOCAL bool default y -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <1238022166-13422-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/7] x86: enable checkpoint support in Kconfig [not found] ` <1238022166-13422-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> @ 2009-03-25 23:26 ` Serge E. Hallyn 0 siblings, 0 replies; 22+ messages in thread From: Serge E. Hallyn @ 2009-03-25 23:26 UTC (permalink / raw) To: Nathan Lynch; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org): > For now, supported only for 32-bit kernels. > > Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> Acked-by: Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> > --- > arch/x86/Kconfig | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index bc2fbad..246e26b 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -71,6 +71,10 @@ config STACKTRACE_SUPPORT > config HAVE_LATENCYTOP_SUPPORT > def_bool y > > +config CHECKPOINT_SUPPORT > + bool > + default y if X86_32 > + > config FAST_CMPXCHG_LOCAL > bool > default y > -- > 1.6.0.6 > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> 2009-03-25 23:02 ` [PATCH 1/7] s390: enable checkpoint support in Kconfig Nathan Lynch 2009-03-25 23:02 ` [PATCH 2/7] x86: " Nathan Lynch @ 2009-03-25 23:02 ` Nathan Lynch [not found] ` <1238022166-13422-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> 2009-03-25 23:02 ` [PATCH 4/7] powerpc: provide APIs for validating and updating DABR Nathan Lynch ` (4 subsequent siblings) 7 siblings, 1 reply; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg Instead of trying to maintain a fruit salad of architecture names and options in the dependency list, have architectures define CHECKPOINT_SUPPORT in their respective Kconfigs when they have implemented the arch-specific C/R hooks. Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- checkpoint/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig index e91e0fd..760c450 100644 --- a/checkpoint/Kconfig +++ b/checkpoint/Kconfig @@ -1,6 +1,6 @@ config CHECKPOINT bool "Enable checkpoint/restart (EXPERIMENTAL)" - depends on (X86_32 || (S390 && 64BIT)) && EXPERIMENTAL + depends on CHECKPOINT_SUPPORT && EXPERIMENTAL help Application checkpoint/restart is the ability to save the state of a running application so that it can later resume -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <1238022166-13422-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT [not found] ` <1238022166-13422-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> @ 2009-03-25 23:26 ` Serge E. Hallyn 2009-03-26 0:39 ` Dave Hansen 1 sibling, 0 replies; 22+ messages in thread From: Serge E. Hallyn @ 2009-03-25 23:26 UTC (permalink / raw) To: Nathan Lynch; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org): > Instead of trying to maintain a fruit salad of architecture names and > options in the dependency list, have architectures define > CHECKPOINT_SUPPORT in their respective Kconfigs when they have > implemented the arch-specific C/R hooks. > > Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> Yup, this is nicer, thanks. Acked-by: Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> > --- > checkpoint/Kconfig | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig > index e91e0fd..760c450 100644 > --- a/checkpoint/Kconfig > +++ b/checkpoint/Kconfig > @@ -1,6 +1,6 @@ > config CHECKPOINT > bool "Enable checkpoint/restart (EXPERIMENTAL)" > - depends on (X86_32 || (S390 && 64BIT)) && EXPERIMENTAL > + depends on CHECKPOINT_SUPPORT && EXPERIMENTAL > help > Application checkpoint/restart is the ability to save the > state of a running application so that it can later resume > -- > 1.6.0.6 > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT [not found] ` <1238022166-13422-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> 2009-03-25 23:26 ` Serge E. Hallyn @ 2009-03-26 0:39 ` Dave Hansen 2009-03-26 3:09 ` Nathan Lynch 1 sibling, 1 reply; 22+ messages in thread From: Dave Hansen @ 2009-03-26 0:39 UTC (permalink / raw) To: Nathan Lynch; +Cc: containers-qjLDD68F18O7TbgM5vRIOg On Wed, 2009-03-25 at 18:02 -0500, Nathan Lynch wrote: > > diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig > index e91e0fd..760c450 100644 > --- a/checkpoint/Kconfig > +++ b/checkpoint/Kconfig > @@ -1,6 +1,6 @@ > config CHECKPOINT > bool "Enable checkpoint/restart (EXPERIMENTAL)" > - depends on (X86_32 || (S390 && 64BIT)) && EXPERIMENTAL > + depends on CHECKPOINT_SUPPORT && EXPERIMENTAL > help > Application checkpoint/restart is the ability to save the > state of a running application so that it can later resume Yeah, this is the right way to do it, very nice. Could we add a wee little ARCH_ prepend on 'CHECKPOINT_SUPPORT' in there? That way, people at least know where to go looking when they want to find out why it isn't enabled. -- Dave ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT 2009-03-26 0:39 ` Dave Hansen @ 2009-03-26 3:09 ` Nathan Lynch [not found] ` <20090325220931.2653f379-4v5LP+xe+1byhTdZtsIeww@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Nathan Lynch @ 2009-03-26 3:09 UTC (permalink / raw) To: Dave Hansen; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Dave Hansen <dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> wrote: > On Wed, 2009-03-25 at 18:02 -0500, Nathan Lynch wrote: > > > > diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig > > index e91e0fd..760c450 100644 > > --- a/checkpoint/Kconfig > > +++ b/checkpoint/Kconfig > > @@ -1,6 +1,6 @@ > > config CHECKPOINT > > bool "Enable checkpoint/restart (EXPERIMENTAL)" > > - depends on (X86_32 || (S390 && 64BIT)) && EXPERIMENTAL > > + depends on CHECKPOINT_SUPPORT && EXPERIMENTAL > > help > > Application checkpoint/restart is the ability to save the > > state of a running application so that it can later resume > > Yeah, this is the right way to do it, very nice. Thanks Dave. > Could we add a wee little ARCH_ prepend on 'CHECKPOINT_SUPPORT' in > there? That way, people at least know where to go looking when they > want to find out why it isn't enabled. You have a point, but I'd prefer to keep the name unchanged: * There doesn't seem to be a strong convention for putting the 'ARCH' string in such symbols. Examples: LOCKDEP_SUPPORT, HAVE_KPROBES, STACKTRACE_SUPPORT. Plenty of counter-examples, too, but there's no standard practice AFAICT. * Making the string more verbose means people are more likely to get it wrong e.g. CONFIG_CHECKPOINT_ARCH_SUPPORT (and this sort of thing can go unnoticed for a while). * Implementers can grep or cscope for it and figure it out pretty quickly, and they likely would do that anyway regardless of what it's called. Prepending ARCH_ would imply the right things, but with a comment, we can be explicit. commit 07087d9295d1c4dcd7e79b19d70abf19370f59da Author: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> Date: Wed Mar 25 21:32:30 2009 -0500 document CHECKPOINT_SUPPORT Make CHECKPOINT_SUPPORT's intended use clear with a comment in checkpoint/Kconfig. Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig index 760c450..1761b0a 100644 --- a/checkpoint/Kconfig +++ b/checkpoint/Kconfig @@ -1,3 +1,7 @@ +# Architectures should define CHECKPOINT_SUPPORT when they have +# implemented the hooks for processor state etc. needed by the +# core checkpoint/restart code. + config CHECKPOINT bool "Enable checkpoint/restart (EXPERIMENTAL)" depends on CHECKPOINT_SUPPORT && EXPERIMENTAL ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <20090325220931.2653f379-4v5LP+xe+1byhTdZtsIeww@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT [not found] ` <20090325220931.2653f379-4v5LP+xe+1byhTdZtsIeww@public.gmane.org> @ 2009-05-12 11:20 ` Ralph-Gordon Paul [not found] ` <FB599A4B-F618-4E6C-94D8-FC4EAE3D41D9-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Ralph-Gordon Paul @ 2009-05-12 11:20 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg Hi, in the kernel menuconfig, there should be a note, that CHECKPOINT_SUPPORT depends on Compat VDSO (Processor type and features --> Compad VDSO support). It took some time for me to find that out. :-) Regards, Ralph-Gordon Paul Am 26.03.2009 um 04:09 schrieb Nathan Lynch: > Dave Hansen <dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> wrote: > >> On Wed, 2009-03-25 at 18:02 -0500, Nathan Lynch wrote: >>> >>> diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig >>> index e91e0fd..760c450 100644 >>> --- a/checkpoint/Kconfig >>> +++ b/checkpoint/Kconfig >>> @@ -1,6 +1,6 @@ >>> config CHECKPOINT >>> bool "Enable checkpoint/restart (EXPERIMENTAL)" >>> - depends on (X86_32 || (S390 && 64BIT)) && EXPERIMENTAL >>> + depends on CHECKPOINT_SUPPORT && EXPERIMENTAL >>> help >>> Application checkpoint/restart is the ability to save the >>> state of a running application so that it can later resume >> >> Yeah, this is the right way to do it, very nice. > > Thanks Dave. > > >> Could we add a wee little ARCH_ prepend on 'CHECKPOINT_SUPPORT' in >> there? That way, people at least know where to go looking when they >> want to find out why it isn't enabled. > > You have a point, but I'd prefer to keep the name unchanged: > > * There doesn't seem to be a strong convention for putting the 'ARCH' > string in such symbols. Examples: LOCKDEP_SUPPORT, HAVE_KPROBES, > STACKTRACE_SUPPORT. Plenty of counter-examples, too, but there's no > standard practice AFAICT. > > * Making the string more verbose means people are more likely to get > it wrong e.g. CONFIG_CHECKPOINT_ARCH_SUPPORT (and this sort of thing > can go unnoticed for a while). > > * Implementers can grep or cscope for it and figure it out pretty > quickly, and they likely would do that anyway regardless of what it's > called. > > Prepending ARCH_ would imply the right things, but with a comment, we > can be explicit. > > > commit 07087d9295d1c4dcd7e79b19d70abf19370f59da > Author: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> > Date: Wed Mar 25 21:32:30 2009 -0500 > > document CHECKPOINT_SUPPORT > > Make CHECKPOINT_SUPPORT's intended use clear with a comment in > checkpoint/Kconfig. > > Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> > > diff --git a/checkpoint/Kconfig b/checkpoint/Kconfig > index 760c450..1761b0a 100644 > --- a/checkpoint/Kconfig > +++ b/checkpoint/Kconfig > @@ -1,3 +1,7 @@ > +# Architectures should define CHECKPOINT_SUPPORT when they have > +# implemented the hooks for processor state etc. needed by the > +# core checkpoint/restart code. > + > config CHECKPOINT > bool "Enable checkpoint/restart (EXPERIMENTAL)" > depends on CHECKPOINT_SUPPORT && EXPERIMENTAL > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <FB599A4B-F618-4E6C-94D8-FC4EAE3D41D9-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend onCONFIG_CHECKPOINT_SUPPORT [not found] ` <FB599A4B-F618-4E6C-94D8-FC4EAE3D41D9-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org> @ 2009-05-12 12:10 ` Serge E. Hallyn [not found] ` <20090512121001.GB28695-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Serge E. Hallyn @ 2009-05-12 12:10 UTC (permalink / raw) To: Ralph-Gordon Paul; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): > Hi, > > in the kernel menuconfig, there should be a note, that > CHECKPOINT_SUPPORT depends on Compat VDSO (Processor type and features > --> Compad VDSO support). > > It took some time for me to find that out. :-) Wha? Oren, since you've taken Alexey's patch to update arch_setup_additional_pages() to take a start address, there should be no reason not to use that to remap the vdso, should there? We shouldn't depend on CONFIG_COMPAT_VDSO anymore. -serge ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <20090512121001.GB28695-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend onCONFIG_CHECKPOINT_SUPPORT [not found] ` <20090512121001.GB28695-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2009-05-12 12:42 ` Ralph-Gordon Paul [not found] ` <3A15FE99-C94B-467B-B475-44BBED892C25-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Ralph-Gordon Paul @ 2009-05-12 12:42 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Ah okay sorry, i used this version: http://git.ncl.cs.columbia.edu/?p=linux-cr.git;a=shortlog;h=refs/heads/ckpt-v15 Is this the official place to download the up to date version ? -Gordon Am 12.05.2009 um 14:10 schrieb Serge E. Hallyn: > Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): >> Hi, >> >> in the kernel menuconfig, there should be a note, that >> CHECKPOINT_SUPPORT depends on Compat VDSO (Processor type and >> features >> --> Compad VDSO support). >> >> It took some time for me to find that out. :-) > > Wha? > > Oren, since you've taken Alexey's patch to update > arch_setup_additional_pages() to take a start address, there should be > no reason not to use that to remap the vdso, should there? > > We shouldn't depend on CONFIG_COMPAT_VDSO anymore. > > -serge ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <3A15FE99-C94B-467B-B475-44BBED892C25-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT [not found] ` <3A15FE99-C94B-467B-B475-44BBED892C25-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org> @ 2009-05-12 14:29 ` Serge E. Hallyn [not found] ` <20090512142912.GA31449-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Serge E. Hallyn @ 2009-05-12 14:29 UTC (permalink / raw) To: Ralph-Gordon Paul; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): > Ah okay sorry, i used this version: http://git.ncl.cs.columbia.edu/?p=linux-cr.git;a=shortlog;h=refs/heads/ckpt-v15 > > Is this the official place to download the up to date version ? > > -Gordon Hi Gordon, yes, and you were right about needing compat vdso. Sorry about the inconvenience (since it was my patch). I was just saying that since Oren has added the underlying code for moving vdso around, there is no reason why we shouldn't complete that support (with 1 line of code) allowing us to remove the dependency on CONFIG_COMPAT_VDSO. thanks, -serge ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <20090512142912.GA31449-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT [not found] ` <20090512142912.GA31449-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2009-05-12 15:16 ` Oren Laadan [not found] ` <4A0992CB.9050404-eQaUEPhvms7ENvBUuze7eA@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Oren Laadan @ 2009-05-12 15:16 UTC (permalink / raw) To: Ralph-Gordon Paul; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Hi Gordon, Serge E. Hallyn wrote: > Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): >> Ah okay sorry, i used this version: http://git.ncl.cs.columbia.edu/?p=linux-cr.git;a=shortlog;h=refs/heads/ckpt-v15 >> >> Is this the official place to download the up to date version ? ckpt-v15 branch per-se is a snapshot of the patchset as it was released. ckpt-v15-dev is the development branch that is based on ckpt-v15, and is probably what you want to use. the userspace utilities are in the matching v15-dev in 'user-cr.git'. >> >> -Gordon > > Hi Gordon, > > yes, and you were right about needing compat vdso. Sorry about the > inconvenience (since it was my patch). I was just saying that since > Oren has added the underlying code for moving vdso around, there is no > reason why we shouldn't complete that support (with 1 line of code) > allowing us to remove the dependency on CONFIG_COMPAT_VDSO. True, no need to keep that dependency. Will remove. Note, however, that we still don't handle the case where the contents of the VDSO page(s) differ between checkpoint and restart time... So it's on the todo list to at least detect that the format changed. That said, that will work in most cases, definitely on the same machine. Oren. ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <4A0992CB.9050404-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT [not found] ` <4A0992CB.9050404-eQaUEPhvms7ENvBUuze7eA@public.gmane.org> @ 2009-05-12 15:44 ` Serge E. Hallyn [not found] ` <20090512154455.GA32658-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Serge E. Hallyn @ 2009-05-12 15:44 UTC (permalink / raw) To: Oren Laadan; +Cc: containers-qjLDD68F18O7TbgM5vRIOg, Ralph-Gordon Paul Quoting Oren Laadan (orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org): > > Hi Gordon, > > Serge E. Hallyn wrote: > > Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): > >> Ah okay sorry, i used this version: http://git.ncl.cs.columbia.edu/?p=linux-cr.git;a=shortlog;h=refs/heads/ckpt-v15 > >> > >> Is this the official place to download the up to date version ? > > ckpt-v15 branch per-se is a snapshot of the patchset as it was released. > > ckpt-v15-dev is the development branch that is based on ckpt-v15, and is > probably what you want to use. > > the userspace utilities are in the matching v15-dev in 'user-cr.git'. > > >> > >> -Gordon > > > > Hi Gordon, > > > > yes, and you were right about needing compat vdso. Sorry about the > > inconvenience (since it was my patch). I was just saying that since > > Oren has added the underlying code for moving vdso around, there is no > > reason why we shouldn't complete that support (with 1 line of code) > > allowing us to remove the dependency on CONFIG_COMPAT_VDSO. > > True, no need to keep that dependency. Will remove. > > Note, however, that we still don't handle the case where the contents of > the VDSO page(s) differ between checkpoint and restart time... So it's > on the todo list to at least detect that the format changed. sigh - yeah, and we still haven't decided how to cleanly solve that, have we... (apart from some arch-specific memcmp template/map that compares the code and not data...) > That said, that will work in most cases, definitely on the same machine. > > Oren. ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <20090512154455.GA32658-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT [not found] ` <20090512154455.GA32658-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2009-05-12 16:16 ` Oren Laadan [not found] ` <4A09A0D4.40208-eQaUEPhvms7ENvBUuze7eA@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Oren Laadan @ 2009-05-12 16:16 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg, Ralph-Gordon Paul Serge E. Hallyn wrote: > Quoting Oren Laadan (orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org): >> Hi Gordon, >> >> Serge E. Hallyn wrote: >>> Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): >>>> Ah okay sorry, i used this version: http://git.ncl.cs.columbia.edu/?p=linux-cr.git;a=shortlog;h=refs/heads/ckpt-v15 >>>> >>>> Is this the official place to download the up to date version ? >> ckpt-v15 branch per-se is a snapshot of the patchset as it was released. >> >> ckpt-v15-dev is the development branch that is based on ckpt-v15, and is >> probably what you want to use. >> >> the userspace utilities are in the matching v15-dev in 'user-cr.git'. >> >>>> -Gordon >>> Hi Gordon, >>> >>> yes, and you were right about needing compat vdso. Sorry about the >>> inconvenience (since it was my patch). I was just saying that since >>> Oren has added the underlying code for moving vdso around, there is no >>> reason why we shouldn't complete that support (with 1 line of code) >>> allowing us to remove the dependency on CONFIG_COMPAT_VDSO. >> True, no need to keep that dependency. Will remove. >> >> Note, however, that we still don't handle the case where the contents of >> the VDSO page(s) differ between checkpoint and restart time... So it's >> on the todo list to at least detect that the format changed. > > sigh - yeah, and we still haven't decided how to cleanly solve that, > have we... (apart from some arch-specific memcmp template/map that > compares the code and not data...) Heh .. I thought we outlined a suitable solution: * On checkpoint, save the contents of the VDSO page(s), or their hash, but not including any dynamic data exported by the kernel. The VDSO contents themselves should be a shared object. * On restart, compare the contents, or their hash, with the local kenrel; If there is a match -- all well. If not - need to provide some compatibility code in place of the original VDSO. The gory details .. oh well ... Oren. ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <4A09A0D4.40208-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>]
* Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT [not found] ` <4A09A0D4.40208-eQaUEPhvms7ENvBUuze7eA@public.gmane.org> @ 2009-05-12 16:39 ` Serge E. Hallyn 0 siblings, 0 replies; 22+ messages in thread From: Serge E. Hallyn @ 2009-05-12 16:39 UTC (permalink / raw) To: Oren Laadan; +Cc: containers-qjLDD68F18O7TbgM5vRIOg, Ralph-Gordon Paul Quoting Oren Laadan (orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org): > > > Serge E. Hallyn wrote: > > Quoting Oren Laadan (orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org): > >> Hi Gordon, > >> > >> Serge E. Hallyn wrote: > >>> Quoting Ralph-Gordon Paul (Ralph-Gordon.Paul-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org): > >>>> Ah okay sorry, i used this version: http://git.ncl.cs.columbia.edu/?p=linux-cr.git;a=shortlog;h=refs/heads/ckpt-v15 > >>>> > >>>> Is this the official place to download the up to date version ? > >> ckpt-v15 branch per-se is a snapshot of the patchset as it was released. > >> > >> ckpt-v15-dev is the development branch that is based on ckpt-v15, and is > >> probably what you want to use. > >> > >> the userspace utilities are in the matching v15-dev in 'user-cr.git'. > >> > >>>> -Gordon > >>> Hi Gordon, > >>> > >>> yes, and you were right about needing compat vdso. Sorry about the > >>> inconvenience (since it was my patch). I was just saying that since > >>> Oren has added the underlying code for moving vdso around, there is no > >>> reason why we shouldn't complete that support (with 1 line of code) > >>> allowing us to remove the dependency on CONFIG_COMPAT_VDSO. > >> True, no need to keep that dependency. Will remove. > >> > >> Note, however, that we still don't handle the case where the contents of > >> the VDSO page(s) differ between checkpoint and restart time... So it's > >> on the todo list to at least detect that the format changed. > > > > sigh - yeah, and we still haven't decided how to cleanly solve that, > > have we... (apart from some arch-specific memcmp template/map that > > compares the code and not data...) > > Heh .. I thought we outlined a suitable solution: > > * On checkpoint, save the contents of the VDSO page(s), or their hash, > but not including any dynamic data exported by the kernel. The VDSO > contents themselves should be a shared object. > > * On restart, compare the contents, or their hash, with the local > kenrel; If there is a match -- all well. If not - need to provide > some compatibility code in place of the original VDSO. > > The gory details .. oh well ... yeah, the details, that's what I was sighing about :) -serge ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 4/7] powerpc: provide APIs for validating and updating DABR [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> ` (2 preceding siblings ...) 2009-03-25 23:02 ` [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT Nathan Lynch @ 2009-03-25 23:02 ` Nathan Lynch 2009-03-25 23:02 ` [PATCH 5/7] powerpc: checkpoint/restart implementation Nathan Lynch ` (3 subsequent siblings) 7 siblings, 0 replies; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg A checkpointed task image may specify a value for the DABR (Data Access Breakpoint Register). The restart code needs to validate this value before making any changes to the current task. ptrace_set_debugreg encapsulates the bounds checking and platform dependencies of programming the DABR. Split this into "validate" (debugreg_valid) and "update" (debugreg_update) functions, and make them available for use outside of the ptrace code. Also ptrace_set_debugreg has extern linkage, but no users outside of ptrace.c. Make it static. Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- arch/powerpc/include/asm/ptrace.h | 7 +++ arch/powerpc/kernel/ptrace.c | 88 +++++++++++++++++++++++++------------ 2 files changed, 66 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index c9c678f..79bc816 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -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]) @@ -138,6 +140,11 @@ do { \ extern void user_enable_single_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__ */ diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 3635be6..0b6cf84 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -735,22 +735,25 @@ void user_disable_single_step(struct task_struct *task) clear_tsk_thread_flag(task, TIF_SINGLESTEP); } -int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, - unsigned long data) +/** + * debugreg_valid() - validate the value to be written to a debug register + * @val: The prospective contents of the register. + * @index: Must be zero. + * + * Returns true if @val is an acceptable value for the register indicated by + * @index, false otherwise. + */ +bool debugreg_valid(unsigned long val, unsigned int index) { - /* For ppc64 we support one DABR and no IABR's at the moment (ppc64). - * For embedded processors we support one DAC and no IAC's at the - * moment. - */ - if (addr > 0) - return -EINVAL; + /* We support only one debug register for now */ + if (index != 0) + return false; /* The bottom 3 bits in dabr are flags */ - if ((data & ~0x7UL) >= TASK_SIZE) - return -EIO; + if ((val & ~0x7UL) >= TASK_SIZE) + return false; #ifndef CONFIG_BOOKE - /* For processors using DABR (i.e. 970), the bottom 3 bits are flags. * It was assumed, on previous implementations, that 3 bits were * passed together with the data address, fitting the design of the @@ -764,47 +767,74 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, */ /* Ensure breakpoint translation bit is set */ - if (data && !(data & DABR_TRANSLATION)) - return -EIO; - - /* Move contents to the DABR register */ - task->thread.dabr = data; - -#endif -#if defined(CONFIG_BOOKE) - + if (val && !(val & DABR_TRANSLATION)) + return false; +#else /* As described above, it was assumed 3 bits were passed with the data * address, but we will assume only the mode bits will be passed * as to not cause alignment restrictions for DAC-based processors. */ + /* Read or Write bits must be set */ + if (!(val & 0x3UL)) + return -EINVAL; +#endif + return true; +} + +/** + * debugreg_update() - update a debug register associated with a task + * @task: The task whose register state is to be modified. + * @val: The value to be written to the debug register. + * @index: Specifies the debug register. Currently unused. + * + * Set a task's DABR/DAC to @val, which should be validated with + * debugreg_valid() beforehand. + */ +void debugreg_update(struct task_struct *task, unsigned long val, + unsigned int index) +{ +#ifndef CONFIG_BOOKE + task->thread.dabr = val; +#else /* DAC's hold the whole address without any mode flags */ - task->thread.dabr = data & ~0x3UL; + task->thread.dabr = val & ~0x3UL; if (task->thread.dabr == 0) { task->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W | DBCR0_IDM); task->thread.regs->msr &= ~MSR_DE; - return 0; } - /* Read or Write bits must be set */ - - if (!(data & 0x3UL)) - return -EINVAL; - /* Set the Internal Debugging flag (IDM bit 1) for the DBCR0 register */ task->thread.dbcr0 = DBCR0_IDM; /* Check for write and read flags and set DBCR0 accordingly */ - if (data & 0x1UL) + if (val & 0x1UL) task->thread.dbcr0 |= DBSR_DAC1R; - if (data & 0x2UL) + if (val & 0x2UL) task->thread.dbcr0 |= DBSR_DAC1W; task->thread.regs->msr |= MSR_DE; #endif +} + +static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, + unsigned long data) +{ + /* For ppc64 we support one DABR and no IABR's at the moment (ppc64). + * For embedded processors we support one DAC and no IAC's at the + * moment. + */ + if (addr > 0) + return -EINVAL; + + if (!debugreg_valid(data, 0)) + return -EIO; + + debugreg_update(task, data, 0); + return 0; } -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5/7] powerpc: checkpoint/restart implementation [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> ` (3 preceding siblings ...) 2009-03-25 23:02 ` [PATCH 4/7] powerpc: provide APIs for validating and updating DABR Nathan Lynch @ 2009-03-25 23:02 ` Nathan Lynch 2009-03-25 23:02 ` [PATCH 6/7] powerpc: wire up checkpoint and restart syscalls Nathan Lynch ` (2 subsequent siblings) 7 siblings, 0 replies; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg Support for checkpointing and restarting GPRs, FPU state, DABR, and Altivec state. The portion of the checkpoint image manipulated by this code begins with a bitmask of features indicating the various contexts saved. Fields in image that can vary depending on kernel configuration (e.g. FP regs due to VSX) have their sizes explicitly recorded, except for GPRS, so migrating between ppc32 and ppc64 won't work yet. The restart code ensures that the task is not modified until the checkpoint image is validated against the current kernel configuration and hardware features (e.g. can't restart a task using Altivec on non-Altivec systems). What works: * self and external checkpoint of simple (single thread, one open file) 32- and 64-bit processes on a ppc64 kernel What doesn't work: * restarting a 32-bit task from a 64-bit task and vice versa Untested: * ppc32 (but it builds) Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- arch/powerpc/include/asm/checkpoint_hdr.h | 15 + arch/powerpc/mm/Makefile | 1 + arch/powerpc/mm/checkpoint.c | 481 +++++++++++++++++++++++++++++ 3 files changed, 497 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/checkpoint_hdr.h create mode 100644 arch/powerpc/mm/checkpoint.c diff --git a/arch/powerpc/include/asm/checkpoint_hdr.h b/arch/powerpc/include/asm/checkpoint_hdr.h new file mode 100644 index 0000000..9f0d099 --- /dev/null +++ b/arch/powerpc/include/asm/checkpoint_hdr.h @@ -0,0 +1,15 @@ +#ifndef __ASM_PPC_CKPT_HDR_H +#define __ASM_PPC_CKPT_HDR_H +/* + * Checkpoint/restart - architecture specific headers ppc + * + * Copyright (C) 2008 Oren Laadan + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of the Linux + * distribution for more details. + */ + +/* nothing to see here */ + +#endif /* __ASM_PPC_CKPT_HDR__H */ diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index 953cc4a..02ecbcb 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile @@ -26,3 +26,4 @@ obj-$(CONFIG_NEED_MULTIPLE_NODES) += numa.o obj-$(CONFIG_PPC_MM_SLICES) += slice.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_PPC_SUBPAGE_PROT) += subpage-prot.o +obj-$(CONFIG_CHECKPOINT) += checkpoint.o diff --git a/arch/powerpc/mm/checkpoint.c b/arch/powerpc/mm/checkpoint.c new file mode 100644 index 0000000..99b9150 --- /dev/null +++ b/arch/powerpc/mm/checkpoint.c @@ -0,0 +1,481 @@ +/* + * Checkpoint/restart - architecture specific support for powerpc. + * Based on x86 implementation. + * + * Copyright (C) 2008 Oren Laadan + * Copyright 2009 IBM Corp. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of the Linux + * distribution for more details. + */ + +#define DEBUG 1 /* for pr_debug */ + +#include <linux/checkpoint.h> +#include <linux/checkpoint_hdr.h> +#include <linux/kernel.h> +#include <asm/processor.h> +#include <asm/ptrace.h> +#include <asm/system.h> + +enum cr_cpu_feature { + CKPT_USED_FP, + CKPT_USED_DEBUG, + CKPT_USED_ALTIVEC, + CKPT_USED_SPE, + CKPT_USED_VSX, + CKPT_FTR_END = 31, +}; + +#define x(ftr) (1UL << ftr) + +/* features this kernel can handle for restart */ +enum { + CKPT_FTRS_POSSIBLE = +#ifdef CONFIG_PPC_FPU + x(CKPT_USED_FP) | +#endif + x(CKPT_USED_DEBUG) | +#ifdef CONFIG_ALTIVEC + x(CKPT_USED_ALTIVEC) | +#endif +#ifdef CONFIG_SPE + x(CKPT_USED_SPE) | +#endif +#ifdef CONFIG_VSX + x(CKPT_USED_VSX) | +#endif + 0, +}; + +#undef x + +struct cr_hdr_cpu { + u32 features_used; + u32 pt_regs_size; + u32 fpr_size; + struct pt_regs pt_regs; + /* relevant fields from thread_struct */ + double fpr[32][TS_FPRWIDTH]; + u32 fpscr; + s32 fpexc_mode; + u64 dabr; + /* Altivec/VMX state */ + vector128 vr[32]; + vector128 vscr; + u64 vrsave; + /* SPE state */ + u32 evr[32]; + u64 acc; + u32 spefscr; +}; + +static void cr_cpu_feature_set(struct cr_hdr_cpu *hdr, enum cr_cpu_feature ftr) +{ + hdr->features_used |= 1ULL << ftr; +} + +static bool cr_cpu_feature_isset(const struct cr_hdr_cpu *hdr, enum cr_cpu_feature ftr) +{ + return hdr->features_used & (1ULL << ftr); +} + +/* determine whether an image has feature bits set that this kernel + * does not support */ +static bool cr_cpu_features_unknown(const struct cr_hdr_cpu *hdr) +{ + return hdr->features_used & ~CKPT_FTRS_POSSIBLE; +} + +static void checkpoint_gprs(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + struct pt_regs *pt_regs; + + pr_debug("%s: saving GPRs\n", __func__); + + cpu_hdr->pt_regs_size = sizeof(*pt_regs); + pt_regs = task_pt_regs(task); + cpu_hdr->pt_regs = *pt_regs; +} + +#ifdef CONFIG_PPC_FPU +static void checkpoint_fpu(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + /* easiest to save FP state unconditionally */ + + pr_debug("%s: saving FPU state\n", __func__); + + if (task == current) + flush_fp_to_thread(task); + + cpu_hdr->fpr_size = sizeof(cpu_hdr->fpr); + cpu_hdr->fpscr = task->thread.fpscr.val; + cpu_hdr->fpexc_mode = task->thread.fpexc_mode; + + memcpy(cpu_hdr->fpr, task->thread.fpr, sizeof(cpu_hdr->fpr)); + + cr_cpu_feature_set(cpu_hdr, CKPT_USED_FP); +} +#else +static void checkpoint_fpu(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + return; +} +#endif + +#ifdef CONFIG_ALTIVEC +static void checkpoint_altivec(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + if (!cpu_has_feature(CPU_FTR_ALTIVEC)) + return; + + if (!task->thread.used_vr) + return; + + pr_debug("%s: saving Altivec state\n", __func__); + + if (task == current) + flush_altivec_to_thread(task); + + cpu_hdr->vrsave = task->thread.vrsave; + memcpy(cpu_hdr->vr, task->thread.vr, sizeof(cpu_hdr->vr)); + cr_cpu_feature_set(cpu_hdr, CKPT_USED_ALTIVEC); +} +#else +static void checkpoint_altivec(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + return; +} +#endif + +#ifdef CONFIG_SPE +static void checkpoint_spe(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + if (!cpu_has_feature(CPU_FTR_SPE)) + return; + + if (!task->thread.used_spe) + return; + + pr_debug("%s: saving SPE state\n", __func__); + + if (task == current) + flush_spe_to_thread(task); + + cpu_hdr->acc = task->thread.acc; + cpu_hdr->spefscr = task->thread.spefscr; + memcpy(cpu_hdr->evr, task->thread.evr, sizeof(cpu_hdr->evr)); + cr_cpu_feature_set(cpu_hdr, CKPT_USED_SPE); +} +#else +static void checkpoint_spe(struct cr_hdr_cpu *cpu_hdr, struct task_struct *task) +{ + return; +} +#endif + +static void checkpoint_dabr(struct cr_hdr_cpu *cpu_hdr, const struct task_struct *task) +{ + if (!task->thread.dabr) + return; + + cpu_hdr->dabr = task->thread.dabr; + cr_cpu_feature_set(cpu_hdr, CKPT_USED_DEBUG); +} + +/* dump the thread_struct of a given task */ +int cr_write_thread(struct cr_ctx *ctx, struct task_struct *t) +{ + return 0; +} + +/* dump the cpu state and registers of a given task */ +int cr_write_cpu(struct cr_ctx *ctx, struct task_struct *t) +{ + struct cr_hdr_cpu *cpu_hdr; + struct cr_hdr cr_hdr; + int rc; + + cr_hdr.type = CR_HDR_CPU; + cr_hdr.len = sizeof(*cpu_hdr); + + rc = -ENOMEM; + cpu_hdr = kzalloc(sizeof(*cpu_hdr), GFP_KERNEL); + if (!cpu_hdr) + goto err; + + checkpoint_gprs(cpu_hdr, t); + checkpoint_fpu(cpu_hdr, t); + checkpoint_dabr(cpu_hdr, t); + checkpoint_altivec(cpu_hdr, t); + checkpoint_spe(cpu_hdr, t); + + rc = cr_write_obj(ctx, &cr_hdr, cpu_hdr); +err: + kfree(cpu_hdr); + return rc; +} + +int cr_write_head_arch(struct cr_ctx *ctx) +{ + return 0; +} + +/* dump the mm->context state */ +int cr_write_mm_context(struct cr_ctx *ctx, struct mm_struct *mm, int parent) +{ + return 0; +} + +/* restart APIs */ + +/* read the thread_struct into the current task */ +int cr_read_thread(struct cr_ctx *ctx) +{ + return 0; +} + +/* Based on the MSR value from a checkpoint image, produce an MSR + * value that is appropriate for the restored task. Right now we only + * check for MSR_SF (64-bit) for PPC64. + */ +static unsigned long sanitize_msr(unsigned long msr_ckpt) +{ +#ifdef CONFIG_PPC32 + return MSR_USER; +#else + if (msr_ckpt & MSR_SF) + return MSR_USER64; + return MSR_USER32; +#endif +} + +static int restore_gprs(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + struct pt_regs *regs; + int rc; + + rc = -EINVAL; + if (cpu_hdr->pt_regs_size != sizeof(*regs)) + goto out; + + rc = 0; + if (!update) + goto out; + + regs = task_pt_regs(task); + *regs = cpu_hdr->pt_regs; + + regs->msr = sanitize_msr(regs->msr); +out: + return rc; +} + +#ifdef CONFIG_PPC_FPU +static int restore_fpu(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + int rc; + + rc = -EINVAL; + if (cpu_hdr->fpr_size != sizeof(task->thread.fpr)) + goto out; + + rc = 0; + if (!update || !cr_cpu_feature_isset(cpu_hdr, CKPT_USED_FP)) + goto out; + + task->thread.fpscr.val = cpu_hdr->fpscr; + task->thread.fpexc_mode = cpu_hdr->fpexc_mode; + + memcpy(task->thread.fpr, cpu_hdr->fpr, sizeof(task->thread.fpr)); +out: + return rc; +} +#else +static int restore_fpu(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + WARN_ON_ONCE(cr_cpu_feature_isset(cpu_hdr, CKPT_USED_FP)); + return 0; +} +#endif + +static int restore_dabr(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + int rc; + + rc = 0; + if (!cr_cpu_feature_isset(cpu_hdr, CKPT_USED_DEBUG)) + goto out; + + rc = -EINVAL; + if (!debugreg_valid(cpu_hdr->dabr, 0)) + goto out; + + rc = 0; + if (!update) + goto out; + + debugreg_update(task, cpu_hdr->dabr, 0); +out: + return rc; +} + +#ifdef CONFIG_ALTIVEC +static int restore_altivec(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + int rc; + + rc = 0; + if (!cr_cpu_feature_isset(cpu_hdr, CKPT_USED_ALTIVEC)) + goto out; + + rc = -EINVAL; + if (!cpu_has_feature(CPU_FTR_ALTIVEC)) + goto out; + + rc = 0; + if (!update) + goto out; + + task->thread.vrsave = cpu_hdr->vrsave; + task->thread.used_vr = 1; + + memcpy(task->thread.vr, cpu_hdr->vr, sizeof(cpu_hdr->vr)); +out: + return rc; +} +#else +static int restore_altivec(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + WARN_ON_ONCE(cr_cpu_feature_isset(CKPT_USED_ALTIVEC)); + return 0; +} +#endif + +#ifdef CONFIG_SPE +static int restore_spe(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + int rc; + + rc = 0; + if (!cr_cpu_feature_isset(cpu_hdr, CKPT_USED_SPE)) + goto out; + + rc = -EINVAL; + if (!cpu_has_feature(CPU_FTR_SPE)) + goto out; + + rc = 0; + if (!update) + goto out; + + task->thread.acc = cpu_hdr->acc; + task->thread.spefscr = cpu_hdr->spefscr; + task->thread.used_spe = 1; + + memcpy(task->thread.evr, cpu_hdr->evr, sizeof(cpu_hdr->evr)); +out: + return rc; +} +#else +static int restore_spe(const struct cr_hdr_cpu *cpu_hdr, struct task_struct *task, bool update) +{ + WARN_ON_ONCE(cr_cpu_feature_isset(cpu_hdr, CKPT_USED_SPE)); + return 0; +} +#endif + +struct restore_func_desc { + int (*func)(const struct cr_hdr_cpu *, struct task_struct *, bool); + const char *info; +}; + +typedef int (*restore_func_t)(const struct cr_hdr_cpu *, struct task_struct *, bool); + +static const restore_func_t restore_funcs[] = { + restore_gprs, + restore_fpu, + restore_dabr, + restore_altivec, + restore_spe, +}; + +static bool bitness_match(const struct cr_hdr_cpu *cpu_hdr, const struct task_struct *task) +{ + /* 64-bit image */ + if (cpu_hdr->pt_regs.msr & MSR_SF) { + if (task->thread.regs->msr & MSR_SF) + return true; + else + return false; + } + + /* 32-bit image */ + if (task->thread.regs->msr & MSR_SF) + return false; + + return true; +} + +int cr_read_cpu(struct cr_ctx *ctx) +{ + struct cr_hdr_cpu *cpu_hdr; + bool update; + int rc; + int i; + + rc = -ENOMEM; + cpu_hdr = kzalloc(sizeof(*cpu_hdr), GFP_KERNEL); + if (!cpu_hdr) + goto err; + + rc = cr_read_obj_type(ctx, cpu_hdr, sizeof(*cpu_hdr), CR_HDR_CPU); + if (rc < 0) + goto err; + + rc = -EINVAL; + if (cr_cpu_features_unknown(cpu_hdr)) + goto err; + + /* temporary: restoring a 32-bit image from a 64-bit task and + * vice-versa is known not to work (probably not restoring + * thread_info correctly); detect this and fail gracefully. + */ + if (!bitness_match(cpu_hdr, current)) + goto err; + + /* We want to determine whether there's anything wrong with + * the checkpoint image before changing the task at all. Run + * a "check" phase (update = false) first. + */ + update = false; +commit: + for (i = 0; i < ARRAY_SIZE(restore_funcs); i++) { + rc = restore_funcs[i](cpu_hdr, current, update); + if (rc == 0) + continue; + pr_debug("%s: restore_func[%i] failed\n", __func__, i); + WARN_ON_ONCE(update); + goto err; + } + + if (!update) { + update = true; + goto commit; + } + +err: + kfree(cpu_hdr); + return rc; +} + +int cr_read_head_arch(struct cr_ctx *ctx) +{ + return 0; +} + +int cr_read_mm_context(struct cr_ctx *ctx, struct mm_struct *mm, int rparent) +{ + return 0; +} -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 6/7] powerpc: wire up checkpoint and restart syscalls [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> ` (4 preceding siblings ...) 2009-03-25 23:02 ` [PATCH 5/7] powerpc: checkpoint/restart implementation Nathan Lynch @ 2009-03-25 23:02 ` Nathan Lynch 2009-03-25 23:02 ` [PATCH 7/7] powerpc: enable checkpoint support in Kconfig Nathan Lynch 2009-03-30 14:57 ` [PATCH 0/7] checkpoint: Kconfig cleanup, powerpc support Oren Laadan 7 siblings, 0 replies; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- arch/powerpc/include/asm/systbl.h | 2 ++ arch/powerpc/include/asm/unistd.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 72353f6..8d8dd68 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h @@ -322,3 +322,5 @@ SYSCALL_SPU(epoll_create1) SYSCALL_SPU(dup3) SYSCALL_SPU(pipe2) SYSCALL(inotify_init1) +SYSCALL(checkpoint) +SYSCALL(restart) diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index e07d0c7..2e333a1 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -341,10 +341,12 @@ #define __NR_dup3 316 #define __NR_pipe2 317 #define __NR_inotify_init1 318 +#define __NR_checkpoint 319 +#define __NR_restart 320 #ifdef __KERNEL__ -#define __NR_syscalls 319 +#define __NR_syscalls 321 #define __NR__exit __NR_exit #define NR_syscalls __NR_syscalls -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 7/7] powerpc: enable checkpoint support in Kconfig [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> ` (5 preceding siblings ...) 2009-03-25 23:02 ` [PATCH 6/7] powerpc: wire up checkpoint and restart syscalls Nathan Lynch @ 2009-03-25 23:02 ` Nathan Lynch 2009-03-30 14:57 ` [PATCH 0/7] checkpoint: Kconfig cleanup, powerpc support Oren Laadan 7 siblings, 0 replies; 22+ messages in thread From: Nathan Lynch @ 2009-03-25 23:02 UTC (permalink / raw) To: containers-qjLDD68F18O7TbgM5vRIOg Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> --- arch/powerpc/Kconfig | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 74cc312..ff7d598 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -26,6 +26,9 @@ config MMU bool default y +config CHECKPOINT_SUPPORT + def_bool y + config GENERIC_CMOS_UPDATE def_bool y -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 0/7] checkpoint: Kconfig cleanup, powerpc support [not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> ` (6 preceding siblings ...) 2009-03-25 23:02 ` [PATCH 7/7] powerpc: enable checkpoint support in Kconfig Nathan Lynch @ 2009-03-30 14:57 ` Oren Laadan 7 siblings, 0 replies; 22+ messages in thread From: Oren Laadan @ 2009-03-30 14:57 UTC (permalink / raw) To: Nathan Lynch; +Cc: containers-qjLDD68F18O7TbgM5vRIOg Thanks, Nathan. I added these to the patch-set for the next version. Nathan Lynch wrote: > The following series, based on Oren's ckpt-v14 branch, improves the > Kconfig situation wrt architecture support and adds the powerpc > implementation. > > Nathan Lynch (7): > s390: enable checkpoint support in Kconfig > x86: enable checkpoint support in Kconfig > make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT > powerpc: provide APIs for validating and updating DABR > powerpc: checkpoint/restart implementation > powerpc: wire up checkpoint and restart syscalls > powerpc: enable checkpoint support in Kconfig > > arch/powerpc/Kconfig | 3 + > arch/powerpc/include/asm/checkpoint_hdr.h | 15 + > 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 | 481 +++++++++++++++++++++++++++++ > arch/s390/Kconfig | 4 + > arch/x86/Kconfig | 4 + > checkpoint/Kconfig | 2 +- > 11 files changed, 580 insertions(+), 31 deletions(-) > create mode 100644 arch/powerpc/include/asm/checkpoint_hdr.h > create mode 100644 arch/powerpc/mm/checkpoint.c > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers > ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2009-05-12 16:39 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-25 23:02 [PATCH 0/7] checkpoint: Kconfig cleanup, powerpc support Nathan Lynch
[not found] ` <1238022166-13422-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-03-25 23:02 ` [PATCH 1/7] s390: enable checkpoint support in Kconfig Nathan Lynch
[not found] ` <1238022166-13422-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-03-25 23:26 ` Serge E. Hallyn
2009-03-25 23:02 ` [PATCH 2/7] x86: " Nathan Lynch
[not found] ` <1238022166-13422-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-03-25 23:26 ` Serge E. Hallyn
2009-03-25 23:02 ` [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT Nathan Lynch
[not found] ` <1238022166-13422-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-03-25 23:26 ` Serge E. Hallyn
2009-03-26 0:39 ` Dave Hansen
2009-03-26 3:09 ` Nathan Lynch
[not found] ` <20090325220931.2653f379-4v5LP+xe+1byhTdZtsIeww@public.gmane.org>
2009-05-12 11:20 ` Ralph-Gordon Paul
[not found] ` <FB599A4B-F618-4E6C-94D8-FC4EAE3D41D9-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org>
2009-05-12 12:10 ` [PATCH 3/7] make CONFIG_CHECKPOINT depend onCONFIG_CHECKPOINT_SUPPORT Serge E. Hallyn
[not found] ` <20090512121001.GB28695-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-12 12:42 ` Ralph-Gordon Paul
[not found] ` <3A15FE99-C94B-467B-B475-44BBED892C25-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org>
2009-05-12 14:29 ` [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT Serge E. Hallyn
[not found] ` <20090512142912.GA31449-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-12 15:16 ` Oren Laadan
[not found] ` <4A0992CB.9050404-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-05-12 15:44 ` Serge E. Hallyn
[not found] ` <20090512154455.GA32658-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-12 16:16 ` Oren Laadan
[not found] ` <4A09A0D4.40208-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-05-12 16:39 ` Serge E. Hallyn
2009-03-25 23:02 ` [PATCH 4/7] powerpc: provide APIs for validating and updating DABR Nathan Lynch
2009-03-25 23:02 ` [PATCH 5/7] powerpc: checkpoint/restart implementation Nathan Lynch
2009-03-25 23:02 ` [PATCH 6/7] powerpc: wire up checkpoint and restart syscalls Nathan Lynch
2009-03-25 23:02 ` [PATCH 7/7] powerpc: enable checkpoint support in Kconfig Nathan Lynch
2009-03-30 14:57 ` [PATCH 0/7] checkpoint: Kconfig cleanup, powerpc support Oren Laadan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.