LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86: don't save unreliable stack trace entries
@ 2008-02-22 18:44 Vegard Nossum
  2008-02-22 18:48 ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: Vegard Nossum @ 2008-02-22 18:44 UTC (permalink / raw)
  To: Arjan van de Ven, Ingo Molnar; +Cc: Linux Kernel Mailing List

I find the following patch to make saved stack traces so much easier to
decipher. There might be other uses of save_stack_trace() that I am not
aware of, though. Also, I suggest changing the underlying struct
stack_trace to include the reliable/unreliable information. This, however,
requires all users of save_stack_trace() and all arches saving this
information to change.

Kind regards,
Vegard Nossum


 From 5edfd896c5f0d728111df3d8cae729a375f29d3c Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Fri, 22 Feb 2008 19:23:58 +0100
Subject: [PATCH] x86: don't save unreliable stack trace entries

Currently, there is no way for print_stack_trace() to determine whether a
given stack trace entry was deemed reliable or not, simply because
save_stack_trace() does not record this information. (Perhaps needless to
say, this makes the saved stack traces A LOT harder to read, and probably
with no other benefits, since debugging features that use
save_stack_trace() most likely also require frame pointers, etc.)

This patch reverts to the old behaviour of only recording the reliable trace
entries for saved stack traces.

Signed-off-by: Vegard Nossum <vegardno@ifi.uio.no>
---
  arch/x86/kernel/stacktrace.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 02f0f61..c28c342 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -25,6 +25,8 @@ static int save_stack_stack(void *data, char *name)
  static void save_stack_address(void *data, unsigned long addr, int reliable)
  {
  	struct stack_trace *trace = data;
+	if (!reliable)
+		return;
  	if (trace->skip > 0) {
  		trace->skip--;
  		return;
@@ -37,6 +39,8 @@ static void
  save_stack_address_nosched(void *data, unsigned long addr, int reliable)
  {
  	struct stack_trace *trace = (struct stack_trace *)data;
+	if (!reliable)
+		return;
  	if (in_sched_functions(addr))
  		return;
  	if (trace->skip > 0) {
-- 
1.5.3.8



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: don't save unreliable stack trace entries
  2008-02-22 18:44 [PATCH] x86: don't save unreliable stack trace entries Vegard Nossum
@ 2008-02-22 18:48 ` Arjan van de Ven
  2008-02-23 10:25   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Arjan van de Ven @ 2008-02-22 18:48 UTC (permalink / raw)
  To: Vegard Nossum; +Cc: Ingo Molnar, Linux Kernel Mailing List

On Fri, 22 Feb 2008 19:44:05 +0100
Vegard Nossum <vegard.nossum@gmail.com> wrote:

> I find the following patch to make saved stack traces so much easier
> to decipher. There might be other uses of save_stack_trace() that I
> am not aware of, though. Also, I suggest changing the underlying
> struct stack_trace to include the reliable/unreliable information.
> This, however, requires all users of save_stack_trace() and all
> arches saving this information to change.
> 
> Kind regards,
> Vegard Nossum
> 
> 
>  From 5edfd896c5f0d728111df3d8cae729a375f29d3c Mon Sep 17 00:00:00
> 2001 From: Vegard Nossum <vegard.nossum@gmail.com>
> Date: Fri, 22 Feb 2008 19:23:58 +0100
> Subject: [PATCH] x86: don't save unreliable stack trace entries
> 
> Currently, there is no way for print_stack_trace() to determine
> whether a given stack trace entry was deemed reliable or not, simply
> because save_stack_trace() does not record this information. (Perhaps
> needless to say, this makes the saved stack traces A LOT harder to
> read, and probably with no other benefits, since debugging features
> that use save_stack_trace() most likely also require frame pointers,
> etc.)
> 
> This patch reverts to the old behaviour of only recording the
> reliable trace entries for saved stack traces.
> 
> Signed-off-by: Vegard Nossum <vegardno@ifi.uio.no>
> ---
>   arch/x86/kernel/stacktrace.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/stacktrace.c
> b/arch/x86/kernel/stacktrace.c index 02f0f61..c28c342 100644
> --- a/arch/x86/kernel/stacktrace.c
> +++ b/arch/x86/kernel/stacktrace.c
> @@ -25,6 +25,8 @@ static int save_stack_stack(void *data, char *name)
>   static void save_stack_address(void *data, unsigned long addr, int
> reliable) {
>   	struct stack_trace *trace = data;
> +	if (!reliable)
> +		return;
>   	if (trace->skip > 0) {
>   		trace->skip--;
>   		return;
> @@ -37,6 +39,8 @@ static void
>   save_stack_address_nosched(void *data, unsigned long addr, int
> reliable) {
>   	struct stack_trace *trace = (struct stack_trace *)data;
> +	if (!reliable)
> +		return;
>   	if (in_sched_functions(addr))
>   		return;
>   	if (trace->skip > 0) {


I was about to make a patch for this second chunk myself and submit it, so
for the second chunk a strong:
Acked-by: Arjan van de Ven <arjan@linux.intel.com>

Thanks for beating me to it ;-)

-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: don't save unreliable stack trace entries
  2008-02-22 18:48 ` Arjan van de Ven
@ 2008-02-23 10:25   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-02-23 10:25 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Vegard Nossum, Linux Kernel Mailing List


* Arjan van de Ven <arjan@infradead.org> wrote:

> > b/arch/x86/kernel/stacktrace.c index 02f0f61..c28c342 100644
> > --- a/arch/x86/kernel/stacktrace.c
> > +++ b/arch/x86/kernel/stacktrace.c
> > @@ -25,6 +25,8 @@ static int save_stack_stack(void *data, char *name)
> >   static void save_stack_address(void *data, unsigned long addr, int
> > reliable) {
> >   	struct stack_trace *trace = data;
> > +	if (!reliable)
> > +		return;
> >   	if (trace->skip > 0) {
> >   		trace->skip--;
> >   		return;
> > @@ -37,6 +39,8 @@ static void
> >   save_stack_address_nosched(void *data, unsigned long addr, int
> > reliable) {
> >   	struct stack_trace *trace = (struct stack_trace *)data;
> > +	if (!reliable)
> > +		return;
> >   	if (in_sched_functions(addr))
> >   		return;
> >   	if (trace->skip > 0) {
> 
> 
> I was about to make a patch for this second chunk myself and submit 
> it, so for the second chunk a strong:
> Acked-by: Arjan van de Ven <arjan@linux.intel.com>

how about the first chunk?

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-23 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-22 18:44 [PATCH] x86: don't save unreliable stack trace entries Vegard Nossum
2008-02-22 18:48 ` Arjan van de Ven
2008-02-23 10:25   ` Ingo Molnar

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).