checkpoint/restart

Kip Macy kmacy at fsmware.com
Sat Oct 11 18:55:58 PDT 2003


Here is the patch. Please let me know if there are any problems with it.
It will also be included in the ckpt7.tgz tarball which will be up at
http://www.fsmware.com/ckpt7.tgz in a few minutes.

			-Kip

On Fri, 10 Oct 2003, Matthew Dillon wrote:

> :..
> :code now uses the above suggested semantics. Instead of directly calling
> :ckpt_checkpoint the code registers handle_ckpt for SIGCKPT (arbitrarily
> :defined as 42) and then sends itself SIGCKPT. The function handle_ckpt is
> :defined as follows:
>
>     Patch set 6 works like a charm!  If you get stuck on the file handle
>     issue I would be pleased to help out there.  Also note that you should
>     not need to use any ELF/EXEC code at all except for the saved register
>     state once you record the file descriptor state and (if not already
>     recorded) related descriptor mappings, the restore code would be
>     image based.
>
>     If you want to get the kernel hook in for the default signal / module
>     support and add the SIGCKPT and SIGCKPTEXIT signals to sys/signal.h,
>     We can commit that early so people doing ongoing testing of the module
>     do not have to patch their kernels.
>
>     FreeBSD-5 has added signal 32, so I recommend we add this to sys/signal.h:
>
> #if __BSD_VISIBLE
> #define SIGTHR          32      /* Thread interrupt (FreeBSD-5 reserved) */
> #define SIGCKPT		33	/* check point and continue */
> #define SIGCKPTEXIT	34	/* check point and exit */
> #endif
>
>     I also recommend that your ckpt_checkpoint() syscall be given an
>     additional flags argument for future augmentation.  e.g. for
>     'pushed' migrations to virtual targets: ckpt_checkpoint(-1, CKPT_CPU|...),
>     or telling it to ignore certain failure cases like sockets and tty's
>     (CKPT_NO_SOCKETS, CKPT_NO_PGRP_TTYS), or to request future retention of
>     detached files through their link counters (CKPT_HOLD_LINKCNT), and
>     other things.
>
>     The retval from ckpt_checkpoint and the flags argument to ckpt_restore()
>     could all use the same flag set (e.g. so in the restore code you would
>     pass CKPT_RETURN instead of THAW_RETURN, and ckpt_checkpoint() would
>     return a set of CKPT_ flags (and still return -1 on failure)), etc.
>
>     Just brainstorming here!
>
> 							-Matt
>
>Index: kern/kern_sig.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/kern_sig.c,v
retrieving revision 1.20
diff -r1.20 kern_sig.c
138a139,140
> #define SA_CKPT         0x80            /* checkpoint process */
> 
171a174,207
> 	SA_IGNORE,              /* SIGTHR */
> 	SA_CKPT,                /* SIGCKPT */ 
> 	SA_KILL|SA_CKPT,        /* SIGCKPTEXIT */  
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 	SA_IGNORE,
> 
885a922,936
> /*
>  * temporary hack to allow checkpoint code to continue to
>  * be in a module for the moment
>  */
> typedef void (proc_func) (struct proc *);
> static proc_func *ckpt_func = NULL;
> proc_func *register_ckpt_func(proc_func *); 
> 
> proc_func *register_ckpt_func(proc_func *cf) 
> {
> 	proc_func *cftmp = ckpt_func;
> 	ckpt_func = cf;
> 	return cftmp;
> }
> 
935a987
> 	
949a1002,1009
> 
> 	if (prop & SA_CKPT && action == SIG_DFL) {
> 		SIGDELSET(p->p_siglist, sig);		
> 		if (ckpt_func) 
> 			ckpt_func(p);
> 		if (prop & SA_KILL) 
> 			SIGADDSET(p->p_siglist, SIGKILL);		
> 	}
Index: sys/signal.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/signal.h,v
retrieving revision 1.3
diff -r1.3 signal.h
105a106,110
> #if __BSD_VISIBLE
> #define SIGTHR          32      /* Thread interrupt (FreeBSD-5 reserved) */
> #define SIGCKPT         33      /* checkpoint and continue */
> #define SIGCKPTEXIT     34      /* checkpoint and exit */
> #endif
217c222
< #define NSIG		32	/* number of old signals (counting 0) */
---
> #define NSIG		64	/* size of sigptbl */




More information about the Kernel mailing list