From: Martin Quinson Date: Tue, 22 Nov 2016 09:37:07 +0000 (+0100) Subject: VM: getters should not be simcalls X-Git-Tag: v3_14~153 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e8c861edf6ed4761a4780c12852a28e540d9fdc4 VM: getters should not be simcalls Removing a simcall changes a bit the output, but that's ok --- diff --git a/examples/msg/cloud-migration/cloud-migration.tesh b/examples/msg/cloud-migration/cloud-migration.tesh index c66bb02e63..2c119003ef 100644 --- a/examples/msg/cloud-migration/cloud-migration.tesh +++ b/examples/msg/cloud-migration/cloud-migration.tesh @@ -12,13 +12,13 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-migration ${srcdir:=.}/small_platform.xml -- > [146.111793] (11:__pr_mig_tx:VM1(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms > [411.540563] (0:maestro@) FIXME: may need a proper handling, 1 > [411.540563] (0:maestro@) FIXME: may need a proper handling, 1 -> [411.566271] (7:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s +> [411.566271] (8:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s > [411.566271] (6:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.454 s > [10146.111793] (1:master_@Fafard) Test: Migrate two VMs at once to different PMs > [10146.111793] (15:__pr_mig_tx:VM0(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms > [10146.111793] (17:__pr_mig_tx:VM1(Fafard-Bourassa)@Fafard) use the default max_downtime value 30ms > [10362.613818] (0:maestro@) FIXME: may need a proper handling, 1 -> [10362.620589] (13:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s +> [10362.620589] (14:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s > [10411.521626] (0:maestro@) FIXME: may need a proper handling, 1 > [10411.547334] (12:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.436 s > [20146.111793] (0:maestro@) Bye (simulation time 20146.1) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index cbd0318e7c..7afd8d23c7 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -260,7 +260,6 @@ 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_start(sg_host_t vm); -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_save(sg_host_t vm); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index b91f255b5a..2e9c361e51 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -871,7 +871,8 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm) * The second one would be easier. */ - msg_host_t old_pm = (msg_host_t) simcall_vm_get_pm(vm); + simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; + msg_host_t old_pm = pimpl->getPm(); if(MSG_host_is_off(old_pm)) THROWF(vm_error, 0, "SRC host(%s) seems off, cannot start a migration", sg_host_get_name(old_pm)); @@ -885,8 +886,7 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm) if (MSG_vm_is_migrating(vm)) THROWF(vm_error, 0, "VM(%s) is already migrating", sg_host_get_name(vm)); - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; - pimpl->isMigrating = 1; + pimpl->isMigrating = 1; { int ret = do_migration(vm, old_pm, new_pm); @@ -994,7 +994,7 @@ void MSG_vm_restore(msg_vm_t vm) */ msg_host_t MSG_vm_get_pm(msg_vm_t vm) { - return (msg_host_t) simcall_vm_get_pm(vm); + return static_cast(vm)->pimpl_vm_->getPm(); } /** @brief Set a CPU bound for a given VM. diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 606f99a616..a3bf0a9aa6 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -186,19 +186,6 @@ void simcall_vm_start(sg_host_t vm) simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_start, vm)); } -/** - * \ingroup simix_vm_management - * \brief Get the physical host on which the given VM runs. - * - * \param vm VM - * \return The physical host - */ -void *simcall_vm_get_pm(sg_host_t vm) -{ - return simgrid::simix::kernelImmediate( - [vm]() { return static_cast(vm)->pimpl_vm_->getPm(); }); -} - /** * @brief Function to set the CPU bound of the given SIMIX VM host. *