Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
authorAdrien Lebre <alebre@dhcp-2-16.rech172-28.emn.fr>
Tue, 19 May 2015 13:35:27 +0000 (15:35 +0200)
committerAdrien Lebre <alebre@dhcp-2-16.rech172-28.emn.fr>
Tue, 19 May 2015 13:35:27 +0000 (15:35 +0200)
1  2 
src/simix/libsmx.c
src/simix/popping_bodies.c
src/simix/popping_generated.c

diff --combined src/simix/libsmx.c
  /* This program is free software; you can redistribute it and/or modify it
   * under the terms of the license (GNU LGPL) which comes with this package.   */
  
+ #include "mc/mc_replay.h"
  #include "smx_private.h"
- #include "mc/mc_interface.h"
+ #include "mc/mc_forward.h"
  #include "xbt/ex.h"
  #include <math.h>         /* isfinite() */
+ #include "mc/mc.h"
  
  XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
  
@@@ -532,24 -534,6 +534,24 @@@ void simcall_vm_destroy(smx_host_t vm
    simcall_BODY_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_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 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
@@@ -755,7 -739,7 +757,7 @@@ void simcall_process_set_kill_time(smx_
      if (simix_global->kill_process_function) {
        XBT_DEBUG("Set kill time %f for process %s(%s)",kill_time, process->name,
            sg_host_name(process->smx_host));
-       SIMIX_timer_set(kill_time, simix_global->kill_process_function, process);
+       process->kill_timer = SIMIX_timer_set(kill_time, simix_global->kill_process_function, process);
      }
    }
  }
@@@ -14,7 -14,7 +14,7 @@@
   */
  
  #include "smx_private.h"
- #include "mc/mc_interface.h"
+ #include "mc/mc_forward.h"
  #include "xbt/ex.h"
    
  inline static smx_host_t simcall_BODY_host_get_by_name(const char* name) {
@@@ -923,29 -923,6 +923,29 @@@ inline static void simcall_BODY_vm_rest
      
    }
    
 +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 */
 +    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));
 +    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);
 +      SIMIX_process_yield(self);
 +    } else {
 +      SIMIX_simcall_handle(&self->simcall, 0);
 +    }    
 +    
 +  }
 +  
  inline static void simcall_BODY_process_create(smx_process_t* process, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart) {
      smx_process_t self = SIMIX_process_self();
  
@@@ -15,6 -15,7 +15,7 @@@
  
  #include "smx_private.h"
  #ifdef HAVE_MC
+ #include "mc/mc_process.h"
  #endif
  
  XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
@@@ -63,7 -64,6 +64,7 @@@ const char* simcall_names[] = 
    [SIMCALL_VM_SHUTDOWN] = "SIMCALL_VM_SHUTDOWN",
    [SIMCALL_VM_SAVE] = "SIMCALL_VM_SAVE",
    [SIMCALL_VM_RESTORE] = "SIMCALL_VM_RESTORE",
 +  [SIMCALL_VM_MIGRATEFROM_RESUMETO] = "SIMCALL_VM_MIGRATEFROM_RESUMETO",
    [SIMCALL_PROCESS_CREATE] = "SIMCALL_PROCESS_CREATE",
    [SIMCALL_PROCESS_KILL] = "SIMCALL_PROCESS_KILL",
    [SIMCALL_PROCESS_KILLALL] = "SIMCALL_PROCESS_KILLALL",
@@@ -373,11 -373,6 +374,11 @@@ case SIMCALL_VM_RESTORE
        SIMIX_simcall_answer(simcall);
        break;  
  
 +case SIMCALL_VM_MIGRATEFROM_RESUMETO:
 +       SIMIX_vm_migratefrom_resumeto((smx_host_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp,(smx_host_t) simcall->args[2].dp);
 +      SIMIX_simcall_answer(simcall);
 +      break;  
 +
  case SIMCALL_PROCESS_CREATE:
         simcall_HANDLER_process_create(simcall , (smx_process_t*) simcall->args[0].dp,  simcall->args[1].cc, (xbt_main_func_t) simcall->args[2].fp,  simcall->args[3].dp,  simcall->args[4].cc,  simcall->args[5].d,  simcall->args[6].i, (char**) simcall->args[7].dp, (xbt_dict_t) simcall->args[8].dp,  simcall->args[9].i);
        SIMIX_simcall_answer(simcall);