diff options
author | Harish Sadineni <Harish.Sadineni@windriver.com> | 2025-07-02 05:36:10 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2025-07-02 09:42:48 -0700 |
commit | 7d0f79dbe7141da74d3c397278515a08bd983113 (patch) | |
tree | 79e2f30bfbef3ac6fc7619675ad2cb2577091792 | |
parent | 7a2f83360920b10214e2659e17a4b9cba2d0435b (diff) | |
download | meta-clang-7d0f79dbe7141da74d3c397278515a08bd983113.tar.gz |
bcc: Backport fix tests to support finish_task_switch.isra.* suffix
When running on kernels compiled with GCC 11.4, the py_test_clang and
py_test_histogram tests fail because the finish_task_switch function
changed to finish_task_switch.isra.0.
Upstream-Status: Backport [https://github.com/iovisor/bcc/pull/5302/commits/b24519e1ba7b87c9676ae3a7f70772215cd5819d]
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
-rw-r--r-- | dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch | 49 | ||||
-rw-r--r-- | dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch new file mode 100644 index 0000000..92a3f7b --- /dev/null +++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | Upstream-Status: Backport [https://github.com/iovisor/bcc/pull/5302/commits/b24519e1ba7b87c9676ae3a7f70772215cd5819d] | ||
2 | Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> | ||
3 | |||
4 | diff --git a/tests/python/test_histogram.py b/tests/python/test_histogram.py | ||
5 | --- a/tests/python/test_histogram.py | ||
6 | +++ b/tests/python/test_histogram.py | ||
7 | @@ -64,7 +64,7 @@ | ||
8 | #include <linux/version.h> | ||
9 | typedef struct { char name[TASK_COMM_LEN]; u64 slot; } Key; | ||
10 | BPF_HISTOGRAM(hist1, Key, 1024); | ||
11 | -int kprobe__finish_task_switch(struct pt_regs *ctx, struct task_struct *prev) { | ||
12 | +int count_prev_task_start_time(struct pt_regs *ctx, struct task_struct *prev) { | ||
13 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0) | ||
14 | Key k = {.slot = bpf_log2l(prev->real_start_time)}; | ||
15 | #else | ||
16 | @@ -77,6 +77,10 @@ | ||
17 | return 0; | ||
18 | } | ||
19 | """) | ||
20 | + b.attach_kprobe( | ||
21 | + event_re=r'^finish_task_switch$|^finish_task_switch\.isra\.\d$', | ||
22 | + fn_name=b"count_prev_task_start_time" | ||
23 | + ) | ||
24 | for i in range(0, 100): time.sleep(0.01) | ||
25 | b[b"hist1"].print_log2_hist() | ||
26 | b.cleanup() | ||
27 | diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py | ||
28 | --- a/tests/python/test_clang.py | ||
29 | +++ b/tests/python/test_clang.py | ||
30 | @@ -399,7 +399,7 @@ | ||
31 | u32 curr_pid; | ||
32 | }; | ||
33 | BPF_HASH(stats, struct key_t, u64, 1024); | ||
34 | -int kprobe__finish_task_switch(struct pt_regs *ctx, struct task_struct *prev) { | ||
35 | +int count_sched(struct pt_regs *ctx, struct task_struct *prev) { | ||
36 | struct key_t key = {}; | ||
37 | u64 zero = 0, *val; | ||
38 | key.curr_pid = bpf_get_current_pid_tgid(); | ||
39 | @@ -412,6 +412,10 @@ | ||
40 | return 0; | ||
41 | } | ||
42 | """) | ||
43 | + b.attach_kprobe( | ||
44 | + event_re=r'^finish_task_switch$|^finish_task_switch\.isra\.\d$', | ||
45 | + fn_name=b"count_sched" | ||
46 | + ) | ||
47 | |||
48 | def test_probe_simple_assign(self): | ||
49 | b = BPF(text=b""" | ||
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb index 69fa9f2..d414f6f 100644 --- a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb +++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb | |||
@@ -25,6 +25,7 @@ SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \ | |||
25 | file://run-ptest \ | 25 | file://run-ptest \ |
26 | file://ptest_wrapper.sh \ | 26 | file://ptest_wrapper.sh \ |
27 | file://bpf_stack_id.patch \ | 27 | file://bpf_stack_id.patch \ |
28 | file://support_finish_task_switch_isra_0.patch \ | ||
28 | " | 29 | " |
29 | 30 | ||
30 | SRCREV = "92e32ff8a06616779f3a3191b75da6881d59fd17" | 31 | SRCREV = "92e32ff8a06616779f3a3191b75da6881d59fd17" |