From: Andi Kleen <andi@firstfloor.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Robert Hancock <hancockr@shaw.ca>,
linux-kernel@vger.kernel.org, david@lang.hm,
Andi Kleen <andi@firstfloor.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: early exception error
Date: Mon, 5 Jan 2009 14:08:36 +0100 [thread overview]
Message-ID: <20090105130836.GN496@one.firstfloor.org> (raw)
In-Reply-To: <20090105092619.GA3699@cmpxchg.org>
On Mon, Jan 05, 2009 at 10:26:19AM +0100, Johannes Weiner wrote:
> On Fri, Jan 02, 2009 at 02:57:17PM -0600, Robert Hancock wrote:
> > Cyrill Gorcunov wrote:
> > >
> > >Here is a new picture if someone would like to jump into
> > >the bug handling
> > >
> > > http://linux.lang.hm/linux/IMG00033.jpg
> >
> > alloc_bootmem_core is a reasonably big function, it would be useful if
> > we could track down what line it's blowing up on.. Can you try to find
> > out what line that fault address (ffffffff8096452a in this crash) is on
> > as described in Documentation/BUG-HUNTING, i.e. build with
> > CONFIG_DEBUG_INFO enabled, run gdb on vmlinux and do:
> >
> > l *0xffffffff8096452a
>
> He has booted with bootmem debugging output. Given that the bdebug()
> describing the request wasn't hit yet, it must be one of the BUG_ON()s
> (or bdata is NULL).
BUG_ONs with early exceptions are always a big annoyance.
I did an EARLY_BUG_ON() infrastructure some time ago, but ended up
not submitting it because the BUG_ONs I wanted it for originally
disappeared before submission.
It would probably be a good idea to convert the bootmem bugs over
to that.
-Andi
---
Add EARLY_BUG_ON infrastructure
EARLY_BUG_ON is larger than BUG_ON, but it works before traps_init
and always outputs the line number without having to decode
addresses from the early exception handler.
It always panics.
Shouldn't be used when multiple CPUs are active because it makes
no attempt to stop the others.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/include/asm/bug.h | 11 +++++++++++
arch/x86/kernel/early_printk.c | 7 +++++++
include/linux/bug.h | 5 +++++
3 files changed, 23 insertions(+)
Index: linux-2.6.28-test/arch/x86/include/asm/bug.h
===================================================================
--- linux-2.6.28-test.orig/arch/x86/include/asm/bug.h 2008-10-24 13:34:40.000000000 +0200
+++ linux-2.6.28-test/arch/x86/include/asm/bug.h 2009-01-05 13:47:02.000000000 +0100
@@ -33,6 +33,17 @@
} while (0)
#endif
+extern void early_bug(char *file, int line) __attribute__((noreturn));
+
+/* All BUG_ONs before console_init should be EARLY_BUG_ONs. */
+#define EARLY_BUG() early_bug(__FILE__, __LINE__)
+#define EARLY_BUG_ON(x) do { if (unlikely(!(x))) EARLY_BUG(); } while (0)
+
+#else
+
+#define EARLY_BUG() do {} while(0)
+#define EARLY_BUG_ON(x) do {} while(0)
+
#endif /* !CONFIG_BUG */
#include <asm-generic/bug.h>
Index: linux-2.6.28-test/arch/x86/kernel/early_printk.c
===================================================================
--- linux-2.6.28-test.orig/arch/x86/kernel/early_printk.c 2008-10-24 13:34:40.000000000 +0200
+++ linux-2.6.28-test/arch/x86/kernel/early_printk.c 2009-01-05 13:48:46.000000000 +0100
@@ -934,6 +934,13 @@
va_end(ap);
}
+void early_bug(char *file, int line)
+{
+ early_printk("PANIC: Early BUG at %s:%d\n", file, line);
+ printk("PANIC: Early BUG at %s:%d\n", file, line);
+ for (;;)
+ cpu_relax();
+}
static int __init setup_early_printk(char *buf)
{
Index: linux-2.6.28-test/include/linux/bug.h
===================================================================
--- linux-2.6.28-test.orig/include/linux/bug.h 2008-07-05 14:11:02.000000000 +0200
+++ linux-2.6.28-test/include/linux/bug.h 2009-01-05 13:49:32.000000000 +0100
@@ -47,4 +47,9 @@
static inline void module_bug_cleanup(struct module *mod) {}
#endif /* CONFIG_GENERIC_BUG */
+
+#ifndef EARLY_BUG_ON
+#define EARLY_BUG_ON(x) BUG_ON(x)
+#endif
+
#endif /* _LINUX_BUG_H */
next prev parent reply other threads:[~2009-01-05 12:54 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-30 22:21 early exception error david
2008-12-30 21:26 ` Cyrill Gorcunov
2008-12-30 22:31 ` david
2008-12-30 21:41 ` Cyrill Gorcunov
2008-12-30 22:48 ` david
2008-12-31 0:25 ` Andi Kleen
2008-12-31 1:39 ` david
2008-12-31 1:25 ` Andi Kleen
2008-12-31 9:38 ` Cyrill Gorcunov
2008-12-31 19:12 ` david
2008-12-31 18:30 ` Cyrill Gorcunov
2008-12-31 19:50 ` Andi Kleen
2008-12-31 20:20 ` Cyrill Gorcunov
2008-12-31 20:59 ` david
2009-01-01 4:17 ` Andi Kleen
2009-01-01 6:17 ` david
2009-01-01 14:02 ` Andi Kleen
2009-01-02 18:21 ` david
2009-01-02 17:24 ` Cyrill Gorcunov
2009-01-02 20:57 ` Robert Hancock
2009-01-05 9:26 ` Johannes Weiner
2009-01-05 13:08 ` Andi Kleen [this message]
2009-01-05 14:51 ` Jiri Slaby
2009-01-05 15:01 ` Cyrill Gorcunov
2009-01-05 15:14 ` Jiri Slaby
2009-01-05 15:30 ` Cyrill Gorcunov
2009-01-05 15:39 ` Jiri Slaby
2009-01-05 15:42 ` Cyrill Gorcunov
2009-01-05 14:51 ` Jiri Slaby
2008-12-31 20:07 ` david
2008-12-31 19:12 ` Cyrill Gorcunov
2008-12-31 21:18 ` david
2008-12-31 20:23 ` Cyrill Gorcunov
2008-12-31 20:27 ` Cyrill Gorcunov
2008-12-31 22:30 ` Cyrill Gorcunov
[not found] <alpine.DEB.1.10.0901021029010.21408@asgard.lang.hm>
[not found] ` <20090102173441.GC5372@localhost>
[not found] ` <alpine.DEB.1.10.0901021044460.21408@asgard.lang.hm>
[not found] ` <20090102174845.GD5372@localhost>
[not found] ` <20090102175226.GE5372@localhost>
[not found] ` <alpine.DEB.1.10.0901021131210.21567@asgard.lang.hm>
[not found] ` <20090102203058.GH5372@localhost>
[not found] ` <alpine.DEB.1.10.0901030823190.23262@asgard.lang.hm>
[not found] ` <20090103161052.GB11093@localhost>
[not found] ` <alpine.DEB.1.10.0901031118450.23262@asgard.lang.hm>
2009-01-03 19:03 ` Cyrill Gorcunov
2009-01-03 21:24 ` Cyrill Gorcunov
2009-01-04 0:24 ` Jiri Slaby
2009-01-04 0:59 ` Andi Kleen
2009-01-04 10:32 ` Cyrill Gorcunov
2009-01-04 11:11 ` Cyrill Gorcunov
2009-01-04 11:29 ` Cyrill Gorcunov
2009-01-04 12:23 ` Jiri Slaby
2009-01-05 22:20 ` david
2009-01-05 21:25 ` Cyrill Gorcunov
2009-01-05 23:20 ` david
2009-01-06 8:01 ` Cyrill Gorcunov
2009-01-05 21:55 ` Yinghai Lu
2009-01-05 22:07 ` Yinghai Lu
2009-01-05 23:20 ` david
2009-01-06 0:50 ` david
2009-01-06 0:54 ` david
2009-01-06 0:02 ` Yinghai Lu
2009-01-06 1:22 ` david
2009-01-06 0:25 ` Yinghai Lu
2009-01-06 2:03 ` david
2009-01-06 1:06 ` Yinghai Lu
2009-01-06 5:29 ` david
2009-01-06 6:09 ` Yinghai Lu
2009-01-07 7:49 ` david
2009-01-05 23:18 ` david
2009-01-05 22:29 ` Yinghai Lu
2009-01-05 22:31 ` Yinghai Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090105130836.GN496@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=akpm@linux-foundation.org \
--cc=david@lang.hm \
--cc=hancockr@shaw.ca \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox