diff options
author | Alexei Starovoitov <ast@kernel.org> | 2020-08-07 02:39:14 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-08-07 02:39:19 +0300 |
commit | 0ac10dc1888cd1a8b994f32b51f0eaeba1e803ef (patch) | |
tree | 89c462f3b9f1fa1ea8e5d22f67d2f21fbf2766e1 /tools/lib/bpf/btf.c | |
parent | 6bcaf41f9613278cd5897fc80ab93033bda8efaa (diff) | |
parent | 74fc097de327b37e8fe3ff580ce7ffaa7c1740dd (diff) | |
download | linux-0ac10dc1888cd1a8b994f32b51f0eaeba1e803ef.tar.xz |
Merge branch 'bpf_iter-uapi-fix'
Yonghong Song says:
====================
Andrii raised a concern that current uapi for bpf iterator map
element is a little restrictive and not suitable for future potential
complex customization. This is a valid suggestion, considering people
may indeed add more complex custimization to the iterator, e.g.,
cgroup_id + user_id, etc. for task or task_file. Another example might
be map_id plus additional control so that the bpf iterator may bail
out a bucket earlier if a bucket has too many elements which may hold
lock too long and impact other parts of systems.
Patch #1 modified uapi with kernel changes. Patch #2
adjusted libbpf api accordingly.
Changelogs:
v3 -> v4:
. add a forward declaration of bpf_iter_link_info in
tools/lib/bpf/bpf.h in case that libbpf is built against
not-latest uapi bpf.h.
. target the patch set to "bpf" instead of "bpf-next"
v2 -> v3:
. undo "not reject iter_info.map.map_fd == 0" from v1.
In the future map_fd may become optional, so let us use map_fd == 0
indicating the map_fd is not set by user space.
. add link_info_len to bpf_iter_attach_opts to ensure always correct
link_info_len from user. Otherwise, libbpf may deduce incorrect
link_info_len if it uses different uapi header than the user app.
v1 -> v2:
. ensure link_create target_fd/flags == 0 since they are not used. (Andrii)
. if either of iter_info ptr == 0 or iter_info_len == 0, but not both,
return error to user space. (Andrii)
. do not reject iter_info.map.map_fd == 0, go ahead to use it trying to
get a map reference since the map_fd is required for map_elem iterator.
. use bpf_iter_link_info in bpf_iter_attach_opts instead of map_fd.
this way, user space is responsible to set up bpf_iter_link_info and
libbpf just passes the data to the kernel, simplifying libbpf design.
(Andrii)
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/btf.c')
0 files changed, 0 insertions, 0 deletions