diff options
author | Wentao Zhang <wentao.zhang@windriver.com> | 2024-04-09 06:25:06 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-04-09 19:34:12 -0700 |
commit | c38281d2c4c5725ab4d3d07de7738b80ad0d8bbc (patch) | |
tree | ed29d1bb2bd355ce3e53f8500aa8ad3b647d032f /dynamic-layers/openembedded-layer | |
parent | 13dcab852c5bcd51fd75ae84ace9eddd99254653 (diff) | |
download | meta-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>
Diffstat (limited to 'dynamic-layers/openembedded-layer')
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 @@ | |||
1 | From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Frank van der Linden <fvdl@google.com> | ||
3 | Date: Mon, 11 Mar 2024 15:35:32 +0000 | ||
4 | Subject: [PATCH] use 64bit alignment for map counter atomic add | ||
5 | |||
6 | For an atomic inc of a map counter (ringbuf loss counter), generate | ||
7 | IR with 64bit alignment. This is more correct, and will avoid problems | ||
8 | with upcoming LLVM versions, as they will emit a function call for | ||
9 | a potentially unaligned atomicrmw. This will lead to an error like this: | ||
10 | |||
11 | error: <unknown>:0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress<ptr @__atomic_compare_exchange> 0 too many arguments | ||
12 | |||
13 | Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc] | ||
14 | |||
15 | Signed-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 | |||
21 | diff --git a/CHANGELOG.md b/CHANGELOG.md | ||
22 | index 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 | |||
34 | diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp | ||
35 | index 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 | -- | ||
48 | 2.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 | ||
6 | cd tests || exit 1 | 6 | cd tests || exit 1 |
7 | export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin | 7 | export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace |
8 | export BPFTRACE_AOT_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace-aotrt | ||
8 | 9 | ||
9 | PASS_CNT=0 | 10 | PASS_CNT=0 |
10 | FAIL_CNT=0 | 11 | 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 \ | |||
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 | " |
28 | SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" | 29 | SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" |