sef: Support for LLVM ltckpt instrumentation.

Change-Id: I86073bddc3a820ab3d7c5d016ea1348840b0260a
This commit is contained in:
Cristiano Giuffrida 2014-10-29 23:18:38 +01:00 committed by David van Moolenbroek
parent 3f82ac6a4e
commit 43065aa378
3 changed files with 38 additions and 3 deletions

View file

@ -69,6 +69,7 @@ int sef_cb_init_fail(int type, sef_init_info_t *info);
int sef_cb_init_reset(int type, sef_init_info_t *info);
int sef_cb_init_crash(int type, sef_init_info_t *info);
int sef_cb_init_timeout(int type, sef_init_info_t *info);
int sef_cb_init_restart_generic(int type, sef_init_info_t *info);
int sef_cb_init_identity_state_transfer(int type, sef_init_info_t *info);
int sef_cb_init_lu_identity_as_restart(int type, sef_init_info_t *info);
int sef_cb_init_lu_generic(int type, sef_init_info_t *info);
@ -80,7 +81,7 @@ 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_RESTART_STATEFUL sef_cb_init_restart_generic
#define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_lu_generic
@ -375,6 +376,7 @@ int sef_llvm_ac_munmap(void *buf, size_t len);
int sef_llvm_ltckpt_enabled(void);
int sef_llvm_get_ltckpt_offset(void);
int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info);
#if !defined(USE_LIVEUPDATE)
#undef INTERCEPT_SEF_LU_REQUESTS

View file

@ -306,6 +306,25 @@ int sef_cb_init_timeout(int UNUSED(type), sef_init_info_t *UNUSED(info))
return EBADCALL;
}
/*===========================================================================*
* sef_cb_init_restart_generic *
*===========================================================================*/
int sef_cb_init_restart_generic(int type, sef_init_info_t *info)
{
/* Always resort to simple identity transfer for self updates. */
if (type == SEF_INIT_LU && (info->flags & SEF_LU_SELF))
return sef_cb_init_identity_state_transfer(type, info);
/* Can only handle restart otherwise. */
if(type != SEF_INIT_RESTART) {
printf("sef_cb_init_restart_generic: init failed\n");
return ENOSYS;
}
/* Perform instrumentation-supported checkpoint-restart. */
return sef_llvm_ltckpt_restart(type, info);
}
/*===========================================================================*
* sef_cb_init_identity_state_transfer *
*===========================================================================*/

View file

@ -209,8 +209,8 @@ int sef_llvm_ac_munmap(void *buf, size_t len)
*===========================================================================*/
int sef_llvm_ltckpt_enabled()
{
extern int __attribute__((weak)) ltckpt_get_offset();
if (!ltckpt_get_offset)
extern int __attribute__((weak)) ltckpt_mechanism_enabled(void);
if (!sef_llvm_get_ltckpt_offset() || !ltckpt_mechanism_enabled())
return 0;
return 1;
}
@ -226,3 +226,17 @@ int sef_llvm_get_ltckpt_offset()
return ltckpt_get_offset();
}
/*===========================================================================*
* sef_llvm_ltckpt_restart *
*===========================================================================*/
int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info)
{
extern int __attribute__((weak)) ltckpt_restart(void *);
if(!sef_llvm_ltckpt_enabled())
return sef_cb_init_identity_state_transfer(type, info);
assert(ltckpt_restart);
return ltckpt_restart(info);
}