linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch V2 00/29] stacktrace: Consolidate stack trace usage
@ 2019-04-18  8:41 Thomas Gleixner
  2019-04-18  8:41 ` [patch V2 01/29] tracing: Cleanup stack trace code Thomas Gleixner
                   ` (28 more replies)
  0 siblings, 29 replies; 72+ messages in thread
From: Thomas Gleixner @ 2019-04-18  8:41 UTC (permalink / raw)
  To: LKML
  Cc: Josh Poimboeuf, x86, Andy Lutomirski, Steven Rostedt,
	Alexander Potapenko, Alexey Dobriyan, Andrew Morton,
	Pekka Enberg, linux-mm, David Rientjes, Christoph Lameter,
	Catalin Marinas, Dmitry Vyukov, Andrey Ryabinin, kasan-dev,
	Mike Rapoport, Akinobu Mita, iommu, Robin Murphy,
	Christoph Hellwig, Marek Szyprowski, Johannes Thumshirn,
	David Sterba, Chris Mason, Josef Bacik, linux-btrfs, dm-devel,
	Mike Snitzer, Alasdair Kergon, intel-gfx, Joonas Lahtinen,
	Maarten Lankhorst, dri-devel, David Airlie, Jani Nikula,
	Daniel Vetter, Rodrigo Vivi, linux-arch

This is an update to V1:

 https://lkml.kernel.org/r/20190410102754.387743324@linutronix.de

Struct stack_trace is a sinkhole for input and output parameters which is
largely pointless for most usage sites. In fact if embedded into other data
structures it creates indirections and extra storage overhead for no
benefit.

Looking at all usage sites makes it clear that they just require an
interface which is based on a storage array. That array is either on stack,
global or embedded into some other data structure.

Some of the stack depot usage sites are outright wrong, but fortunately the
wrongness just causes more stack being used for nothing and does not have
functional impact.

Fix this up by:

  1) Providing plain storage array based interfaces for stacktrace and
     stackdepot.

  2) Cleaning up the mess at the callsites including some related
     cleanups.

  3) Removing the struct stack_trace based interfaces

  This is not yet changing the struct stack_trace interfaces at the
  architecture level, but it removes the exposure to the usage sites.

The last two patches are extending the cleanup to the architecture level by
replacing the various save_stack_trace.* architecture interfaces with a
more unified arch_stack_walk() interface. x86 is converted, but I have
worked through all architectures already and it removes lots of duplicated
code and allows consolidation across the board. The rest of the
architecture patches are not included in this posting as I want to get
feedback on the approach itself. The diffstat of cleaning up the remaining
architectures is currently on top of the current lot is:

   47 files changed, 402 insertions(+), 1196 deletions(-)

Once this has settled, the core interfaces can be improved by adding
features, which allow to get rid of the imprecise 'skip number of entries'
approach which tries to remove the stack tracer and the callsites themself
from the trace. That's error prone due to inlining and other issues. Having
e.g. a _RET_IP_ based filter allows to do that far more reliable.

The series is based on:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/stacktrace

which contains the removal of the inconsistent and pointless ULONG_MAX
termination of stacktraces.

It's also available from git:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.core/stacktrace

   up to:  131038eb3e2f ("x86/stacktrace: Use common infrastructure")

Changes vs. V1:

   - Applied the ULONG_MAX termination cleanup in tip

   - Addressed the review comments

   - Fixed up the last users of struct stack_trace outside the stacktrace
     core and architecture code (livepatch, tracing)

   - Added the new arch_stack_walk() model and converted x86 to it

Thanks,

	tglx

---
 arch/x86/Kconfig                              |    1 
 arch/x86/kernel/stacktrace.c                  |  116 +--------
 drivers/gpu/drm/drm_mm.c                      |   22 -
 drivers/gpu/drm/i915/i915_vma.c               |   11 
 drivers/gpu/drm/i915/intel_runtime_pm.c       |   21 -
 drivers/md/dm-bufio.c                         |   15 -
 drivers/md/persistent-data/dm-block-manager.c |   19 -
 fs/btrfs/ref-verify.c                         |   15 -
 fs/proc/base.c                                |   14 -
 include/linux/ftrace.h                        |   18 -
 include/linux/lockdep.h                       |    9 
 include/linux/stackdepot.h                    |    8 
 include/linux/stacktrace.h                    |   80 +++++-
 kernel/backtracetest.c                        |   11 
 kernel/dma/debug.c                            |   13 -
 kernel/latencytop.c                           |   17 -
 kernel/livepatch/transition.c                 |   22 -
 kernel/locking/lockdep.c                      |   81 ++----
 kernel/stacktrace.c                           |  323 ++++++++++++++++++++++++--
 kernel/trace/trace.c                          |  105 +++-----
 kernel/trace/trace.h                          |    8 
 kernel/trace/trace_events_hist.c              |   12 
 kernel/trace/trace_stack.c                    |   76 ++----
 lib/Kconfig                                   |    4 
 lib/fault-inject.c                            |   12 
 lib/stackdepot.c                              |   50 ++--
 mm/kasan/common.c                             |   30 --
 mm/kasan/report.c                             |    7 
 mm/kmemleak.c                                 |   24 -
 mm/page_owner.c                               |   79 ++----
 mm/slub.c                                     |   12 
 31 files changed, 664 insertions(+), 571 deletions(-)




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

end of thread, other threads:[~2019-04-24 19:51 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  8:41 [patch V2 00/29] stacktrace: Consolidate stack trace usage Thomas Gleixner
2019-04-18  8:41 ` [patch V2 01/29] tracing: Cleanup stack trace code Thomas Gleixner
2019-04-18 13:57   ` Josh Poimboeuf
2019-04-18 21:14     ` Thomas Gleixner
2019-04-18 21:24       ` Steven Rostedt
2019-04-18 21:50         ` Steven Rostedt
2019-04-18 22:19   ` Steven Rostedt
2019-04-18 22:44     ` Thomas Gleixner
2019-04-19  0:39       ` Steven Rostedt
2019-04-18  8:41 ` [patch V2 02/29] stacktrace: Provide helpers for common stack trace operations Thomas Gleixner
2019-04-18  8:41 ` [patch V2 03/29] lib/stackdepot: Provide functions which operate on plain storage arrays Thomas Gleixner
2019-04-18 11:51   ` Mike Rapoport
2019-04-18 11:58     ` Thomas Gleixner
2019-04-18  8:41 ` [patch V2 04/29] backtrace-test: Simplify stack trace handling Thomas Gleixner
2019-04-18  8:41 ` [patch V2 05/29] proc: Simplify task stack retrieval Thomas Gleixner
2019-04-18  8:41 ` [patch V2 06/29] latency_top: Simplify stack trace handling Thomas Gleixner
2019-04-18  8:41 ` [patch V2 07/29] mm/slub: Simplify stack trace retrieval Thomas Gleixner
2019-04-18  8:41 ` [patch V2 08/29] mm/kmemleak: Simplify stacktrace handling Thomas Gleixner
2019-04-18 15:17   ` Catalin Marinas
2019-04-18  8:41 ` [patch V2 09/29] mm/kasan: " Thomas Gleixner
2019-04-18 10:39   ` Andrey Ryabinin
2019-04-18 11:53     ` Thomas Gleixner
2019-04-18  8:41 ` [patch V2 10/29] mm/page_owner: Simplify stack trace handling Thomas Gleixner
2019-04-18  8:41 ` [patch V2 11/29] fault-inject: Simplify stacktrace retrieval Thomas Gleixner
2019-04-18  8:41 ` [patch V2 12/29] dma/debug: Simplify stracktrace retrieval Thomas Gleixner
2019-04-19  7:05   ` Christoph Hellwig
2019-04-18  8:41 ` [patch V2 13/29] btrfs: ref-verify: Simplify stack trace retrieval Thomas Gleixner
2019-04-18  8:41 ` [patch V2 14/29] dm bufio: " Thomas Gleixner
2019-04-18 10:44   ` Alexander Potapenko
2019-04-18 11:54     ` Thomas Gleixner
2019-04-18 12:11       ` Alexander Potapenko
2019-04-18 13:33         ` Steven Rostedt
2019-04-18  8:41 ` [patch V2 15/29] dm persistent data: Simplify stack trace handling Thomas Gleixner
2019-04-18  8:41 ` [patch V2 16/29] drm: Simplify stacktrace handling Thomas Gleixner
2019-04-23  7:36   ` Daniel Vetter
2019-04-18  8:41 ` [patch V2 17/29] lockdep: Remove unused trace argument from print_circular_bug() Thomas Gleixner
2019-04-18  8:41 ` [patch V2 18/29] lockdep: Move stack trace logic into check_prev_add() Thomas Gleixner
2019-04-24 19:45   ` Peter Zijlstra
2019-04-24 19:51     ` Thomas Gleixner
2019-04-18  8:41 ` [patch V2 19/29] lockdep: Simplify stack trace handling Thomas Gleixner
2019-04-24 19:45   ` Peter Zijlstra
2019-04-18  8:41 ` [patch V2 20/29] tracing: Simplify stacktrace retrieval in histograms Thomas Gleixner
2019-04-18 13:40   ` Steven Rostedt
2019-04-18 19:58     ` Tom Zanussi
2019-04-18 20:13       ` Steven Rostedt
2019-04-18 20:22         ` Tom Zanussi
2019-04-18  8:41 ` [patch V2 21/29] tracing: Use percpu stack trace buffer more intelligently Thomas Gleixner
2019-04-18 14:53   ` Steven Rostedt
2019-04-18 15:43     ` Thomas Gleixner
2019-04-18 15:46       ` Steven Rostedt
2019-04-18  8:41 ` [patch V2 22/29] tracing: Make ftrace_trace_userstack() static and conditional Thomas Gleixner
2019-04-19 13:28   ` Steven Rostedt
2019-04-18  8:41 ` [patch V2 23/29] tracing: Simplify stack trace retrieval Thomas Gleixner
2019-04-19 20:11   ` Steven Rostedt
2019-04-18  8:41 ` [patch V2 24/29] tracing: Remove the last struct stack_trace usage Thomas Gleixner
2019-04-19 20:11   ` Steven Rostedt
2019-04-18  8:41 ` [patch V2 25/29] livepatch: Simplify stack trace retrieval Thomas Gleixner
2019-04-23  8:18   ` Miroslav Benes
2019-04-18  8:41 ` [patch V2 26/29] stacktrace: Remove obsolete functions Thomas Gleixner
2019-04-18  8:41 ` [patch V2 27/29] lib/stackdepot: " Thomas Gleixner
2019-04-18  8:41 ` [patch V2 28/29] stacktrace: Provide common infrastructure Thomas Gleixner
2019-04-18 11:52   ` Mike Rapoport
2019-04-18 11:57     ` Thomas Gleixner
2019-04-18 14:52   ` Josh Poimboeuf
2019-04-18 15:42     ` Thomas Gleixner
2019-04-19  7:02       ` Peter Zijlstra
2019-04-19 15:50         ` Josh Poimboeuf
2019-04-19  7:18   ` Peter Zijlstra
2019-04-19  8:32     ` Thomas Gleixner
2019-04-19  9:07       ` Peter Zijlstra
2019-04-19 16:17         ` Josh Poimboeuf
2019-04-18  8:41 ` [patch V2 29/29] x86/stacktrace: Use " Thomas Gleixner

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