summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWentao Zhang <wentao.zhang@windriver.com>2024-04-09 06:25:06 +0000
committerKhem Raj <raj.khem@gmail.com>2024-04-09 19:34:12 -0700
commitc38281d2c4c5725ab4d3d07de7738b80ad0d8bbc (patch)
treeed29d1bb2bd355ce3e53f8500aa8ad3b647d032f
parent13dcab852c5bcd51fd75ae84ace9eddd99254653 (diff)
downloadmeta-clang-c38281d2c4c5725ab4d3d07de7738b80ad0d8bbc.tar.gz
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: <unknown>:0:0: in function BEGIN i64 (ptr): 0x56056cec80f0: i64 = GlobalAddress<ptr @__atomic_compare_exchange> 0 too many arguments The new patch in the bb file is to solve this problem. Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com>
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch49
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest3
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb1
3 files changed, 52 insertions, 1 deletions
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 @@
1From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001
2From: Frank van der Linden <fvdl@google.com>
3Date: Mon, 11 Mar 2024 15:35:32 +0000
4Subject: [PATCH] use 64bit alignment for map counter atomic add
5
6For an atomic inc of a map counter (ringbuf loss counter), generate
7IR with 64bit alignment. This is more correct, and will avoid problems
8with upcoming LLVM versions, as they will emit a function call for
9a potentially unaligned atomicrmw. This will lead to an error like this:
10
11error: <unknown>:0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress<ptr @__atomic_compare_exchange> 0 too many arguments
12
13Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc]
14
15Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com>
16---
17 CHANGELOG.md | 2 ++
18 src/ast/irbuilderbpf.cpp | 2 +-
19 2 files changed, 3 insertions(+), 1 deletion(-)
20
21diff --git a/CHANGELOG.md b/CHANGELOG.md
22index 4fa3b673..81b6e0e2 100644
23--- a/CHANGELOG.md
24+++ b/CHANGELOG.md
25@@ -19,6 +19,8 @@ and this project adheres to
26 #### Fixed
27 - Fix field resolution on structs with anon union as first field
28 - [#2964](https://github.com/bpftrace/bpftrace/pull/2964)
29+- Fix alignment of atomic map counter update
30+ - [#3045](https://github.com/bpftrace/bpftrace/pull/3045)
31 #### Docs
32 #### Tools
33
34diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
35index 2ff3c0ce..98c4b0d5 100644
36--- a/src/ast/irbuilderbpf.cpp
37+++ b/src/ast/irbuilderbpf.cpp
38@@ -1474,7 +1474,7 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name,
39 CREATE_ATOMIC_RMW(AtomicRMWInst::BinOp::Add,
40 val,
41 getInt64(1),
42- 1,
43+ 8,
44 AtomicOrdering::SequentiallyConsistent);
45 CreateBr(lookup_merge_block);
46
47--
482.35.5
49
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 @@
4# parameter in ptest-runner is necessary to not kill it before completion 4# parameter in ptest-runner is necessary to not kill it before completion
5 5
6cd tests || exit 1 6cd tests || exit 1
7export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin 7export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace
8export BPFTRACE_AOT_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace-aotrt
8 9
9PASS_CNT=0 10PASS_CNT=0
10FAIL_CNT=0 11FAIL_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 \
23 file://0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch \ 23 file://0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch \
24 file://0003-ast-Adjust-to-enum-changes-in-llvm-18.patch \ 24 file://0003-ast-Adjust-to-enum-changes-in-llvm-18.patch \
25 file://0004-cmake-Bump-max-LLVM-version-to-18.patch \ 25 file://0004-cmake-Bump-max-LLVM-version-to-18.patch \
26 file://0001-use-64bit-alignment-for-map-counter-atomic-add.patch \
26 file://run-ptest \ 27 file://run-ptest \
27" 28"
28SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" 29SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723"