* [PATCH] Additional kgdb hooks
@ 2004-11-08 14:32 dhowells
2004-11-08 16:41 ` Tom Rini
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: dhowells @ 2004-11-08 14:32 UTC (permalink / raw)
To: torvalds, akpm, davidm; +Cc: linux-kernel, uclinux-dev
The attached patch adds a couple of extra hooks by which kgdb or an equivalent
gdbstub can catch bad_page() and panic() invocations.
Signed-Off-By: dhowells@redhat.com
---
diffstat kgdb-hooks-2610rc1mm3.diff
include/asm-generic/bug.h | 8 ++++++++
kernel/panic.c | 1 +
mm/page_alloc.c | 1 +
3 files changed, 10 insertions(+)
diff -uNrp /warthog/kernels/linux-2.6.10-rc1-mm3/include/asm-generic/bug.h linux-2.6.10-rc1-mm3-frv/include/asm-generic/bug.h
--- /warthog/kernels/linux-2.6.10-rc1-mm3/include/asm-generic/bug.h 2004-10-19 10:42:12.000000000 +0100
+++ linux-2.6.10-rc1-mm3-frv/include/asm-generic/bug.h 2004-11-05 14:13:04.327459964 +0000
@@ -18,6 +18,10 @@
} while (0)
#endif
+#ifndef HAVE_ARCH_KGDB_BAD_PAGE
+#define kgdb_bad_page(page) do {} while(0)
+#endif
+
#ifndef HAVE_ARCH_BUG_ON
#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
#endif
@@ -31,4 +35,8 @@
} while (0)
#endif
+#ifndef HAVE_ARCH_KGDB_RAISE
+#define kgdb_raise(signr) do {} while(0)
+#endif
+
#endif
diff -uNrp /warthog/kernels/linux-2.6.10-rc1-mm3/kernel/panic.c linux-2.6.10-rc1-mm3-frv/kernel/panic.c
--- /warthog/kernels/linux-2.6.10-rc1-mm3/kernel/panic.c 2004-11-05 13:15:51.000000000 +0000
+++ linux-2.6.10-rc1-mm3-frv/kernel/panic.c 2004-11-05 14:13:04.528442988 +0000
@@ -73,6 +73,7 @@ NORET_TYPE void panic(const char * fmt,
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf);
+ kgdb_raise(SIGABRT);
bust_spinlocks(0);
/* If we have crashed, perform a kexec reboot, for dump write-out */
diff -uNrp /warthog/kernels/linux-2.6.10-rc1-mm3/mm/page_alloc.c linux-2.6.10-rc1-mm3-frv/mm/page_alloc.c
--- /warthog/kernels/linux-2.6.10-rc1-mm3/mm/page_alloc.c 2004-11-05 13:15:52.000000000 +0000
+++ linux-2.6.10-rc1-mm3-frv/mm/page_alloc.c 2004-11-05 14:13:04.654432347 +0000
@@ -88,6 +89,7 @@ static void bad_page(const char *functio
page->mapping, page_mapcount(page), page_count(page));
printk(KERN_EMERG "Backtrace:\n");
dump_stack();
+ kgdb_bad_page(page);
printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n");
page->flags &= ~(1 << PG_private |
1 << PG_locked |
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Additional kgdb hooks
2004-11-08 14:32 [PATCH] Additional kgdb hooks dhowells
@ 2004-11-08 16:41 ` Tom Rini
2004-11-08 16:55 ` David Howells
2004-11-08 22:44 ` Andrew Morton
2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2004-11-08 16:41 UTC (permalink / raw)
To: dhowells; +Cc: torvalds, akpm, davidm, linux-kernel, uclinux-dev
On Mon, Nov 08, 2004 at 02:32:41PM +0000, dhowells@redhat.com wrote:
> The attached patch adds a couple of extra hooks by which kgdb or an equivalent
> gdbstub can catch bad_page() and panic() invocations.
What stub are you using that doesn't catch these?
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Additional kgdb hooks
2004-11-08 14:32 [PATCH] Additional kgdb hooks dhowells
2004-11-08 16:41 ` Tom Rini
@ 2004-11-08 16:55 ` David Howells
2004-11-08 22:44 ` Andrew Morton
2 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2004-11-08 16:55 UTC (permalink / raw)
To: Tom Rini; +Cc: torvalds, akpm, davidm, linux-kernel, uclinux-dev
> > The attached patch adds a couple of extra hooks by which kgdb or an
> > equivalent gdbstub can catch bad_page() and panic() invocations.
>
> What stub are you using that doesn't catch these?
FRV.
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Additional kgdb hooks
2004-11-08 14:32 [PATCH] Additional kgdb hooks dhowells
2004-11-08 16:41 ` Tom Rini
2004-11-08 16:55 ` David Howells
@ 2004-11-08 22:44 ` Andrew Morton
2004-11-09 23:29 ` George Anzinger
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2004-11-08 22:44 UTC (permalink / raw)
To: dhowells; +Cc: torvalds, davidm, linux-kernel, uclinux-dev
dhowells@redhat.com wrote:
>
> The attached patch adds a couple of extra hooks by which kgdb or an equivalent
> gdbstub can catch bad_page() and panic() invocations.
Tom is valiantly flogging his way through a generic KGDB implementation. I
think it would be better to push ahead with that and to not put into
generic code hooks which are specific to one arch's kgdb implementation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Additional kgdb hooks
2004-11-08 22:44 ` Andrew Morton
@ 2004-11-09 23:29 ` George Anzinger
2004-11-19 22:06 ` Tom Rini
0 siblings, 1 reply; 6+ messages in thread
From: George Anzinger @ 2004-11-09 23:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: dhowells, torvalds, davidm, linux-kernel, uclinux-dev
Andrew Morton wrote:
> dhowells@redhat.com wrote:
>
>>The attached patch adds a couple of extra hooks by which kgdb or an equivalent
>>gdbstub can catch bad_page() and panic() invocations.
>
>
> Tom is valiantly flogging his way through a generic KGDB implementation. I
> think it would be better to push ahead with that and to not put into
> generic code hooks which are specific to one arch's kgdb implementation.
>
IMNSHO the trap should be in dump_stack(). That way it catches a bunch of
things all at once.
Also, panic has a notify option that kgdb should use just like everybody else.
--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Additional kgdb hooks
2004-11-09 23:29 ` George Anzinger
@ 2004-11-19 22:06 ` Tom Rini
0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2004-11-19 22:06 UTC (permalink / raw)
To: George Anzinger
Cc: Andrew Morton, dhowells, torvalds, davidm, linux-kernel, uclinux-dev
On Tue, Nov 09, 2004 at 03:29:28PM -0800, George Anzinger wrote:
> Andrew Morton wrote:
> >dhowells@redhat.com wrote:
> >
> >>The attached patch adds a couple of extra hooks by which kgdb or an
> >>equivalent
> >>gdbstub can catch bad_page() and panic() invocations.
> >
> >
> >Tom is valiantly flogging his way through a generic KGDB implementation. I
> >think it would be better to push ahead with that and to not put into
> >generic code hooks which are specific to one arch's kgdb implementation.
>
> IMNSHO the trap should be in dump_stack(). That way it catches a bunch of
> things all at once.
The hard question is how to do this cleanly. Perhaps changing things
slightly so that lib/dump_stack.c provides the 'true' dump_stack() (or
moving it to kernel/dump_stack.c) which calls a notify chain and then
arch_dump_stack() ?
> Also, panic has a notify option that kgdb should use just like everybody
> else.
This is a good idea, I'm surprised we didn't already do, so I've just
done it.
--
Tom Rini
http://gate.crashing.org/~trini/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-11-19 22:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-08 14:32 [PATCH] Additional kgdb hooks dhowells
2004-11-08 16:41 ` Tom Rini
2004-11-08 16:55 ` David Howells
2004-11-08 22:44 ` Andrew Morton
2004-11-09 23:29 ` George Anzinger
2004-11-19 22:06 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.