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 <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.")
|
||||
|
||||
@@ -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()];
|
||||
|
||||
@@ -165,7 +165,7 @@ class MemTest : public ClockedObject
|
||||
|
||||
const bool atomic;
|
||||
|
||||
const bool suppressFuncWarnings;
|
||||
const bool suppressFuncErrors;
|
||||
|
||||
Stats::Scalar numReadsStat;
|
||||
Stats::Scalar numWritesStat;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user