All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch V5 00/31] rseq: Optimize exit to user space
@ 2025-10-22 12:52 Thomas Gleixner
  2025-10-22 12:52 ` [patch V5 01/31] rseq: Avoid pointless evaluation in __rseq_notify_resume() Thomas Gleixner
                   ` (31 more replies)
  0 siblings, 32 replies; 36+ messages in thread
From: Thomas Gleixner @ 2025-10-22 12:52 UTC (permalink / raw)
  To: LKML
  Cc: Michael Jeanson, Jens Axboe, Mathieu Desnoyers, Peter Zijlstra,
	Paul E. McKenney, x86, Sean Christopherson, Wei Liu

This is a follow up on the V4 series, which can be found here:

   https://lore.kernel.org/all/20250908212737.353775467@linutronix.de

The V2 posting contains a detailed list of the addressed problems:

   https://lore.kernel.org/20250916163004.674341701@linutronix.de

TLDR:
    - A significant amount of pointless RSEQ operations on exit to user
      space, which have been reported by people as measurable impact after
      glibc switched to use RSEQ

    - Suboptimal hotpath handling both in the scheduler and on exit to user
      space.

This series addresses these issues by:

  1) Limiting the RSEQ work to the actual conditions where it is
     required. The full benefit is only available for architectures using
     the generic entry infrastructure. All others get at least the basic
     improvements.

  2) Re-implementing the whole user space handling based on proper data
     structures and by actually looking at the impact it creates in the
     fast path.

  3) Moving the actual handling of RSEQ out to the latest point in the exit
     path, where possible. This is fully inlined into the fast path to keep
     the impact confined.

Changes vs. V4:

  - Add a comment to the KVM retrigger logic - Sean

  - Reduce the fast path decision to event::sched_switch - Mathieu

  - Initialize IDs on registration, keep them on fork and lift the first
    exit restriction in the debug code - Mathieu

  - Update comments and fix typos - Mathieu

  - Adapted it to the uaccess changes

  - Dropped the already upstream parts and prerequisites

As for the previous version these patches have a dependency on the uaccess
scope series:

   https://lore.kernel.org/20251022102427.400699796@linutronix.de

which is available at:

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git uaccess/scoped

For your convenience the combination of both is available from git:

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git rseq/perf

Thanks,

	tglx
---
Thomas Gleixner (31):
      rseq: Avoid pointless evaluation in __rseq_notify_resume()
      rseq: Condense the inline stubs
      rseq: Move algorithm comment to top
      rseq: Remove the ksig argument from rseq_handle_notify_resume()
      rseq: Simplify registration
      rseq: Simplify the event notification
      rseq, virt: Retrigger RSEQ after vcpu_run()
      rseq: Avoid CPU/MM CID updates when no event pending
      rseq: Introduce struct rseq_data
      entry: Cleanup header
      entry: Remove syscall_enter_from_user_mode_prepare()
      entry: Inline irqentry_enter/exit_from/to_user_mode()
      sched: Move MM CID related functions to sched.h
      rseq: Cache CPU ID and MM CID values
      rseq: Record interrupt from user space
      rseq: Provide tracepoint wrappers for inline code
      rseq: Expose lightweight statistics in debugfs
      rseq: Provide static branch for runtime debugging
      rseq: Provide and use rseq_update_user_cs()
      rseq: Replace the original debug implementation
      rseq: Make exit debugging static branch based
      rseq: Use static branch for syscall exit debug when GENERIC_IRQ_ENTRY=y
      rseq: Provide and use rseq_set_ids()
      rseq: Separate the signal delivery path
      rseq: Rework the TIF_NOTIFY handler
      rseq: Optimize event setting
      rseq: Implement fast path for exit to user
      rseq: Switch to fast path processing on exit to user
      entry: Split up exit_to_user_mode_prepare()
      rseq: Split up rseq_exit_to_user_mode()
      rseq: Switch to TIF_RSEQ if supported

 Documentation/admin-guide/kernel-parameters.txt |    4 
 arch/x86/entry/syscall_32.c                     |    3 
 drivers/hv/mshv_root_main.c                     |    3 
 fs/binfmt_elf.c                                 |    2 
 fs/exec.c                                       |    2 
 include/asm-generic/thread_info_tif.h           |    3 
 include/linux/entry-common.h                    |   38 -
 include/linux/irq-entry-common.h                |   68 ++
 include/linux/mm.h                              |   25 
 include/linux/resume_user_mode.h                |    2 
 include/linux/rseq.h                            |  228 +++++---
 include/linux/rseq_entry.h                      |  592 +++++++++++++++++++++
 include/linux/rseq_types.h                      |   93 +++
 include/linux/sched.h                           |   48 +
 include/linux/thread_info.h                     |    5 
 include/trace/events/rseq.h                     |    4 
 include/uapi/linux/rseq.h                       |   21 
 init/Kconfig                                    |   28 -
 kernel/entry/common.c                           |   39 -
 kernel/entry/syscall-common.c                   |    8 
 kernel/ptrace.c                                 |    6 
 kernel/rseq.c                                   |  654 ++++++++++--------------
 kernel/sched/core.c                             |   10 
 kernel/sched/membarrier.c                       |    8 
 kernel/sched/sched.h                            |    5 
 virt/kvm/kvm_main.c                             |    7 
 26 files changed, 1301 insertions(+), 605 deletions(-)




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

end of thread, other threads:[~2025-10-23  9:22 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 12:52 [patch V5 00/31] rseq: Optimize exit to user space Thomas Gleixner
2025-10-22 12:52 ` [patch V5 01/31] rseq: Avoid pointless evaluation in __rseq_notify_resume() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 02/31] rseq: Condense the inline stubs Thomas Gleixner
2025-10-22 12:52 ` [patch V5 03/31] rseq: Move algorithm comment to top Thomas Gleixner
2025-10-22 12:52 ` [patch V5 04/31] rseq: Remove the ksig argument from rseq_handle_notify_resume() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 05/31] rseq: Simplify registration Thomas Gleixner
2025-10-22 12:52 ` [patch V5 06/31] rseq: Simplify the event notification Thomas Gleixner
2025-10-22 12:52 ` [patch V5 07/31] rseq, virt: Retrigger RSEQ after vcpu_run() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 08/31] rseq: Avoid CPU/MM CID updates when no event pending Thomas Gleixner
2025-10-22 12:52 ` [patch V5 09/31] rseq: Introduce struct rseq_data Thomas Gleixner
2025-10-22 12:52 ` [patch V5 10/31] entry: Cleanup header Thomas Gleixner
2025-10-22 12:52 ` [patch V5 11/31] entry: Remove syscall_enter_from_user_mode_prepare() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 12/31] entry: Inline irqentry_enter/exit_from/to_user_mode() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 13/31] sched: Move MM CID related functions to sched.h Thomas Gleixner
2025-10-22 12:52 ` [patch V5 14/31] rseq: Cache CPU ID and MM CID values Thomas Gleixner
2025-10-22 12:52 ` [patch V5 15/31] rseq: Record interrupt from user space Thomas Gleixner
2025-10-22 12:52 ` [patch V5 16/31] rseq: Provide tracepoint wrappers for inline code Thomas Gleixner
2025-10-22 12:52 ` [patch V5 17/31] rseq: Expose lightweight statistics in debugfs Thomas Gleixner
2025-10-22 12:52 ` [patch V5 18/31] rseq: Provide static branch for runtime debugging Thomas Gleixner
2025-10-22 12:52 ` [patch V5 19/31] rseq: Provide and use rseq_update_user_cs() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 20/31] rseq: Replace the original debug implementation Thomas Gleixner
2025-10-22 12:52 ` [patch V5 21/31] rseq: Make exit debugging static branch based Thomas Gleixner
2025-10-22 12:52 ` [patch V5 22/31] rseq: Use static branch for syscall exit debug when GENERIC_IRQ_ENTRY=y Thomas Gleixner
2025-10-22 12:52 ` [patch V5 23/31] rseq: Provide and use rseq_set_ids() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 24/31] rseq: Separate the signal delivery path Thomas Gleixner
2025-10-22 12:52 ` [patch V5 25/31] rseq: Rework the TIF_NOTIFY handler Thomas Gleixner
2025-10-22 13:31   ` Sean Christopherson
2025-10-22 12:52 ` [patch V5 26/31] rseq: Optimize event setting Thomas Gleixner
2025-10-22 12:52 ` [patch V5 27/31] rseq: Implement fast path for exit to user Thomas Gleixner
2025-10-23  8:51   ` Peter Zijlstra
2025-10-22 12:52 ` [patch V5 28/31] rseq: Switch to fast path processing on " Thomas Gleixner
2025-10-23  9:04   ` Peter Zijlstra
2025-10-22 12:52 ` [patch V5 29/31] entry: Split up exit_to_user_mode_prepare() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 30/31] rseq: Split up rseq_exit_to_user_mode() Thomas Gleixner
2025-10-22 12:52 ` [patch V5 31/31] rseq: Switch to TIF_RSEQ if supported Thomas Gleixner
2025-10-23  9:22 ` [patch V5 00/31] rseq: Optimize exit to user space Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.