From: Frederic Suter Date: Fri, 11 Aug 2017 13:26:07 +0000 (+0200) Subject: kill kill simcall X-Git-Tag: v3_17~208 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4c372fe556f773fbce3514655087de660dbe6b1a kill kill simcall --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 80721f53a8..de1ac3ad5f 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -199,7 +199,6 @@ XBT_PUBLIC(smx_actor_t) simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc, char** argv, std::map* properties); -XBT_PUBLIC(void) simcall_process_kill(smx_actor_t process); XBT_PUBLIC(void) simcall_process_killall(int reset_pid); XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg); diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 7dcef8fee5..f3f5ab06bf 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -134,7 +134,7 @@ void Actor::kill(aid_t pid) { smx_actor_t process = SIMIX_process_from_PID(pid); if(process != nullptr) { - simcall_process_kill(process); + simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); }); } else { std::ostringstream oss; oss << "kill: ("<< pid <<") - No such process" << std::endl; @@ -147,7 +147,9 @@ smx_actor_t Actor::getImpl() { } void Actor::kill() { - simcall_process_kill(pimpl_); + smx_actor_t process = SIMIX_process_self(); + simgrid::simix::kernelImmediate( + [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); }); } // ***** Static functions ***** @@ -294,7 +296,8 @@ bool isSuspended() void kill() { - simcall_process_kill(SIMIX_process_self()); + smx_actor_t process = SIMIX_process_self(); + simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); }); } void onExit(int_f_pvoid_pvoid_t fun, void* data) diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 00d518b6ca..610678fe55 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -457,9 +457,6 @@ void SIMIX_process_runall() simix_global->process_to_run.clear(); } -void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process) { - SIMIX_process_kill(process, simcall->issuer); -} /** * \brief Internal function to kill a SIMIX process. * diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 16ee544e22..d8a0a0f711 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -154,19 +154,6 @@ e_smx_state_t simcall_execution_wait(smx_activity_t execution) return (e_smx_state_t) simcall_BODY_execution_wait(execution); } -/** - * \ingroup simix_process_management - * \brief Kills a SIMIX process. - * - * This function simply kills a process. - * - * \param process poor victim - */ -void simcall_process_kill(smx_actor_t process) -{ - simcall_BODY_process_kill(process); -} - /** * \ingroup simix_process_management * \brief Kills all SIMIX processes. diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index d16dc06c78..eb130f4bd7 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -15,19 +15,6 @@ */ #include "src/simix/popping_private.h" -static inline smx_actor_t simcall_process_kill__get__process(smx_simcall_t simcall) -{ - return simgrid::simix::unmarshal(simcall->args[0]); -} -static inline smx_actor_t simcall_process_kill__getraw__process(smx_simcall_t simcall) -{ - return simgrid::simix::unmarshal_raw(simcall->args[0]); -} -static inline void simcall_process_kill__set__process(smx_simcall_t simcall, smx_actor_t arg) -{ - simgrid::simix::marshal(simcall->args[0], arg); -} - static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall) { return simgrid::simix::unmarshal(simcall->args[0]); @@ -1461,7 +1448,6 @@ static inline void simcall_run_blocking__set__code(smx_simcall_t simcall, std::f /* The prototype of all simcall handlers, automatically generated for you */ -XBT_PRIVATE void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process); XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid); XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process); XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout); diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index c2c83cc915..3a1bd5edbb 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -36,12 +36,6 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) return simgrid::simix::unmarshal(self->simcall.result); } -inline static void simcall_BODY_process_kill(smx_actor_t process) { - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_process_kill(&SIMIX_process_self()->simcall, process); - return simcall(SIMCALL_PROCESS_KILL, process); - } - inline static void simcall_BODY_process_killall(int reset_pid) { /* Go to that function to follow the code flow through the simcall barrier */ if (0) simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 8c5c93730d..a2f3155909 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -19,7 +19,6 @@ */ typedef enum { SIMCALL_NONE, - SIMCALL_PROCESS_KILL, SIMCALL_PROCESS_KILLALL, SIMCALL_PROCESS_CLEANUP, SIMCALL_PROCESS_SUSPEND, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index d388546ea4..e52c41f726 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -25,7 +25,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping); /** @brief Simcalls' names (generated from src/simix/simcalls.in) */ const char* simcall_names[] = { "SIMCALL_NONE", - "SIMCALL_PROCESS_KILL", "SIMCALL_PROCESS_KILLALL", "SIMCALL_PROCESS_CLEANUP", "SIMCALL_PROCESS_SUSPEND", @@ -76,11 +75,6 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) { if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP) return; switch (simcall->call) { -case SIMCALL_PROCESS_KILL: - simcall_HANDLER_process_kill(simcall, simgrid::simix::unmarshal(simcall->args[0])); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_PROCESS_KILLALL: simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal(simcall->args[0])); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 3a6cc0f0af..c13413f840 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -35,7 +35,6 @@ # Last but not the least, you should declare the new simix call in # ./include/simgrid/simix.h (otherwise you will get a warning at compile time) -void process_kill(smx_actor_t process); void process_killall(int reset_pid); void process_cleanup(smx_actor_t process) [[nohandler]]; void process_suspend(smx_actor_t process) [[block]]; diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 2aa1d17443..0e6973544e 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -425,20 +425,6 @@ void SIMIX_run() /* Run all processes that are ready to run, possibly in parallel */ SIMIX_process_runall(); - /* Move all killer processes to the end of the list, because killing a process that have an ongoing simcall is a bad idea */ - simgrid::xbt::three_way_partition(begin(simix_global->process_that_ran), end(simix_global->process_that_ran), - [](smx_actor_t p) { - switch (p->simcall.call) { - case SIMCALL_NONE: - case SIMCALL_PROCESS_KILL: - return 2; - // case SIMCALL_PROCESS_RESUME: - // return 1; - default: - return 0; - } - }); - /* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round */ /* WARNING, the order *must* be fixed or you'll jeopardize the simulation reproducibility (see RR-7653) */ diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index ff6a24857d..59561a4699 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -3,13 +3,14 @@ /* 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 "private.h" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" -#include "private.h" #include "smpi_comm.hpp" #include "smpi_datatype_derived.hpp" #include "smpi_process.hpp" #include "smpi_status.hpp" +#include "src/simix/ActorImpl.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)"); @@ -119,7 +120,8 @@ int PMPI_Abort(MPI_Comm comm, int errorcode) { smpi_bench_end(); // FIXME: should kill all processes in comm instead - simcall_process_kill(SIMIX_process_self()); + smx_actor_t process = SIMIX_process_self(); + simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); }); return MPI_SUCCESS; }