[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130408160811.GA20612@gmail.com>
Date: Mon, 8 Apr 2013 18:08:11 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Tejun Heo <tj@...nel.org>
Cc: linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, mingo@...hat.com, x86@...nel.org,
rth@...ddle.net, linux@....linux.org.uk, msalter@...hat.com,
starvik@...s.com, dhowells@...hat.com, tony.luck@...el.com,
benh@...nel.crashing.org, takata@...ux-m32r.org,
geert@...ux-m68k.org, james.hogan@...tec.com, monstr@...str.eu,
ralf@...ux-mips.org, jonas@...thpole.se, rkuo@...eaurora.org,
schwidefsky@...ibm.com, liqin.chen@...plusct.com,
davem@...emloft.net, lethal@...ux-sh.org, vgupta@...opsys.com,
chris@...kel.net, cmetcalf@...era.com, ysato@...rs.sourceforge.jp,
gxt@...c.pku.edu.cn, jdike@...toit.com
Subject: Re: [PATCH 1/7] x86: don't show trace beyond show_stack(NULL, NULL)
* Tejun Heo <tj@...nel.org> wrote:
> show_stack(current or NULL, NULL) is used to print the backtrace of
> the current task. As trace beyond the function itself isn't of much
> interest to anyone, don't show it by determining sp and bp in
> show_stack()'s frame and passing them to show_stack_log_lvl().
>
> This brings show_stack(NULL, NULL)'s behavior in line with
> dump_stack().
>
> Signed-off-by: Tejun Heo <tj@...nel.org>
> ---
> arch/x86/kernel/dumpstack.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> index c8797d5..dd1a7c3 100644
> --- a/arch/x86/kernel/dumpstack.c
> +++ b/arch/x86/kernel/dumpstack.c
> @@ -176,7 +176,19 @@ void show_trace(struct task_struct *task, struct pt_regs *regs,
>
> void show_stack(struct task_struct *task, unsigned long *sp)
> {
> - show_stack_log_lvl(task, NULL, sp, 0, "");
> + unsigned long bp = 0;
> + unsigned long stack;
> +
> + /*
> + * Stack frames below this one aren't interesting. Don't show them
> + * if we're printing for %current.
> + */
> + if (!sp && (!task || task == current)) {
> + sp = &stack;
> + bp = stack_frame(current, NULL);
> + }
> +
> + show_stack_log_lvl(task, NULL, sp, bp, "");
Hm, show_regs() has a similar problem AFAICS.
Would be nice to create an __always_inline helper for all this, and to use it for
show_regs() as well.
Then the !bp special case in dump_trace() could be removed, and !bp be made an
invalid variant.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists