Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More progress toward the atomic simcall for vm migration - Ad(rien)
authorAdrien Lebre <alebre@dhcp-2-16.rech172-28.emn.fr>
Wed, 13 May 2015 12:37:31 +0000 (14:37 +0200)
committerAdrien Lebre <alebre@dhcp-2-16.rech172-28.emn.fr>
Wed, 13 May 2015 12:37:31 +0000 (14:37 +0200)
src/msg/msg_vm.c
src/simix/libsmx.c
src/simix/popping_accessors.h
src/simix/popping_bodies.c
src/simix/simcalls.in
src/simix/smx_vm.c

index ee3bd54..ac42d90 100644 (file)
@@ -392,16 +392,18 @@ static int migration_rx_fun(int argc, char *argv[])
    msg_host_t dst_pm = ms-> dst_pm;
    msg_host_priv_t priv = msg_host_resource_priv(vm);
 
    msg_host_t dst_pm = ms-> dst_pm;
    msg_host_priv_t priv = msg_host_resource_priv(vm);
 
-// 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
-  /* deinstall the current affinity setting for the CPU */
-  simcall_vm_set_affinity(vm, src_pm, 0);
-
-  /* Update the vm location */
-  simcall_vm_migrate(vm, dst_pm);
-  /* Resume the VM */
-  simcall_vm_resume(vm);
+// // 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
+//  /* deinstall the current affinity setting for the CPU */
+//  simcall_vm_set_affinity(vm, src_pm, 0);
+//
+//  /* Update the vm location */
+//  simcall_vm_migrate(vm, dst_pm);
+// 
+//  /* Resume the VM */
+//  simcall_vm_resume(vm);
+//
+   simcall_vm_migratefrom_resumeto(vm, src_pm, dst_pm); 
 
   /* install the affinity setting of the VM on the destination pm */
   {
 
   /* install the affinity setting of the VM on the destination pm */
   {
index b3c48f3..d5a78fa 100644 (file)
@@ -532,7 +532,6 @@ void simcall_vm_destroy(smx_host_t vm)
   simcall_BODY_vm_destroy(vm);
 }
 
   simcall_BODY_vm_destroy(vm);
 }
 
-Proc - vm_migratefrom_resumeto (void) (ind_vm, void*, smx_host_t)(ind_src_pm, void*, smx_host_t) (ind_dst_pm, void*, smx_host_t)
 /**
  * \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
 /**
  * \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
@@ -546,15 +545,12 @@ Proc - vm_migratefrom_resumeto (void) (ind_vm, void*, smx_host_t)(ind_src_pm, vo
  * \param vm VM to migrate
  * \param src_pm  Source physical host
  * \param dst_pmt Destination physical host
  * \param vm VM to migrate
  * \param src_pm  Source physical host
  * \param dst_pmt Destination physical host
  */
 void simcall_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
 {
   simcall_BODY_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
 }
 
  */
 void simcall_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
 {
   simcall_BODY_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
 }
 
-
-
 /**
  * \ingroup simix_process_management
  * \brief Creates and runs a new SIMIX process.
 /**
  * \ingroup simix_process_management
  * \brief Creates and runs a new SIMIX process.
index b307993..e551501 100644 (file)
@@ -584,22 +584,22 @@ static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, void*
     simcall->args[0].dp = arg;
 }
 
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_migratefrom_resumeto__get__ind_vm(smx_simcall_t simcall) {
+static inline smx_host_t simcall_vm_migratefrom_resumeto__get__vm(smx_simcall_t simcall) {
   return (smx_host_t) simcall->args[0].dp;
 }
   return (smx_host_t) simcall->args[0].dp;
 }
-static inline void simcall_vm_migratefrom_resumeto__set__ind_vm(smx_simcall_t simcall, void* arg) {
+static inline void simcall_vm_migratefrom_resumeto__set__vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_vm_migratefrom_resumeto__get__ind_src_pm(smx_simcall_t simcall) {
+static inline smx_host_t simcall_vm_migratefrom_resumeto__get__src_pm(smx_simcall_t simcall) {
   return (smx_host_t) simcall->args[1].dp;
 }
   return (smx_host_t) simcall->args[1].dp;
 }
-static inline void simcall_vm_migratefrom_resumeto__set__ind_src_pm(smx_simcall_t simcall, void* arg) {
+static inline void simcall_vm_migratefrom_resumeto__set__src_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
 }
     simcall->args[1].dp = arg;
 }
-static inline smx_host_t simcall_vm_migratefrom_resumeto__get__ind_dst_pm(smx_simcall_t simcall) {
+static inline smx_host_t simcall_vm_migratefrom_resumeto__get__dst_pm(smx_simcall_t simcall) {
   return (smx_host_t) simcall->args[2].dp;
 }
   return (smx_host_t) simcall->args[2].dp;
 }
-static inline void simcall_vm_migratefrom_resumeto__set__ind_dst_pm(smx_simcall_t simcall, void* arg) {
+static inline void simcall_vm_migratefrom_resumeto__set__dst_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[2].dp = arg;
 }
 
     simcall->args[2].dp = arg;
 }
 
index e538690..7b4a39c 100644 (file)
@@ -923,19 +923,19 @@ inline static void simcall_BODY_vm_restore(smx_host_t ind_vm) {
     
   }
   
     
   }
   
-inline static void simcall_BODY_vm_migratefrom_resumeto(smx_host_t ind_vm, smx_host_t ind_src_pm, smx_host_t ind_dst_pm) {
+inline static void simcall_BODY_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_migratefrom_resumeto(ind_vm, ind_src_pm, ind_dst_pm);
+    if (0) SIMIX_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
     self->simcall.call = SIMCALL_VM_MIGRATEFROM_RESUMETO;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
     self->simcall.call = SIMCALL_VM_MIGRATEFROM_RESUMETO;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    self->simcall.args[1].dp = (void*) ind_src_pm;
-    self->simcall.args[2].dp = (void*) ind_dst_pm;
+    self->simcall.args[0].dp = (void*) vm;
+    self->simcall.args[1].dp = (void*) src_pm;
+    self->simcall.args[2].dp = (void*) dst_pm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
index e8faeb1..d3986bb 100644 (file)
@@ -84,7 +84,7 @@ Proc H vm_resume (void) (ind_vm, void*, smx_host_t)
 Proc H vm_shutdown (void) (ind_vm, void*, smx_host_t)
 Proc H vm_save (void) (ind_vm, void*, smx_host_t)
 Proc H vm_restore (void) (ind_vm, void*, smx_host_t)
 Proc H vm_shutdown (void) (ind_vm, void*, smx_host_t)
 Proc H vm_save (void) (ind_vm, void*, smx_host_t)
 Proc H vm_restore (void) (ind_vm, void*, smx_host_t)
-Proc - vm_migratefrom_resumeto (void) (ind_vm, void*, smx_host_t)(ind_src_pm, void*, smx_host_t) (ind_dst_pm, void*, smx_host_t)
+Proc - vm_migratefrom_resumeto (void) (vm, void*, smx_host_t)(src_pm, void*, smx_host_t) (dst_pm, void*, smx_host_t)
 Proc H process_create (void) (process, void*, smx_process_t*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int)
 Proc H process_kill (void) (process, void*, smx_process_t)
 Proc H process_killall (void) (reset_pid, int)
 Proc H process_create (void) (process, void*, smx_process_t*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int)
 Proc H process_kill (void) (process, void*, smx_process_t)
 Proc H process_killall (void) (reset_pid, int)
index d2eab04..9bf0d6b 100644 (file)
@@ -116,6 +116,31 @@ void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm)
   surf_vm_workstation_migrate(ind_vm, ind_dst_pm);
 }
 
   surf_vm_workstation_migrate(ind_vm, ind_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_set_affinity(vm, src_pm, 0); 
+ *     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(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
+{
+  /* deinstall the current affinity setting for the CPU */
+  SIMIX _vm_set_affinity(vm, src_pm, 0);
+
+  /* Update the vm location */
+  SIMIX_vm_migrate(vm, dst_pm);
+  /* Resume the VM */
+  SIMIX_vm_resume(vm);
+} 
+
 /**
  * \brief Function to get the physical host of the given SIMIX VM host.
  *
 /**
  * \brief Function to get the physical host of the given SIMIX VM host.
  *