From: David VomLehn <dvomlehn@cisco.com>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: dvomlehn@cisco.com, linux-arch@vger.kernel.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/23] Make register values available to panic notifiers
Date: Wed, 14 Apr 2010 16:47:47 -0400 [thread overview]
Message-ID: <4BC629F3.8040103@cisco.com> (raw)
In-Reply-To: <20100412120330.GA2566@osiris.boeblingen.de.ibm.com>
Heiko Carstens wrote:
> On Sun, Apr 11, 2010 at 11:06:09PM -0700, David VomLehn wrote:
>
>> This patch makes panic() and die() registers available to, for example,
>> panic notifier functions. Panic notifier functions are quite useful
>> for recording crash information, but they don't get passed the register
>> values. This makes it hard to print register contents, do stack
>> backtraces, etc. The changes in this patch save the register state when
>> panic() is called and introduce a function for die() to call that allows
>> it to pass in the registers it was passed.
>>
>> Following this patch are more patches, one per architecture. These include
>> two types of changes:
>> o A save_ptregs() function for the processor. I've taken a whack at
>> doing this for all of the processors. I have tested x86 and MIPS
>> versions. I was able to find cross compilers for ARM, ... and the
>> code compiles cleanly. Everything else, well, what you see is sheer
>> fantasy. You are welcome to chortle with merriment.
>> o When I could figure it out, I replaced the calls to panic() in
>> exception handling functions with calls to panic_with_regs() so
>> that everyone can leverage these changes without much effort. Again,
>> not all the code was transparent, so there are likely some places
>> that should have additional work done.
>>
>> Note that the pointer to the struct pt_regs may be NULL. This is to
>> accomodate those processors which don't have a working save_ptregs(). I'd
>> love to eliminate this case by providing a save_ptregs() for all
>> architectures, but I'll need help to so.
>>
>
> Wouldn't it be much easier to implement panic with an illegal op and let
> the exception handler set up the pt regs structure instead? Just like some
> architectures do that already for warnings.
> Have a look at lib/bug.c and at various arch/<...>/include/asm/bug.h.
> BUG_FLAG_PANIC would do the trick.
>
You could do this so long as your exception handler wasn't compromised. When
you get here, your system is already known to have failed, so the idea
is to be
as gentle as possible.
> But I'm still wondering what the use case would be. You haven't posted any
> code that would actually use this.
>
I'm working my way towards this, but the general idea is to be able to
log all system
state from within a panic handler. So, you'd want to print the
registers, the stack,
the window of memory around instructions, the stack trace, etc., all of
which need
some set of the register values.
next prev parent reply other threads:[~2010-04-14 20:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-12 6:06 [PATCH 1/23] Make register values available to panic notifiers David VomLehn
2010-04-12 6:06 ` David VomLehn
2010-04-12 6:24 ` Mike Frysinger
2010-04-12 6:24 ` Mike Frysinger
2010-04-12 11:16 ` David Howells
2010-04-12 11:16 ` David Howells
2010-04-14 20:41 ` David VomLehn
2010-04-14 20:42 ` David VomLehn
2010-04-14 23:52 ` David Howells
2010-04-14 23:58 ` David Miller
2010-04-12 12:03 ` Heiko Carstens
2010-04-12 12:03 ` Heiko Carstens
2010-04-12 12:24 ` Russell King
2010-04-12 12:24 ` Russell King
2010-04-14 20:47 ` David VomLehn [this message]
2010-04-12 12:20 ` David Howells
2010-04-12 12:20 ` David Howells
2010-04-12 12:27 ` Russell King
2010-04-12 12:27 ` Russell King
2010-04-12 13:35 ` Martin Schwidefsky
2010-04-12 13:35 ` Martin Schwidefsky
2010-04-14 21:09 ` David VomLehn
2010-04-14 21:00 ` David VomLehn
2010-04-12 12:45 ` David Howells
2010-04-14 21:04 ` David VomLehn
2010-04-15 2:54 ` Paul Mundt
-- strict thread matches above, loose matches on Subject: below --
2010-04-12 6:03 David VomLehn
2010-04-12 21:57 ` Andrew Morton
2010-04-14 22:02 ` David VomLehn
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=4BC629F3.8040103@cisco.com \
--to=dvomlehn@cisco.com \
--cc=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-arch@vger.kernel.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 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.