Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:

jobs:
fmt:
runs-on: [ self-hosted, silk-arm-small-cpu ]
runs-on: [self-hosted, silk-arm-small-cpu]

steps:
- uses: actions/checkout@v5
Expand All @@ -26,7 +26,7 @@ jobs:
run: ./bb fmt --check

test:
runs-on: [ self-hosted, "${{ matrix.arch.runner }}" ]
runs-on: [self-hosted, "${{ matrix.arch.runner }}"]

strategy:
fail-fast: false
Expand Down Expand Up @@ -68,7 +68,9 @@ jobs:
contrib/librseq \
contrib/liburing \
contrib/googletest \
contrib/benchmark
contrib/benchmark \
contrib/libbpf \
contrib/bpftool

- name: Init Poco submodule
if: matrix.build.name == 'release' || matrix.build.name == 'tsan'
Expand Down Expand Up @@ -111,16 +113,15 @@ jobs:
ccache \
libboost-context-dev \
libboost-program-options-dev \
libbpf-dev \
libdouble-conversion-dev \
libelf-dev \
zlib1g-dev

- name: Cache ccache
uses: actions/cache@v5
with:
path: ~/.cache/ccache
key: ${{ runner.os }}-ccache-${{ matrix.arch.name }}-${{ matrix.build.name
}}-${{ github.sha }}
key: ${{ runner.os }}-ccache-${{ matrix.arch.name }}-${{ matrix.build.name }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-${{ matrix.arch.name }}-${{ matrix.build.name }}-

Expand Down Expand Up @@ -149,7 +150,7 @@ jobs:
pages:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: [ self-hosted, silk-amd-small-cpu ]
runs-on: [self-hosted, silk-amd-small-cpu]

permissions:
pages: write
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@
[submodule "contrib/librseq"]
path = contrib/librseq
url = https://github.com/compudj/librseq.git
[submodule "contrib/libbpf"]
path = contrib/libbpf
url = https://github.com/libbpf/libbpf.git
[submodule "contrib/bpftool"]
path = contrib/bpftool
url = https://github.com/libbpf/bpftool.git
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ add_subdirectory(contrib/librseq-cmake)
add_subdirectory(contrib/libbacktrace-cmake)
add_subdirectory(contrib/googletest-cmake)
add_subdirectory(contrib/benchmark-cmake)
add_subdirectory(contrib/systemtap-sdt)
add_subdirectory(contrib/libbpf-cmake)
add_subdirectory(contrib/bpftool-cmake)

option(BUILD_POCO "Build Poco library (required by http-perf)" OFF)
if(BUILD_POCO)
Expand Down
1 change: 1 addition & 0 deletions contrib/bpftool
Submodule bpftool added at d844a2
47 changes: 47 additions & 0 deletions contrib/bpftool-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
if(NOT TARGET Libbpf::Libbpf)
return()
endif()

set(BPFTOOL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../bpftool)

file(GLOB BPFTOOL_SOURCES ${BPFTOOL_SRC}/src/*.c)
list(APPEND BPFTOOL_SOURCES ${BPFTOOL_SRC}/src/kernel/bpf/disasm.c)
# jit_disasm.c needs libbfd or LLVM disassembler; without either the
# inline stubs in main.h cover the API for everything else we use.
list(REMOVE_ITEM BPFTOOL_SOURCES ${BPFTOOL_SRC}/src/jit_disasm.c)

add_executable(bpftool ${BPFTOOL_SOURCES})

target_compile_options(bpftool PRIVATE
-w
-Wno-unused-parameter
-Wno-missing-field-initializers
# struct list_head lives in <linux/types.h>; libbpf's <linux/list.h>
# uses it without including types.h directly.
-include linux/types.h
# bpftool is a build-time tool; don't pay the cost of sanitizers,
# and skip false positives like qsort_r(NULL, 0, ...) tripping
# UBSan's nonnull-attribute check.
-fno-sanitize=all
)
target_link_options(bpftool PRIVATE -fno-sanitize=all)

# BPFTOOL_WITHOUT_SKELETONS turns the prog-profile / pid-iter paths (which
# depend on bpftool's own bootstrap-built skel headers) into stubs. The
# remaining commands -- including `btf dump` and `gen skeleton` that silk
# uses -- compile without needing a bootstrap stage.
target_compile_definitions(bpftool PRIVATE
BPFTOOL_WITHOUT_SKELETONS
BPFTOOL_VERSION="7.5.0"
PACKAGE="bpftool"
__EXPORTED_HEADERS__
_GNU_SOURCE
)

target_include_directories(bpftool PRIVATE
${BPFTOOL_SRC}/include
${BPFTOOL_SRC}/include/uapi
${BPFTOOL_SRC}/src/kernel/bpf
)

target_link_libraries(bpftool PRIVATE Libbpf::Libbpf)
1 change: 1 addition & 0 deletions contrib/libbpf
Submodule libbpf added at 09b9e8
48 changes: 48 additions & 0 deletions contrib/libbpf-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
find_library(LIBELF_LIBRARY NAMES elf)
find_path(LIBELF_INCLUDE_DIR libelf.h)
if(NOT LIBELF_LIBRARY OR NOT LIBELF_INCLUDE_DIR)
message(STATUS "Skipping libbpf: libelf not found (install libelf-dev)")
return()
endif()
find_package(ZLIB REQUIRED)

set(LIBBPF_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../libbpf)
set(LIBBPF_BIN ${CMAKE_BINARY_DIR}/libbpf-generated)

# Stage src/*.h under a bpf/ subdir so consumers can use <bpf/X.h>.
# The headers live directly in src/ in the repo but ship under bpf/ in
# the install layout that <bpf/...> includes assume.
file(MAKE_DIRECTORY ${LIBBPF_BIN}/include/bpf)
file(GLOB _libbpf_public_headers ${LIBBPF_SRC}/src/*.h)
foreach(_hdr IN LISTS _libbpf_public_headers)
get_filename_component(_name ${_hdr} NAME)
configure_file(${_hdr} ${LIBBPF_BIN}/include/bpf/${_name} COPYONLY)
endforeach()

file(GLOB LIBBPF_SOURCES ${LIBBPF_SRC}/src/*.c)

add_library(_libbpf STATIC ${LIBBPF_SOURCES})

target_compile_options(_libbpf PRIVATE
-w
-std=gnu89
# Don't sanitize third-party libbpf source; lets bpftool (which we
# also build with -fno-sanitize=all) link it without pulling in the
# sanitizer runtime, and keeps silk's profiler binary slimmer.
-fno-sanitize=all
)

target_compile_definitions(_libbpf PRIVATE
_LARGEFILE64_SOURCE
_FILE_OFFSET_BITS=64
)

target_include_directories(_libbpf
PRIVATE ${LIBBPF_SRC}/src
PUBLIC ${LIBBPF_BIN}/include ${LIBBPF_SRC}/include ${LIBBPF_SRC}/include/uapi
)

target_link_libraries(_libbpf PUBLIC ZLIB::ZLIB ${LIBELF_LIBRARY})
target_include_directories(_libbpf SYSTEM PUBLIC ${LIBELF_INCLUDE_DIR})

add_library(Libbpf::Libbpf ALIAS _libbpf)
12 changes: 12 additions & 0 deletions contrib/systemtap-sdt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Vendored copy of systemtap's <sys/sdt.h> + <sys/sdt-config.h>, the two
# header files needed to emit USDT (Statically Defined Tracepoint) probes.
# Both files are dedicated to the public domain (CC0) by upstream specifically
# so user programs incorporating them are not GPL-tainted; no further attribution
# or LICENSE artifact is required.
#
# We vendor instead of relying on the systemtap-sdt-dev distro package so that
# the silk build has zero extra apt dependencies for USDT.

add_library(systemtap-sdt INTERFACE)
target_include_directories(systemtap-sdt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
add_library(SystemTap::Sdt ALIAS systemtap-sdt)
6 changes: 6 additions & 0 deletions contrib/systemtap-sdt/sys/sdt-config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* includes/sys/sdt-config.h. Generated from sdt-config.h.in by configure.

This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to
indicate whether the assembler supports "?" in .pushsection directives. */

#define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1
Loading
Loading