[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1242404236-17624-1-git-send-email-ian.campbell@citrix.com>
Date: Fri, 15 May 2009 17:17:16 +0100
From: Ian Campbell <ian.campbell@...rix.com>
To: linux-kernel@...r.kernel.org
Cc: Ian Campbell <ian.campbell@...rix.com>,
Jesper Nilsson <jesper.nilsson@...s.com>,
Johannes Weiner <hannes@...xchg.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
Hugh Dickins <hugh@...itas.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] Fix print out of function which called WARN_ON()
All WARN_ON()'s currently appear to come from warn_slowpath_null e.g.:
WARNING: at kernel/softirq.c:143 warn_slowpath_null+0x1c/0x20()
This is because since:
commit 57adc4d2dbf968fdbe516359688094eef4d46581
Author: Andi Kleen <andi@...stfloor.org>
Date: Wed May 6 16:02:53 2009 -0700
Eliminate thousands of warnings with gcc 3.2 build
the caller of warn_slowpath_fmt really is warn_flowpath_null not the
interesting caller next up the chain. Since __builtin_return_address(X) for X >
0 is not reliable, pass the real caller as an argument to warn_slowpath_fmt.
[If there was a __builtin_this_address() I would use that for the WARN() case
for consistency, I don't know of such a thing though]
Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
Cc: Jesper Nilsson <jesper.nilsson@...s.com>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Arjan van de Ven <arjan@...ux.intel.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Hugh Dickins <hugh@...itas.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
---
include/asm-generic/bug.h | 5 +++--
kernel/panic.c | 11 ++++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 4f4f6e9..39d8dbd 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -59,12 +59,13 @@ struct bug_entry {
#ifndef __WARN
#ifndef __ASSEMBLY__
extern void warn_slowpath_fmt(const char *file, const int line,
- const char *fmt, ...) __attribute__((format(printf, 3, 4)));
+ unsigned long caller,
+ const char *fmt, ...) __attribute__((format(printf, 4, 5)));
extern void warn_slowpath_null(const char *file, const int line);
#define WANT_WARN_ON_SLOWPATH
#endif
#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
-#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
+#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, 0UL, arg)
#else
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
#endif
diff --git a/kernel/panic.c b/kernel/panic.c
index 874ecf1..4e1d746 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -340,13 +340,16 @@ void oops_exit(void)
}
#ifdef WANT_WARN_ON_SLOWPATH
-void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
+void warn_slowpath_fmt(const char *file, int line, unsigned long caller,
+ const char *fmt, ...)
{
va_list args;
char function[KSYM_SYMBOL_LEN];
- unsigned long caller = (unsigned long)__builtin_return_address(0);
const char *board;
+ if (!caller)
+ caller = (unsigned long)__builtin_return_address(0);
+
sprint_symbol(function, caller);
printk(KERN_WARNING "------------[ cut here ]------------\n");
@@ -372,7 +375,9 @@ EXPORT_SYMBOL(warn_slowpath_fmt);
void warn_slowpath_null(const char *file, int line)
{
static const char *empty = "";
- warn_slowpath_fmt(file, line, empty);
+ warn_slowpath_fmt(file, line,
+ (unsigned long)__builtin_return_address(0),
+ empty);
}
EXPORT_SYMBOL(warn_slowpath_null);
#endif
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists