Skip to content

Parameterize task iterators.

Kui-Feng Lee bpf 11 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 Latest5 patches 2 repliesApplied 5/5
  2. v105 patches 1 replySuperseded
  3. v95 patches 4 repliesSuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v85 patches13 repliesSuperseded
v75 patches8 repliesSuperseded
v64 patches12 repliesSuperseded
v53 patches18 repliesSuperseded
v43 patches4 repliesSuperseded
v33 patches2 repliesSuperseded
v23 patches8 repliesSuperseded
v13 patches18 repliesSuperseded

Patches in v11 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: Parameterize task iterators.include/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/task_iter.c +1 more+207 -221 replyApplied
2/5bpf: Handle bpf_link_info for the parameterized task BPF iterators.include/uapi/linux/bpf.h kernel/bpf/task_iter.c tools/include/uapi/linux/bpf.h+26 -00 repliesApplied
3/5bpf: Handle show_fdinfo for the parameterized task BPF iteratorskernel/bpf/task_iter.c+18 -00 repliesApplied
4/5selftests/bpf: Test parameterized task BPF iterators.tools/testing/selftests/bpf/prog_tests/bpf_iter.c tools/testing/selftests/bpf/prog_tests/btf_dump.c tools/testing/selftests/bpf/progs/bpf_iter_task.c +3 more+322 -240 repliesApplied
5/5bpftool: Show parameters of BPF task iterators.tools/bpf/bpftool/link.c+19 -00 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchYonghong SongQuentin MonnetMartin KaFai Lau
SeriesA-b
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b 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 3 reviewers.

Read the v11 thread

Cover letter [PATCH bpf-next v11 0/5] Parameterize task iterators.

Allow creating an iterator that loops through resources of one task/thread.

People could only create iterators to loop through all resources of files, vma, and tasks in the system, even though they were interested in only the resources of a specific task or process. Passing the additional parameters, people can now create an iterator to go through all resources or only the resources of a task.

Major Changes:

- Add new parameters in bpf_iter_link_info to indicate to go through all tasks or to go through a specific task.

- Change the implementations of BPF iterators of vma, files, and tasks to allow going through only the resources of a specific task.

- Provide the arguments of parameterized task iterators in bpf_link_info.

Differences from v10:

- Check pid_alive() to avoid potential errors.

Differences from v9:

- Fix the boundary check of computing page_shift.

- Rewording the reason of checking and returning the same task.

Differences from v8:

- Fix uninitialized variable.

- Avoid redundant work of getting task from pid.

- Change format string to use %u instead of %d.

- Use the value of page_shift to compute correct offset in bpf_iter_vm_offset.c.

Differences from v7:

- Travel the tasks of a process through task_group linked list instead of traveling through the whole namespace.

Differences from v6:

- Add part 5 to make bpftool show the value of parameters.

- Change of wording of show_fdinfo() to show pid or tid instead of always pid.

- Simplify error handling and naming of test cases.

Differences from v5:

- Use user-space tid/pid terminologies in bpf_iter_link_info and bpf_link_info.

- Fix reference count

- Merge all variants to one 'u32 pid' in internal structs. (bpf_iter_aux_info and bpf_iter_seq_task_common)

- Compare the result of get_uprobe_offset() with the implementation with the vma iterators.

- Implement show_fdinfo.

Differences from v4:

- Remove 'type' from bpf_iter_link_info and bpf_link_info.

v10: https://lore.kernel.org/all/[email protected]/
v9: https://lore.kernel.org/bpf/[email protected]/
v8: https://lore.kernel.org/bpf/[email protected]/
v7: https://lore.kernel.org/bpf/[email protected]/
v6: https://lore.kernel.org/bpf/[email protected]/
v5: https://lore.kernel.org/bpf/[email protected]/
v4: https://lore.kernel.org/bpf/[email protected]/
v3: https://lore.kernel.org/bpf/[email protected]/
v2: https://lore.kernel.org/bpf/[email protected]/
v1: https://lore.kernel.org/bpf/[email protected]/

Kui-Feng Lee (5):
bpf: Parameterize task iterators.
bpf: Handle bpf_link_info for the parameterized task BPF iterators.
bpf: Handle show_fdinfo for the parameterized task BPF iterators selftests/bpf: Test parameterized task BPF iterators.
bpftool: Show parameters of BPF task iterators.

 include/linux/bpf.h                           |  25 ++
 include/uapi/linux/bpf.h                      |  10 +
 kernel/bpf/task_iter.c                        | 228 ++++++++++++--
 tools/bpf/bpftool/link.c                      |  19 ++
 tools/include/uapi/linux/bpf.h                |  10 +
 .../selftests/bpf/prog_tests/bpf_iter.c       | 282 ++++++++++++++++--
 .../selftests/bpf/prog_tests/btf_dump.c       |   2 +-
 .../selftests/bpf/progs/bpf_iter_task.c       |   9 +
 .../selftests/bpf/progs/bpf_iter_task_file.c  |   9 +-
 .../selftests/bpf/progs/bpf_iter_task_vma.c   |   7 +-
 .../selftests/bpf/progs/bpf_iter_vma_offset.c |  37 +++
 11 files changed, 592 insertions(+), 46 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_vma_offset.c
Signature · 1 line
2.30.2