linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lauraa@codeaurora.org (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] process: change from __backtrace to dump_stack_regs in show_regs
Date: Wed, 24 Aug 2011 13:58:18 -0700 (PDT)	[thread overview]
Message-ID: <a82026b2eff29e255a843f51d7c72ca7.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <alpine.LFD.2.00.1108241434140.20358@xanadu.home>


On Wed, August 24, 2011 11:57 am, Nicolas Pitre wrote:
> On Wed, 24 Aug 2011, Laura Abbott wrote:
>
>> Currently, show_regs calls __backtrace which does
>> nothing if CONIFG_FRAME_POINTER is not set. Switch to
>
> s/CONIFG/CONFIG/
>
>> dump_stack_regs to show the backtrace from a given
>> set of registers.
>>
>> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
>> ---
>>  arch/arm/kernel/process.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
>> index 1a347f4..6f11213 100644
>> --- a/arch/arm/kernel/process.c
>> +++ b/arch/arm/kernel/process.c
>> @@ -319,7 +319,7 @@ void show_regs(struct pt_regs * regs)
>>  	printk("\n");
>>  	printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
>>  	__show_regs(regs);
>> -	__backtrace();
>> +	dump_stack_regs(regs);
>
> This is not equivalent.  A call to __backtrace() will display a call
> trace leading to this show_regs().  Given that you defined
> dump_stack_regs(regs) as dump_backtrace(regs, NULL), the trace will
> instead contain calls leading up to the point where those regs were
> saved.
>

Do other architectures show the call stack to show_regs? From my reading
of other code (x86, ppc) it seems like if show_regs generates a call stack
it generates a call stack based off of the saved registers unless I'm
drastically misunderstanding the code. Generating a call stack based off
of not saved registers seems inconsistent with the rest of show_regs which
shows saved state.

> A better way to achieve what you want would be:
>
> - remove the __backtrace entry point from lib/backtrace.S
>
> - define __backtrace() in kernel/traps.c as a call to
>   dump_backtrace(NULL, NULL) which will have the same effect as the
>   assembly code for __backtrace().
>
> - realize that dump_stack() is already doing exactly that, therefore...
>
> - use dump_stack() in show_regs() which is the only caller of
>   __backtrace and get rid of __backtrace entirely.
>
> Obviously the above can be collapsed in one patch.
>
>
> Nicolas
>

Laura

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2011-08-24 20:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 17:21 [PATCH] Fix show_regs to give a backtrace Laura Abbott
2011-08-24 17:21 ` [PATCH 1/2] arm: add dump_stack_regs to dump stack from registers Laura Abbott
2011-08-24 17:21 ` [PATCH 2/2] process: change from __backtrace to dump_stack_regs in show_regs Laura Abbott
2011-08-24 18:57   ` Nicolas Pitre
2011-08-24 20:58     ` Laura Abbott [this message]
2011-08-24 23:27       ` Nicolas Pitre

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=a82026b2eff29e255a843f51d7c72ca7.squirrel@www.codeaurora.org \
    --to=lauraa@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).