-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpftrace: fix the runtime ptest errors
bpftrace/bpftrace#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>
- Loading branch information
1 parent
13dcab8
commit c38281d
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...ipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001 | ||
From: Frank van der Linden <fvdl@google.com> | ||
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: <unknown>:0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress<ptr @__atomic_compare_exchange> 0 too many arguments | ||
|
||
Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc] | ||
|
||
Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com> | ||
--- | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters