linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] stacktrace: don't skip first entry on noncurrent tasks
Date: Fri, 25 Oct 2019 09:21:10 -0500	[thread overview]
Message-ID: <20191025142110.jgz5jy4nuryhawv5@treble> (raw)
In-Reply-To: <20191025065226.10196-1-jslaby@suse.cz>

On Fri, Oct 25, 2019 at 08:52:26AM +0200, Jiri Slaby wrote:
> When doing cat /proc/<PID>/stack, the output is missing the first entry.
> When the current code walks the stack starting in stack_trace_save_tsk,
> it skips all scheduler functions (that's OK) plus one more function. But
> this one function should be skipped only for the 'current' task as it is
> stack_trace_save_tsk proper.
> 
> The original code (before the common infrastructure) skipped one
> function only for the 'current' task -- see save_stack_trace_tsk before
> 3599fe12a125. So do so also in the new infrastructure now.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Fixes: 214d8ca6ee85 ("stacktrace: Provide common infrastructure")
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  kernel/stacktrace.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
> index 6d1f68b7e528..d06a2e4d0142 100644
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -141,7 +141,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
>  	struct stacktrace_cookie c = {
>  		.store	= store,
>  		.size	= size,
> -		.skip	= skipnr + 1,
> +		/* skip this function if they are tracing us */
> +		.skip	= skipnr + !!(current == tsk),
>  	};
>  
>  	if (!try_get_task_stack(tsk))

I think a similar change is needed for the other !CONFIG_ARCH_STACKWALK
version of stack_trace_save_tsk() in that file?

-- 
Josh


  reply	other threads:[~2019-10-25 14:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  6:52 [PATCH] stacktrace: don't skip first entry on noncurrent tasks Jiri Slaby
2019-10-25 14:21 ` Josh Poimboeuf [this message]
2019-10-29  7:19   ` [PATCH v2] " Jiri Slaby
2019-10-29 13:35     ` Josh Poimboeuf
2019-10-30  6:09     ` Jiri Slaby
2019-10-30  7:25     ` [PATCH v3] " Jiri Slaby
2019-11-04 20:24       ` [tip: core/urgent] stacktrace: Don't " tip-bot2 for Jiri Slaby

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=20191025142110.jgz5jy4nuryhawv5@treble \
    --to=jpoimboe@redhat.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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).