*/
void simcall_vm_restore(sg_host_t vm)
{
- simcall_BODY_vm_restore(vm);
+ simgrid::simix::kernelImmediate([vm]() {
+ if (SIMIX_vm_get_state(vm) != SURF_VM_STATE_SAVED)
+ THROWF(vm_error, 0, "VM(%s) was not saved", vm->name().c_str());
+
+ XBT_DEBUG("restore VM(%s), where %d processes exist", vm->name().c_str(),
+ xbt_swag_size(sg_host_simix(vm)->process_list));
+
+ /* jump to vm_ws_restore() */
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->restore();
+
+ smx_actor_t smx_process, smx_process_safe;
+ xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(vm)->process_list)
+ {
+ XBT_DEBUG("resume %s", smx_process->name.c_str());
+ SIMIX_process_resume(smx_process);
+ }
+ });
}
/**
*/
void simcall_vm_destroy(sg_host_t vm)
{
- simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_destroy, vm));
+ simgrid::simix::kernelImmediate([vm]() {
+ /* this code basically performs a similar thing like SIMIX_host_destroy() */
+ XBT_DEBUG("destroy %s", vm->name().c_str());
+
+ /* FIXME: this is really strange that everything fails if the next line is removed.
+ * This is as if we shared these data with the PM, which definitely should not be the case...
+ *
+ * We need to test that suspending a VM does not suspends the processes running on its PM, for example.
+ * Or we need to simplify this code enough to make it actually readable (but this sounds harder than testing)
+ */
+ vm->extension_set<simgrid::simix::Host>(nullptr);
+
+ /* Don't free these things twice: they are the ones of my physical host */
+ vm->pimpl_cpu = nullptr;
+ vm->pimpl_netcard = nullptr;
+
+ vm->destroy();
+ });
}
/**
simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
}
-static inline sg_host_t simcall_vm_restore__get__ind_vm(smx_simcall_t simcall) {
- return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
-}
-static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
- simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
-}
-
static inline smx_actor_t simcall_process_kill__get__process(smx_simcall_t simcall) {
return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
}
static inline void simcall_execution_parallel_start__set__rate(smx_simcall_t simcall, double arg) {
simgrid::simix::marshal<double>(simcall->args[6], arg);
}
-static inline double simcall_execution_parallel_start__get__timeout(smx_simcall_t simcall)
-{
+static inline double simcall_execution_parallel_start__get__timeout(smx_simcall_t simcall) {
return simgrid::simix::unmarshal<double>(simcall->args[7]);
}
-static inline void simcall_execution_parallel_start__set__timeout(smx_simcall_t simcall, double arg)
-{
- simgrid::simix::marshal<double>(simcall->args[7], arg);
+static inline void simcall_execution_parallel_start__set__timeout(smx_simcall_t simcall, double arg) {
+ simgrid::simix::marshal<double>(simcall->args[7], arg);
}
static inline smx_activity_t simcall_execution_parallel_start__get__result(smx_simcall_t simcall){
return simgrid::simix::unmarshal<smx_activity_t>(simcall->result);
inline static void simcall_BODY_vm_resume(sg_host_t ind_vm) {
/* Go to that function to follow the code flow through the simcall barrier */
- if (0)
- SIMIX_vm_resume(ind_vm);
+ if (0) SIMIX_vm_resume(ind_vm);
return simcall<void, sg_host_t>(SIMCALL_VM_RESUME, ind_vm);
}
return simcall<void, sg_host_t>(SIMCALL_VM_SAVE, ind_vm);
}
-inline static void simcall_BODY_vm_restore(sg_host_t ind_vm) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0)
- SIMIX_vm_restore(ind_vm);
- return simcall<void, sg_host_t>(SIMCALL_VM_RESTORE, ind_vm);
- }
-
inline static void simcall_BODY_process_kill(smx_actor_t process) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_process_kill(&SIMIX_process_self()->simcall, process);
inline static void simcall_BODY_process_resume(smx_actor_t process) {
/* Go to that function to follow the code flow through the simcall barrier */
- if (0)
- SIMIX_process_resume(process);
+ if (0) SIMIX_process_resume(process);
return simcall<void, smx_actor_t>(SIMCALL_PROCESS_RESUME, process);
}
if (0) simcall_HANDLER_execution_start(&SIMIX_process_self()->simcall, name, flops_amount, priority, bound);
return simcall<smx_activity_t, const char*, double, double, double>(SIMCALL_EXECUTION_START, name, flops_amount, priority, bound);
}
-
- inline static smx_activity_t simcall_BODY_execution_parallel_start(const char* name, int host_nb,
- sg_host_t* host_list, double* flops_amount,
- double* bytes_amount, double amount, double rate,
- double timeout)
- {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0)
- SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, timeout);
- return simcall<smx_activity_t, const char*, int, sg_host_t*, double*, double*, double, double, double>(
- SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, timeout);
+
+inline static smx_activity_t simcall_BODY_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate, double timeout) {
+ /* Go to that function to follow the code flow through the simcall barrier */
+ if (0) SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, timeout);
+ return simcall<smx_activity_t, const char*, int, sg_host_t*, double*, double*, double, double, double>(SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, timeout);
}
inline static void simcall_BODY_execution_cancel(smx_activity_t execution) {
SIMCALL_VM_RESUME,
SIMCALL_VM_SHUTDOWN,
SIMCALL_VM_SAVE,
- SIMCALL_VM_RESTORE,
SIMCALL_PROCESS_KILL,
SIMCALL_PROCESS_KILLALL,
SIMCALL_PROCESS_CLEANUP,
"SIMCALL_VM_RESUME",
"SIMCALL_VM_SHUTDOWN",
"SIMCALL_VM_SAVE",
- "SIMCALL_VM_RESTORE",
"SIMCALL_PROCESS_KILL",
"SIMCALL_PROCESS_KILLALL",
"SIMCALL_PROCESS_CLEANUP",
break;
case SIMCALL_VM_RESUME:
- SIMIX_vm_resume(simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
- SIMIX_simcall_answer(simcall);
- break;
+ SIMIX_vm_resume(simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
+ SIMIX_simcall_answer(simcall);
+ break;
case SIMCALL_VM_SHUTDOWN:
simcall_HANDLER_vm_shutdown(simcall, simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_VM_RESTORE:
- SIMIX_vm_restore(simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_PROCESS_KILL:
simcall_HANDLER_process_kill(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
SIMIX_simcall_answer(simcall);
break;
case SIMCALL_PROCESS_RESUME:
- SIMIX_process_resume(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
- SIMIX_simcall_answer(simcall);
- break;
+ SIMIX_process_resume(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
+ SIMIX_simcall_answer(simcall);
+ break;
case SIMCALL_PROCESS_SET_HOST:
simcall_HANDLER_process_set_host(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
break;
case SIMCALL_EXECUTION_PARALLEL_START:
- simgrid::simix::marshal<smx_activity_t>(
- simcall->result,
- SIMIX_execution_parallel_start(
- simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]),
- simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]),
- simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]),
- simgrid::simix::unmarshal<double>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7])));
- SIMIX_simcall_answer(simcall);
- break;
+ simgrid::simix::marshal<smx_activity_t>(simcall->result, SIMIX_execution_parallel_start(simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]), simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]), simgrid::simix::unmarshal<double>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7])));
+ SIMIX_simcall_answer(simcall);
+ break;
case SIMCALL_EXECUTION_CANCEL:
SIMIX_execution_cancel(simgrid::simix::unmarshal<smx_activity_t>(simcall->args[0]));
void vm_resume(sg_host_t ind_vm) [[nohandler]];
void vm_shutdown(sg_host_t ind_vm);
void vm_save(sg_host_t ind_vm);
-void vm_restore(sg_host_t ind_vm) [[nohandler]];
void process_kill(smx_actor_t process);
void process_killall(int reset_pid);
XBT_PRIVATE void SIMIX_set_category(smx_activity_t synchro, const char *category);
/* vm related stuff */
-XBT_PRIVATE void SIMIX_vm_destroy(sg_host_t ind_vm);
-// --
XBT_PRIVATE void SIMIX_vm_resume(sg_host_t ind_vm);
XBT_PRIVATE void SIMIX_vm_suspend(sg_host_t ind_vm, smx_actor_t issuer);
// --
XBT_PRIVATE void SIMIX_vm_save(sg_host_t ind_vm, smx_actor_t issuer);
-XBT_PRIVATE void SIMIX_vm_restore(sg_host_t ind_vm);
-// --
XBT_PRIVATE void SIMIX_vm_start(sg_host_t ind_vm);
XBT_PRIVATE void SIMIX_vm_shutdown(sg_host_t ind_vm, smx_actor_t issuer);
SIMIX_vm_save(vm, simcall->issuer);
}
-/**
- * @brief Function to restore a SIMIX VM host. This function restart the execution of the
- * VM. All the processes on this VM will run again.
- *
- * @param vm the vm host to restore (a sg_host_t)
- */
-void SIMIX_vm_restore(sg_host_t vm)
-{
- if (SIMIX_vm_get_state(vm) != SURF_VM_STATE_SAVED)
- THROWF(vm_error, 0, "VM(%s) was not saved", vm->name().c_str());
-
- XBT_DEBUG("restore VM(%s), where %d processes exist",
- vm->name().c_str(), xbt_swag_size(sg_host_simix(vm)->process_list));
-
- /* jump to vm_ws_restore() */
- static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->restore();
-
- smx_actor_t smx_process, smx_process_safe;
- xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(vm)->process_list) {
- XBT_DEBUG("resume %s", smx_process->name.c_str());
- SIMIX_process_resume(smx_process);
- }
-}
-
/**
* @brief Function to shutdown a SIMIX VM host. This function powers off the
* VM. All the processes on this VM will be killed. But, the state of the VM is
{
SIMIX_vm_shutdown(vm, simcall->issuer);
}
-
-/**
- * @brief Function to destroy a SIMIX VM host.
- *
- * @param vm the vm host to destroy (a sg_host_t)
- */
-void SIMIX_vm_destroy(sg_host_t vm)
-{
- /* this code basically performs a similar thing like SIMIX_host_destroy() */
- XBT_DEBUG("destroy %s", vm->name().c_str());
-
- /* FIXME: this is really strange that everything fails if the next line is removed.
- * This is as if we shared these data with the PM, which definitely should not be the case...
- *
- * We need to test that suspending a VM does not suspends the processes running on its PM, for example.
- * Or we need to simplify this code enough to make it actually readable (but this sounds harder than testing)
- */
- vm->extension_set<simgrid::simix::Host>(nullptr);
-
- /* Don't free these things twice: they are the ones of my physical host */
- vm->pimpl_cpu = nullptr;
- vm->pimpl_netcard = nullptr;
-
- vm->destroy();
-}