bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 bpf-next 0/4] introduce bpf_iter for task_vma
@ 2021-02-08 22:52 Song Liu
  2021-02-08 22:52 ` [PATCH v5 bpf-next 1/4] bpf: introduce task_vma bpf_iter Song Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Song Liu @ 2021-02-08 22:52 UTC (permalink / raw)
  To: bpf, netdev, linux-mm; +Cc: ast, daniel, kernel-team, akpm, Song Liu

This set introduces bpf_iter for task_vma, which can be used to generate
information similar to /proc/pid/maps. Patch 4/4 adds an example that
mimics /proc/pid/maps.

Current /proc/<pid>/maps and /proc/<pid>/smaps provide information of
vma's of a process. However, these information are not flexible enough to
cover all use cases. For example, if a vma cover mixed 2MB pages and 4kB
pages (x86_64), there is no easy way to tell which address ranges are
backed by 2MB pages. task_vma solves the problem by enabling the user to
generate customize information based on the vma (and vma->vm_mm,
vma->vm_file, etc.).

Changes v4 => v5:
  1. Fix a refcount leak on task_struct. (Yonghong)
  2. Fix the selftest. (Yonghong)

Changes v3 => v4:
  1. Avoid skipping vma by assigning invalid prev_vm_start in
     task_vma_seq_stop(). (Yonghong)
  2. Move "again" label in task_vma_seq_get_next() save a check. (Yonghong)

Changes v2 => v3:
  1. Rewrite 1/4 so that we hold mmap_lock while calling BPF program. This
     enables the BPF program to access the real vma with BTF. (Alexei)
  2. Fix the logic when the control is returned to user space. (Yonghong)
  3. Revise commit log and cover letter. (Yonghong)

Changes v1 => v2:
  1. Small fixes in task_iter.c and the selftests. (Yonghong)

Song Liu (4):
  bpf: introduce task_vma bpf_iter
  bpf: allow bpf_d_path in sleepable bpf_iter program
  libbpf: introduce section "iter.s/" for sleepable bpf_iter program
  selftests/bpf: add test for bpf_iter_task_vma

 kernel/bpf/task_iter.c                        | 217 +++++++++++++++++-
 kernel/trace/bpf_trace.c                      |   5 +
 tools/lib/bpf/libbpf.c                        |   5 +
 .../selftests/bpf/prog_tests/bpf_iter.c       | 118 +++++++++-
 tools/testing/selftests/bpf/progs/bpf_iter.h  |   8 +
 .../selftests/bpf/progs/bpf_iter_task_vma.c   |  58 +++++
 6 files changed, 400 insertions(+), 11 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_vma.c

--
2.24.1

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

end of thread, other threads:[~2021-02-12  1:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 22:52 [PATCH v5 bpf-next 0/4] introduce bpf_iter for task_vma Song Liu
2021-02-08 22:52 ` [PATCH v5 bpf-next 1/4] bpf: introduce task_vma bpf_iter Song Liu
2021-02-08 23:12   ` Yonghong Song
2021-02-09 21:30   ` Alexei Starovoitov
2021-02-09 22:08     ` Song Liu
2021-02-10  3:00       ` Alexei Starovoitov
2021-02-10  8:00         ` Song Liu
2021-02-10 23:02         ` Yonghong Song
2021-02-12  1:41           ` Song Liu
2021-02-08 22:52 ` [PATCH v5 bpf-next 2/4] bpf: allow bpf_d_path in sleepable bpf_iter program Song Liu
2021-02-08 22:52 ` [PATCH v5 bpf-next 3/4] libbpf: introduce section "iter.s/" for " Song Liu
2021-02-08 22:52 ` [PATCH v5 bpf-next 4/4] selftests/bpf: add test for bpf_iter_task_vma Song Liu
2021-02-08 23:12   ` Yonghong Song

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