From: Michael Ellerman <mpe@ellerman.id.au>
To: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>,
linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH] powerpc: fix /proc/self/stack
Date: Wed, 22 Mar 2017 22:03:53 +1100 [thread overview]
Message-ID: <87inn1d146.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20170317155921.24369-1-cascardo@canonical.com>
Thadeu Lima de Souza Cascardo <cascardo@canonical.com> writes:
> For the current task, the kernel stack would only tell the last time the
> process was rescheduled, if ever. Use the current stack pointer for the
> current task.
You say "fix" in the subject, but is it a bug, or just an enhancement?
> This is also consistent with some other architectures.
Such as .. arm64 and x86 (though it's buried in the unwind code).
> diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
> index 6671195..2446066 100644
> --- a/arch/powerpc/kernel/stacktrace.c
> +++ b/arch/powerpc/kernel/stacktrace.c
> @@ -59,7 +59,12 @@ EXPORT_SYMBOL_GPL(save_stack_trace);
>
> void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
> {
> - save_context_stack(trace, tsk->thread.ksp, tsk, 0);
> + unsigned long sp = tsk->thread.ksp;
> +
> + if (tsk == current)
> + sp = current_stack_pointer();
else
sp = tsk->thread.ksp;
Would be clearer IMHO.
> +
> + save_context_stack(trace, sp, tsk, 0);
> }
> EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
>
> --
> 2.9.3
cheers
next prev parent reply other threads:[~2017-03-22 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 15:59 Thadeu Lima de Souza Cascardo
2017-03-22 11:03 ` Michael Ellerman [this message]
2017-03-27 19:32 ` [PATCH v2] powerpc: make /proc/self/stack always print the current stack Thadeu Lima de Souza Cascardo
2017-03-31 12:33 ` [v2] " Michael Ellerman
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=87inn1d146.fsf@concordia.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=benh@kernel.crashing.org \
--cc=cascardo@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®