From: Martin Quinson Date: Mon, 19 Dec 2016 14:38:57 +0000 (+0100) Subject: convert another VM simcall into a s4u method X-Git-Tag: v3_14~26 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9247d4b33ae71aa749f24c052cae31a133fa9f61 convert another VM simcall into a s4u method --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 7935d29187..8d06139ef4 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -258,8 +258,6 @@ XBT_PUBLIC(void) simcall_execution_set_bound(smx_activity_t execution, double bo 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); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 4b6514f687..2f3b93dfd6 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -323,11 +323,9 @@ static int migration_rx_fun(int argc, char *argv[]) /* 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(); }); { @@ -723,7 +721,7 @@ static int migration_tx_fun(int argc, char *argv[]) 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(ms->vm)->pimpl_vm_->resume(); return 0; } @@ -858,7 +856,7 @@ void MSG_vm_suspend(msg_vm_t vm) */ void MSG_vm_resume(msg_vm_t vm) { - simcall_vm_resume(vm); + static_cast(vm)->pimpl_vm_->resume(); if (TRACE_msg_vm_is_enabled()) { container_t vm_container = PJ_container_get(vm->cname()); diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 5c4345ab8c..74d2ea749d 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -162,7 +162,20 @@ void VirtualMachineImpl::suspend() 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()->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; } @@ -171,7 +184,7 @@ void VirtualMachineImpl::resume() * 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) { diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 347fa98355..5afac827ef 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -172,17 +172,6 @@ void simcall_vm_suspend(sg_host_t vm) 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 diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 1c1a3532e5..70ef173af5 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -21,13 +21,6 @@ static inline void simcall_vm_suspend__set__ind_vm(smx_simcall_t simcall, sg_hos simgrid::simix::marshal(simcall->args[0], arg); } -static inline sg_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall) { - return simgrid::simix::unmarshal(simcall->args[0]); -} -static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) { - simgrid::simix::marshal(simcall->args[0], arg); -} - static inline sg_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall) { return simgrid::simix::unmarshal(simcall->args[0]); } diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index b2da1e10a7..78d1a92e79 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -41,12 +41,6 @@ inline static void simcall_BODY_vm_suspend(sg_host_t ind_vm) { return simcall(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(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); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 50ce0314ae..f7effdb519 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -19,7 +19,6 @@ typedef enum { SIMCALL_NONE, SIMCALL_VM_SUSPEND, - SIMCALL_VM_RESUME, SIMCALL_VM_SHUTDOWN, SIMCALL_PROCESS_KILL, SIMCALL_PROCESS_KILLALL, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 1e2481f350..16081732df 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -24,7 +24,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping); /** @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", @@ -105,11 +104,6 @@ case SIMCALL_VM_SUSPEND: SIMIX_simcall_answer(simcall); break; -case SIMCALL_VM_RESUME: - SIMIX_vm_resume(simgrid::simix::unmarshal(simcall->args[0])); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_VM_SHUTDOWN: simcall_HANDLER_vm_shutdown(simcall, simgrid::simix::unmarshal(simcall->args[0])); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 66aa969ca9..c8de23a905 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -37,7 +37,6 @@ # 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); diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index 2a255b6b75..cc6e69768b 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -67,8 +67,6 @@ XBT_PRIVATE void SIMIX_execution_finish(simgrid::kernel::activity::Exec *exec); 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); diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 49115f1753..ffea83851a 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -47,30 +47,6 @@ void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, sg_host_t vm) 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(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(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