RFC stacktrace: Avoid the pointless redirection through struct stack_trace
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest41 patches 30 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/41 | um/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 2/41 | x86/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +2 | 0 replies | |
| 3/41 | arm/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 4/41 | sh/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 5/41 | unicore32/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 6/41 | riscv/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 7/41 | arm64/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 8/41 | parisc/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 9/41 | s390/stacktrace: Remove the pointless ULONG_MAX markerarch/ | +0 | 0 replies | |
| 10/41 | lockdep: Remove the ULONG_MAX stack trace hackerykernel/ | +0 | 0 replies | |
| 11/41 | mm/slub: Remove the ULONG_MAX stack trace hackerymm/ | +4 | 0 replies | |
| 12/41 | mm/page_owner: Remove the ULONG_MAX stack trace hackerymm/ | +0 | 0 replies | |
| 13/41 | mm/kasan: Remove the ULONG_MAX stack trace hackerymm/ | +0 | 1 reply | |
| 14/41 | latency_top: Remove the ULONG_MAX stack trace hackeryfs/ kernel/ | +7 | 0 replies | |
| 15/41 | drm: Remove the ULONG_MAX stack trace hackerydrivers/ drivers/ | +0 | 0 replies | |
| 16/41 | tracing: Remove the ULONG_MAX stack trace hackerykernel/ kernel/ | +6 | 2 replies | |
| 17/41 | tracing: Make stack_trace_print() static and rename itinclude/ kernel/ | +2 | 2 replies | |
| 18/41 | stacktrace: Provide helpers for common stack trace operationsinclude/ kernel/ | +140 | 0 replies | |
| 19/41 | lib/stackdepot: Provide functions which operate on plain storage arraysinclude/ lib/ | +51 | 1 reply | |
| 20/41 | backtrace-test: Simplify stack trace handlingkernel/ | +3 | 1 reply | |
| 21/41 | proc: Simplify task stack retrievalfs/ | +5 | 1 reply | |
| 22/41 | latency_top: Simplify stack trace handlingkernel/ | +2 | 0 replies | |
| 23/41 | mm/slub: Simplify stack trace retrievalmm/ | +4 | 0 replies | |
| 24/41 | mm/kmemleak: Simplify stacktrace handlingmm/ | +3 | 0 replies | |
| 25/41 | mm/kasan: Simplify stacktrace handlingmm/ mm/ | +16 | 4 replies | |
| 26/41 | mm/page_owner: Simplify stack trace handlingmm/ | +28 | 0 replies | |
| 27/41 | fault-inject: Simplify stacktrace retrievallib/ | +3 | 0 replies | |
| 28/41 | dma/debug: Simplify stracktrace retrievalkernel/ | +5 | 8 replies | |
| 29/41 | btrfs: ref-verify: Simplify stack trace retrievalfs/ | +2 | 5 replies | |
| 30/41 | dm bufio: Simplify stack trace retrievaldrivers/ | +6 | 0 replies | |
| 31/41 | dm persistent data: Simplify stack trace handlingdrivers/ | +9 | 0 replies | |
| 32/41 | drm: Simplify stacktrace handlingdrivers/ drivers/ drivers/ | +18 | 0 replies | |
| 33/41 | lockdep: Remove unused trace argument from print_circular_bug()kernel/ | +4 | 0 replies | |
| 34/41 | lockdep: Move stack trace logic into check_prev_add()kernel/ | +8 | 0 replies | |
| 35/41 | lockdep: Simplify stack trace handlinginclude/ kernel/ | +27 | 0 replies | |
| 36/41 | tracing: Simplify stacktrace retrieval in histogramskernel/ | +3 | 0 replies | |
| 37/41 | tracing: Use percpu stack trace buffer more intelligentlykernel/ | +39 | 0 replies | |
| 38/41 | tracing: Make ftrace_trace_userstack() static and conditionalkernel/ kernel/ | +8 | 0 replies | |
| 39/41 | tracing: Simplify stack trace retrievalkernel/ | +9 | 0 replies | |
| 40/41 | stacktrace: Remove obsolete functionsinclude/ kernel/ | +16 | 3 replies | |
| 41/41 | lib/stackdepot: Remove obsolete functionsinclude/ lib/ | +0 | 1 reply |
Reviews trailers per patch
6 of 41 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Dmitry Vyukov | Peter Zijlstra (Intel) | Johannes Thumshirn | David Sterba | Alexander Potapenko | Alexey Dobriyan |
|---|---|---|---|---|---|---|
| Series | A-b | |||||
| 1/41 | ||||||
| 2/41 | ||||||
| 3/41 | ||||||
| 4/41 | ||||||
| 5/41 | ||||||
| 6/41 | ||||||
| 7/41 | ||||||
| 8/41 | ||||||
| 9/41 | ||||||
| 10/41 | ||||||
| 11/41 | ||||||
| 12/41 | ||||||
| 13/41 | A-b | |||||
| 14/41 | ||||||
| 15/41 | ||||||
| 16/41 | ||||||
| 17/41 | ||||||
| 18/41 | ||||||
| 19/41 | A-b | |||||
| 20/41 | ||||||
| 21/41 | R-b | |||||
| 22/41 | ||||||
| 23/41 | ||||||
| 24/41 | ||||||
| 25/41 | A-b | |||||
| 26/41 | ||||||
| 27/41 | ||||||
| 28/41 | ||||||
| 29/41 | R-b | A-b | ||||
| 30/41 | ||||||
| 31/41 | ||||||
| 32/41 | ||||||
| 33/41 | ||||||
| 34/41 | ||||||
| 35/41 | ||||||
| 36/41 | ||||||
| 37/41 | ||||||
| 38/41 | ||||||
| 39/41 | ||||||
| 40/41 | ||||||
| 41/41 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.
Cover letter [RFC patch 00/41] stacktrace: Avoid the pointless redirection through struct stack_trace
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.
Another oddity is the inconsistent termination of the stack trace with ULONG_MAX. It's pointless as the number of entries is what determines the length of the stored trace. In fact quite some call sites remove the ULONG_MAX marker afterwards with or without nasty comments about it. Not all architectures do that and those which do, do it inconsistenly either conditional on nr_entries == 0 or unconditionally.
The following series cleans that up by:
1) Removing the ULONG_MAX termination in the architecture code
2) Removing the ULONG_MAX fixups at the call sites
3) Providing plain storage array based interfaces for stacktrace and stackdepot.
4) Cleaning up the mess at the callsites including some related cleanups.
5) Removing the struct stack_trace based interfaces
This is not changing the struct stack_trace interfaces at the architecture level, but it removes the exposure to the generic code.
It's only lightly tested as I'm traveling and access to my test boxes is limited.
Thanks,
tglx
8<-----------------
arch/um/kernel/stacktrace.c | 2 b/arch/arm/kernel/stacktrace.c | 6 - b/arch/arm64/kernel/stacktrace.c | 4 b/arch/parisc/kernel/stacktrace.c | 5 - b/arch/riscv/kernel/stacktrace.c | 2 b/arch/s390/kernel/stacktrace.c | 6 - b/arch/sh/kernel/stacktrace.c | 4 b/arch/unicore32/kernel/stacktrace.c | 2 b/arch/x86/kernel/stacktrace.c | 14 -- drivers/gpu/drm/drm_mm.c | 27 +---- drivers/gpu/drm/i915/i915_vma.c | 11 -- drivers/gpu/drm/i915/intel_runtime_pm.c | 25 +---- 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 | 18 +-- include/linux/ftrace.h | 1 include/linux/lockdep.h | 9 + include/linux/stackdepot.h | 8 - include/linux/stacktrace.h | 40 ++++---- kernel/backtracetest.c | 11 -- kernel/dma/debug.c | 13 +- kernel/latencytop.c | 29 +---- kernel/locking/lockdep.c | 87 ++++++----------- kernel/stacktrace.c | 127 ++++++++++++++++++++++---- kernel/trace/trace.c | 103 +++++++++------------ kernel/trace/trace.h | 8 - kernel/trace/trace_events_hist.c | 14 -- kernel/trace/trace_stack.c | 24 +--- lib/fault-inject.c | 12 -- lib/stackdepot.c | 50 +++++----- mm/kasan/common.c | 33 ++---- mm/kasan/report.c | 7 - mm/kmemleak.c | 24 ---- mm/page_owner.c | 82 +++++----------- mm/slub.c | 21 +--- 36 files changed, 375 insertions(+), 503 deletions(-)