From 379da2474b42c6aedfcc0a34367d41206efe1d4e Mon Sep 17 00:00:00 2001 From: Jason Lowe-Power Date: Tue, 14 Feb 2023 10:48:38 -0800 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67937 Reviewed-by: Ayaz Akram Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/cpu/base.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 60d443af8c..d2c0a78d44 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -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); });