Richard Cooper has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/69958?usp=email )
Change subject: arch-arm: Add support to exit the simloop on PMU interrupt
......................................................................
arch-arm: Add support to exit the simloop on PMU interrupt
Add an option `exitOnPMUInterrupt` to ArmPMU.
The PMU is often used to identify and demark regions of interest in a
workload intended for sampled simulation (e.g. fast-forward, warm-up,
detailed simulation). Often the PMU is enabled and disabled to demark
these regions, but for some workloads PMU interrupts are used to count
committed instructions directly.
This patch adds the option to exit the simulation loop when a PMU
interrupt is triggered so additional simulation control can be
effected (e.g. stats dump/reset, CPU switch, etc).
Change-Id: Ife02fe8e467dec91a2d4fda3f7dc9540a092f1ec
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69958
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
---
M src/arch/arm/ArmPMU.py
M src/arch/arm/pmu.cc
M src/arch/arm/pmu.hh
M src/python/gem5/simulate/exit_event.py
4 files changed, 14 insertions(+), 1 deletion(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/arm/ArmPMU.py b/src/arch/arm/ArmPMU.py
index a07239b..a4a2ebe 100644
--- a/src/arch/arm/ArmPMU.py
+++ b/src/arch/arm/ArmPMU.py
@@ -218,6 +218,7 @@
exitOnPMUControl = Param.Bool(
False, "Exit on PMU enable, disable, or reset"
)
+ exitOnPMUInterrupt = Param.Bool(False, "Exit on PMU interrupt")
# 64-bit PMU event counters are officially supported when
# Armv8.5-A FEAT_PMUv3p5 is implemented. This parameter is not a
diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc
index efd6417..2cb7085 100644
--- a/src/arch/arm/pmu.cc
+++ b/src/arch/arm/pmu.cc
@@ -68,7 +68,8 @@
swIncrementEvent(nullptr),
reg_pmcr_conf(0),
interrupt(nullptr),
- exitOnPMUControl(p.exitOnPMUControl)
+ exitOnPMUControl(p.exitOnPMUControl),
+ exitOnPMUInterrupt(p.exitOnPMUInterrupt)
{
DPRINTF(PMUVerbose, "Initializing the PMU.\n");
@@ -677,6 +678,10 @@
void
PMU::raiseInterrupt()
{
+ if (exitOnPMUInterrupt) {
+ inform("Exiting simulation: PMU interrupt detected");
+ exitSimLoop("performance counter interrupt", 0);
+ }
if (interrupt) {
DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n");
interrupt->raise();
diff --git a/src/arch/arm/pmu.hh b/src/arch/arm/pmu.hh
index 4999031..64f8f13 100644
--- a/src/arch/arm/pmu.hh
+++ b/src/arch/arm/pmu.hh
@@ -638,6 +638,10 @@
*/
const bool exitOnPMUControl;
+ /**
+ * Exit simloop on PMU interrupt
+ */
+ bool exitOnPMUInterrupt;
};
} // namespace ArmISA
diff --git a/src/python/gem5/simulate/exit_event.py
b/src/python/gem5/simulate/exit_event.py
index 61462e4..cffe864 100644
--- a/src/python/gem5/simulate/exit_event.py
+++ b/src/python/gem5/simulate/exit_event.py
@@ -52,6 +52,7 @@
PERF_COUNTER_ENABLE = "performance counter enabled"
PERF_COUNTER_DISABLE = "performance counter disabled"
PERF_COUNTER_RESET = "performance counter reset"
+ PERF_COUNTER_INTERRUPT = "performance counter interrupt"
@classmethod
def translate_exit_status(cls, exit_string: str) -> "ExitEvent":
@@ -99,6 +100,8 @@
return ExitEvent.PERF_COUNTER_DISABLE
elif exit_string == "performance counter reset":
return ExitEvent.PERF_COUNTER_RESET
+ elif exit_string == "performance counter interrupt":
+ return ExitEvent.PERF_COUNTER_INTERRUPT
elif exit_string.endswith("will terminate the simulation.\n"):
# This is for the traffic generator exit event
return ExitEvent.EXIT
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69958?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ife02fe8e467dec91a2d4fda3f7dc9540a092f1ec
Gerrit-Change-Number: 69958
Gerrit-PatchSet: 3
Gerrit-Owner: Richard Cooper <richard.coo...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Richard Cooper <richard.coo...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org