|
| 1 | +From patchwork Fri Aug 2 18:54:34 2024 |
| 2 | +From: Yonghong Song < [email protected]> |
| 3 | +Subject: [PATCH bpf-next] selftests/bpf: Fix a btf_dump selftest failure |
| 4 | + |
| 5 | +Jakub reported bpf selftest "btf_dump" failure after forwarding to |
| 6 | +v6.11-rc1 with netdev. |
| 7 | + Error: #33 btf_dump |
| 8 | + Error: #33/15 btf_dump/btf_dump: var_data |
| 9 | + btf_dump_data:FAIL:find type id unexpected find type id: actual -2 < expected 0 |
| 10 | + |
| 11 | +The reason for the failure is due to |
| 12 | + commit 94ede2a3e913 ("profiling: remove stale percpu flip buffer variables") |
| 13 | +where percpu static variable "cpu_profile_flip" is removed. |
| 14 | + |
| 15 | +Let us replace "cpu_profile_flip" with a variable in bpf subsystem |
| 16 | +so whenever that variable gets deleted or renamed, we can detect the |
| 17 | +failure immediately. In this case, I picked a static percpu variable |
| 18 | +"bpf_cgrp_storage_busy" which is defined in kernel/bpf/bpf_cgrp_storage.c. |
| 19 | + |
| 20 | +Reported-by: Jakub Kicinski < [email protected]> |
| 21 | +Signed-off-by: Yonghong Song < [email protected]> |
| 22 | +--- |
| 23 | + tools/testing/selftests/bpf/prog_tests/btf_dump.c | 4 ++-- |
| 24 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 25 | + |
| 26 | +diff --git a/tools/testing/selftests/bpf/prog_tests/btf_dump.c b/tools/testing/selftests/bpf/prog_tests/btf_dump.c |
| 27 | +index 09a8e6f9b379..b293b8501fd6 100644 |
| 28 | +--- a/tools/testing/selftests/bpf/prog_tests/btf_dump.c |
| 29 | ++++ b/tools/testing/selftests/bpf/prog_tests/btf_dump.c |
| 30 | +@@ -805,8 +805,8 @@ static void test_btf_dump_var_data(struct btf *btf, struct btf_dump *d, |
| 31 | + TEST_BTF_DUMP_VAR(btf, d, NULL, str, "cpu_number", int, BTF_F_COMPACT, |
| 32 | + "int cpu_number = (int)100", 100); |
| 33 | + #endif |
| 34 | +- TEST_BTF_DUMP_VAR(btf, d, NULL, str, "cpu_profile_flip", int, BTF_F_COMPACT, |
| 35 | +- "static int cpu_profile_flip = (int)2", 2); |
| 36 | ++ TEST_BTF_DUMP_VAR(btf, d, NULL, str, "bpf_cgrp_storage_busy", int, BTF_F_COMPACT, |
| 37 | ++ "static int bpf_cgrp_storage_busy = (int)2", 2); |
| 38 | + } |
| 39 | + |
| 40 | + static void test_btf_datasec(struct btf *btf, struct btf_dump *d, char *str, |
0 commit comments