Skip to contentSkip to conversation

checkpoint: Kconfig cleanup, powerpc support

PATCH In review Nathan Lynch 5 participants 22 messages Mar 25, 2009 – May 12, 2009 12 messages not in the archive

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

cover checkpoint: Kconfig cleanup, powerpc support

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

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

#2 lore raw

PATCH 1/7 s390: enable checkpoint support in Kconfig

Only 64-bit kernels are supported.

---
 arch/s390/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/s390/Kconfig +4 -0
index 6b0a353..98d339e 100644
@@ -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
Signature · 1 line
1.6.0.6

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

#4 lore raw

Re: [PATCH 1/7] s390: enable checkpoint support in Kconfig

Quoted 3 lines · Nathan Lynch

Only 64-bit kernels are supported.

Quoted 26 lines
---
 arch/s390/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/s390/Kconfig +4 -0
index 6b0a353..98d339e 100644
@@ -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
Signature · 6 lines
1.6.0.6

_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
#5 lore raw

PATCH 2/7 x86: enable checkpoint support in Kconfig

In reply to a message not in the archive

For now, supported only for 32-bit kernels.

---
 arch/x86/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/Kconfig +4 -0
index bc2fbad..246e26b 100644
@@ -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
Signature · 1 line
1.6.0.6

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

#7 lore raw

Re: [PATCH 2/7] x86: enable checkpoint support in Kconfig

Quoted 3 lines · Nathan Lynch

For now, supported only for 32-bit kernels.

Quoted 26 lines
---
 arch/x86/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/Kconfig +4 -0
index bc2fbad..246e26b 100644
@@ -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
Signature · 6 lines
1.6.0.6

_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
#8 lore raw

PATCH 3/7 make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT

In reply to a message not in the archive

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.

---
 checkpoint/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
checkpoint/Kconfig +1 -1
index e91e0fd..760c450 100644
@@ -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
Signature · 1 line
1.6.0.6

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

#10 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT

Quoted 6 lines · Nathan Lynch

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.

Yup, this is nicer, thanks.

Quoted 23 lines
---
 checkpoint/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
checkpoint/Kconfig +1 -1
index e91e0fd..760c450 100644
@@ -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
Signature · 6 lines
1.6.0.6

_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
#11 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT

In reply to a message not in the archive

checkpoint/Kconfig line 6

Quoted 13 lines · Nathan Lynch
checkpoint/Kconfig +1 -1
index e91e0fd..760c450 100644
@@ -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

#12 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT

Quoted 16 lines · Dave Hansen

checkpoint/Kconfig line 6

Quoted 13 lines · Nathan Lynch
checkpoint/Kconfig +1 -1
index e91e0fd..760c450 100644
@@ -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.

Quoted 3 lines

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 <[email protected]>
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.

checkpoint/Kconfig +4 -0
index 760c450..1761b0a 100644
@@ -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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend on CONFIG_CHECKPOINT_SUPPORT

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:

Quoted 72 lines
Quoted 16 lines · Dave Hansen

checkpoint/Kconfig

Quoted 13 lines · Nathan Lynch
checkpoint/Kconfig +0 -0
index e91e0fd..760c450 100644
@@ -1,6 +1,6 @@

config CHECKPOINT
bool "Enable checkpoint/restart (EXPERIMENTAL)"

checkpoint/Kconfig +1 -1
-       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.

Quoted 3 lines

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 <[email protected]>
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.

checkpoint/Kconfig +4 -0
index 760c450..1761b0a 100644
@@ -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

A message that is not in the archive (sent off-list or not yet received): FB599A4B-F618-4E6C-94D8-FC4EAE3D41D9-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org

#16 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend onCONFIG_CHECKPOINT_SUPPORT

Quoted 7 lines · Ralph-Gordon Paul

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

A message that is not in the archive (sent off-list or not yet received): 20090512121001.GB28695-r/[email protected]

#18 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT depend onCONFIG_CHECKPOINT_SUPPORT

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:

Quoted 19 lines · Ralph-Gordon Paul
Quoted 8 lines

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

A message that is not in the archive (sent off-list or not yet received): 3A15FE99-C94B-467B-B475-44BBED892C25-4bfl1RV3iZDOEhgYWvzSCYQuADTiUCJX@public.gmane.org

#20 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT

Quoted 5 lines · Ralph-Gordon Paul

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

A message that is not in the archive (sent off-list or not yet received): 20090512142912.GA31449-r/[email protected]

#22 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT

Hi Gordon,

Quoted 4 lines · Serge E. Hallyn
Quoted 3 lines · Ralph-Gordon Paul

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'.

Quoted 10 lines
Quoted 2 lines

-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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#24 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT

Quoted 27 lines · Oren Laadan

Hi Gordon,

Quoted 4 lines · Serge E. Hallyn
Quoted 3 lines · Ralph-Gordon Paul

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'.

Quoted 10 lines
Quoted 2 lines

-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.

Quoted 5 lines

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...)

Quoted 3 lines

That said, that will work in most cases, definitely on the same machine.

Oren.

A message that is not in the archive (sent off-list or not yet received): 20090512154455.GA32658-r/[email protected]

#26 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT

Quoted 25 lines · Serge E. Hallyn
Quoted 24 lines · Oren Laadan

Hi Gordon,

Quoted 4 lines · Serge E. Hallyn
Quoted 3 lines · Ralph-Gordon Paul

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'.

Quoted 8 lines
Quoted 1 line

-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.

Quoted 7 lines
Quoted 3 lines

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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#28 lore raw

Re: [PATCH 3/7] make CONFIG_CHECKPOINT dependonCONFIG_CHECKPOINT_SUPPORT

Quoted 42 lines · Oren Laadan
Quoted 25 lines · Serge E. Hallyn
Quoted 24 lines · Oren Laadan

Hi Gordon,

Quoted 4 lines · Serge E. Hallyn
Quoted 3 lines · Ralph-Gordon Paul

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'.

Quoted 8 lines
Quoted 1 line

-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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 5 lines

* 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

#29 lore raw

PATCH 4/7 powerpc: provide APIs for validating and updating DABR

In reply to a message not in the archive

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.

---
 arch/powerpc/include/asm/ptrace.h |    7 +++
 arch/powerpc/kernel/ptrace.c      |   88 +++++++++++++++++++++++++------------
 2 files changed, 66 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/ptrace.h +7 -0
index c9c678f..79bc816 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])
@@ -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__ */
arch/powerpc/kernel/ptrace.c +59 -29

128 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#30 lore raw

PATCH 5/7 powerpc: checkpoint/restart implementation

In reply to a message not in the archive

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)

---
 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
arch/powerpc/include/asm/checkpoint_hdr.h new file +15 -0
new file mode 100644
index 0000000..9f0d099
@@ -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 */
arch/powerpc/mm/Makefile +1 -0
index 953cc4a..02ecbcb 100644
@@ -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
arch/powerpc/mm/checkpoint.c new file +481 -0

481 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#31 lore raw

PATCH 6/7 powerpc: wire up checkpoint and restart syscalls

In reply to a message not in the archive
---
 arch/powerpc/include/asm/systbl.h |    2 ++
 arch/powerpc/include/asm/unistd.h |    4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/systbl.h +2 -0
index 72353f6..8d8dd68 100644
@@ -322,3 +322,5 @@ SYSCALL_SPU(epoll_create1)
 SYSCALL_SPU(dup3)
 SYSCALL_SPU(pipe2)
 SYSCALL(inotify_init1)
+SYSCALL(checkpoint)
+SYSCALL(restart)
arch/powerpc/include/asm/unistd.h +3 -1
index e07d0c7..2e333a1 100644
@@ -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
Signature · 1 line
1.6.0.6
#32 lore raw

PATCH 7/7 powerpc: enable checkpoint support in Kconfig

In reply to a message not in the archive
---
 arch/powerpc/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/Kconfig +3 -0
index 74cc312..ff7d598 100644
@@ -26,6 +26,9 @@ config MMU
 	bool
 	default y
 
+config CHECKPOINT_SUPPORT
+	def_bool y
+
 config GENERIC_CMOS_UPDATE
 	def_bool y
 
Signature · 1 line
1.6.0.6
#33 lore raw
In reply to a message not in the archive

Thanks, Nathan.

I added these to the patch-set for the next version.

Quoted 33 lines · Nathan Lynch

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