XBT_PUBLIC(e_smx_state_t) simcall_execution_wait(smx_activity_t execution);
/******************************* VM simcalls ********************************/
-// Create the vm_workstation at the SURF level
-XBT_PUBLIC(void) simcall_vm_resume(sg_host_t vm);
XBT_PUBLIC(void) simcall_vm_suspend(sg_host_t vm);
XBT_PUBLIC(void) simcall_vm_shutdown(sg_host_t vm);
/* precopy migration makes the VM temporally paused */
xbt_assert(vm->pimpl_vm_->getState() == SURF_VM_STATE_SUSPENDED);
- /* jump to vm_ws_xigrate(). this will update the vm location. */
+ /* Update the vm location and resume it */
vm->pimpl_vm_->migrate(dst_pm);
-
- /* Resume the VM */
- SIMIX_vm_resume(vm);
+ vm->pimpl_vm_->resume();
});
{
catch(xbt_ex& e) {
//hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
// Stop the dirty page tracking an return (there is no memory space to release)
- simcall_vm_resume(ms->vm);
+ static_cast<simgrid::s4u::VirtualMachine*>(ms->vm)->pimpl_vm_->resume();
return 0;
}
*/
void MSG_vm_resume(msg_vm_t vm)
{
- simcall_vm_resume(vm);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->resume();
if (TRACE_msg_vm_is_enabled()) {
container_t vm_container = PJ_container_get(vm->cname());
void VirtualMachineImpl::resume()
{
+ if (getState() != SURF_VM_STATE_SUSPENDED)
+ THROWF(vm_error, 0, "Cannot resume VM %s: it was not suspended", piface_->cname());
+
+ xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
+ XBT_DEBUG("Resume VM %s, containing %d processes.", piface_->cname(), xbt_swag_size(process_list));
+
action_->resume();
+
+ smx_actor_t smx_process, smx_process_safe;
+ xbt_swag_foreach_safe(smx_process, smx_process_safe, process_list) {
+ XBT_DEBUG("resume %s", smx_process->cname());
+ SIMIX_process_resume(smx_process);
+ }
+
vmState_ = SURF_VM_STATE_RUNNING;
}
* This function is the same as vm_suspend, but the state of the VM is saved to the disk, and not preserved in memory.
* We can later restore it again.
*
- * @param vm the vm host to save (a sg_host_t)
+ * @param issuer the process requesting this operation
*/
void VirtualMachineImpl::save(smx_actor_t issuer)
{
simcall_BODY_vm_suspend(vm);
}
-/**
- * \ingroup simix_vm_management
- * \brief Resume the given VM
- *
- * \param vm VM
- */
-void simcall_vm_resume(sg_host_t vm)
-{
- simcall_BODY_vm_resume(vm);
-}
-
/**
* \ingroup simix_vm_management
* \brief Shutdown the given VM
simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
}
-static inline sg_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall) {
- return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
-}
-static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
- simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
-}
-
static inline sg_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall) {
return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
}
return simcall<void, sg_host_t>(SIMCALL_VM_SUSPEND, ind_vm);
}
-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);
- return simcall<void, sg_host_t>(SIMCALL_VM_RESUME, ind_vm);
- }
-
inline static void simcall_BODY_vm_shutdown(sg_host_t ind_vm) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_vm_shutdown(&SIMIX_process_self()->simcall, ind_vm);
typedef enum {
SIMCALL_NONE,
SIMCALL_VM_SUSPEND,
- SIMCALL_VM_RESUME,
SIMCALL_VM_SHUTDOWN,
SIMCALL_PROCESS_KILL,
SIMCALL_PROCESS_KILLALL,
/** @brief Simcalls' names (generated from src/simix/simcalls.in) */
const char* simcall_names[] = {
"SIMCALL_NONE", "SIMCALL_VM_SUSPEND",
- "SIMCALL_VM_RESUME",
"SIMCALL_VM_SHUTDOWN",
"SIMCALL_PROCESS_KILL",
"SIMCALL_PROCESS_KILLALL",
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_VM_RESUME:
- 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);
# compilation time)
void vm_suspend(sg_host_t ind_vm);
-void vm_resume(sg_host_t ind_vm) [[nohandler]];
void vm_shutdown(sg_host_t ind_vm);
void process_kill(smx_actor_t process);
XBT_PRIVATE void SIMIX_set_category(smx_activity_t synchro, const char *category);
/* vm related stuff */
-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_shutdown(sg_host_t ind_vm, smx_actor_t issuer);
XBT_DEBUG("simcall_HANDLER_vm_suspend done");
}
-
-/**
- * @brief Function to resume 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 resume (a sg_host_t)
- */
-void SIMIX_vm_resume(sg_host_t vm)
-{
- if (static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getState() != SURF_VM_STATE_SUSPENDED)
- THROWF(vm_error, 0, "VM(%s) was not suspended", vm->cname());
-
- XBT_DEBUG("resume VM(%s), where %d processes exist", vm->cname(), xbt_swag_size(sg_host_simix(vm)->process_list));
-
- /* jump to vm_ws_resume() */
- static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->resume();
-
- 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