From: Ingo Molnar <mingo@elte.hu>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@gmail.com>,
mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
tglx@linutronix.de,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [tip:x86/cleanups] x86, dumpstack: Use frame pointer during stack trace
Date: Wed, 23 Mar 2011 15:36:27 +0100 [thread overview]
Message-ID: <20110323143627.GA31377@elte.hu> (raw)
In-Reply-To: <AANLkTikMaimbA=ia-Gr91JbdwFqeAcyTuQ9VzHhATent@mail.gmail.com>
* Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 2011/3/23 Namhyung Kim <namhyung@gmail.com>:
> > 2011-03-11 (금), 00:02 +0100, Frederic Weisbecker:
> >> On Thu, Mar 10, 2011 at 10:26:07PM +0000, tip-bot for Namhyung Kim wrote:
> >> > Commit-ID: 2f8058ae197236f9d5641850ce27f67d8f3e0b39
> >> > Gitweb: http://git.kernel.org/tip/2f8058ae197236f9d5641850ce27f67d8f3e0b39
> >> > Author: Namhyung Kim <namhyung@gmail.com>
> >> > AuthorDate: Tue, 8 Mar 2011 20:44:22 +0900
> >> > Committer: Thomas Gleixner <tglx@linutronix.de>
> >> > CommitDate: Thu, 10 Mar 2011 23:20:30 +0100
> >> >
> >> > x86, dumpstack: Use frame pointer during stack trace
> >> >
> >> > If CONFIG_FRAME_POINTER is set then use the frame pointer for the
> >> > stack backtrace rather than scanning whole stack blindly.
> >>
> >> We don't do it blindly, we actually check the reliability with the
> >> frame pointer.
> >>
> >> I'm not sure this patch is a good idea. stack dumps need to stay very
> >> robust and not exclusively rely on the frame pointer to be correct.
> >> At least walking blindly the stack provides a best effort dump as a last
> >> resort.
> >>
> >
> > Sounds reasonable. How about adding a boot param to control it then?
>
> Hmm, but I'm not sure what it would be useful for. Even if one is sure that
> his crash will have the needed reliable addresses already, having unreliable
> ones too in the report are not a problem. Are they?
Agreed, there's no point in such a boot parameter really.
The principles for printing backtraces are the following:
- Robustness comes first. We do not ever want to crash or miss important
information because the frame pointer chain broke in some rarely used
assembler code.
- Information. Backtraces like:
[ 3.522991] Call Trace:
[ 3.523351] [<ffffffff814f35b9>] panic+0x91/0x199
[ 3.523468] [<ffffffff814f3729>] ? printk+0x68/0x6a
[ 3.523576] [<ffffffff81a981b2>] mount_block_root+0x257/0x26e
[ 3.523681] [<ffffffff81a9821f>] mount_root+0x56/0x5a
[ 3.523780] [<ffffffff81a98393>] prepare_namespace+0x170/0x1a9
[ 3.523885] [<ffffffff81a9772b>] kernel_init+0x1d2/0x1e2
[ 3.523987] [<ffffffff81003894>] kernel_thread_helper+0x4/0x10
[ 3.524228] [<ffffffff814f6880>] ? restore_args+0x0/0x30
[ 3.524345] [<ffffffff81a97559>] ? kernel_init+0x0/0x1e2
[ 3.524445] [<ffffffff81003890>] ? kernel_thread_helper+0x0/0x10
are immensely useful, because firstly we see the 'real' backtrace:
[ 3.523351] [<ffffffff814f35b9>] panic+0x91/0x199
[ 3.523576] [<ffffffff81a981b2>] mount_block_root+0x257/0x26e
[ 3.523681] [<ffffffff81a9821f>] mount_root+0x56/0x5a
[ 3.523780] [<ffffffff81a98393>] prepare_namespace+0x170/0x1a9
[ 3.523885] [<ffffffff81a9772b>] kernel_init+0x1d2/0x1e2
[ 3.523987] [<ffffffff81003894>] kernel_thread_helper+0x4/0x10
Secondly, we also see the 'residual trace' of what is on the kernel stack:
[ 3.523468] [<ffffffff814f3729>] ? printk+0x68/0x6a
[ 3.524228] [<ffffffff814f6880>] ? restore_args+0x0/0x30
[ 3.524345] [<ffffffff81a97559>] ? kernel_init+0x0/0x1e2
[ 3.524445] [<ffffffff81003890>] ? kernel_thread_helper+0x0/0x10
Which is a poor man's kernel trace really. Here it tells us that a printk
executed shortly before the backtrace was generated. Info like this can
be useful when rare crashes are analyzed.
So hiding that information is not really productive. If then we could think about
making the visual output more expressive. For example:
Call Trace:
[<ffffffff814f35b9>] panic() # 0x091/0x199
[<ffffffff814f3729>] # ? printk+0x68/0x6a
[<ffffffff81a981b2>] mount_block_root() # 0x257/0x26e
[<ffffffff81a9821f>] mount_root() # 0x056/0x05a
[<ffffffff81a98393>] prepare_namespace() # 0x170/0x1a9
[<ffffffff81a9772b>] kernel_init() # 0x1d2/0x1e2
[<ffffffff81003894>] kernel_thread_helper() # 0x004/0x010
[<ffffffff814f6880>] # ? restore_args+0x0/0x30
[<ffffffff81a97559>] # ? kernel_init+0x0/0x1e2
[<ffffffff81003890>] # ? kernel_thread_helper+0x0/0x10
Would be a 'human readable' variant that tells us the real backtrace 'at a
glance' - perhaps in a bit clearer fashion - while still keeping the 'residual'
entries included as well.
The downside is that tools that parse backtraces out of the syslog might get
confused, so that aspect has to be investigated as well.
Thanks,
Ingo
next prev parent reply other threads:[~2011-03-23 14:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 11:44 [PATCH v4 -tip 1/4] x86, dumpstack: Correct stack dump info when frame pointer is available Namhyung Kim
2011-03-08 11:44 ` [PATCH v4 -tip 2/4] x86, dumpstack: Random printk changes Namhyung Kim
2011-03-10 22:25 ` [tip:x86/cleanups] x86, dumpstack: Cleanup printks tip-bot for Namhyung Kim
2011-03-08 11:44 ` [PATCH v4 -tip 3/4] x86, dumpstack: Rename print_context_stack and friends Namhyung Kim
2011-03-10 22:25 ` [tip:x86/cleanups] " tip-bot for Namhyung Kim
2011-03-08 11:44 ` [PATCH v4 -tip 4/4] x86, dumpstack: Use frame pointer during stack trace Namhyung Kim
2011-03-10 22:26 ` [tip:x86/cleanups] " tip-bot for Namhyung Kim
2011-03-10 23:02 ` Frederic Weisbecker
2011-03-23 13:08 ` Namhyung Kim
2011-03-23 14:08 ` Frederic Weisbecker
2011-03-23 14:36 ` Ingo Molnar [this message]
2011-03-10 22:24 ` [tip:x86/cleanups] x86, dumpstack: Correct stack dump info when frame pointer is available tip-bot for Namhyung Kim
2011-03-10 22:46 ` Frederic Weisbecker
2011-03-11 19:54 ` Thomas Gleixner
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=20110323143627.GA31377@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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