From b4ab0c168cea7697176b19f0d0a4e54db139ed3c Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 10 Mar 2020 18:43:12 +0000 Subject: [PATCH] mem: make MemTest panic on a packet error 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 Maintainer: Jason Lowe-Power Tested-by: kokoro --- configs/example/ruby_mem_test.py | 10 +++++----- src/cpu/testers/memtest/MemTest.py | 2 +- src/cpu/testers/memtest/memtest.cc | 9 ++++----- src/cpu/testers/memtest/memtest.hh | 2 +- tests/configs/memtest-ruby.py | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/configs/example/ruby_mem_test.py b/configs/example/ruby_mem_test.py index 5325c5028..310ee3c03 100644 --- a/configs/example/ruby_mem_test.py +++ b/configs/example/ruby_mem_test.py @@ -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: diff --git a/src/cpu/testers/memtest/MemTest.py b/src/cpu/testers/memtest/MemTest.py index 463c55379..36bc92951 100644 --- a/src/cpu/testers/memtest/MemTest.py +++ b/src/cpu/testers/memtest/MemTest.py @@ -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.") diff --git a/src/cpu/testers/memtest/memtest.cc b/src/cpu/testers/memtest/memtest.cc index 262f1a931..720b2739e 100644 --- a/src/cpu/testers/memtest/memtest.cc +++ b/src/cpu/testers/memtest/memtest.cc @@ -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(); 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()]; diff --git a/src/cpu/testers/memtest/memtest.hh b/src/cpu/testers/memtest/memtest.hh index 86ac6e403..fa13c0a49 100644 --- a/src/cpu/testers/memtest/memtest.hh +++ b/src/cpu/testers/memtest/memtest.hh @@ -165,7 +165,7 @@ class MemTest : public ClockedObject const bool atomic; - const bool suppressFuncWarnings; + const bool suppressFuncErrors; Stats::Scalar numReadsStat; Stats::Scalar numWritesStat; diff --git a/tests/configs/memtest-ruby.py b/tests/configs/memtest-ruby.py index fe02c2878..7aca77f95 100644 --- a/tests/configs/memtest-ruby.py +++ b/tests/configs/memtest-ruby.py @@ -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 -- 2.30.2