From: mlaurent Date: Wed, 8 Nov 2023 10:26:51 +0000 (+0100) Subject: Merge branch 'master' of https://framagit.org/simgrid/simgrid X-Git-Tag: v3.35~87 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/eb115a05127cacf97d96dca1107ebfe60653e4bd?hp=ff4bc56d5d0d4b1bf3e5c83e5af51ac3cc119789 Merge branch 'master' of https://framagit.org/simgrid/simgrid --- diff --git a/examples/cpp/synchro-barrier/s4u-mc-synchro-barrier.tesh b/examples/cpp/synchro-barrier/s4u-mc-synchro-barrier.tesh index 9ed6eb7f45..a9ee7cea4d 100644 --- a/examples/cpp/synchro-barrier/s4u-mc-synchro-barrier.tesh +++ b/examples/cpp/synchro-barrier/s4u-mc-synchro-barrier.tesh @@ -3,9 +3,9 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-barrier 1 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n" > [Checker] Start a DFS exploration. Reduction is: dpor. > [Checker] Sleep set actually containing: -> [Checker] Execute 1: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) +> [Checker] Executed 1: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: BARRIER_WAIT(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) +> [Checker] Executed 1: BARRIER_WAIT(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) > [Checker] 0 actors remain, but none of them need to be interleaved (depth 4). > [Checker] Execution came to an end at 1;1 (state: 3, depth: 3) > [Checker] Backtracking from 1;1 @@ -14,19 +14,19 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-barrier 2 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n" > [Checker] Start a DFS exploration. Reduction is: dpor. > [Checker] Sleep set actually containing: -> [Checker] Execute 1: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) +> [Checker] Executed 1: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) +> [Checker] Executed 2: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 BARRIER_ASYNC_LOCK(barrier: 0) (state=1) > [Checker] #2 BARRIER_ASYNC_LOCK(barrier: 0) (state=2) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: BARRIER_WAIT(barrier: 0) (stack depth: 3, state: 3, 0 interleaves) +> [Checker] Executed 1: BARRIER_WAIT(barrier: 0) (stack depth: 3, state: 3, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #2 BARRIER_ASYNC_LOCK(barrier: 0) (state=2) > [Checker] #1 BARRIER_WAIT(barrier: 0) (state=3) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: BARRIER_WAIT(barrier: 0) (stack depth: 4, state: 4, 0 interleaves) +> [Checker] Executed 2: BARRIER_WAIT(barrier: 0) (stack depth: 4, state: 4, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 BARRIER_WAIT(barrier: 0) (state=3) > [Checker] #2 BARRIER_WAIT(barrier: 0) (state=4) @@ -38,7 +38,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] Backtracking from 1;2;1;2 > [Checker] Sleep set actually containing: > [Checker] <1,BARRIER_ASYNC_LOCK(barrier: 0)> -> [Checker] Execute 2: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) +> [Checker] Executed 2: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) > [Checker] 2 actors remain, but none of them need to be interleaved (depth 3). > [Checker] Backtracking from 2 > [Checker] DFS exploration ended. 6 unique states visited; 1 backtracks (0 transition replays, 7 states visited overall) @@ -46,14 +46,14 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-barrier 3 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n" > [Checker] Start a DFS exploration. Reduction is: dpor. > [Checker] Sleep set actually containing: -> [Checker] Execute 1: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) +> [Checker] Executed 1: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 1, state: 1, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) +> [Checker] Executed 2: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 BARRIER_ASYNC_LOCK(barrier: 0) (state=1) > [Checker] #2 BARRIER_ASYNC_LOCK(barrier: 0) (state=2) > [Checker] Sleep set actually containing: -> [Checker] Execute 3: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 3, state: 3, 0 interleaves) +> [Checker] Executed 3: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 3, state: 3, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #2 BARRIER_ASYNC_LOCK(barrier: 0) (state=2) > [Checker] #3 BARRIER_ASYNC_LOCK(barrier: 0) (state=3) @@ -61,12 +61,12 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] #1 BARRIER_ASYNC_LOCK(barrier: 0) (state=1) > [Checker] #3 BARRIER_ASYNC_LOCK(barrier: 0) (state=3) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: BARRIER_WAIT(barrier: 0) (stack depth: 4, state: 4, 0 interleaves) +> [Checker] Executed 1: BARRIER_WAIT(barrier: 0) (stack depth: 4, state: 4, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #3 BARRIER_ASYNC_LOCK(barrier: 0) (state=3) > [Checker] #1 BARRIER_WAIT(barrier: 0) (state=4) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: BARRIER_WAIT(barrier: 0) (stack depth: 5, state: 5, 0 interleaves) +> [Checker] Executed 2: BARRIER_WAIT(barrier: 0) (stack depth: 5, state: 5, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 BARRIER_WAIT(barrier: 0) (state=4) > [Checker] #2 BARRIER_WAIT(barrier: 0) (state=5) @@ -74,7 +74,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] #3 BARRIER_ASYNC_LOCK(barrier: 0) (state=3) > [Checker] #2 BARRIER_WAIT(barrier: 0) (state=5) > [Checker] Sleep set actually containing: -> [Checker] Execute 3: BARRIER_WAIT(barrier: 0) (stack depth: 6, state: 6, 0 interleaves) +> [Checker] Executed 3: BARRIER_WAIT(barrier: 0) (stack depth: 6, state: 6, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #2 BARRIER_WAIT(barrier: 0) (state=5) > [Checker] #3 BARRIER_WAIT(barrier: 0) (state=6) @@ -89,7 +89,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] Backtracking from 1;2;3;1;2;3 > [Checker] Sleep set actually containing: > [Checker] <2,BARRIER_ASYNC_LOCK(barrier: 0)> -> [Checker] Execute 3: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) +> [Checker] Executed 3: BARRIER_ASYNC_LOCK(barrier: 0) (stack depth: 2, state: 2, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 BARRIER_ASYNC_LOCK(barrier: 0) (state=1) > [Checker] #3 BARRIER_ASYNC_LOCK(barrier: 0) (state=2) diff --git a/examples/cpp/synchro-mutex/s4u-mc-synchro-mutex.tesh b/examples/cpp/synchro-mutex/s4u-mc-synchro-mutex.tesh index 5f726fec70..26f7e203c4 100644 --- a/examples/cpp/synchro-mutex/s4u-mc-synchro-mutex.tesh +++ b/examples/cpp/synchro-mutex/s4u-mc-synchro-mutex.tesh @@ -6,13 +6,13 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [App ] Configuration change: Set 'actors' to '1' > [Checker] Start a DFS exploration. Reduction is: dpor. > [Checker] Sleep set actually containing: -> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 1, state: 1, 0 interleaves) +> [Checker] Executed 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 1, state: 1, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 2, state: 2, 0 interleaves) +> [Checker] Executed 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 2, state: 2, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 3, state: 3, 0 interleaves) +> [Checker] Executed 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 3, state: 3, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 4, state: 4, 0 interleaves) +> [Checker] Executed 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 4, state: 4, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3) > [Checker] #2 MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4) @@ -23,12 +23,12 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] #1 MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=1) > [Checker] #2 MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 5, state: 5, 0 interleaves) +> [Checker] Executed 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 5, state: 5, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #1 MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3) > [Checker] #2 MUTEX_WAIT(mutex: 0, owner: 2) (state=5) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 6, 0 interleaves) +> [Checker] Executed 2: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 6, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #1 MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3) > [Checker] #2 MUTEX_UNLOCK(mutex: 0, owner: -1) (state=6) @@ -37,7 +37,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] Backtracking from 1;1;1;2;2;2 > [Checker] Sleep set actually containing: > [Checker] <1,MUTEX_UNLOCK(mutex: 0, owner: -1)> -> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 3, state: 3, 0 interleaves) +> [Checker] Executed 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 3, state: 3, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 MUTEX_WAIT(mutex: 0, owner: 1) (state=2) > [Checker] #2 MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=3) @@ -48,29 +48,29 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs. > [Checker] Backtracking from 1;1;2 > [Checker] Sleep set actually containing: > [Checker] <1,MUTEX_ASYNC_LOCK(mutex: 0, owner: 1)> -> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 1, state: 1, 0 interleaves) +> [Checker] Executed 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 1, state: 1, 0 interleaves) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 2, state: 9, 0 interleaves) +> [Checker] Executed 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 2, state: 9, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #2 MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1) > [Checker] #1 MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=9) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 3, state: 10, 0 interleaves) +> [Checker] Executed 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 3, state: 10, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=9) > [Checker] #2 MUTEX_WAIT(mutex: 0, owner: 2) (state=10) > [Checker] Sleep set actually containing: -> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: 1) (stack depth: 4, state: 11, 0 interleaves) +> [Checker] Executed 2: MUTEX_UNLOCK(mutex: 0, owner: 1) (stack depth: 4, state: 11, 0 interleaves) > [Checker] INDEPENDENT Transitions: > [Checker] #1 MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=9) > [Checker] #2 MUTEX_UNLOCK(mutex: 0, owner: 1) (state=11) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 5, state: 12, 0 interleaves) +> [Checker] Executed 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 5, state: 12, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #2 MUTEX_UNLOCK(mutex: 0, owner: 1) (state=11) > [Checker] #1 MUTEX_WAIT(mutex: 0, owner: 1) (state=12) > [Checker] Sleep set actually containing: -> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 13, 0 interleaves) +> [Checker] Executed 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 13, 0 interleaves) > [Checker] Dependent Transitions: > [Checker] #2 MUTEX_UNLOCK(mutex: 0, owner: 1) (state=11) > [Checker] #1 MUTEX_UNLOCK(mutex: 0, owner: -1) (state=13) diff --git a/examples/sthread/pthread-mc-producer-consumer.tesh b/examples/sthread/pthread-mc-producer-consumer.tesh index 508d8dac98..3c2eee5958 100644 --- a/examples/sthread/pthread-mc-producer-consumer.tesh +++ b/examples/sthread/pthread-mc-producer-consumer.tesh @@ -13,4 +13,4 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-chec $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-check/reduction:odpor --cfg=model-check/setenv:LD_PRELOAD=${libdir:=.}/libsthread.so ${bindir:=.}/pthread-producer-consumer -q -C 1 -P 1 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/reduction' to 'odpor' > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: odpor. -> [0.000000] [mc_dfs/INFO] DFS exploration ended. 39 unique states visited; 0 backtracks (0 transition replays, 39 states visited overall) +> [0.000000] [mc_dfs/INFO] DFS exploration ended. 617 unique states visited; 29 backtracks (524 transition replays, 1170 states visited overall) diff --git a/examples/sthread/stdobject/stdobject.cpp b/examples/sthread/stdobject/stdobject.cpp index 246095eaef..c2af786d2c 100644 --- a/examples/sthread/stdobject/stdobject.cpp +++ b/examples/sthread/stdobject/stdobject.cpp @@ -13,8 +13,8 @@ extern void sthread_access_end(void* addr, const char* objname, const char* file } #define STHREAD_ACCESS(obj) \ - for (bool first = sthread_access_begin(static_cast(obj), #obj, __FILE__, __LINE__, __FUNCTION__) || true; \ - first; sthread_access_end(static_cast(obj), #obj, __FILE__, __LINE__, __FUNCTION__), first = false) + for (bool first = sthread_access_begin(static_cast(obj), #obj, __FILE__, __LINE__, __func__) || true; first; \ + sthread_access_end(static_cast(obj), #obj, __FILE__, __LINE__, __func__), first = false) static void thread_code() { diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 72f114d072..f264993204 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -168,7 +168,7 @@ CommImpl* CommImpl::start() std::vector CommImpl::get_traversed_links() const { - xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __FUNCTION__, + xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __func__, get_state_str()); std::vector vlinks; XBT_ATTRIB_UNUSED double res = 0; diff --git a/src/kernel/activity/SemaphoreImpl.hpp b/src/kernel/activity/SemaphoreImpl.hpp index ebb439ba49..e7b21d2b0c 100644 --- a/src/kernel/activity/SemaphoreImpl.hpp +++ b/src/kernel/activity/SemaphoreImpl.hpp @@ -49,7 +49,7 @@ class XBT_PUBLIC SemaphoreImpl { std::deque ongoing_acquisitions_; static unsigned next_id_; - unsigned id_ = next_id_++; + const unsigned id_ = next_id_++; friend SemAcquisitionImpl; friend actor::SemaphoreObserver; diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 013ad5b217..61e0479325 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -509,8 +509,10 @@ void create_maestro(const std::function& code) /** (in kernel mode) unpack the simcall and activate the handler */ void ActorImpl::simcall_handle(int times_considered) { - XBT_DEBUG("Handling simcall %p: %s(%ld) %s", &simcall_, simcall_.issuer_->get_cname(), simcall_.issuer_->get_pid(), - (simcall_.observer_ != nullptr ? simcall_.observer_->to_string().c_str() : simcall_.get_cname())); + XBT_DEBUG("Handling simcall %p: %s(%ld) %s (times_considered:%d)", &simcall_, simcall_.issuer_->get_cname(), + simcall_.issuer_->get_pid(), + (simcall_.observer_ != nullptr ? simcall_.observer_->to_string().c_str() : simcall_.get_cname()), + times_considered); if (simcall_.observer_ != nullptr) simcall_.observer_->prepare(times_considered); if (wannadie()) diff --git a/src/kernel/actor/SynchroObserver.cpp b/src/kernel/actor/SynchroObserver.cpp index efe5bffd31..4382ec49a0 100644 --- a/src/kernel/actor/SynchroObserver.cpp +++ b/src/kernel/actor/SynchroObserver.cpp @@ -31,7 +31,8 @@ void MutexObserver::serialize(std::stringstream& stream) const std::string MutexObserver::to_string() const { return std::string(mc::Transition::to_c_str(type_)) + "(mutex_id:" + std::to_string(get_mutex()->get_id()) + - " owner:" + std::to_string(get_mutex()->get_owner()->get_pid()) + ")"; + " owner:" + + (get_mutex()->get_owner() == nullptr ? "none" : std::to_string(get_mutex()->get_owner()->get_pid())) + ")"; } bool MutexObserver::is_enabled() @@ -48,7 +49,8 @@ SemaphoreObserver::SemaphoreObserver(ActorImpl* actor, mc::Transition::Type type void SemaphoreObserver::serialize(std::stringstream& stream) const { - stream << (short)type_ << ' ' << get_sem()->get_id() << ' ' << false /* Granted is ignored for LOCK/UNLOCK */; + stream << (short)type_ << ' ' << get_sem()->get_id() << ' ' << false /* Granted is ignored for LOCK/UNLOCK */ << ' ' + << get_sem()->get_capacity(); } std::string SemaphoreObserver::to_string() const { @@ -66,7 +68,8 @@ bool SemaphoreAcquisitionObserver::is_enabled() } void SemaphoreAcquisitionObserver::serialize(std::stringstream& stream) const { - stream << (short)type_ << ' ' << acquisition_->semaphore_->get_id() << ' ' << acquisition_->granted_; + stream << (short)type_ << ' ' << acquisition_->semaphore_->get_id() << ' ' << acquisition_->granted_ << ' ' + << acquisition_->semaphore_->get_capacity(); } std::string SemaphoreAcquisitionObserver::to_string() const { diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index aff9d5cb60..b5929f3751 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -212,9 +212,8 @@ void State::seed_wakeup_tree_if_needed(const odpor::Execution& prior) // Find an enabled transition to pick for (const auto& [_, actor] : get_actors_list()) { if (actor.is_enabled()) { - // For each variant of the transition, we want - // to insert the action into the tree. This ensures - // that all variants are searched + // For each variant of the transition that is enabled, we want to insert the action into the tree. + // This ensures that all variants are searched for (unsigned times = 0; times < actor.get_max_considered(); ++times) { wakeup_tree_.insert(prior, odpor::PartialExecution{actor.get_transition(times)}); } diff --git a/src/mc/api/strategy/BasicStrategy.hpp b/src/mc/api/strategy/BasicStrategy.hpp index de0fe65d9b..3d7d01bbd6 100644 --- a/src/mc/api/strategy/BasicStrategy.hpp +++ b/src/mc/api/strategy/BasicStrategy.hpp @@ -40,11 +40,10 @@ public: ~BasicStrategy() override = default; std::pair best_transition(bool must_be_todo) const override { - for (auto const& [aid, actor] : actors_to_run_) { - /* Only consider actors (1) marked as interleaving by the checker and (2) currently enabled in the application */ - if ((not actor.is_todo() && must_be_todo) || not actor.is_enabled() || actor.is_done()) { + for (auto const& [aid, actor] : actors_to_run_) { + /* Only consider actors (1) marked as interleaving by the checker and (2) currently enabled in the application */ + if ((not actor.is_todo() && must_be_todo) || not actor.is_enabled() || actor.is_done()) continue; - } return std::make_pair(aid, depth_); } diff --git a/src/mc/explo/DFSExplorer.cpp b/src/mc/explo/DFSExplorer.cpp index 6fe0b46ab4..033c525924 100644 --- a/src/mc/explo/DFSExplorer.cpp +++ b/src/mc/explo/DFSExplorer.cpp @@ -65,12 +65,9 @@ void DFSExplorer::restore_stack(std::shared_ptr state) } XBT_DEBUG("Replaced stack by %s", get_record_trace().to_string().c_str()); if (reduction_mode_ == ReductionMode::sdpor || reduction_mode_ == ReductionMode::odpor) { - // NOTE: The outgoing transition for the top-most - // state of the stack refers to that which was taken - // as part of the last trace explored by the algorithm. - // Thus, only the sequence of transitions leading up to, - // but not including, the last state must be included - // when reconstructing the Exploration for SDPOR. + // NOTE: The outgoing transition for the top-most state of the stack refers to that which was taken + // as part of the last trace explored by the algorithm. Thus, only the sequence of transitions leading up to, + // but not including, the last state must be included when reconstructing the Exploration for SDPOR. for (auto iter = std::next(stack_.begin()); iter != stack_.end(); ++iter) { execution_seq_.push_transition((*iter)->get_transition_in()); } @@ -124,16 +121,12 @@ void DFSExplorer::run() } if (reduction_mode_ == ReductionMode::odpor) { - // In the case of ODPOR, the wakeup tree for this - // state may be empty if we're exploring new territory - // (rather than following the partial execution of a - // wakeup tree). This corresponds to lines 9 to 13 of + // In the case of ODPOR, the wakeup tree for this state may be empty if we're exploring new territory + // (rather than following the partial execution of a wakeup tree). This corresponds to lines 9 to 13 of // the ODPOR pseudocode // - // INVARIANT: The execution sequence should be consistent - // with the state when seeding the tree. If the sequence - // gets out of sync with the state, selection will not - // work as we intend + // INVARIANT: The execution sequence should be consistent with the state when seeding the tree. If the sequence + // gets out of sync with the state, selection will not work as we intend state->seed_wakeup_tree_if_needed(execution_seq_); } @@ -163,13 +156,16 @@ void DFSExplorer::run() XBT_VERB(" <%ld,%s>", aid, transition->to_string().c_str()); } + auto todo = state->get_actors_list().at(next).get_transition(); + XBT_DEBUG("wanna execute %ld: %.60s", next, todo->to_string().c_str()); + /* Actually answer the request: let's execute the selected request (MCed does one step) */ auto executed_transition = state->execute_next(next, get_remote_app()); on_transition_execute_signal(state->get_transition_out().get(), get_remote_app()); // If there are processes to interleave and the maximum depth has not been // reached then perform one step of the exploration algorithm. - XBT_VERB("Execute %ld: %.150s (stack depth: %zu, state: %ld, %zu interleaves)", state->get_transition_out()->aid_, + XBT_VERB("Executed %ld: %.60s (stack depth: %zu, state: %ld, %zu interleaves)", state->get_transition_out()->aid_, state->get_transition_out()->to_string().c_str(), stack_.size(), state->get_num(), state->count_todo()); /* Create the new expanded state (copy the state of MCed into our MCer data) */ @@ -177,13 +173,10 @@ void DFSExplorer::run() on_state_creation_signal(next_state.get(), get_remote_app()); if (reduction_mode_ == ReductionMode::odpor) { - // With ODPOR, after taking a step forward, we must - // assign a copy of that subtree to the next state. + // With ODPOR, after taking a step forward, we must assign a copy of that subtree to the next state. // - // NOTE: We only add actions to the sleep set AFTER - // we've regenerated states. We must perform the search - // fully down a single path before we consider adding - // any elements to the sleep set according to the pseudocode + // NOTE: We only add actions to the sleep set AFTER we've regenerated states. We must perform the search + // fully down a single path before we consider adding any elements to the sleep set according to the pseudocode next_state->sprout_tree_from_parent_state(); } else { /* Sleep set procedure: @@ -245,15 +238,13 @@ void DFSExplorer::run() /** * SDPOR Source Set Procedure: * - * Find "reversible races" in the current execution `E` with respect - * to the latest action `p`. For each such race, determine one thread - * not contained in the backtrack set at the "race point" `r` which - * "represents" the trace formed by first executing everything after - * `r` that doesn't depend on it (`v := notdep(r, E)`) and then `p` to + * Find "reversible races" in the current execution `E` with respect to the latest action `p`. For each such race, + * determine one thread not contained in the backtrack set at the "race point" `r` which "represents" the trace + * formed by first executing everything after `r` that doesn't depend on it (`v := notdep(r, E)`) and then `p` to * flip the race. * - * The intuition is that some subsequence of `v` may enable `p`, so - * we want to be sure that search "in that direction" + * The intuition is that some subsequence of `v` may enable `p`, so we want to be sure that search "in that + * direction" */ execution_seq_.push_transition(std::move(executed_transition)); xbt_assert(execution_seq_.get_latest_event_handle().has_value(), "No events are contained in the SDPOR execution " @@ -264,12 +255,10 @@ void DFSExplorer::run() State* prev_state = stack_[e_race].get(); const auto choices = execution_seq_.get_missing_source_set_actors_from(e_race, prev_state->get_backtrack_set()); if (not choices.empty()) { - // NOTE: To incorporate the idea of attempting to select the "best" - // backtrack point into SDPOR, instead of selecting the `first` initial, - // we should instead compute all choices and decide which is best + // NOTE: To incorporate the idea of attempting to select the "best" backtrack point into SDPOR, instead of + // selecting the `first` initial, we should instead compute all choices and decide which is best // - // Here, we choose the actor with the lowest ID to ensure - // we get deterministic results + // Here, we choose the actor with the lowest ID to ensure we get deterministic results const auto q = std::min_element(choices.begin(), choices.end(), [](const aid_t a1, const aid_t a2) { return a1 < a2; }); prev_state->consider_one(*q); @@ -277,8 +266,7 @@ void DFSExplorer::run() } } } else if (reduction_mode_ == ReductionMode::odpor) { - // In the case of ODPOR, we simply observe the transition that was executed - // until we've reached a maximal trace + // In the case of ODPOR, we simply observe the transition that was executed until we've reached a maximal trace execution_seq_.push_transition(std::move(executed_transition)); } @@ -362,13 +350,10 @@ void DFSExplorer::backtrack() /** * ODPOR Race Detection Procedure: * - * For each reversible race in the current execution, we - * note if there are any continuations `C` equivalent to that which - * would reverse the race that have already either a) been searched by ODPOR or - * b) been *noted* to be searched by the wakeup tree at the - * appropriate reversal point, either as `C` directly or - * an as equivalent to `C` ("eventually looks like C", viz. the `~_E` - * relation) + * For each reversible race in the current execution, we note if there are any continuations `C` equivalent to that + * which would reverse the race that have already either a) been searched by ODPOR or b) been *noted* to be searched + * by the wakeup tree at the appropriate reversal point, either as `C` directly or an as equivalent to `C` + * ("eventually looks like C", viz. the `~_E` relation) */ for (auto e_prime = static_cast(0); e_prime <= last_event.value(); ++e_prime) { XBT_DEBUG("ODPOR: Now considering all possible race with `%u`", e_prime); diff --git a/src/mc/explo/odpor/ReversibleRaceCalculator.cpp b/src/mc/explo/odpor/ReversibleRaceCalculator.cpp index f6007c27ff..9b8f6144f0 100644 --- a/src/mc/explo/odpor/ReversibleRaceCalculator.cpp +++ b/src/mc/explo/odpor/ReversibleRaceCalculator.cpp @@ -5,6 +5,8 @@ #include "src/mc/explo/odpor/ReversibleRaceCalculator.hpp" #include "src/mc/explo/odpor/Execution.hpp" +#include "src/mc/transition/Transition.hpp" +#include "src/mc/transition/TransitionSynchro.hpp" #include #include @@ -174,15 +176,15 @@ bool ReversibleRaceCalculator::is_race_reversible_SemUnlock(const Execution&, Ex return true; } -bool ReversibleRaceCalculator::is_race_reversible_SemWait(const Execution&, Execution::EventHandle /*e1*/, +bool ReversibleRaceCalculator::is_race_reversible_SemWait(const Execution& E, Execution::EventHandle e1, const Transition* /*e2*/) { - // TODO: Get the semantics correct here - // Certainement qu'il suffit de considérer les SemUnlock. ⋀ a priori, - // il doit même suffir de considérer le cas où leur capacity après execution est <=1 - // ces cas disent qu'avant éxecution la capacity était de 0. Donc aucune chance de pouvoir - // wait avant le unlock. - return false; + // Reversible with everynbody but unlock which creates a free token + const auto e1_transition = E.get_transition_for_handle(e1); + if (e1_transition->type_ == Transition::Type::SEM_UNLOCK && + static_cast(e1_transition)->get_capacity() <= 1) + return false; + return true; } bool ReversibleRaceCalculator::is_race_reversible_ObjectAccess(const Execution&, Execution::EventHandle /*e1*/, diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index 84769a1dc9..aabac0027a 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -89,6 +89,8 @@ void AppSide::handle_simcall_execute(const s_mc_message_simcall_execute_t* messa { kernel::actor::ActorImpl* actor = kernel::EngineImpl::get_instance()->get_actor_by_pid(message->aid_); xbt_assert(actor != nullptr, "Invalid pid %ld", message->aid_); + xbt_assert(actor->simcall_.observer_ == nullptr || actor->simcall_.observer_->is_enabled(), + "Please, model-checker, don't execute disabled transitions."); // The client may send some messages to the server while processing the transition actor->simcall_handle(message->times_considered_); diff --git a/src/mc/transition/TransitionSynchro.cpp b/src/mc/transition/TransitionSynchro.cpp index 5e7ded2aed..469c71cbac 100644 --- a/src/mc/transition/TransitionSynchro.cpp +++ b/src/mc/transition/TransitionSynchro.cpp @@ -109,16 +109,16 @@ bool MutexTransition::depends(const Transition* o) const std::string SemaphoreTransition::to_string(bool verbose) const { if (type_ == Type::SEM_ASYNC_LOCK || type_ == Type::SEM_UNLOCK) - return xbt::string_printf("%s(semaphore: %" PRIxPTR ")", Transition::to_c_str(type_), sem_); + return xbt::string_printf("%s(semaphore: %u, capacity: %u)", Transition::to_c_str(type_), capacity_, sem_); if (type_ == Type::SEM_WAIT) - return xbt::string_printf("%s(semaphore: %" PRIxPTR ", granted: %s)", Transition::to_c_str(type_), sem_, - granted_ ? "yes" : "no"); + return xbt::string_printf("%s(semaphore: %u, capacity: %u, granted: %s)", Transition::to_c_str(type_), capacity_, + sem_, granted_ ? "yes" : "no"); THROW_IMPOSSIBLE; } SemaphoreTransition::SemaphoreTransition(aid_t issuer, int times_considered, Type type, std::stringstream& stream) : Transition(type, issuer, times_considered) { - xbt_assert(stream >> sem_ >> granted_); + xbt_assert(stream >> sem_ >> granted_ >> capacity_); } bool SemaphoreTransition::depends(const Transition* o) const { diff --git a/src/mc/transition/TransitionSynchro.hpp b/src/mc/transition/TransitionSynchro.hpp index 8742e651cb..a4ea7e3ab1 100644 --- a/src/mc/transition/TransitionSynchro.hpp +++ b/src/mc/transition/TransitionSynchro.hpp @@ -35,13 +35,15 @@ public: }; class SemaphoreTransition : public Transition { - uintptr_t sem_; + unsigned int sem_; // ID bool granted_; + unsigned capacity_; public: std::string to_string(bool verbose) const override; SemaphoreTransition(aid_t issuer, int times_considered, Type type, std::stringstream& stream); bool depends(const Transition* other) const override; + int get_capacity() const { return capacity_; } }; } // namespace simgrid::mc diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index ab9fefbdfc..5d27168a0f 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -214,7 +214,7 @@ Host* Comm::get_destination() const CommPtr Comm::set_rate(double rate) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); rate_ = rate; return this; } @@ -222,7 +222,7 @@ CommPtr Comm::set_rate(double rate) CommPtr Comm::set_mailbox(Mailbox* mailbox) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); mailbox_ = mailbox; return this; } @@ -230,7 +230,7 @@ CommPtr Comm::set_mailbox(Mailbox* mailbox) CommPtr Comm::set_src_data(void* buff) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(dst_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); src_buff_ = buff; return this; @@ -239,7 +239,7 @@ CommPtr Comm::set_src_data(void* buff) CommPtr Comm::set_src_data_size(size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); src_buff_size_ = size; return this; } @@ -247,7 +247,7 @@ CommPtr Comm::set_src_data_size(size_t size) CommPtr Comm::set_src_data(void* buff, size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(dst_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); src_buff_ = buff; @@ -258,7 +258,7 @@ CommPtr Comm::set_src_data(void* buff, size_t size) CommPtr Comm::set_dst_data(void** buff) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(src_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); dst_buff_ = buff; return this; @@ -267,7 +267,7 @@ CommPtr Comm::set_dst_data(void** buff) CommPtr Comm::set_dst_data(void** buff, size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); xbt_assert(src_buff_ == nullptr, "Cannot set the src and dst buffers at the same time"); dst_buff_ = buff; @@ -317,7 +317,7 @@ bool Comm::is_assigned() const Comm* Comm::do_start() { xbt_assert(get_state() == State::INITED || get_state() == State::STARTING, - "You cannot use %s() once your communication started (not implemented)", __FUNCTION__); + "You cannot use %s() once your communication started (not implemented)", __func__); auto myself = kernel::actor::ActorImpl::self(); @@ -388,7 +388,7 @@ Comm* Comm::do_start() Comm* Comm::detach() { xbt_assert(state_ == State::INITED || state_ == State::STARTING, - "You cannot use %s() once your communication is %s (not implemented)", __FUNCTION__, get_state_str()); + "You cannot use %s() once your communication is %s (not implemented)", __func__, get_state_str()); xbt_assert(dst_buff_ == nullptr && dst_buff_size_ == 0, "You can only detach sends, not recvs"); detached_ = true; start(); diff --git a/src/s4u/s4u_Mess.cpp b/src/s4u/s4u_Mess.cpp index 9799ad1eb7..0a8da79d37 100644 --- a/src/s4u/s4u_Mess.cpp +++ b/src/s4u/s4u_Mess.cpp @@ -35,7 +35,7 @@ MessPtr Mess::set_payload(void* payload) MessPtr Mess::set_dst_data(void** buff, size_t size) { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", - __FUNCTION__); + __func__); dst_buff_ = buff; dst_buff_size_ = size; @@ -61,7 +61,7 @@ Actor* Mess::get_receiver() const Mess* Mess::do_start() { xbt_assert(get_state() == State::INITED || get_state() == State::STARTING, - "You cannot use %s() once your message exchange has started (not implemented)", __FUNCTION__); + "You cannot use %s() once your message exchange has started (not implemented)", __func__); auto myself = kernel::actor::ActorImpl::self(); if (myself == sender_) { diff --git a/src/sthread/sthread_impl.cpp b/src/sthread/sthread_impl.cpp index 9dbf78913e..c1b58b2699 100644 --- a/src/sthread/sthread_impl.cpp +++ b/src/sthread/sthread_impl.cpp @@ -181,7 +181,7 @@ int sthread_mutex_lock(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); static_cast(mutex->mutex)->lock(); return 0; } @@ -192,7 +192,7 @@ int sthread_mutex_trylock(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); if (static_cast(mutex->mutex)->try_lock()) return 0; return EBUSY; @@ -204,7 +204,7 @@ int sthread_mutex_unlock(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); static_cast(mutex->mutex)->unlock(); return 0; } @@ -214,7 +214,7 @@ int sthread_mutex_destroy(sthread_mutex_t* mutex) if (mutex->mutex == nullptr) sthread_mutex_init(mutex, nullptr); - XBT_DEBUG("%s(%p)", __FUNCTION__, mutex); + XBT_DEBUG("%s(%p)", __func__, mutex); intrusive_ptr_release(static_cast(mutex->mutex)); return 0; } diff --git a/tools/jenkins/Coverage.sh b/tools/jenkins/Coverage.sh index 8558631d89..0e374b0976 100755 --- a/tools/jenkins/Coverage.sh +++ b/tools/jenkins/Coverage.sh @@ -87,7 +87,7 @@ if [ -f Testing/TAG ] ; then /usr/bin/python3-coverage xml -i -o ./python_coverage.xml #convert all gcov reports to xml cobertura reports - gcovr -r "$WORKSPACE" --xml-pretty -e "$WORKSPACE"/teshsuite -e MBI -e "$WORKSPACE"/examples/smpi/NAS -e "$WORKSPACE"/examples/smpi/mc -u -o xml_coverage.xml --gcov-ignore-parse-errors + gcovr -r "$WORKSPACE" --xml-pretty -e "$WORKSPACE"/teshsuite -e MBI -e "$WORKSPACE"/examples/smpi/NAS -e "$WORKSPACE"/examples/smpi/mc -u -o xml_coverage.xml --gcov-ignore-parse-errors all --gcov-ignore-errors all cd "$WORKSPACE" xsltproc "$WORKSPACE"/tools/jenkins/ctest2junit.xsl build/Testing/"$( head -n 1 < build/Testing/TAG )"/Test.xml > CTestResults_memcheck.xml