[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87inn1d146.fsf@concordia.ellerman.id.au>
Date: Wed, 22 Mar 2017 22:03:53 +1100
From: Michael Ellerman <mpe@...erman.id.au>
To: Thadeu Lima de Souza Cascardo <cascardo@...onical.com>,
linuxppc-dev@...ts.ozlabs.org
Cc: linux-kernel@...r.kernel.org, Paul Mackerras <paulus@...ba.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: Re: [PATCH] powerpc: fix /proc/self/stack
Thadeu Lima de Souza Cascardo <cascardo@...onical.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
Powered by blists - more mailing lists