services: Selectively enable stateful restart.

Change-Id: Ibf6afa3041013ca714e28b673abb1329cd72d2d5
This commit is contained in:
Cristiano Giuffrida 2014-12-20 11:45:05 +01:00 committed by David van Moolenbroek
parent dc76d7e9da
commit 3f82ac6a4e
46 changed files with 53 additions and 169 deletions

View file

@ -638,9 +638,6 @@ static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fail);
/* No live update support for now. */
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -474,11 +474,6 @@ sef_local_startup()
sef_setcb_init_restart(sef_cb_init);
/* Register live update callbacks */
/* Agree to update immediately when LU is requested in a valid state */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* - Support live update starting from any standard state */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* - Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -718,21 +718,6 @@ sef_local_startup(void)
sef_setcb_init_lu(sef_cb_init);
sef_setcb_init_restart(sef_cb_init);
/*
* Register live update callbacks.
*/
/* - Agree to update immediately when LU is requested in a valid
* state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* - Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
#if 0
/* - Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
#endif
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -74,10 +74,6 @@ static void sef_local_startup()
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -160,14 +160,6 @@ sef_local_startup()
sef_setcb_init_lu(sef_cb_init);
sef_setcb_init_restart(sef_cb_init);
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -472,11 +472,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -103,11 +103,6 @@ static void sef_local_startup()
/*
* Register live update callbacks.
*/
/* - Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* - Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* - Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -102,10 +102,6 @@ static void sef_local_startup()
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
#if 0
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -126,10 +126,6 @@ static void sef_local_startup()
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -334,11 +334,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -233,11 +233,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -551,11 +551,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -454,11 +454,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -403,11 +403,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -2374,7 +2374,6 @@ static void sef_local_startup(void)
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_lu(sef_cb_init_fresh);
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -182,7 +182,6 @@ static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_lu(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare);

View file

@ -352,8 +352,7 @@ static void sef_local_startup(void)
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* No live update support for now. */
sef_setcb_init_lu(sef_cb_init_fresh);
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -308,7 +308,6 @@ static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_lu(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare);

View file

@ -117,10 +117,6 @@ static void sef_local_startup()
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -544,7 +544,6 @@ sef_local_startup()
* Use the same function for all event types
*/
sef_setcb_init_fresh(block_system_event_cb);
sef_setcb_init_lu(block_system_event_cb);
/* Register a signal handler */
sef_setcb_signal_handler(block_signal_handler_cb);

View file

@ -731,7 +731,6 @@ static void
sef_local_startup(void)
{
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_signal_handler(sef_cb_signal_handler);
sef_startup();

View file

@ -74,10 +74,6 @@ static void sef_local_startup()
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -214,8 +214,6 @@ static void tty_startup(void)
sef_setcb_init_fresh(tty_init);
sef_setcb_init_restart(tty_init);
/* No live update support for now. */
/* No signal support for now. */
/* Let SEF perform startup. */

View file

@ -296,8 +296,7 @@ static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/* No live update support for now. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -298,11 +298,6 @@ sef_local_startup()
sef_setcb_init_restart(sef_cb_init);
/* Register live update callbacks */
/* - Agree to update immediately when LU is requested in a valid state*/
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* - Support live update starting from any standard state */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* - Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -942,11 +942,6 @@ sef_local_startup(void)
/*
* Register live update callbacks.
*/
/* Agree to update immediately when LU is requested in a valid state. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
/* Support live update starting from any standard state. */
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register a custom routine to save the state. */
sef_setcb_lu_state_save(sef_cb_lu_state_save);
/* Let SEF perform startup. */

View file

@ -53,9 +53,6 @@ static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fail);
/* No live update support for now. */
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -44,8 +44,7 @@ static void sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/* No live update support for now. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -32,8 +32,7 @@ static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/* No live update support for now. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -408,8 +408,7 @@ pfs_startup(void)
/* Register initialization callbacks. */
sef_setcb_init_fresh(pfs_init);
/* No live update support for now. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Register signal callbacks. */
sef_setcb_signal_handler(pfs_signal);

View file

@ -51,8 +51,16 @@ init_hook(void)
{
static int first_time = TRUE;
struct inode *root;
int r;
if (first_time) {
/*
* Initialize some state. If we are incompatible with the kernel,
* exit immediately.
*/
if ((r = init_tree()) != OK)
panic("init_tree failed!");
root = get_root_inode();
construct_tree(root, root_files);
@ -69,14 +77,6 @@ init_hook(void)
int main(void)
{
static struct inode_stat stat;
int r;
/*
* Initialize some state. If we are incompatible with the kernel, exit
* immediately.
*/
if ((r = init_tree()) != OK)
return r;
/* Properties of the root directory. */
stat.mode = DIR_ALL_MODE;

View file

@ -80,9 +80,10 @@ int sef_cb_init_response_rs_asyn_once(message *m_ptr);
#define SEF_CB_INIT_LU_NULL sef_cb_init_null
#define SEF_CB_INIT_RESTART_NULL sef_cb_init_null
#define SEF_CB_INIT_RESPONSE_NULL sef_cb_init_response_null
#define SEF_CB_INIT_RESTART_STATEFUL sef_cb_init_identity_state_transfer
#define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_lu_generic
#define SEF_CB_INIT_RESTART_DEFAULT sef_cb_init_reset
#define SEF_CB_INIT_RESPONSE_DEFAULT sef_cb_init_response_rs_reply
@ -200,9 +201,9 @@ int sef_cb_lu_response_rs_reply(message *m_ptr);
#define SEF_CB_LU_RESPONSE_NULL sef_cb_lu_response_null
#define SEF_CB_LU_PREPARE_DEFAULT sef_cb_lu_prepare_null
#define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_null
#define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_generic
#define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null
#define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_null
#define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_eval
#define SEF_CB_LU_STATE_SAVE_DEFAULT sef_cb_lu_state_save_null
#define SEF_CB_LU_RESPONSE_DEFAULT sef_cb_lu_response_rs_reply

View file

@ -595,7 +595,6 @@ netdriver_task(const struct netdriver * ndp)
/* Perform SEF initialization. */
sef_setcb_init_fresh(do_init);
sef_setcb_init_restart(do_init); /* TODO: revisit this */
sef_setcb_signal_handler(got_signal);
netdriver_table = ndp;

View file

@ -346,7 +346,7 @@ int sef_cb_init_identity_state_transfer(int type, sef_init_info_t *info)
new_brksize = _brksize;
/* Transfer heap if necessary. */
if(old_brksize != new_brksize) {
if(sef_self_endpoint != VM_PROC_NR && old_brksize != new_brksize) {
#if SEF_ST_DEBUG
printf("sef_cb_init_identity_state_transfer: brk() for new_brksize = 0x%08x\n",
@ -391,9 +391,10 @@ int sef_cb_init_lu_identity_as_restart(int type, sef_init_info_t *info)
/* Resort to restart callback only for identity updates, ignore other cases. */
if(SEF_LU_IS_IDENTITY_UPDATE(info->flags)) {
if(info->flags & (SEF_INIT_DEFCB|SEF_INIT_SCRIPT_RESTART)) {
/* Use default callback when requested or when using a script.*/
return SEF_CB_INIT_RESTART_DEFAULT(type, info);
if((info->flags & (SEF_INIT_DEFCB|SEF_INIT_SCRIPT_RESTART))
|| sef_init_cbs.sef_cb_init_restart == sef_cb_init_reset) {
/* Use stateful restart callback when necessary. */
return SEF_CB_INIT_RESTART_STATEFUL(type, info);
}
return sef_init_cbs.sef_cb_init_restart(type, info);
}

View file

@ -51,13 +51,11 @@ got_signal(int signal)
static void
sef_local_startup(void)
{
sef_setcb_init_fresh(init_server);
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
sef_setcb_signal_handler(got_signal);
/* No support for live update yet. */
sef_startup();
}

View file

@ -145,8 +145,6 @@ static void sef_local_startup()
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* No live update support for now. */
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -141,8 +141,6 @@ static void sef_local_startup(void)
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* No live update support for now. */
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -732,8 +732,6 @@ uds_startup(void)
/* Register init callbacks. */
sef_setcb_init_fresh(uds_init);
/* No live update support for now. */
/* Register signal callbacks. */
sef_setcb_signal_handler(uds_signal);

View file

@ -94,12 +94,11 @@ static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Register state transfer callbacks. */
sef_llvm_ds_st_init();
/* No live update support for now. */
/* Let SEF perform startup. */
sef_startup();
}

View file

@ -123,8 +123,6 @@ static void sef_local_startup()
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* No live update support for now. */
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -80,10 +80,6 @@ static void sef_local_startup()
sef_setcb_init_lu(sef_cb_init_fresh);
sef_setcb_init_restart(sef_cb_init_fresh);
/* Register live update callbacks. */
sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready);
sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard);
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);

View file

@ -114,8 +114,7 @@ static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/* No live update support for now. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Register signal callbacks. */
sef_setcb_signal_manager(process_ksig);

View file

@ -147,8 +147,6 @@ static void sef_local_startup()
sef_setcb_init_response(sef_cb_init_response);
sef_setcb_lu_response(sef_cb_lu_response);
/* No live update support for now. */
/* Register signal callbacks. */
sef_setcb_signal_handler(sef_cb_signal_handler);
sef_setcb_signal_manager(sef_cb_signal_manager);
@ -507,9 +505,9 @@ static int sef_cb_init_restart(int type, sef_init_info_t *info)
assert(info->endpoint == RS_PROC_NR);
/* Perform default state transfer first. */
r = SEF_CB_INIT_RESTART_DEFAULT(type, info);
r = SEF_CB_INIT_RESTART_STATEFUL(type, info);
if(r != OK) {
printf("SEF_CB_INIT_RESTART_DEFAULT failed: %d\n", r);
printf("SEF_CB_INIT_RESTART_STATEFUL failed: %d\n", r);
return r;
}
@ -557,7 +555,7 @@ static int sef_cb_init_lu(int type, sef_init_info_t *info)
assert(info->endpoint == RS_PROC_NR);
/* Perform default state transfer first. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_DEFAULT);
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
r = SEF_CB_INIT_LU_DEFAULT(type, info);
if(r != OK) {
printf("SEF_CB_INIT_LU_DEFAULT failed: %d\n", r);

View file

@ -12,6 +12,7 @@
/* Declare some local functions. */
static void reply(endpoint_t whom, message *m_ptr);
static void sef_local_startup(void);
static int sef_cb_init_fresh(int type, sef_init_info_t *info);
struct machine machine; /* machine info */
@ -26,16 +27,10 @@ int main(void)
int who_e; /* caller's endpoint */
int result; /* result to system call */
int rv;
int s;
/* SEF local startup. */
sef_local_startup();
if (OK != (s=sys_getmachine(&machine)))
panic("couldn't get machine info: %d", s);
/* Initialize scheduling timers, used for running balance_queues */
init_scheduling();
/* This is SCHED's main loop - get work and do it, forever and forever. */
while (TRUE) {
int ipc_status;
@ -115,10 +110,28 @@ static void reply(endpoint_t who_e, message *m_ptr)
*===========================================================================*/
static void sef_local_startup(void)
{
/* No init callbacks for now. */
/* No live update support for now. */
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* No signal callbacks for now. */
/* Let SEF perform startup. */
sef_startup();
}
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
int s;
if (OK != (s=sys_getmachine(&machine)))
panic("couldn't get machine info: %d", s);
/* Initialize scheduling timers, used for running balance_queues */
init_scheduling();
return(OK);
}

View file

@ -290,8 +290,7 @@ static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
/* No live update support for now. */
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
/* Let SEF perform startup. */
sef_startup();

View file

@ -661,13 +661,13 @@ static int sef_cb_init_lu_restart(int type, sef_init_info_t *info)
int old_p;
struct vmproc *old_vmp, *new_vmp;
/* Perform default state transfer first. Assume VM doesn't brk(). */
/* Perform default state transfer first. */
if(type == SEF_INIT_LU) {
sef_setcb_init_restart(SEF_CB_INIT_RESTART_DEFAULT);
sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL);
r = SEF_CB_INIT_LU_DEFAULT(type, info);
}
else {
r = SEF_CB_INIT_RESTART_DEFAULT(type, info);
r = SEF_CB_INIT_RESTART_STATEFUL(type, info);
}
if(r != OK) {
return r;