<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/bpf/bpftool/link.c, branch linux-6.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.1.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.1.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-09-28T23:30:08Z</updated>
<entry>
<title>bpftool: Show parameters of BPF task iterators.</title>
<updated>2022-09-28T23:30:08Z</updated>
<author>
<name>Kui-Feng Lee</name>
</author>
<published>2022-09-26T18:49:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6bdb6d6be019f697296f52c37865dd7b0ce80750'/>
<id>urn:sha1:6bdb6d6be019f697296f52c37865dd7b0ce80750</id>
<content type='text'>
Show tid or pid of iterators if giving an argument of tid or pid

For example, the command `bpftool link list` may list following
lines.

1: iter  prog 2  target_name bpf_map
2: iter  prog 3  target_name bpf_prog
33: iter  prog 225  target_name task_file  tid 1644
        pids test_progs(1644)

Link 33 is a task_file iterator with tid 1644.  For now, only targets
of task, task_file and task_vma may be with tid or pid to filter out
tasks other than those belonging to a process (pid) or a thread (tid).

Signed-off-by: Kui-Feng Lee &lt;kuifeng@fb.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Acked-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220926184957.208194-6-kuifeng@fb.com
</content>
</entry>
<entry>
<title>bpftool: Add support for querying cgroup_iter link</title>
<updated>2022-08-30T18:02:03Z</updated>
<author>
<name>Hao Luo</name>
</author>
<published>2022-08-29T23:18:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f95de6d713130c953af0a40b13c1da519f91c4e'/>
<id>urn:sha1:6f95de6d713130c953af0a40b13c1da519f91c4e</id>
<content type='text'>
Support dumping info of a cgroup_iter link. This includes
showing the cgroup's id and the order for walking the cgroup
hierarchy. Example output is as follows:

&gt; bpftool link show
1: iter  prog 2  target_name bpf_map
2: iter  prog 3  target_name bpf_prog
3: iter  prog 12  target_name cgroup  cgroup_id 72  order self_only

&gt; bpftool -p link show
[{
        "id": 1,
        "type": "iter",
        "prog_id": 2,
        "target_name": "bpf_map"
    },{
        "id": 2,
        "type": "iter",
        "prog_id": 3,
        "target_name": "bpf_prog"
    },{
        "id": 3,
        "type": "iter",
        "prog_id": 12,
        "target_name": "cgroup",
        "cgroup_id": 72,
        "order": "self_only"
    }
]

Signed-off-by: Hao Luo &lt;haoluo@google.com&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/r/20220829231828.1016835-1-haoluo@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@linux.dev&gt;
</content>
</entry>
<entry>
<title>bpftool: Use libbpf_bpf_link_type_str</title>
<updated>2022-06-02T23:26:38Z</updated>
<author>
<name>Daniel Müller</name>
</author>
<published>2022-05-23T23:04:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c7e7e279dc8367920bddbe96115beef4ec2519a3'/>
<id>urn:sha1:c7e7e279dc8367920bddbe96115beef4ec2519a3</id>
<content type='text'>
This change switches bpftool over to using the recently introduced
libbpf_bpf_link_type_str function instead of maintaining its own string
representation for the bpf_link_type enum.

Signed-off-by: Daniel Müller &lt;deso@posteo.net&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20220523230428.3077108-13-deso@posteo.net
</content>
</entry>
<entry>
<title>bpftool: Use libbpf_bpf_attach_type_str</title>
<updated>2022-06-02T23:26:30Z</updated>
<author>
<name>Daniel Müller</name>
</author>
<published>2022-05-23T23:04:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1ba5ad36e00f46e3f7676f5de6b87f5a2f57f1f1'/>
<id>urn:sha1:1ba5ad36e00f46e3f7676f5de6b87f5a2f57f1f1</id>
<content type='text'>
This change switches bpftool over to using the recently introduced
libbpf_bpf_attach_type_str function instead of maintaining its own
string representation for the bpf_attach_type enum.

Note that contrary to other enum types, the variant names that bpftool
maps bpf_attach_type to do not adhere a simple to follow rule. With
bpf_prog_type, for example, the textual representation can easily be
inferred by stripping the BPF_PROG_TYPE_ prefix and lowercasing the
remaining string. bpf_attach_type violates this rule for various
variants.
We decided to fix up this deficiency with this change, meaning that
bpftool uses the same textual representations as libbpf. Supporting
tests, completion scripts, and man pages have been adjusted accordingly.
However, we did add support for accepting (the now undocumented)
original attach type names when they are provided by users.

For the test (test_bpftool_synctypes.py), I have removed the enum
representation checks, because we no longer mirror the various enum
variant names in bpftool source code. For the man page, help text, and
completion script checks we are now using enum definitions from
uapi/linux/bpf.h as the source of truth directly.

Signed-off-by: Daniel Müller &lt;deso@posteo.net&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220523230428.3077108-10-deso@posteo.net
</content>
</entry>
<entry>
<title>bpftool: Use libbpf_bpf_prog_type_str</title>
<updated>2022-06-02T23:26:18Z</updated>
<author>
<name>Daniel Müller</name>
</author>
<published>2022-05-23T23:04:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b700eeb406a6c1f4d955242e06151f11f13d3e29'/>
<id>urn:sha1:b700eeb406a6c1f4d955242e06151f11f13d3e29</id>
<content type='text'>
This change switches bpftool over to using the recently introduced
libbpf_bpf_prog_type_str function instead of maintaining its own string
representation for the bpf_prog_type enum.

Signed-off-by: Daniel Müller &lt;deso@posteo.net&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Acked-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20220523230428.3077108-4-deso@posteo.net
</content>
</entry>
<entry>
<title>bpf, x86: Generate trampolines from bpf_tramp_links</title>
<updated>2022-05-11T00:50:40Z</updated>
<author>
<name>Kui-Feng Lee</name>
</author>
<published>2022-05-10T20:59:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f7e0beaf39d3868dc700d4954b26cf8443c5d423'/>
<id>urn:sha1:f7e0beaf39d3868dc700d4954b26cf8443c5d423</id>
<content type='text'>
Replace struct bpf_tramp_progs with struct bpf_tramp_links to collect
struct bpf_tramp_link(s) for a trampoline.  struct bpf_tramp_link
extends bpf_link to act as a linked list node.

arch_prepare_bpf_trampoline() accepts a struct bpf_tramp_links to
collects all bpf_tramp_link(s) that a trampoline should call.

Change BPF trampoline and bpf_struct_ops to pass bpf_tramp_links
instead of bpf_tramp_progs.

Signed-off-by: Kui-Feng Lee &lt;kuifeng@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220510205923.3206889-2-kuifeng@fb.com
</content>
</entry>
<entry>
<title>bpftool: Add missing link types</title>
<updated>2022-04-04T21:54:34Z</updated>
<author>
<name>Milan Landaverde</name>
</author>
<published>2022-03-31T15:45:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fff3dfab17866f6ac5c5666839f6132b6c52f306'/>
<id>urn:sha1:fff3dfab17866f6ac5c5666839f6132b6c52f306</id>
<content type='text'>
Will display the link type names in bpftool link show output

Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220331154555.422506-3-milan@mdaverde.com
</content>
</entry>
<entry>
<title>bpftool: Fix error check when calling hashmap__new()</title>
<updated>2022-01-13T01:01:36Z</updated>
<author>
<name>Mauricio Vásquez</name>
</author>
<published>2022-01-07T15:26:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=622a5b582cc27d3deedc38fcef68da2972e8e58d'/>
<id>urn:sha1:622a5b582cc27d3deedc38fcef68da2972e8e58d</id>
<content type='text'>
hashmap__new() encodes errors with ERR_PTR(), hence it's not valid to
check the returned pointer against NULL and IS_ERR() has to be used
instead.

libbpf_get_error() can't be used in this case as hashmap__new() is not
part of the public libbpf API and it'll continue using ERR_PTR() after
libbpf 1.0.

Fixes: 8f184732b60b ("bpftool: Switch to libbpf's hashmap for pinned paths of BPF objects")
Fixes: 2828d0d75b73 ("bpftool: Switch to libbpf's hashmap for programs/maps in BTF listing")
Fixes: d6699f8e0f83 ("bpftool: Switch to libbpf's hashmap for PIDs/names references")
Signed-off-by: Mauricio Vásquez &lt;mauricio@kinvolk.io&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Link: https://lore.kernel.org/bpf/20220107152620.192327-2-mauricio@kinvolk.io
</content>
</entry>
<entry>
<title>bpftool: Switch to libbpf's hashmap for PIDs/names references</title>
<updated>2021-10-26T00:31:39Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2021-10-23T20:51:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6699f8e0f834b40db35466f704705ae757be11a'/>
<id>urn:sha1:d6699f8e0f834b40db35466f704705ae757be11a</id>
<content type='text'>
In order to show PIDs and names for processes holding references to BPF
programs, maps, links, or BTF objects, bpftool creates hash maps to
store all relevant information. This commit is part of a set that
transitions from the kernel's hash map implementation to the one coming
with libbpf.

The motivation is to make bpftool less dependent of kernel headers, to
ease the path to a potential out-of-tree mirror, like libbpf has.

This is the third and final step of the transition, in which we convert
the hash maps used for storing the information about the processes
holding references to BPF objects (programs, maps, links, BTF), and at
last we drop the inclusion of tools/include/linux/hashtable.h.

Note: Checkpatch complains about the use of __weak declarations, and the
missing empty lines after the bunch of empty function declarations when
compiling without the BPF skeletons (none of these were introduced in
this patch). We want to keep things as they are, and the reports should
be safe to ignore.

Signed-off-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211023205154.6710-6-quentin@isovalent.com
</content>
</entry>
<entry>
<title>bpftool: Switch to libbpf's hashmap for pinned paths of BPF objects</title>
<updated>2021-10-26T00:31:38Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2021-10-23T20:51:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8f184732b60b74a8f8ba0d9a5c248bf611b1ebba'/>
<id>urn:sha1:8f184732b60b74a8f8ba0d9a5c248bf611b1ebba</id>
<content type='text'>
In order to show pinned paths for BPF programs, maps, or links when
listing them with the "-f" option, bpftool creates hash maps to store
all relevant paths under the bpffs. So far, it would rely on the
kernel implementation (from tools/include/linux/hashtable.h).

We can make bpftool rely on libbpf's implementation instead. The
motivation is to make bpftool less dependent of kernel headers, to ease
the path to a potential out-of-tree mirror, like libbpf has.

This commit is the first step of the conversion: the hash maps for
pinned paths for programs, maps, and links are converted to libbpf's
hashmap.{c,h}. Other hash maps used for the PIDs of process holding
references to BPF objects are left unchanged for now. On the build side,
this requires adding a dependency to a second header internal to libbpf,
and making it a dependency for the bootstrap bpftool version as well.
The rest of the changes are a rather straightforward conversion.

Signed-off-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211023205154.6710-4-quentin@isovalent.com
</content>
</entry>
</feed>
