From: Andreas Sandberg Date: Mon, 22 Apr 2013 17:20:31 +0000 (-0400) Subject: arm: Enable support for triggering a sim panic on kernel panics X-Git-Tag: stable_2013_10_14~155 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f2361f3afb5c8d15e0a5f262a0f8a7942084563;p=gem5.git arm: Enable support for triggering a sim panic on kernel panics Add the options 'panic_on_panic' and 'panic_on_oops' to the LinuxArmSystem SimObject. When these option are enabled, the simulator panics when the guest kernel panics or oopses. Enable panic on panic and panic on oops in ARM-based test cases. --- diff --git a/src/arch/arm/ArmSystem.py b/src/arch/arm/ArmSystem.py index 763b043dc..b48c2a29d 100644 --- a/src/arch/arm/ArmSystem.py +++ b/src/arch/arm/ArmSystem.py @@ -68,3 +68,8 @@ class LinuxArmSystem(ArmSystem): early_kernel_symbols = Param.Bool(False, "enable early kernel symbol tables before MMU") enable_context_switch_stats_dump = Param.Bool(False, "enable stats/task info dumping at context switch boundaries") + + panic_on_panic = Param.Bool(False, "Trigger a gem5 panic if the " \ + "guest kernel panics") + panic_on_oops = Param.Bool(False, "Trigger a gem5 panic if the " \ + "guest kernel oopses") diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc index de4c27d8b..e714cc913 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -62,11 +62,22 @@ using namespace Linux; LinuxArmSystem::LinuxArmSystem(Params *p) : ArmSystem(p), - enableContextSwitchStatsDump(p->enable_context_switch_stats_dump) + enableContextSwitchStatsDump(p->enable_context_switch_stats_dump), + kernelPanicEvent(NULL), kernelOopsEvent(NULL) { + if (p->panic_on_panic) { + kernelPanicEvent = addKernelFuncEventOrPanic( + "panic", "Kernel panic in simulated kernel"); + } else { #ifndef NDEBUG - kernelPanicEvent = addKernelFuncEventOrPanic("panic"); + kernelPanicEvent = addKernelFuncEventOrPanic("panic"); #endif + } + + if (p->panic_on_oops) { + kernelOopsEvent = addKernelFuncEventOrPanic( + "oops_exit", "Kernel oops in guest"); + } // With ARM udelay() is #defined to __udelay uDelaySkipEvent = addKernelFuncEventOrPanic( diff --git a/src/arch/arm/linux/system.hh b/src/arch/arm/linux/system.hh index feed8cfaa..008c64429 100644 --- a/src/arch/arm/linux/system.hh +++ b/src/arch/arm/linux/system.hh @@ -98,10 +98,12 @@ class LinuxArmSystem : public ArmSystem void mapPid(ThreadContext* tc, uint32_t pid); private: -#ifndef NDEBUG /** Event to halt the simulator if the kernel calls panic() */ - BreakPCEvent *kernelPanicEvent; -#endif + PCEvent *kernelPanicEvent; + + /** Event to halt the simulator if the kernel calls oopses */ + PCEvent *kernelOopsEvent; + /** * PC based event to skip udelay(