Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move check from checker side to app. side.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 9 Mar 2021 14:15:33 +0000 (15:15 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 9 Mar 2021 20:14:44 +0000 (21:14 +0100)
src/kernel/activity/MutexImpl.cpp
src/mc/checker/SafetyChecker.cpp

index ee075b7..0b4cf38 100644 (file)
@@ -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;
index 4198071..8b4f656 100644 (file)
@@ -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_) {