Re: early exception error

Johannes Weiner
2009-01-05T09:26:46Z

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).

If you can find out the line with gdb, this would be great.

Besides that it might be useful to move the bdebug() before the
BUG_ON()s. With the line info available, the expressions that trigger
a bug are pretty unambiguous, but since we would print the parameters
anyway we can as well do so before a possible panic to quickly deduce
what went wrong without decoding.

Hannes

---
Subject: bootmem: print request details before BUG_ON(them)

Moving the request details print-out before the sanity checks that
might panic() enables us to analyse invalid requests without having
access to the line information of the stack dump.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---

diff --git a/mm/bootmem.c b/mm/bootmem.c
index ac5a891..51a0ccf 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -435,6 +435,10 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
unsigned long fallback = 0;
unsigned long min, max, start, sidx, midx, step;

+ bdebug("nid=%td size=%lx [%lu pages] align=%lx goal=%lx limit=%lx\n",
+ bdata - bootmem_node_data, size, PAGE_ALIGN(size) >> PAGE_SHIFT,
+ align, goal, limit);
+
BUG_ON(!size);
BUG_ON(align & (align - 1));
BUG_ON(limit && goal + size > limit);
@@ -442,10 +446,6 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
if (!bdata->node_bootmem_map)
return NULL;

- bdebug("nid=%td size=%lx [%lu pages] align=%lx goal=%lx limit=%lx\n",
- bdata - bootmem_node_data, size, PAGE_ALIGN(size) >> PAGE_SHIFT,
- align, goal, limit);
-
min = bdata->node_min_pfn;
max = bdata->node_low_pfn;