From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Byungchul Park <byungchul.park@lge.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
peterz@infradead.org, linux-kernel@vger.kernel.org,
walken@google.com, Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 1/2] x86/dumpstack: Optimize save_stack_trace
Date: Mon, 18 Jul 2016 08:09:10 -0500 [thread overview]
Message-ID: <20160718130910.vmyvadh5arurxptv@treble> (raw)
In-Reply-To: <20160718031422.GN2279@X58A-UD3R>
On Mon, Jul 18, 2016 at 12:14:22PM +0900, Byungchul Park wrote:
> On Fri, Jul 08, 2016 at 10:22:46AM -0500, Josh Poimboeuf wrote:
> > > > > Also, could you please rename the _norm names to _fast or so, to signal that this
> > > > > is a faster but less reliable method to get a stack dump? Nobody knows what
> > > > > '_norm' means, but '_fast' is pretty self-explanatory.
> > > >
> > > > Hm, but is print_context_stack_bp() variant really less reliable? From
> > > > what I can tell, its only differences vs print_context_stack() are:
> > > >
> > > > - It doesn't scan the stack for "guesses" (which are 'unreliable' and
> > > > are ignored by the ops->address() callback anyway).
> > > >
> > > > - It stops if ops->address() returns an error (which in this case means
> > > > the array is full anyway).
> > > >
> > > > - It stops if the address isn't a kernel text address. I think this
> > > > shouldn't normally be possible unless there's some generated code like
> > > > bpf on the stack. Maybe it could be slightly improved for this case.
> > > >
> > > > So instead of adding a new save_stack_trace_fast() variant, why don't we
> > > > just modify the existing save_stack_trace() to use
> > > > print_context_stack_bp()?
> > >
> > > I'm not sure this is a good idea. First of all if the kernel isn't built with
> > > frame pointers, all you have is wild walk guesses.
> >
> > True, though I'd argue that if frame pointers are disabled then
> > save_stack_trace() should return an empty trace. But admittedly, that
>
> As Frederic said, I think, some save_stack_trace() users may want to
> check the 'guesses', in other words, it's not good idea for
> save_stack_trace() to return an empty trace when frame pointers are
> disabled. No?
With frame pointers disabled, yes, maybe guesses are better than
nothing.
> > > There are several different users of save_stack_trace() in the kernel, we can't
> > > be sure that all of them are interested in dropping those guesses.
> > >
> > > So I'd rather advocate in favour of a new seperate helper.
> >
> > So how about we change save_stack_trace() to use print_context_stack()
> > for CONFIG_FRAME_POINTER=n and print_context_stack_bp() for
> > CONFIG_FRAME_POINTER=y? That would preserve the existing behavior, no?
>
> Even if CONFIG_FRAME_POINTER=y, someone may want to guess, doesn't they?
For CONFIG_FRAME_POINTER=y, the guesses are ignored by
__save_stack_address() and only the reliable addresses are saved.
We shouldn't change that behavior, unless you actually know of a caller
who wants the guesses. And even then the "guess" variation should be
named accordingly to make it clear that it's not a "reliable" stack
trace, even though frame pointers are enabled.
--
Josh
next prev parent reply other threads:[~2016-07-18 13:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 10:27 [PATCH 1/2] x86/dumpstack: Optimize save_stack_trace Byungchul Park
2016-07-04 10:27 ` [PATCH 2/2] x86/dumpstack: Add save_stack_trace_norm() Byungchul Park
2016-07-07 10:17 ` [PATCH 1/2] x86/dumpstack: Optimize save_stack_trace Byungchul Park
2016-07-08 10:08 ` Ingo Molnar
2016-07-08 14:29 ` Josh Poimboeuf
2016-07-08 14:48 ` Ingo Molnar
2016-07-08 15:02 ` Frederic Weisbecker
2016-07-08 15:22 ` Josh Poimboeuf
2016-07-18 3:14 ` Byungchul Park
2016-07-18 13:09 ` Josh Poimboeuf [this message]
2016-07-19 0:08 ` Byungchul Park
2016-07-18 2:42 ` Byungchul Park
2016-07-08 15:07 ` Frederic Weisbecker
2016-07-18 2:37 ` Byungchul Park
2016-07-08 14:08 ` Josh Poimboeuf
2016-07-08 14:44 ` Frederic Weisbecker
2016-07-18 3:25 ` Byungchul Park
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=20160718130910.vmyvadh5arurxptv@treble \
--to=jpoimboe@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=byungchul.park@lge.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=walken@google.com \
/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