This series does not make any user space visible changes. It only adds the necessary infrastructure of the deferred unwinder.
Based off of tip/master: d60119b82d8871c66563f8657bb3e550a80234de This has modifications in x86 and I would like it to go through the x86 tree. Preferably it can go into this merge window so we can focus on getting perf and ftrace to work on top of this. Perf exposes a lot of the interface to user space as the perf tool needs to handle the merging of the stacks, I figured it would be better to just get the kernel side mostly done and then work out the kinks of the code between user and kernel. As there is no exposure to user space at this time, if something is found wrong with it it can be fixed without worrying about breaking API. I ran all these patches through my tests and they passed (had to add the fix for the CONFIG_MODULE in tip/master: https://lore.kernel.org/all/20250513025839.495755-1-ebigg...@kernel.org/) Changes since v8: https://lore.kernel.org/all/20250509164524.448387...@goodmis.org/ - The patches posted here have not been updated since v8. - Removed updates to perf proper This is only to create the unwind infrastructure so that perf and ftrace can be worked on simultaneously without dependencies for each. - Discussion about using guard for SRCU Andrii Nakryiko brought up using guard for SRCU around the list iteration, but it was decided that just using the normal methods were fine for this use case. Josh Poimboeuf (9): unwind_user: Add user space unwinding API unwind_user: Add frame pointer support unwind_user/x86: Enable frame pointer unwinding on x86 perf/x86: Rename and move get_segment_base() and make it global unwind_user: Add compat mode frame pointer support unwind_user/x86: Enable compat mode frame pointer unwinding on x86 unwind_user/deferred: Add unwind cache unwind_user/deferred: Add deferred unwinding interface unwind_user/deferred: Make unwind deferral requests NMI-safe Steven Rostedt (4): unwind_user/deferred: Add unwind_deferred_trace() unwind deferred: Use bitmask to determine which callbacks to call unwind deferred: Use SRCU unwind_deferred_task_work() unwind: Clear unwind_mask on exit back to user space ---- MAINTAINERS | 8 + arch/Kconfig | 11 + arch/x86/Kconfig | 2 + arch/x86/events/core.c | 44 +--- arch/x86/include/asm/ptrace.h | 2 + arch/x86/include/asm/unwind_user.h | 61 +++++ arch/x86/include/asm/unwind_user_types.h | 17 ++ arch/x86/kernel/ptrace.c | 38 ++++ include/asm-generic/Kbuild | 2 + include/asm-generic/unwind_user.h | 24 ++ include/asm-generic/unwind_user_types.h | 9 + include/linux/entry-common.h | 2 + include/linux/sched.h | 6 + include/linux/unwind_deferred.h | 72 ++++++ include/linux/unwind_deferred_types.h | 17 ++ include/linux/unwind_user.h | 15 ++ include/linux/unwind_user_types.h | 35 +++ kernel/Makefile | 1 + kernel/fork.c | 4 + kernel/unwind/Makefile | 1 + kernel/unwind/deferred.c | 367 +++++++++++++++++++++++++++++++ kernel/unwind/user.c | 130 +++++++++++ 22 files changed, 829 insertions(+), 39 deletions(-) create mode 100644 arch/x86/include/asm/unwind_user.h create mode 100644 arch/x86/include/asm/unwind_user_types.h create mode 100644 include/asm-generic/unwind_user.h create mode 100644 include/asm-generic/unwind_user_types.h create mode 100644 include/linux/unwind_deferred.h create mode 100644 include/linux/unwind_deferred_types.h create mode 100644 include/linux/unwind_user.h create mode 100644 include/linux/unwind_user_types.h create mode 100644 kernel/unwind/Makefile create mode 100644 kernel/unwind/deferred.c create mode 100644 kernel/unwind/user.c