cpu: Add fatal in BaseCPU for wrong workloads

The CPU models assume that the number of workloads (Processes) is equal
to the number of threads when using SE mode. This wasn't checked leading
to a segfault if there were no workloads. This change makes the error
more clear.

Change-Id: I9a7b21112b8f819c6eeca944ee0d73ae9ce9a57b
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67937
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Jason Lowe-Power
2023-02-14 10:48:38 -08:00
committed by Jason Lowe-Power
parent 9fb5ce5cd3
commit 379da2474b

View File

@@ -182,6 +182,12 @@ BaseCPU::BaseCPU(const Params &p, bool is_checker)
"of threads (%i).\n", params().isa.size(), numThreads);
}
if (!FullSystem && params().workload.size() != numThreads) {
fatal("Number of processes (cpu.workload) (%i) assigned to the CPU "
"does not equal number of threads (%i).\n",
params().workload.size(), numThreads);
}
modelResetPort.onChange([this](const bool &new_val) {
setReset(new_val);
});