From c38281d2c4c5725ab4d3d07de7738b80ad0d8bbc Mon Sep 17 00:00:00 2001 From: Wentao Zhang Date: Tue, 9 Apr 2024 06:25:06 +0000 Subject: bpftrace: fix the runtime ptest errors https://github.com/bpftrace/bpftrace/pull/2935 changed the test scripts, then the runtime ptest got the following errors: | KeyError: 'BPFTRACE_AOT_RUNTIME_TEST_EXECUTABLE' | Output: /bin/sh: line 1: /usr/bin/: Is a directory\n The changes in run-ptest is to solve these problems. After fixing the previously mentioned problems, we got the the following errors while running the runtime ptest: | error: :0:0: in function BEGIN i64 (ptr): 0x56056cec80f0: i64 = GlobalAddress 0 too many arguments The new patch in the bb file is to solve this problem. Signed-off-by: Wentao Zhang --- ...4bit-alignment-for-map-counter-atomic-add.patch | 49 ++++++++++++++++++++++ .../recipes-devtools/bpftrace/bpftrace/run-ptest | 3 +- .../recipes-devtools/bpftrace/bpftrace_0.20.1.bb | 1 + 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch (limited to 'dynamic-layers') diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch new file mode 100644 index 0000000..49938a1 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch @@ -0,0 +1,49 @@ +From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001 +From: Frank van der Linden +Date: Mon, 11 Mar 2024 15:35:32 +0000 +Subject: [PATCH] use 64bit alignment for map counter atomic add + +For an atomic inc of a map counter (ringbuf loss counter), generate +IR with 64bit alignment. This is more correct, and will avoid problems +with upcoming LLVM versions, as they will emit a function call for +a potentially unaligned atomicrmw. This will lead to an error like this: + +error: :0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress 0 too many arguments + +Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc] + +Signed-off-by: Wentao Zhang +--- + CHANGELOG.md | 2 ++ + src/ast/irbuilderbpf.cpp | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 4fa3b673..81b6e0e2 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -19,6 +19,8 @@ and this project adheres to + #### Fixed + - Fix field resolution on structs with anon union as first field + - [#2964](https://github.com/bpftrace/bpftrace/pull/2964) ++- Fix alignment of atomic map counter update ++ - [#3045](https://github.com/bpftrace/bpftrace/pull/3045) + #### Docs + #### Tools + +diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp +index 2ff3c0ce..98c4b0d5 100644 +--- a/src/ast/irbuilderbpf.cpp ++++ b/src/ast/irbuilderbpf.cpp +@@ -1474,7 +1474,7 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name, + CREATE_ATOMIC_RMW(AtomicRMWInst::BinOp::Add, + val, + getInt64(1), +- 1, ++ 8, + AtomicOrdering::SequentiallyConsistent); + CreateBr(lookup_merge_block); + +-- +2.35.5 + diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest index bab3033..63d65e2 100644 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest @@ -4,7 +4,8 @@ # parameter in ptest-runner is necessary to not kill it before completion cd tests || exit 1 -export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin +export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace +export BPFTRACE_AOT_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace-aotrt PASS_CNT=0 FAIL_CNT=0 diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb index bc39afa..355f427 100644 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb @@ -23,6 +23,7 @@ SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ file://0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch \ file://0003-ast-Adjust-to-enum-changes-in-llvm-18.patch \ file://0004-cmake-Bump-max-LLVM-version-to-18.patch \ + file://0001-use-64bit-alignment-for-map-counter-atomic-add.patch \ file://run-ptest \ " SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" -- cgit v1.2.3-54-g00ecf