From 42cfbbdfaf9122139df7a1b9dda96dd6b689c563 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 19 Nov 2016 22:54:47 +0100 Subject: [PATCH 1/1] inline a bunch of VM functions --- include/simgrid/simix.h | 1 - src/msg/msg_vm.cpp | 10 +++++++++- src/simix/libsmx.cpp | 19 ------------------- src/simix/smx_host_private.h | 2 -- src/simix/smx_vm.cpp | 21 --------------------- 5 files changed, 9 insertions(+), 44 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 40f0295ccc..c3ea65732d 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -266,7 +266,6 @@ 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); -XBT_PUBLIC(void) simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm); XBT_PUBLIC(void) simcall_vm_save(sg_host_t vm); XBT_PUBLIC(void) simcall_vm_restore(sg_host_t vm); XBT_PUBLIC(void) simcall_vm_suspend(sg_host_t vm); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 0d5304b91d..77b9855e3a 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -20,6 +20,8 @@ #include "xbt/log.h" #include "simgrid/host.h" +#include "src/simix/smx_host_private.h" /* don't ask me why the VM functions are in there (FIXME:KILLME) */ + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg, "Cloud-oriented parts of the MSG API"); @@ -342,7 +344,13 @@ static int migration_rx_fun(int argc, char *argv[]) // /* Resume the VM */ // simcall_vm_resume(vm); // - simcall_vm_migratefrom_resumeto(vm, src_pm, dst_pm); + simgrid::simix::kernelImmediate([vm, src_pm, dst_pm]() { + /* Update the vm location */ + SIMIX_vm_migrate(vm, dst_pm); + + /* Resume the VM */ + SIMIX_vm_resume(vm); + }); { // Now the VM is running on the new host (the migration is completed) (even if the SRC crash) diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index a522ef764c..13bbba3d67 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -320,25 +320,6 @@ void simcall_vm_destroy(sg_host_t vm) simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_destroy, vm)); } -/** - * \ingroup simix_vm_management - * \brief Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration - * The simcall actually invokes the following calls: - * simcall_vm_migrate(vm, dst_pm); - * simcall_vm_resume(vm); - * - * It is called at the end of the migration_rx_fun function from msg/msg_vm.c - * - * \param vm VM to migrate - * \param src_pm Source physical host - * \param dst_pmt Destination physical host - */ -void simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm) -{ - simgrid::simix::kernelImmediate(std::bind( - SIMIX_vm_migratefrom_resumeto, vm, src_pm, dst_pm)); -} - /** * \ingroup simix_process_management * \brief Kills a SIMIX process. diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index b8d2920cd1..16a099a27e 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -86,8 +86,6 @@ XBT_PRIVATE e_surf_vm_state_t SIMIX_vm_get_state(sg_host_t ind_vm); // -- XBT_PRIVATE void SIMIX_vm_migrate(sg_host_t ind_vm, sg_host_t ind_dst_pm); -XBT_PRIVATE void SIMIX_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm); - SG_END_DECL() #endif diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 0eb77b56b6..f6d3396b46 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -92,27 +92,6 @@ void SIMIX_vm_migrate(sg_host_t vm, sg_host_t dst_pm) static_cast(vm)->pimpl_vm_->migrate(dst_pm); } -/** - * @brief Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration - * The simcall actually invokes the following calls: - * simcall_vm_migrate(vm, dst_pm); - * simcall_vm_resume(vm); - * - * It is called at the end of the migration_rx_fun function from msg/msg_vm.c - * - * @param vm VM to migrate - * @param src_pm Source physical host - * @param dst_pmt Destination physical host - */ -void SIMIX_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm) -{ - /* Update the vm location */ - SIMIX_vm_migrate(vm, dst_pm); - - /* Resume the VM */ - SIMIX_vm_resume(vm); -} - /** * @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