From: Arnaud Giersch Date: Tue, 9 Mar 2021 14:15:33 +0000 (+0100) Subject: Move check from checker side to app. side. X-Git-Tag: v3.27~188 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2de2f4073329fac1cc52b4e5f60cf2b784930825 Move check from checker side to app. side. --- diff --git a/src/kernel/activity/MutexImpl.cpp b/src/kernel/activity/MutexImpl.cpp index ee075b790d..0b4cf38771 100644 --- a/src/kernel/activity/MutexImpl.cpp +++ b/src/kernel/activity/MutexImpl.cpp @@ -8,6 +8,16 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_mutex, simix_synchro, "Mutex kernel-space implementation"); +#if SIMGRID_HAVE_MC +#include "simgrid/modelchecker.h" +#include "src/mc/mc_safety.hpp" +#define MC_CHECK_NO_DPOR() \ + xbt_assert(not MC_is_active() || simgrid::mc::reduction_mode != simgrid::mc::ReductionMode::dpor, \ + "Mutex is currently not supported with DPOR, use --cfg=model-check/reduction:none") +#else +#define MC_CHECK_NO_DPOR() (void)0 +#endif + namespace simgrid { namespace kernel { namespace activity { @@ -15,6 +25,7 @@ namespace activity { void MutexImpl::lock(actor::ActorImpl* issuer) { XBT_IN("(%p; %p)", this, issuer); + MC_CHECK_NO_DPOR(); /* FIXME: check where to validate the arguments */ RawImplPtr synchro = nullptr; @@ -43,6 +54,7 @@ void MutexImpl::lock(actor::ActorImpl* issuer) bool MutexImpl::try_lock(actor::ActorImpl* issuer) { XBT_IN("(%p, %p)", this, issuer); + MC_CHECK_NO_DPOR(); if (locked_) { XBT_OUT(); return false; diff --git a/src/mc/checker/SafetyChecker.cpp b/src/mc/checker/SafetyChecker.cpp index 4198071243..8b4f6566cc 100644 --- a/src/mc/checker/SafetyChecker.cpp +++ b/src/mc/checker/SafetyChecker.cpp @@ -187,9 +187,6 @@ void SafetyChecker::backtrack() if (reductionMode_ == ReductionMode::dpor) { auto call = state->executed_req_.call_; const kernel::actor::ActorImpl* issuer = api::get().simcall_get_issuer(&state->executed_req_); - if (call == simix::Simcall::MUTEX_LOCK) - xbt_die("Mutex is currently not supported with DPOR, use --cfg=model-check/reduction:none"); - for (auto i = stack_.rbegin(); i != stack_.rend(); ++i) { State* prev_state = i->get(); if (state->executed_req_.issuer_ == prev_state->executed_req_.issuer_) {