From 0586543235cb7550a5952d01af0d4f656670c622 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 20 Nov 2016 20:12:50 +0100 Subject: [PATCH] inline another VM function, and kill another one, unused --- include/simgrid/simix.h | 1 - src/msg/msg_vm.cpp | 17 ++++++----------- src/simix/libsmx.cpp | 12 ------------ src/simix/smx_host_private.h | 2 -- src/simix/smx_vm.cpp | 14 -------------- 5 files changed, 6 insertions(+), 40 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 59cc0fb446..4964376be9 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -261,7 +261,6 @@ XBT_PUBLIC(e_smx_state_t) simcall_execution_wait(smx_activity_t execution); // Create the vm_workstation at the SURF level XBT_PUBLIC(sg_host_t) simcall_vm_create(const char *name, sg_host_t host); XBT_PUBLIC(void) simcall_vm_start(sg_host_t vm); -XBT_PUBLIC(void) simcall_vm_migrate(sg_host_t vm, sg_host_t dst_pm); XBT_PUBLIC(void *) simcall_vm_get_pm(sg_host_t vm); XBT_PUBLIC(void) simcall_vm_set_bound(sg_host_t vm, double bound); XBT_PUBLIC(void) simcall_vm_resume(sg_host_t vm); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index fb1e82d780..c70ff31bd4 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -337,19 +337,14 @@ static int migration_rx_fun(int argc, char *argv[]) msg_host_t src_pm = ms->src_pm; msg_host_t dst_pm = ms->dst_pm; - // TODO: we have an issue, if the DST node is turning off during the three next calls, then the VM is in an - // inconsistent - // state. I should check with Takahiro in order to make this portion of code atomic - // - // /* Update the vm location */ - // simcall_vm_migrate(vm, dst_pm); - // - // /* Resume the VM */ - // simcall_vm_resume(vm); - // + // Make sure that we cannot get interrupted between the migrate and the resume to not end in an inconsistent state simgrid::simix::kernelImmediate([vm, src_pm, dst_pm]() { /* Update the vm location */ - SIMIX_vm_migrate(vm, dst_pm); + /* precopy migration makes the VM temporally paused */ + xbt_assert(static_cast(vm)->pimpl_vm_->getState() == SURF_VM_STATE_SUSPENDED); + + /* jump to vm_ws_xigrate(). this will update the vm location. */ + static_cast(vm)->pimpl_vm_->migrate(dst_pm); /* Resume the VM */ SIMIX_vm_resume(vm); diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 1f15dfe8d1..c506bfeae8 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -230,18 +230,6 @@ void simcall_vm_set_bound(sg_host_t vm, double bound) [vm, bound]() { static_cast(vm)->pimpl_vm_->setBound(bound); }); } -/** - * \ingroup simix_vm_management - * \brief Migrate the given VM to the given physical host - * - * \param vm VM - * \param host Destination physical host - */ -void simcall_vm_migrate(sg_host_t vm, sg_host_t host) -{ - simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_migrate, vm, host)); -} - /** * \ingroup simix_vm_management * \brief Suspend the given VM diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index d87ae8b34e..794df1984c 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -78,8 +78,6 @@ 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); // -- -XBT_PRIVATE void SIMIX_vm_migrate(sg_host_t ind_vm, sg_host_t ind_dst_pm); - SG_END_DECL() #endif diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 515fb1ffd9..e11f0777d4 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -54,20 +54,6 @@ void SIMIX_vm_start(sg_host_t vm) static_cast(vm)->pimpl_vm_->setState(SURF_VM_STATE_RUNNING); } -/** - * @brief Function to migrate a SIMIX VM host. - * - * @param host the vm host to migrate (a sg_host_t) - */ -void SIMIX_vm_migrate(sg_host_t vm, sg_host_t dst_pm) -{ - /* precopy migration makes the VM temporally paused */ - xbt_assert(static_cast(vm)->pimpl_vm_->getState() == SURF_VM_STATE_SUSPENDED); - - /* jump to vm_ws_xigrate(). this will update the vm location. */ - static_cast(vm)->pimpl_vm_->migrate(dst_pm); -} - /** * @brief Function to suspend a SIMIX VM host. This function stops the execution of the * VM. All the processes on this VM will pause. The state of the VM is -- 2.20.1