Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
bba7358
Add slabratetop libbpf-tools.
Rtoax Jan 7, 2022
80b1e77
libbpf-tools: fix fentry_try_attach bug
Jun 23, 2022
77615d4
tools/profile: decode bytes to str
asd142513 Jun 23, 2022
c0995ce
libbpf-tools: Fix syscount
chenhengqi Jun 21, 2022
118bf16
libbpf-tools: Fix tcpconnect
chenhengqi Jun 21, 2022
df8d58a
libbpf-tools: Allow tcpconnlat to run on old kernels
chenhengqi Jun 21, 2022
c3c99a9
libbpf-tools: Allow filelife to run on kernels without CONIFG_SECURITY
chenhengqi Jun 21, 2022
f1b769b
tools/biosnoop: Add disk filter support
xingfeng2510 Jun 21, 2022
fb14766
tools/biosnoop: Remove unused import re
xingfeng2510 Jun 21, 2022
b2af01e
libbpf-tools: Fix biopattern with recent tracepoint change
chenhengqi Jun 27, 2022
d81e56c
tools/stackcount: remove b''
yezhengmao1 Jun 21, 2022
5370855
Add pin support for xsk map (#4061)
Y7n05h Jul 3, 2022
4b3cbf4
bcc/syms: Fix shared lib module offset <-> global addr conversion
davemarchevsky Jun 30, 2022
c54336e
Merge pull request #4089 from davemarchevsky/davemarchevsky_fix_so
davemarchevsky Jul 5, 2022
741ba58
[cmake] Add a definition to enable clang sanitizers.
chantra Jul 5, 2022
9c043a2
[cc] Fix memory leak in BPFModule::finalize()
chantra Jul 5, 2022
185143b
[bcc] stop using deprecated `bpf_load_program_attr`
chantra Jul 5, 2022
e96571e
Merge pull request #4093 from chantra/fix_bpf_load_program_attr
davemarchevsky Jul 6, 2022
fbc1540
Merge pull request #3797 from Rtoax/patch-8
davemarchevsky Jul 7, 2022
984d24c
tests/python: @mayFail offcputime in py_smoke_tests
davemarchevsky Jul 7, 2022
d7dcbb5
Merge pull request #4097 from davemarchevsky/davemarchevsky_fix_test
davemarchevsky Jul 8, 2022
ea3c885
tools: fix typos
asd142513 Jul 8, 2022
f0dee60
tools: fix minor bugs
asd142513 Jul 8, 2022
ba0af23
Merge pull request #4086 from asd142513/typo
davemarchevsky Jul 8, 2022
d21c85e
[py] Add support for CGROUP_SOCKOPT program type
chantra Jul 8, 2022
8c5babf
Merge pull request #4098 from chantra/bcc_py_sockopt
davemarchevsky Jul 9, 2022
8c746a6
sync libbpf
chantra Jul 6, 2022
6a29236
bcc: Fix tracepoint struct generation
chenhengqi Jul 7, 2022
b5c78af
Add support and doc for new helpers from libbpf repo
yonghong-song Jul 11, 2022
7b1803c
libbpf-tools: Make tools independent of vmlinux.h
chenhengqi Jul 4, 2022
6409ff8
libbpf-tools: Bump x86 vmlinux.h to v5.18
chenhengqi Jul 4, 2022
a7fb5d6
libbpf-tools: Add RISC-V support
chenhengqi Jul 4, 2022
ca03af7
riscv: initial ebpf support (#4085)
xmzzz Jul 11, 2022
4ce27d4
libbpf-tools: fix ksnoop panic
chendotjs Jul 12, 2022
74ba1d1
Merge pull request #4088 from chenhengqi/add-riscv-support-for-libbpf…
davemarchevsky Jul 12, 2022
798a105
libbpf-tools: Add tcptracer
mauriciovasquezbernal Jun 6, 2022
dd530d0
docs:add install guide for wsl users
lalawuu Jul 15, 2022
6c4080f
docs: add fullname of wsl for search
lalawuu Jul 16, 2022
9a5a22b
Merge pull request #4108 from aseaday/doc-add-install-guide-for-WSL-u…
davemarchevsky Jul 16, 2022
29c6449
tools/runqslower.py: remove unused global variable rq.
linuszeng Jul 19, 2022
6703af1
tools/runqlat.py: remove unused global variable rq.
linuszeng Jul 20, 2022
d109d58
Merge pull request #4119 from linuszeng/runqslow
davemarchevsky Jul 20, 2022
83a379e
[bcc] Add macros to check libbcc version
chantra Jul 5, 2022
ee216fd
riscv:fix user_regs_struct macro issue
xmzzz Jul 18, 2022
8397d00
Fix warning: passing argument 4 of ‘btf_dump__new’ from incompatible …
Rtoax Jul 18, 2022
e9c5931
riscv: using bpf_probe_read_{kernel|user} on riscv64
xmzzz Jul 19, 2022
dca2d00
libbpf-tools: add sigsnoop
chenhengqi Aug 8, 2021
cb23ebb
bcc: Add basic and usdt support for LoongArch
seehearfeel Jul 19, 2022
4c2d123
libbpf-tools: tcpconnect: take source port into consideration
aspsk Jul 28, 2022
4a8b593
tools/profile: add multi process/thread support, like perf convention
yezhengmao1 Jul 12, 2022
4902819
Update biosnoop.py (#4124)
WuXianChangKuang Jul 29, 2022
300fc6a
[test] Fix wrapper script to allow testing individual tests (#4126)
chantra Jul 29, 2022
4a60443
tools/cpudist: Add extension summary support (#4131)
xingfeng2510 Jul 29, 2022
8528919
tools/syscount: Add syscall filter support (#4132)
xingfeng2510 Jul 29, 2022
6616092
[lsan] Fix leaks detected by sanitier
chantra Jul 22, 2022
1fd6e19
sigsnoop: Get rid of SIGIOT
namhyung Jul 26, 2022
aacec93
tools/mdflush: include blkdev.h instead of genhd.h
jeromemarchand Aug 1, 2022
1bc837e
libbpf-tools: Build and use lightweight bootstrap version of bpftool
chenhengqi Aug 1, 2022
30ea527
Merge pull request #4143 from chenhengqi/bpftool-bootstrap
davemarchevsky Aug 1, 2022
58fe075
Merge pull request #4142 from jeromemarchand/mdflush-genhd
davemarchevsky Aug 1, 2022
f6c4b4c
Merge pull request #4135 from aspsk/aspsk/tcpconnect-add-an-option
davemarchevsky Aug 1, 2022
0e29f70
tools/biolatency: Simplify extension summary redundant logic (#4145)
xingfeng2510 Aug 4, 2022
1d68595
oomkill: Remove extra trailing newline from output
chenhengqi Aug 4, 2022
86bf109
tools/cpudist: Fix warning introduced by recent change
chenhengqi Aug 6, 2022
17c1ac3
Merge pull request #4149 from chenhengqi/fix-cpudist
davemarchevsky Aug 8, 2022
dda13ed
Merge pull request #4147 from chenhengqi/fix-oomkill-output
davemarchevsky Aug 8, 2022
408fb40
tools/syscount: Use lock_xadd to guarantee atomicity of addition oper…
xingfeng2510 Aug 9, 2022
c65e6c5
fix llvm15 compilation error
yonghong-song Aug 10, 2022
1c4e10b
fix a llvm compilation error with llvm16
yonghong-song Aug 10, 2022
5bf9b4d
Sync with latest libbpf repo
yonghong-song Aug 10, 2022
711f030
Update debian changelog for release v0.25.0
yonghong-song Aug 10, 2022
05b2e20
CMake tweaks for static library builds
oazizi000 Oct 29, 2021
1b941ba
Customizing probe names for Pixie
oazizi000 Jul 19, 2019
93f866a
Shorten a name that is too long for attaching uprobe
yzhao1012 Nov 11, 2019
a5d7f31
BPFTable: Add get_addr_symbol
oazizi000 Mar 16, 2021
2384d3a
BPFTable.h|cc: add 'clear_table' with get_table_offline() for hash ta…
Mar 21, 2021
64fa5d4
BPFTable.h|cc: add parameter 'clear' (defaulted to false) to get_stac…
Mar 25, 2021
341d921
perf_reader: Change `perf_reader_event_read` to only read a maximum of
JamesMBartlett Jan 24, 2022
b9cc317
Add some more options to the BCC build
zasgar Jun 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if(CMAKE_SANITIZE_TYPE)
add_compile_options(-fsanitize=${CMAKE_SANITIZE_TYPE})
add_link_options(-fsanitize=${CMAKE_SANITIZE_TYPE})
endif()


if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "path to install" FORCE)
endif()
Expand Down Expand Up @@ -78,6 +84,11 @@ include(GNUInstallDirs)
include(CheckCXXCompilerFlag)
include(cmake/FindCompilerFlag.cmake)


option(ENABLE_INTROSPECTIONS "Enable introspection tool" OFF)
option(ENABLE_LUA "Enable lua bindings" OFF)
option(ENABLE_PYTHON "Enable python binding" OFF)
option(ENABLE_SHARED "Enable shared libraries" OFF)
option(ENABLE_LLVM_NATIVECODEGEN "Enable use of llvm nativecodegen module (needed by rw-engine)" ON)
option(ENABLE_RTTI "Enable compiling with real time type information" OFF)
option(ENABLE_LLVM_SHARED "Enable linking LLVM as a shared library" OFF)
Expand Down Expand Up @@ -125,6 +136,9 @@ find_library(libclangRewrite NAMES clangRewrite clang-cpp HINTS ${CLANG_SEARCH})
find_library(libclangSema NAMES clangSema clang-cpp HINTS ${CLANG_SEARCH})
find_library(libclangSerialization NAMES clangSerialization clang-cpp HINTS ${CLANG_SEARCH})
find_library(libclangASTMatchers NAMES clangASTMatchers clang-cpp HINTS ${CLANG_SEARCH})
if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 15 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 15)
find_library(libclangSupport NAMES clangSupport clang-cpp HINTS ${CLANG_SEARCH})
endif()
find_library(libclang-shared libclang-cpp.so HINTS ${CLANG_SEARCH})
if(libclangBasic STREQUAL "libclangBasic-NOTFOUND")
message(FATAL_ERROR "Unable to find clang libraries")
Expand Down Expand Up @@ -158,24 +172,35 @@ if (USINGISYSTEM AND GCC_VERSION VERSION_LESS 6.0)
endif()

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 16 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 16)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()

endif(NOT PYTHON_ONLY)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${CXX_ISYSTEM_DIRS}")

add_subdirectory(src)
add_subdirectory(introspection)

if(ENABLE_INTROSPECTIONS)
add_subdirectory(introspection)
endif(ENABLE_INTROSPECTIONS)

if(ENABLE_CLANG_JIT)
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(ENABLE_EXAMPLES)
if(ENABLE_MAN)
add_subdirectory(man)
endif(ENABLE_MAN)
if(ENABLE_TESTS)
add_subdirectory(tests)
endif(ENABLE_TESTS)
add_subdirectory(tools)
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(ENABLE_EXAMPLES)

if(ENABLE_MAN)
add_subdirectory(man)
endif(ENABLE_MAN)

if(ENABLE_TESTS)
add_subdirectory(tests)
endif(ENABLE_TESTS)

add_subdirectory(tools)
endif(ENABLE_CLANG_JIT)
24 changes: 24 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Amazon Linux 1](#amazon-linux-1---binary)
- [Amazon Linux 2](#amazon-linux-2---binary)
- [Alpine](#alpine---binary)
- [WSL](#wslwindows-subsystem-for-linux---binary)
* [Source](#source)
- [libbpf Submodule](#libbpf-submodule)
- [Debian](#debian---source)
Expand Down Expand Up @@ -270,6 +271,29 @@ sudo docker run --rm -it --privileged \
alpine:3.12
```

## WSL(Windows Subsystem for Linux) - Binary

### Install dependencies
The compiling depends on the headers and lib of linux kernel module which was not found in wsl distribution packages repo. We have to compile the kernel moudle manually.
```bash
apt-get install flex bison libssl-dev libelf-dev dwarves
```
### Install packages
```
cp Microsoft/config-wsl .config
make oldconfig && make prepare
make scripts
make modules && make modules_install
# if your kernel version is 4.19.y
mv /lib/modules/x.y.z-microsoft-standard+ /lib/modules/x.y.z-microsoft-standard
````
Then you can install bcc tools package according your distribution.

If you met some problems, try to
```
sudo mount -t debugfs debugfs /sys/kernel/debug
```

# Source

## libbpf Submodule
Expand Down
8 changes: 7 additions & 1 deletion cmake/clang_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ list(APPEND clang_libs
${libclangRewrite}
${libclangEdit}
${libclangAST}
${libclangLex}
${libclangLex})

# if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 15 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 15)
list(APPEND clang_libs ${libclangSupport})
# endif()

list(APPEND clang_libs
${libclangBasic})
endif()

Expand Down
9 changes: 8 additions & 1 deletion cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,12 @@ else()
set(REVISION_LAST "${REVISION}")
endif()

if (REVISION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(REVISION_MAJOR ${CMAKE_MATCH_1})
set(REVISION_MINOR ${CMAKE_MATCH_2})
set(REVISION_PATCH ${CMAKE_MATCH_3})
else()
message(WARNING "Could not extract major/minor/patch from revision ${REVISION}" )
endif()
# strip leading 'v', and make unique for the tag
message(STATUS "Revision is ${REVISION}")
message(STATUS "Revision is ${REVISION} (major ${REVISION_MAJOR}, minor ${REVISION_MINOR}, patch ${REVISION_PATCH})")
19 changes: 19 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
bcc (0.25.0-1) unstable; urgency=low

* Support for kernel up to 5.19
* bcc tool updates for oomkill.py, biolatpcts.py, sslsniff.py, tcpaccept.py, etc.
* libbpf tool updates for klockstat, opensnoop, tcpconnect, etc.
* new bcc tools: tcpcong
* new libbpf tools: tcpsynbl, mdflush, oomkill, sigsnoop
* usdt: support xmm registers as args for x64
* bpftool as a submodule now
* remove uses of libbpf deprecated APIs
* use new llvm pass manager
* support cgroup filtering libbpf tools
* fix shared lib module offset <-> global addr conversion
* riscv support
* LoongArch support
* doc update, bug fixes and other tools improvement

-- Yonghong Song <ys114321@gmail.com> Wed, 10 Aug 2022 17:00:00 +0000

bcc (0.24.0-1) unstable; urgency=low

* Support for kernel up to 5.16
Expand Down
12 changes: 12 additions & 0 deletions docs/kernel-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ Helper | Kernel version | License | Commit |
`BPF_FUNC_csum_update()` | 4.9 | | [`36bbef52c7eb`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=36bbef52c7eb646ed6247055a2acd3851e317857)
`BPF_FUNC_current_task_under_cgroup()` | 4.9 | | [`60d20f9195b2`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=60d20f9195b260bdf0ac10c275ae9f6016f9c069)
`BPF_FUNC_d_path()` | 5.10 | | [`6e22ab9da793`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=6e22ab9da79343532cd3cde39df25e5a5478c692)
`BPF_FUNC_dynptr_data()` | 5.19 | | [`34d4ef5775f7`](https://github.com/torvalds/linux/commit/34d4ef5775f776ec4b0d53a02d588bf3195cada6)
`BPF_FUNC_dynptr_from_mem()` | 5.19 | | [`263ae152e962`](https://github.com/torvalds/linux/commit/263ae152e96253f40c2c276faad8629e096b3bad)
`BPF_FUNC_dynptr_read()` | 5.19 | | [`13bbbfbea759`](https://github.com/torvalds/linux/commit/13bbbfbea7598ea9f8d9c3d73bf053bb57f9c4b2)
`BPF_FUNC_dynptr_write()` | 5.19 | | [`13bbbfbea759`](https://github.com/torvalds/linux/commit/13bbbfbea7598ea9f8d9c3d73bf053bb57f9c4b2)
`BPF_FUNC_fib_lookup()` | 4.18 | GPL | [`87f5fc7e48dd`](https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=87f5fc7e48dd3175b30dd03b41564e1a8e136323)
`BPF_FUNC_find_vma()` | 5.17 | | [`7c7e3d31e785`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=7c7e3d31e7856a8260a254f8c71db416f7f9f5a1)
`BPF_FUNC_for_each_map_elem()` | 5.13 | | [`69c087ba6225`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=69c087ba6225b574afb6e505b72cb75242a3d844)
Expand Down Expand Up @@ -308,10 +312,13 @@ Helper | Kernel version | License | Commit |
`BPF_FUNC_redirect_peer()` | 5.10 | | [`9aa1206e8f48`](https://github.com/torvalds/linux/commit/9aa1206e8f48222f35a0c809f33b2f4aaa1e2661)
`BPF_FUNC_reserve_hdr_opt()` | 5.10 | | [`0813a841566f`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=0813a841566f0962a5551be7749b43c45f0022a0)
`BPF_FUNC_ringbuf_discard()` | 5.8 | | [`457f44363a88`](https://github.com/torvalds/linux/commit/457f44363a8894135c85b7a9afd2bd8196db24ab)
`BPF_FUNC_ringbuf_discard_dynptr()` | 5.19 | | [`bc34dee65a65`](https://github.com/torvalds/linux/commit/bc34dee65a65e9c920c420005b8a43f2a721a458)
`BPF_FUNC_ringbuf_output()` | 5.8 | | [`457f44363a88`](https://github.com/torvalds/linux/commit/457f44363a8894135c85b7a9afd2bd8196db24ab)
`BPF_FUNC_ringbuf_query()` | 5.8 | | [`457f44363a88`](https://github.com/torvalds/linux/commit/457f44363a8894135c85b7a9afd2bd8196db24ab)
`BPF_FUNC_ringbuf_reserve()` | 5.8 | | [`457f44363a88`](https://github.com/torvalds/linux/commit/457f44363a8894135c85b7a9afd2bd8196db24ab)
`BPF_FUNC_ringbuf_reserve_dynptr()` | 5.19 | | [`bc34dee65a65`](https://github.com/torvalds/linux/commit/bc34dee65a65e9c920c420005b8a43f2a721a458)
`BPF_FUNC_ringbuf_submit()` | 5.8 | | [`457f44363a88`](https://github.com/torvalds/linux/commit/457f44363a8894135c85b7a9afd2bd8196db24ab)
`BPF_FUNC_ringbuf_submit_dynptr()` | 5.19 | | [`bc34dee65a65`](https://github.com/torvalds/linux/commit/bc34dee65a65e9c920c420005b8a43f2a721a458)
`BPF_FUNC_send_signal()` | 5.3 | | [`8b401f9ed244`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=8b401f9ed2441ad9e219953927a842d24ed051fc)
`BPF_FUNC_send_signal_thread()` | 5.5 | | [`8482941f0906`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=8482941f09067da42f9c3362e15bfb3f3c19d610)
`BPF_FUNC_seq_printf()` | 5.7 | GPL | [`492e639f0c22`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next/+/492e639f0c222784e2e0f121966375f641c61b15)
Expand Down Expand Up @@ -357,6 +364,7 @@ Helper | Kernel version | License | Commit |
`BPF_FUNC_skb_vlan_pop()` | 4.3 | | [`4e10df9a60d9`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4e10df9a60d96ced321dd2af71da558c6b750078)
`BPF_FUNC_skb_vlan_push()` | 4.3 | | [`4e10df9a60d9`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4e10df9a60d96ced321dd2af71da558c6b750078)
`BPF_FUNC_skc_lookup_tcp()` | 5.2 | | [`edbf8c01de5a`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/edbf8c01de5a104a71ed6df2bf6421ceb2836a8e)
`BPF_FUNC_skc_to_mctcp_sock()` | 5.19 | | [`3bc253c2e652`](https://github.com/torvalds/linux/commit/3bc253c2e652cf5f12cd8c00d80d8ec55d67d1a7)
`BPF_FUNC_skc_to_tcp_sock()` | 5.9 | | [`478cfbdf5f13`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next/+/478cfbdf5f13dfe09cfd0b1cbac821f5e27f6108)
`BPF_FUNC_skc_to_tcp_request_sock()` | 5.9 | | [`478cfbdf5f13`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next/+/478cfbdf5f13dfe09cfd0b1cbac821f5e27f6108)
`BPF_FUNC_skc_to_tcp_timewait_sock()` | 5.9 | | [`478cfbdf5f13`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next/+/478cfbdf5f13dfe09cfd0b1cbac821f5e27f6108)
Expand Down Expand Up @@ -386,6 +394,10 @@ Helper | Kernel version | License | Commit |
`BPF_FUNC_task_storage_get()` | 5.11 | | [`4cf1bc1f1045`](https://github.com/torvalds/linux/commit/4cf1bc1f10452065a29d576fc5693fc4fab5b919)
`BPF_FUNC_tcp_check_syncookie()` | 5.2 | | [`399040847084`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/399040847084a69f345e0a52fd62f04654e0fce3)
`BPF_FUNC_tcp_gen_syncookie()` | 5.3 | | [`70d66244317e`](https://github.com/torvalds/linux/commit/70d66244317e958092e9c971b08dd5b7fd29d9cb#diff-05da4bf36c7fbcd176254e1615d98b28)
`BPF_FUNC_tcp_raw_check_syncookie_ipv4()` | 5.20 | | [`33bf9885040c`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=33bf9885040c399cf6a95bd33216644126728e14)
`BPF_FUNC_tcp_raw_check_syncookie_ipv6()` | 5.20 | | [`33bf9885040c`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=33bf9885040c399cf6a95bd33216644126728e14)
`BPF_FUNC_tcp_raw_gen_syncookie_ipv4()` | 5.20 | | [`33bf9885040c`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=33bf9885040c399cf6a95bd33216644126728e14)
`BPF_FUNC_tcp_raw_gen_syncookie_ipv6()` | 5.20 | | [`33bf9885040c`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=33bf9885040c399cf6a95bd33216644126728e14)
`BPF_FUNC_tcp_send_ack()` | 5.5 | | [`206057fe020a`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=206057fe020ac5c037d5e2dd6562a9bd216ec765)
`BPF_FUNC_tcp_sock()` | 5.1 | | [`655a51e536c0`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=655a51e536c09d15ffa3603b1b6fce2b45b85a1f)
`BPF_FUNC_this_cpu_ptr()` | 5.10 | | [`63d9b80dcf2c`](https://github.com/torvalds/linux/commit/63d9b80dcf2c67bc5ade61cbbaa09d7af21f43f1) |
Expand Down
4 changes: 2 additions & 2 deletions docs/reference_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,9 @@ Examples in situ:

### 13. BPF_XSKMAP

Syntax: ```BPF_XSKMAP(name, size)```
Syntax: ```BPF_XSKMAP(name, size [, "/sys/fs/bpf/xyz"])```

This creates a xsk map named ```name``` with ```size``` entries. Each entry represents one NIC's queue id. This map is only used in XDP to redirect packet to an AF_XDP socket. If the AF_XDP socket is binded to a queue which is different than the current packet's queue id, the packet will be dropped. For kernel v5.3 and latter, `lookup` method is available and can be used to check whether and AF_XDP socket is available for the current packet's queue id. More details at [AF_XDP](https://www.kernel.org/doc/html/latest/networking/af_xdp.html).
This creates a xsk map named ```name``` with ```size``` entries and pin it to the bpffs as a FILE. Each entry represents one NIC's queue id. This map is only used in XDP to redirect packet to an AF_XDP socket. If the AF_XDP socket is binded to a queue which is different than the current packet's queue id, the packet will be dropped. For kernel v5.3 and latter, `lookup` method is available and can be used to check whether and AF_XDP socket is available for the current packet's queue id. More details at [AF_XDP](https://www.kernel.org/doc/html/latest/networking/af_xdp.html).

For example:
```C
Expand Down
8 changes: 6 additions & 2 deletions libbpf-tools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
/funclatency
/gethostlatency
/hardirqs
/killsnoop
/klockstat
/ksnoop
/llcstat
/nfsdist
/nfsslower
/mdflush
/mountsnoop
/nfsdist
/nfsslower
/numamove
/offcputime
/oomkill
Expand All @@ -39,13 +40,16 @@
/runqlat
/runqlen
/runqslower
/sigsnoop
/slabratetop
/softirqs
/solisten
/statsnoop
/syscount
/tcpconnect
/tcpconnlat
/tcplife
/tcptracer
/tcprtt
/tcpsynbl
/vfsstat
Expand Down
28 changes: 19 additions & 9 deletions libbpf-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ OUTPUT := $(abspath .output)
CLANG ?= clang
LLVM_STRIP ?= llvm-strip
BPFTOOL_SRC := $(abspath ./bpftool/src)
BPFTOOL ?= $(OUTPUT)/bpftool/bpftool
BPFTOOL_OUTPUT ?= $(abspath $(OUTPUT)/bpftool)
BPFTOOL ?= $(BPFTOOL_OUTPUT)/bootstrap/bpftool
LIBBPF_SRC := $(abspath ../src/cc/libbpf/src)
LIBBPF_OBJ := $(abspath $(OUTPUT)/libbpf.a)
INCLUDES := -I$(OUTPUT) -I../src/cc/libbpf/include/uapi
CFLAGS := -g -O2 -Wall
BPFCFLAGS := -g -O2 -Wall
INSTALL ?= install
prefix ?= /usr/local
ARCH := $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' | sed 's/ppc64le/powerpc/' | sed 's/mips.*/mips/')
ARCH := $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' \
| sed 's/ppc64le/powerpc/' | sed 's/mips.*/mips/' \
| sed 's/riscv64/riscv/' | sed 's/loongarch.*/loongarch/')
BTFHUB_ARCHIVE ?= $(abspath btfhub-archive)

ifeq ($(wildcard $(ARCH)/),)
Expand Down Expand Up @@ -52,10 +55,13 @@ APPS = \
runqlat \
runqlen \
runqslower \
sigsnoop \
slabratetop \
softirqs \
solisten \
statsnoop \
syscount \
tcptracer \
tcpconnect \
tcpconnlat \
tcplife \
Expand All @@ -69,7 +75,8 @@ export OUTPUT BPFTOOL ARCH BTFHUB_ARCHIVE APPS

FSDIST_ALIASES = btrfsdist ext4dist nfsdist xfsdist
FSSLOWER_ALIASES = btrfsslower ext4slower nfsslower xfsslower
APP_ALIASES = $(FSDIST_ALIASES) $(FSSLOWER_ALIASES)
SIGSNOOP_ALIAS = killsnoop
APP_ALIASES = $(FSDIST_ALIASES) $(FSSLOWER_ALIASES) ${SIGSNOOP_ALIAS}

COMMON_OBJ = \
$(OUTPUT)/trace_helpers.o \
Expand Down Expand Up @@ -114,14 +121,13 @@ clean:
$(call msg,CLEAN)
$(Q)rm -rf $(OUTPUT) $(APPS) $(APP_ALIASES)

$(OUTPUT) $(OUTPUT)/libbpf:
$(OUTPUT) $(OUTPUT)/libbpf $(BPFTOOL_OUTPUT):
$(call msg,MKDIR,$@)
$(Q)mkdir -p $@

.PHONY: bpftool
bpftool:
$(Q)mkdir -p $(OUTPUT)/bpftool
$(Q)$(MAKE) ARCH= CROSS_COMPILE= OUTPUT=$(OUTPUT)/bpftool/ -C $(BPFTOOL_SRC)
$(BPFTOOL): | $(BPFTOOL_OUTPUT)
$(call msg,BPFTOOL,$@)
$(Q)$(MAKE) ARCH= CROSS_COMPILE= OUTPUT=$(BPFTOOL_OUTPUT)/ -C $(BPFTOOL_SRC) bootstrap

$(APPS): %: $(OUTPUT)/%.o $(LIBBPF_OBJ) $(COMMON_OBJ) | $(OUTPUT)
$(call msg,BINARY,$@)
Expand All @@ -133,7 +139,7 @@ $(OUTPUT)/%.o: %.c $(wildcard %.h) $(LIBBPF_OBJ) | $(OUTPUT)
$(call msg,CC,$@)
$(Q)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@

$(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(OUTPUT) bpftool
$(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(OUTPUT) $(BPFTOOL)
$(call msg,GEN-SKEL,$@)
$(Q)$(BPFTOOL) gen skeleton $< > $@

Expand Down Expand Up @@ -169,6 +175,10 @@ $(FSDIST_ALIASES): fsdist
$(call msg,SYMLINK,$@)
$(Q)ln -f -s $^ $@

$(SIGSNOOP_ALIAS): sigsnoop
$(call msg,SYMLINK,$@)
$(Q)ln -f -s $^ $@

install: $(APPS) $(APP_ALIASES)
$(call msg, INSTALL libbpf-tools)
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
Expand Down
21 changes: 3 additions & 18 deletions libbpf-tools/biolatency.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <bpf/bpf_tracing.h>
#include "biolatency.h"
#include "bits.bpf.h"
#include "core_fixes.bpf.h"

#define MAX_ENTRIES 10240

Expand All @@ -19,10 +20,6 @@ const volatile bool targ_ms = false;
const volatile bool filter_dev = false;
const volatile __u32 targ_dev = 0;

struct request_queue___x {
struct gendisk *disk;
} __attribute__((preserve_access_index));

struct {
__uint(type, BPF_MAP_TYPE_CGROUP_ARRAY);
__type(key, u32);
Expand Down Expand Up @@ -55,15 +52,9 @@ int trace_rq_start(struct request *rq, int issue)
u64 ts = bpf_ktime_get_ns();

if (filter_dev) {
struct request_queue___x *q = (void *)BPF_CORE_READ(rq, q);
struct gendisk *disk;
struct gendisk *disk = get_disk(rq);
u32 dev;

if (bpf_core_field_exists(q->disk))
disk = BPF_CORE_READ(q, disk);
else
disk = BPF_CORE_READ(rq, rq_disk);

dev = disk ? MKDEV(BPF_CORE_READ(disk, major),
BPF_CORE_READ(disk, first_minor)) : 0;
if (targ_dev != dev)
Expand Down Expand Up @@ -127,13 +118,7 @@ int BPF_PROG(block_rq_complete, struct request *rq, int error,
goto cleanup;

if (targ_per_disk) {
struct request_queue___x *q = (void *)BPF_CORE_READ(rq, q);
struct gendisk *disk;

if (bpf_core_field_exists(q->disk))
disk = BPF_CORE_READ(q, disk);
else
disk = BPF_CORE_READ(rq, rq_disk);
struct gendisk *disk = get_disk(rq);

hkey.dev = disk ? MKDEV(BPF_CORE_READ(disk, major),
BPF_CORE_READ(disk, first_minor)) : 0;
Expand Down
Loading