mem: make MemTest panic on a packet error
authorCiro Santilli <ciro.santilli@arm.com>
Tue, 10 Mar 2020 18:43:12 +0000 (18:43 +0000)
committerCiro Santilli <ciro.santilli@arm.com>
Wed, 29 Apr 2020 18:33:50 +0000 (18:33 +0000)
Before this change, running:

./build/NULL/gem5.opt configs/example/ruby_mem_test.py -m 20000000 \
  --functional 10

would only print warning for memory errors such as:

warn: Read access failed at 0x107a00

and there was no way to make the simulation fail.

This commit makes those warnings into errors such as:

panic: Read access failed at 0x107a00

unless --suppress-func-errors is given.

This will be used to automate MemTest testing in later commits.

Change-Id: I1840c1ed1853f1a71ec73bd50cadaac095794f91
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26804
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
configs/example/ruby_mem_test.py
src/cpu/testers/memtest/MemTest.py
src/cpu/testers/memtest/memtest.cc
src/cpu/testers/memtest/memtest.hh
tests/configs/memtest-ruby.py

index 5325c5028312c76309c5e4c26dcd60dee3d0e57a..310ee3c036537a65d5d5d6a96fd7c9f9ddf5b143 100644 (file)
@@ -55,8 +55,8 @@ parser.add_option("--progress", type="int", default=1000,
 parser.add_option("--num-dmas", type="int", default=0, help="# of dma testers")
 parser.add_option("--functional", type="int", default=0,
                   help="percentage of accesses that should be functional")
-parser.add_option("--suppress-func-warnings", action="store_true",
-                  help="suppress warnings when functional accesses fail")
+parser.add_option("--suppress-func-errors", action="store_true",
+                  help="suppress panic when functional accesses fail")
 
 #
 # Add the ruby specific and protocol specific options
@@ -96,7 +96,7 @@ cpus = [ MemTest(max_loads = options.maxloads,
                  percent_functional = options.functional,
                  percent_uncacheable = 0,
                  progress_interval = options.progress,
-                 suppress_func_warnings = options.suppress_func_warnings) \
+                 suppress_func_errors = options.suppress_func_errors) \
          for i in range(options.num_cpus) ]
 
 system = System(cpu = cpus,
@@ -108,8 +108,8 @@ if options.num_dmas > 0:
                      percent_functional = 0,
                      percent_uncacheable = 0,
                      progress_interval = options.progress,
-                     suppress_func_warnings =
-                                        not options.suppress_func_warnings) \
+                     suppress_func_errors =
+                                        not options.suppress_func_errors) \
              for i in range(options.num_dmas) ]
     system.dma_devices = dmas
 else:
index 463c5537936c447382f099a835ae4e8b2ce4675e..36bc9295118dd95790cb41aa6baaa3b492ae0008 100644 (file)
@@ -69,5 +69,5 @@ class MemTest(ClockedObject):
 
     # Add the ability to supress error responses on functional
     # accesses as Ruby needs this
-    suppress_func_warnings = Param.Bool(False, "Suppress warnings when "\
+    suppress_func_errors = Param.Bool(False, "Suppress panic when "\
                                             "functional accesses fail.")
index 262f1a931fef02310bd9cd3fb8ac15d0739f5195..720b2739ef05988ca9750eab891d399d4b0363e8 100644 (file)
@@ -99,7 +99,7 @@ MemTest::MemTest(const Params *p)
       nextProgressMessage(p->progress_interval),
       maxLoads(p->max_loads),
       atomic(p->system->isAtomicMode()),
-      suppressFuncWarnings(p->suppress_func_warnings)
+      suppressFuncErrors(p->suppress_func_errors)
 {
     id = TESTER_ALLOCATOR++;
     fatal_if(id >= blockSize, "Too many testers, only %d allowed\n",
@@ -146,10 +146,9 @@ MemTest::completeRequest(PacketPtr pkt, bool functional)
     const uint8_t *pkt_data = pkt->getConstPtr<uint8_t>();
 
     if (pkt->isError()) {
-        if (!functional || !suppressFuncWarnings) {
-            warn("%s access failed at %#x\n",
-                 pkt->isWrite() ? "Write" : "Read", req->getPaddr());
-        }
+        if (!functional || !suppressFuncErrors)
+            panic( "%s access failed at %#x\n",
+                pkt->isWrite() ? "Write" : "Read", req->getPaddr());
     } else {
         if (pkt->isRead()) {
             uint8_t ref_data = referenceData[req->getPaddr()];
index 86ac6e403926098b1c12f588dc3b6c34ad6e860f..fa13c0a494700b85232ad5af8c103f88cb207d80 100644 (file)
@@ -165,7 +165,7 @@ class MemTest : public ClockedObject
 
     const bool atomic;
 
-    const bool suppressFuncWarnings;
+    const bool suppressFuncErrors;
 
     Stats::Scalar numReadsStat;
     Stats::Scalar numWritesStat;
index fe02c28783cf6b7806ee3487743b6c50c9562315..7aca77f951303be896f91e2849ae320145fbb67c 100644 (file)
@@ -63,7 +63,7 @@ nb_cores = 8
 
 # ruby does not support atomic, functional, or uncacheable accesses
 cpus = [ MemTest(percent_functional=50,
-                 percent_uncacheable=0, suppress_func_warnings=True) \
+                 percent_uncacheable=0, suppress_func_errors=True) \
          for i in range(nb_cores) ]
 
 # overwrite options.num_cpus with the nb_cores value