[PATCH 2/3] Add tracing_off_event() calls to BUG() and WARN() paths

Chase Douglas
2010-04-14T16:20:25Z

This change adds tracing_off_event() calls, which stop debug tracing,
when a BUG() or WARN() function is called. The stoppage depends on
commandline paramenter tracing_off={bug,warn,none}. The default is
"bug", so only the BUG() paths will stop tracing.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
---
kernel/panic.c | 4 +++-
lib/bug.c | 2 ++
2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 13d966b..f0ff321 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -319,7 +319,7 @@ int oops_may_print(void)
*/
void oops_enter(void)
{
- tracing_off();
+ tracing_off_event(TRACE_EVENT_BUG);
/* can't trust the integrity of the kernel anymore: */
debug_locks_off();
do_oops_enter_exit();
@@ -369,6 +369,8 @@ static void warn_slowpath_common(const char *file, int line, void *caller, struc
{
const char *board;

+ tracing_off_event(TRACE_EVENT_WARN);
+
printk(KERN_WARNING "------------[ cut here ]------------\n");
printk(KERN_WARNING "WARNING: at %s:%d %pS()\n", file, line, caller);
board = dmi_get_system_info(DMI_PRODUCT_NAME);
diff --git a/lib/bug.c b/lib/bug.c
index 300e41a..457c1eb 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -154,6 +154,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
warning = (bug->flags & BUGFLAG_WARNING) != 0;
}

+ tracing_off_event(warning ? TRACE_EVENT_WARN : TRACE_EVENT_BUG);
+
if (warning) {
/* this is a WARN_ON rather than BUG/BUG_ON */
if (file)
--
1.7.0