From: David VomLehn <dvomlehn@cisco.com>
To: David Howells <dhowells@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>,
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 17:04:39 -0400 [thread overview]
Message-ID: <4BC62DE7.20603@cisco.com> (raw)
In-Reply-To: <25356.1271076327@redhat.com>
David Howells wrote:
> Russell King <rmk@arm.linux.org.uk> wrote:
>
>
>> Can you explain why you want this?
>>
>> I'm wondering about the value of saving the registers; normally when a panic
>> occurs, it's because of a well defined reason, and not because something
>> went wrong in some CPU register; to put it another way, a panic() is a
>> more controlled exception than a BUG() or a bad pointer dereference.
>>
>
> +1.
>
> I found in FS-Cache and CacheFiles that often the things I most wanted to know
> when I had something of the form:
>
> if (A == B)
> BUG();
>
> was a and b, so I made the following macro:
>
> #define ASSERTCMP(X, OP, Y) \
> do { \
> if (unlikely(!((X) OP (Y)))) { \
> printk(KERN_ERR "\n"); \
> printk(KERN_ERR "AFS: Assertion failed\n"); \
> printk(KERN_ERR "%lu " #OP " %lu is false\n", \
> (unsigned long)(X), (unsigned long)(Y)); \
> printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
> (unsigned long)(X), (unsigned long)(Y)); \
> BUG(); \
> } \
> } while(0)
>
> which I could then call like this:
>
> ASSERTCMP(A, ==, B);
>
> and if the assertion failed, it prints A and B explicitly. This is much
> easier than trying to pick the values out of a register dump, especially as
> the compiler may be free to clobber A or B immediately after testing them.
>
This is great if you'r in a development environment, and can focus on a
single, well
characterized case. Unfortunately, I'm staring at hundreds of thousands
of systems
in the field, all which which have a large number of panic() statements
for which this
approach has not been taken. So, I have no alternative but to pick the
value out of
a register dump.
> David
>
next prev parent reply other threads:[~2010-04-14 21:04 UTC|newest]
Thread overview: 20+ 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 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:24 ` Russell King
2010-04-12 12:24 ` Russell King
2010-04-14 20:47 ` David VomLehn
2010-04-12 12:20 ` David Howells
2010-04-12 12:27 ` Russell King
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 [this message]
2010-04-15 2:54 ` Paul Mundt
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=4BC62DE7.20603@cisco.com \
--to=dvomlehn@cisco.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).