All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 tip/perf/core 0/5] uprobes,mm: speculative lockless VMA-to-uprobe lookup
@ 2024-10-01 22:52 Andrii Nakryiko
  2024-10-01 22:52 ` [PATCH v2 tip/perf/core 1/5] mm: introduce mmap_lock_speculation_{start|end} Andrii Nakryiko
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Andrii Nakryiko @ 2024-10-01 22:52 UTC (permalink / raw)
  To: linux-trace-kernel, peterz, oleg
  Cc: rostedt, mhiramat, bpf, linux-kernel, jolsa, paulmck, willy,
	surenb, akpm, linux-mm, mjguzik, brauner, jannh, mhocko, vbabka,
	mingo, Andrii Nakryiko

Implement speculative (lockless) resolution of VMA to inode to uprobe,
bypassing the need to take mmap_lock for reads, if possible. Patch #1 by Suren
adds mm_struct helpers that help detect whether mm_struct were changed, which
is used by uprobe logic to validate that speculative results can be trusted
after all the lookup logic results in a valid uprobe instance. Patch #2
follows to make mm_lock_seq into 64-bit counter (on 64-bit architectures).

Patch #3 adds back RCU-delayed freeing for FMODE_BACKING files, which is
necessary to make speculation safe to access struct file's memory in any
possible situation.

Patch #4 is a simplification to uprobe VMA flag checking, suggested by Oleg.

And, finally, patch #5 is the speculative VMA-to-uprobe resolution logic. See
corresponding patch for details and benchmarking results.

v1->v2:
- adjusted vma_end_write_all() comment to point out it should never be called
  manually now, but I wasn't sure how ACQUIRE/RELEASE comments should be
  reworded (previously requested by Jann), so I'd appreciate some help there
  (Jann);
- int -> long change for mm_lock_seq, as agreed at LPC2024 (Jann, Suren, Liam);
- kfree_rcu_mightsleep() for FMODE_BACKING (Suren, Christian);
- vm_flags simplification in find_active_uprobe_rcu() and
  find_active_uprobe_speculative() (Oleg);
- guard(rcu)() simplified find_active_uprobe_speculative() implementation.

Andrii Nakryiko (4):
  mm: switch to 64-bit mm_lock_seq/vm_lock_seq on 64-bit architectures
  fs: add back RCU-delayed freeing of FMODE_BACKING file
  uprobes: simplify find_active_uprobe_rcu() VMA checks
  uprobes: add speculative lockless VMA-to-inode-to-uprobe resolution

Suren Baghdasaryan (1):
  mm: introduce mmap_lock_speculation_{start|end}

 fs/file_table.c           |  2 +-
 include/linux/mm.h        |  6 ++--
 include/linux/mm_types.h  |  7 ++--
 include/linux/mmap_lock.h | 72 ++++++++++++++++++++++++++++++++-------
 kernel/events/uprobes.c   | 46 ++++++++++++++++++++++++-
 kernel/fork.c             |  3 --
 6 files changed, 114 insertions(+), 22 deletions(-)

-- 
2.43.5


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

end of thread, other threads:[~2024-10-09 19:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 22:52 [PATCH v2 tip/perf/core 0/5] uprobes,mm: speculative lockless VMA-to-uprobe lookup Andrii Nakryiko
2024-10-01 22:52 ` [PATCH v2 tip/perf/core 1/5] mm: introduce mmap_lock_speculation_{start|end} Andrii Nakryiko
2024-10-07 17:05   ` Andrii Nakryiko
2024-10-01 22:52 ` [PATCH v2 tip/perf/core 2/5] mm: switch to 64-bit mm_lock_seq/vm_lock_seq on 64-bit architectures Andrii Nakryiko
2024-10-01 22:52 ` [PATCH v2 tip/perf/core 3/5] fs: add back RCU-delayed freeing of FMODE_BACKING file Andrii Nakryiko
2024-10-03  9:13   ` Christian Brauner
2024-10-04  8:01     ` Christian Brauner
2024-10-04 19:58       ` Andrii Nakryiko
2024-10-09 10:35         ` Christian Brauner
2024-10-09 19:37           ` Andrii Nakryiko
2024-10-01 22:52 ` [PATCH v2 tip/perf/core 4/5] uprobes: simplify find_active_uprobe_rcu() VMA checks Andrii Nakryiko
2024-10-02  6:22   ` Oleg Nesterov
2024-10-01 22:52 ` [PATCH v2 tip/perf/core 5/5] uprobes: add speculative lockless VMA-to-inode-to-uprobe resolution Andrii Nakryiko
2024-10-02  7:25   ` Oleg Nesterov
2024-10-02 20:02     ` Andrii Nakryiko
2024-10-03  9:32       ` Oleg Nesterov
2024-10-04 23:59   ` kernel test robot
2024-10-05  1:12   ` kernel test robot
2024-10-08 15:20 ` [PATCH v2 tip/perf/core 0/5] uprobes,mm: speculative lockless VMA-to-uprobe lookup Oleg Nesterov

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.