libbpf: Wire up spec management and other arch-independent USDT logic
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 4 Apr 2022 23:41:59 +0000 (16:41 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 5 Apr 2022 20:16:07 +0000 (13:16 -0700)
commit999783c8bbda2e82390cb8c39ed9e3954cf51b82
tree576e79ae893d65b624bf68ba65e954f594b2592c
parent74cc6311cec906daf1d64cefe4922dbf79c416c9
libbpf: Wire up spec management and other arch-independent USDT logic

Last part of architecture-agnostic user-space USDT handling logic is to
set up BPF spec and, optionally, IP-to-ID maps from user-space.
usdt_manager performs a compact spec ID allocation to utilize
fixed-sized BPF maps as efficiently as possible. We also use hashmap to
deduplicate USDT arg spec strings and map identical strings to single
USDT spec, minimizing the necessary BPF map size. usdt_manager supports
arbitrary sequences of attachment and detachment, both of the same USDT
and multiple different USDTs and internally maintains a free list of
unused spec IDs. bpf_link_usdt's logic is extended with proper setup and
teardown of this spec ID free list and supporting BPF maps.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Reviewed-by: Dave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/bpf/20220404234202.331384-5-andrii@kernel.org
tools/lib/bpf/usdt.c