From 4a77d532b0191f4db54ea40f4184e7c6a5e0f8f9 Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Sat, 25 Nov 2023 22:36:05 +0000 Subject: [PATCH] stdlib: Add Kernel Panic/Oops exit event to stdlib RISCV full system workloads have the capability of exit the simulation loop upon the guest's kernel panic/oops. This change adds more stdlib exit event types to accommodate the corresponding gem5 exits upon the guest's kernel panic and kernel oops. Change-Id: I3a4f313711793a473c6f138ff831b948034d0bb6 Signed-off-by: Hoa Nguyen --- src/python/gem5/simulate/exit_event.py | 6 ++++++ src/python/gem5/simulate/simulator.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/python/gem5/simulate/exit_event.py b/src/python/gem5/simulate/exit_event.py index 3fd12c371b..b902643a3f 100644 --- a/src/python/gem5/simulate/exit_event.py +++ b/src/python/gem5/simulate/exit_event.py @@ -53,6 +53,8 @@ class ExitEvent(Enum): PERF_COUNTER_DISABLE = "performance counter disabled" PERF_COUNTER_RESET = "performance counter reset" PERF_COUNTER_INTERRUPT = "performance counter interrupt" + KERNEL_PANIC = "kernel panic in simulated system" + KERNEL_OOPS = "kernel oops in simulated system" @classmethod def translate_exit_status(cls, exit_string: str) -> "ExitEvent": @@ -103,6 +105,10 @@ class ExitEvent(Enum): return ExitEvent.PERF_COUNTER_RESET elif exit_string == "performance counter interrupt": return ExitEvent.PERF_COUNTER_INTERRUPT + elif exit_string == "Kernel panic in simulated system.": + return ExitEvent.KERNEL_PANIC + elif exit_string == "Kernel oops in simulated system.": + return ExitEvent.KERNEL_OOPS elif exit_string.endswith("will terminate the simulation.\n"): # This is for the traffic generator exit event return ExitEvent.EXIT diff --git a/src/python/gem5/simulate/simulator.py b/src/python/gem5/simulate/simulator.py index fcbfb6d57d..708a484ead 100644 --- a/src/python/gem5/simulate/simulator.py +++ b/src/python/gem5/simulate/simulator.py @@ -308,6 +308,8 @@ class Simulator: "max instructions", "exiting the simulation", )(), + ExitEvent.KERNEL_PANIC: exit_generator(), + ExitEvent.KERNEL_OOPS: exit_generator(), } if on_exit_event: