linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2 v2] tracing/arm: Fix the stack tracer when LR is saved after local storage
@ 2019-08-07 17:28 Steven Rostedt
  2019-08-07 17:28 ` [PATCH 1/2 v2] tracing/arm64: Have max stack tracer handle the case of return address after data Steven Rostedt
  2019-08-07 17:28 ` [PATCH 2/2 v2] tracing: Document the stack trace algorithm in the comments Steven Rostedt
  0 siblings, 2 replies; 14+ messages in thread
From: Steven Rostedt @ 2019-08-07 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Joel Fernandes, Jiping Ma, mingo, catalin.marinas, will.deacon,
	linux-arm-kernel

As arm64 saves the link register after a function's local variables are
stored, it causes the max stack tracer to be off by one in its output
of which function has the bloated stack frame.

The first patch fixes this by creating a ARCH_RET_ADDR_BEFORE_LOCAL_VARS
define that an achitecture (arm64) may set in asm/ftrace.h, and this
will cause the stack tracer to make the shift.

As it has been proven that the stack tracer isn't the most trivial
algorithm to understand by staring at the code, the second patch adds
comments to the code to explain the algorithm with and without the
ARCH_RET_ADDR_BEFORE_LOCAL_VARS.

Hmm, should this be sent to stable (and for inclusion now?)

-- Steve

Changes since v1:

 - Fixed wrong value in stack_trace_index[] array in comment

 - Added a comment about gcc currently saves the LR after local variables,
   but there's no guarantee that it will be like that in the future.
   (Notified of this by Mark Rutland)

Steven Rostedt (VMware) (2):
      tracing/arm64: Have max stack tracer handle the case of return address after data
      tracing: Document the stack trace algorithm in the comments

----
 arch/arm64/include/asm/ftrace.h |  13 +++++
 kernel/trace/trace_stack.c      | 112 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+)

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

end of thread, other threads:[~2019-08-13 17:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 17:28 [PATCH 0/2 v2] tracing/arm: Fix the stack tracer when LR is saved after local storage Steven Rostedt
2019-08-07 17:28 ` [PATCH 1/2 v2] tracing/arm64: Have max stack tracer handle the case of return address after data Steven Rostedt
2019-08-07 19:29   ` Steven Rostedt
2019-08-08 16:28   ` Will Deacon
2019-08-08 16:36     ` Steven Rostedt
2019-08-08 17:11       ` Will Deacon
2019-08-08 17:24         ` Steven Rostedt
2019-08-09  2:17           ` Jiping Ma
2019-08-09  2:24             ` Steven Rostedt
2019-08-13 17:31               ` Will Deacon
2019-08-13 17:47                 ` Steven Rostedt
2019-08-09  8:55   ` Mark Rutland
2019-08-07 17:28 ` [PATCH 2/2 v2] tracing: Document the stack trace algorithm in the comments Steven Rostedt
2019-08-08 20:17   ` Joel Fernandes

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