Nicolas Boichat has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/67235?usp=email )

Change subject: fastmodel: Add handler to catch DMI warnings
......................................................................

fastmodel: Add handler to catch DMI warnings

Catch DMI warnings from fastmodel, and abort the simulation when
they happen (instead of slowing down simulation).

This is controlled by an exit_on_dmi_warning flag passed to
fm.setup_simulation, defaulting to false.

Change-Id: I07fbc9b2579989d40d601ff0b6af9bfe719309a1
---
M src/arch/arm/fastmodel/arm_fast_model.py
M src/arch/arm/fastmodel/fastmodel.cc
2 files changed, 42 insertions(+), 1 deletion(-)



diff --git a/src/arch/arm/fastmodel/arm_fast_model.py b/src/arch/arm/fastmodel/arm_fast_model.py
index 1100417..48b4634 100644
--- a/src/arch/arm/fastmodel/arm_fast_model.py
+++ b/src/arch/arm/fastmodel/arm_fast_model.py
@@ -141,7 +141,10 @@


 # This should be called once per simulation
-def setup_simulation(sim_name, min_sync_latency=100.0 / 100000000):
+def setup_simulation(sim_name, min_sync_latency=100.0 / 100000000,
+                     exit_on_dmi_warning=False):
     set_armlmd_license_file()
     scx_initialize(sim_name)
     scx_set_min_sync_latency(min_sync_latency)
+    if exit_on_dmi_warning:
+        _m5.arm_fast_model.gem5.enable_exit_on_dmi_warning_handler()
diff --git a/src/arch/arm/fastmodel/fastmodel.cc b/src/arch/arm/fastmodel/fastmodel.cc
index 33a0c43..2edf1fa 100644
--- a/src/arch/arm/fastmodel/fastmodel.cc
+++ b/src/arch/arm/fastmodel/fastmodel.cc
@@ -37,9 +37,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include "base/logging.hh"
 #include "python/pybind11/pybind.hh"
 #include "scx/scx.h"
 #include "sim/init.hh"
+#include "systemc/utils/report.hh"

 namespace gem5
 {
@@ -48,6 +50,21 @@
 {

 void
+fastmodel_sc_report_handler(
+     const sc_core::sc_report &report, const sc_core::sc_actions &actions)
+{
+    const char *msg = report.get_msg();
+    if (!msg)
+        return;
+
+    panic_if(
+ strstr(msg, "Simulation code-translation cache failed to gain DMI") ||
+            strstr(msg, "I-side given unusable DMI"),
+        "DMI warning from fastmodel, "
+        "aborting simulation instead of running slowly.");
+}
+
+void
 arm_fast_model_pybind(pybind11::module_ &m_internal)
 {
     auto arm_fast_model = m_internal.def_submodule("arm_fast_model");
@@ -118,6 +135,12 @@
              static_cast<sg::ticks_t (*)(sg::Tag<sg::ticks_t> *)>(
                  &scx::scx_get_min_sync_latency))
         ;
+
+    // submodule for gem5-specific functions
+    auto gem5 = arm_fast_model.def_submodule("gem5");
+    gem5.def("enable_exit_on_dmi_warning_handler", []() {
+ sc_gem5::addExtraSystemCReportHandler(fastmodel_sc_report_handler);
+        });
 }
 EmbeddedPyBind embed_("arm_fast_model", &arm_fast_model_pybind);


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/67235?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I07fbc9b2579989d40d601ff0b6af9bfe719309a1
Gerrit-Change-Number: 67235
Gerrit-PatchSet: 1
Gerrit-Owner: Nicolas Boichat <drink...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to