Skip to content

Commit 542e405

Browse files
committed
Merge bitcoin/bitcoin#23724: build: add systemtap's sys/sdt.h as depends for GUIX builds with USDT tracepoints
6200fbf build: rename --enable-ebpf to --enable-usdt (0xb10c) e158a2a build: add systemtap's sys/sdt.h as depends (0xb10c) Pull request description: There has been light conceptual agreement on including the Userspace, Statically Defined Tracing tracepoints in Bitcoin Core release builds. This, for example, enables user to hook into production deployments, if they need to. Binaries don't have to be switched out. This is possible because we don't do [expensive computations](https://github.com/bitcoin/bitcoin/blob/master/doc/tracing.md#no-expensive-computations-for-tracepoints) only needed for the tracepoints. The tracepoints are NOPs when not used. Systemtap's `sys/sdt.h` header is required to build Bitcoin Core with USDT support. The header file defines the `DTRACE_PROBE` macros used in [`src/util/trace.h`](https://github.com/bitcoin/bitcoin/blob/master/src/util/trace.h). This PR adds Systemtap 4.5 (May 2021) as dependency. GUIX builds for Linux hosts now include the tracepoints. Closes bitcoin/bitcoin#23297. ACKs for top commit: fanquake: ACK 6200fbf - tested enabling / disabling and with/without SDT from depends. We can follow up with #23819, #23907 and #23296, and if any serious issues arise before feature freeze, it is easy for us to flip depends such that USDT becomes opt-in, rather than opt-out, and thus, releases would be tracepoint free. Tree-SHA512: 0263f44892bf8450e8a593e4de7a498243687f8d81269e1c3283fa8354922c7cf93fddef4b92cf5192d33798424aa5812e03e68ef8de31af078a32dd34021382
2 parents 2e01b69 + 6200fbf commit 542e405

File tree

7 files changed

+64
-13
lines changed

7 files changed

+64
-13
lines changed

configure.ac

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ AC_ARG_WITH([bdb],
137137
[use_bdb=$withval],
138138
[use_bdb=auto])
139139

140-
AC_ARG_ENABLE([ebpf],
141-
[AS_HELP_STRING([--enable-ebpf],
142-
[enable eBPF tracing (default is yes if sys/sdt.h is found)])],
143-
[use_ebpf=$enableval],
144-
[use_ebpf=yes])
140+
AC_ARG_ENABLE([usdt],
141+
[AS_HELP_STRING([--enable-usdt],
142+
[enable tracepoints for Userspace, Statically Defined Tracing (default is yes if sys/sdt.h is found)])],
143+
[use_usdt=$enableval],
144+
[use_usdt=yes])
145145

146146
AC_ARG_WITH([miniupnpc],
147147
[AS_HELP_STRING([--with-miniupnpc],
@@ -1337,15 +1337,15 @@ if test "$enable_wallet" != "no"; then
13371337
fi
13381338
fi
13391339

1340-
if test "$use_ebpf" != "no"; then
1341-
AC_MSG_CHECKING([whether eBPF tracepoints are supported])
1340+
if test "$use_usdt" != "no"; then
1341+
AC_MSG_CHECKING([whether Userspace, Statically Defined Tracing tracepoints are supported])
13421342
AC_COMPILE_IFELSE([
13431343
AC_LANG_PROGRAM(
13441344
[#include <sys/sdt.h>],
13451345
[DTRACE_PROBE("context", "event");]
13461346
)],
1347-
[AC_MSG_RESULT([yes]); have_sdt=yes; AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable eBPF user static defined tracepoints])],
1348-
[AC_MSG_RESULT([no]); have_sdt=no;]
1347+
[AC_MSG_RESULT([yes]); AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing])],
1348+
[AC_MSG_RESULT([no]); use_usdt=no;]
13491349
)
13501350
fi
13511351

@@ -1759,7 +1759,6 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test "$TARGET_OS" = "windows"])
17591759
AM_CONDITIONAL([ENABLE_WALLET], [test "$enable_wallet" = "yes"])
17601760
AM_CONDITIONAL([USE_SQLITE], [test "$use_sqlite" = "yes"])
17611761
AM_CONDITIONAL([USE_BDB], [test "$use_bdb" = "yes"])
1762-
AM_CONDITIONAL([ENABLE_TRACING], [test "$have_sdt" = "yes"])
17631762
AM_CONDITIONAL([ENABLE_TESTS], [test "$BUILD_TEST" = "yes"])
17641763
AM_CONDITIONAL([ENABLE_FUZZ], [test "$enable_fuzz" = "yes"])
17651764
AM_CONDITIONAL([ENABLE_FUZZ_BINARY], [test "$enable_fuzz_binary" = "yes"])
@@ -1929,7 +1928,7 @@ echo " with bench = $use_bench"
19291928
echo " with upnp = $use_upnp"
19301929
echo " with natpmp = $use_natpmp"
19311930
echo " use asm = $use_asm"
1932-
echo " ebpf tracing = $have_sdt"
1931+
echo " USDT tracing = $use_usdt"
19331932
echo " sanitizers = $use_sanitizers"
19341933
echo " debug enabled = $enable_debug"
19351934
echo " gprof enabled = $enable_gprof"

depends/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ NO_SQLITE ?=
3939
NO_WALLET ?=
4040
NO_ZMQ ?=
4141
NO_UPNP ?=
42+
NO_USDT ?=
4243
NO_NATPMP ?=
4344
MULTIPROCESS ?=
4445
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
@@ -149,8 +150,9 @@ natpmp_packages_$(NO_NATPMP) = $(natpmp_packages)
149150

150151
zmq_packages_$(NO_ZMQ) = $(zmq_packages)
151152
multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_packages)
153+
usdt_packages_$(NO_USDT) = $(usdt_$(host_os)_packages)
152154

153-
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_)
155+
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(natpmp_packages_) $(usdt_packages_)
154156
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
155157

156158
ifneq ($(zmq_packages_),)
@@ -228,6 +230,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
228230
-e 's|@no_bdb@|$(NO_BDB)|' \
229231
-e 's|@no_sqlite@|$(NO_SQLITE)|' \
230232
-e 's|@no_upnp@|$(NO_UPNP)|' \
233+
-e 's|@no_usdt@|$(NO_USDT)|' \
231234
-e 's|@no_natpmp@|$(NO_NATPMP)|' \
232235
-e 's|@multiprocess@|$(MULTIPROCESS)|' \
233236
-e 's|@debug@|$(DEBUG)|' \

depends/config.site.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ if test -z "$enable_zmq" && test -n "@no_zmq@"; then
7070
enable_zmq=no
7171
fi
7272

73+
if test -z "$enable_usdt" && test -n "@no_usdt@"; then
74+
enable_usdt=no
75+
fi
76+
7377
if test "@host_os@" = darwin; then
7478
BREW=no
7579
fi

depends/packages/packages.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ natpmp_packages=libnatpmp
1919
multiprocess_packages = libmultiprocess capnp
2020
multiprocess_native_packages = native_libmultiprocess native_capnp
2121

22+
usdt_linux_packages=systemtap
23+
2224
darwin_native_packages = native_ds_store native_mac_alias
2325

2426
$(host_arch)_$(host_os)_native_packages += native_b2

depends/packages/systemtap.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package=systemtap
2+
$(package)_version=4.5
3+
$(package)_download_path=https://sourceware.org/systemtap/ftp/releases/
4+
$(package)_file_name=$(package)-$($(package)_version).tar.gz
5+
$(package)_sha256_hash=75078ed37e0dd2a769c9d1f9394170b2d9f4d7daa425f43ca80c13bad6cfc925
6+
$(package)_patches=remove_SDT_ASM_SECTION_AUTOGROUP_SUPPORT_check.patch
7+
8+
define $(package)_preprocess_cmds
9+
patch -p1 < $($(package)_patch_dir)/remove_SDT_ASM_SECTION_AUTOGROUP_SUPPORT_check.patch && \
10+
mkdir -p $($(package)_staging_prefix_dir)/include/sys && \
11+
cp includes/sys/sdt.h $($(package)_staging_prefix_dir)/include/sys/sdt.h
12+
endef
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
commit b92d4c121486f3c6e8a2cea537c53eb09894479a
2+
Author: 0xb10c <[email protected]>
3+
Date: Tue Dec 7 11:02:07 2021 +0100
4+
5+
Remove _SDT_ASM_SECTION_AUTOGROUP_SUPPORT check
6+
7+
We assume that the assembler supports "?" in .pushsection directives.
8+
This enables us to skip configure and make.
9+
10+
See https://github.com/bitcoin/bitcoin/issues/23297.
11+
12+
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
13+
index 97766e710..352b4ee25 100644
14+
--- a/includes/sys/sdt.h
15+
+++ b/includes/sys/sdt.h
16+
@@ -230,12 +230,10 @@ __extension__ extern unsigned long long __sdt_unsp;
17+
nice with code in COMDAT sections, which comes up in C++ code.
18+
Without that assembler support, some combinations of probe placements
19+
in certain kinds of C++ code may produce link-time errors. */
20+
-#include "sdt-config.h"
21+
-#if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT
22+
+/* PATCH: We assume that the assembler supports the feature. This
23+
+ enables us to skip configure and make. In turn, this means we
24+
+ require fewer dependencies and have shorter depend build times. */
25+
# define _SDT_ASM_AUTOGROUP "?"
26+
-#else
27+
-# define _SDT_ASM_AUTOGROUP ""
28+
-#endif
29+
30+
#define _SDT_ASM_BODY(provider, name, pack_args, args) \
31+
_SDT_ASM_1(990: _SDT_NOP) \

doc/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
2323
| Qt | [5.12.11](https://download.qt.io/official_releases/qt/) | [5.9.5](https://github.com/bitcoin/bitcoin/issues/20104) | No | | |
2424
| SQLite | [3.32.1](https://sqlite.org/download.html) | [3.7.17](https://github.com/bitcoin/bitcoin/pull/19077) | | | |
2525
| XCB | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) (Linux only) |
26-
| systemtap ([tracing](tracing.md))| | | | | |
26+
| systemtap ([tracing](tracing.md))| [4.5](https://sourceware.org/systemtap/ftp/releases/) | | | | |
2727
| xkbcommon | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) (Linux only) |
2828
| ZeroMQ | [4.3.1](https://github.com/zeromq/libzmq/releases) | 4.0.0 | No | | |
2929
| zlib | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk) |

0 commit comments

Comments
 (0)