From: David VomLehn <dvomlehn@cisco.com>
To: Davi Howells <dhowells@redhat.com>
Cc: to@dvomlehn-lnx2.corp.sa.net, linux-arch@vger.kernel.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
maint_arch@dvomlehn-lnx2.corp.sa.net
Subject: Re: [PATCH 1/23] Make register values available to panic notifiers
Date: Wed, 14 Apr 2010 16:41:19 -0400 [thread overview]
Message-ID: <4BC6286F.6030308@cisco.com> (raw)
In-Reply-To: <24048.1271070978@redhat.com>
David Howells wrote:
> David VomLehn <dvomlehn@cisco.com> wrote:
>
>
>> +NORET_TYPE void panic(const char *fmt, ...)
>> +{
>> + va_list args;
>> + const struct pt_regs *regs;
>> + int i;
>> +
>> + preempt_disable();
>> + bust_spinlocks(1);
>> + regs = save_ptregs(&__get_cpu_var(panic_panic_regs));
>> + va_start(args, fmt);
>> + vpanic_with_regs(regs, fmt, args);
>> + /* Since vpanic_with_regs doesn't return, we skip va_end() */
>> + /* Infinite loop so compiler doesn't complain about this returning */
>> + for (i = 0; ; )
>> + mdelay(1);
>> +}
>>
>
> Can the use of va_start() clobber lots of registers, thereby rendering the
> exercise pointless on some arches?
>
The implementations I'm familiar with only need one or two registers.
What it
*does* do is to force the contents of registers being used to pass
argument values
onto the stack. This is roughly what gcc does for asm() statements when you
tell it registers are clobbered.
> Also, can the save_ptregs() function be out of line asm? The FRV constructed
> inline statement is huge (and wrong).
>
With this implementation it has to be inline. One use of the saved
registers is to
backtrace the stack. If you call a function to save the registers, the
stack pointer
and program counter would be those of the called function, which will not be
valid after it returns. I expect that you could come up with an alternative
out-of-line function--on every processor I know, you could backtrace one
frame
to get reasonable values for those registers,. Unfortunately, you would
run the
risk of clobbering other registers by doing the function call. The more you
change register values from those in the function that calls panic(),
the less
useful this becomes. In this case, I think an inline function is worth the
effort to get working. (I'd be interested in know more details about how
tshings are broken in the FRV)
> David
>
next prev parent reply other threads:[~2010-04-14 20:41 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 [this message]
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
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=4BC6286F.6030308@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=maint_arch@dvomlehn-lnx2.corp.sa.net \
--cc=to@dvomlehn-lnx2.corp.sa.net \
/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).