* [PATCH bpf-next] selftest/bpf: fix compilation on clang 11
@ 2020-11-25 3:52 Andrei Matei
2020-11-25 6:28 ` Yonghong Song
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrei Matei @ 2020-11-25 3:52 UTC (permalink / raw)
To: bpf; +Cc: andrii, Andrei Matei
Before this patch, profiler.inc.h wouldn't compile with clang-11 (before
the __builtin_preserve_enum_value LLVM builtin was introduced in
https://reviews.llvm.org/D83242).
Another test that uses this builtin (test_core_enumval) is conditionally
skipped if the compiler is too old. In that spirit, this patch inhibits
part of populate_cgroup_info(), which needs this CO-RE builtin. The
selftests build again on clang-11. The affected test (the profiler
test) doesn't pass on clang-11 because it's missing
https://reviews.llvm.org/D85570, but at least the test suite as a whole
compiles. The test's expected failure is already called out in the
README.
Signed-off-by: Andrei Matei <andreimatei1@gmail.com>
---
tools/testing/selftests/bpf/progs/profiler.inc.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
index 30982a7e4d0f..b79d7f688655 100644
--- a/tools/testing/selftests/bpf/progs/profiler.inc.h
+++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
@@ -256,6 +256,8 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
BPF_CORE_READ(task, nsproxy, cgroup_ns, root_cset, dfl_cgrp, kn);
struct kernfs_node* proc_kernfs = BPF_CORE_READ(task, cgroups, dfl_cgrp, kn);
+
+#if __has_builtin(__builtin_preserve_enum_value)
if (ENABLE_CGROUP_V1_RESOLVER && CONFIG_CGROUP_PIDS) {
int cgrp_id = bpf_core_enum_value(enum cgroup_subsys_id___local,
pids_cgrp_id___local);
@@ -275,6 +277,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
}
}
}
+#endif
cgroup_data->cgroup_root_inode = get_inode_from_kernfs(root_kernfs);
cgroup_data->cgroup_proc_inode = get_inode_from_kernfs(proc_kernfs);
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftest/bpf: fix compilation on clang 11
2020-11-25 3:52 [PATCH bpf-next] selftest/bpf: fix compilation on clang 11 Andrei Matei
@ 2020-11-25 6:28 ` Yonghong Song
2020-11-25 20:20 ` Florian Lehner
2020-11-25 23:37 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2020-11-25 6:28 UTC (permalink / raw)
To: Andrei Matei, bpf; +Cc: andrii
On 11/24/20 7:52 PM, Andrei Matei wrote:
> Before this patch, profiler.inc.h wouldn't compile with clang-11 (before
> the __builtin_preserve_enum_value LLVM builtin was introduced in
> https://reviews.llvm.org/D83242 ).
> Another test that uses this builtin (test_core_enumval) is conditionally
> skipped if the compiler is too old. In that spirit, this patch inhibits
> part of populate_cgroup_info(), which needs this CO-RE builtin. The
> selftests build again on clang-11. The affected test (the profiler
> test) doesn't pass on clang-11 because it's missing
> https://reviews.llvm.org/D85570 , but at least the test suite as a whole
> compiles. The test's expected failure is already called out in the
> README.
>
> Signed-off-by: Andrei Matei <andreimatei1@gmail.com>
Thanks for the fix! This change won't impact correctness as
profiler.c mostly to test verifier.
Acked-by: Yonghong Song <yhs@fb.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftest/bpf: fix compilation on clang 11
2020-11-25 3:52 [PATCH bpf-next] selftest/bpf: fix compilation on clang 11 Andrei Matei
2020-11-25 6:28 ` Yonghong Song
@ 2020-11-25 20:20 ` Florian Lehner
2020-11-25 23:37 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Florian Lehner @ 2020-11-25 20:20 UTC (permalink / raw)
To: Andrei Matei; +Cc: bpf, andrii
On Tue, Nov 24, 2020 at 10:52:55PM -0500, Andrei Matei wrote:
> Before this patch, profiler.inc.h wouldn't compile with clang-11 (before
> the __builtin_preserve_enum_value LLVM builtin was introduced in
> https://reviews.llvm.org/D83242).
> Another test that uses this builtin (test_core_enumval) is conditionally
> skipped if the compiler is too old. In that spirit, this patch inhibits
> part of populate_cgroup_info(), which needs this CO-RE builtin. The
> selftests build again on clang-11. The affected test (the profiler
> test) doesn't pass on clang-11 because it's missing
> https://reviews.llvm.org/D85570, but at least the test suite as a whole
> compiles. The test's expected failure is already called out in the
> README.
>
> Signed-off-by: Andrei Matei <andreimatei1@gmail.com>
Tested-by: Florian Lehner <dev@der-flo.net>
Thanks for the fix!
> ---
> tools/testing/selftests/bpf/progs/profiler.inc.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
> index 30982a7e4d0f..b79d7f688655 100644
> --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> @@ -256,6 +256,8 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> BPF_CORE_READ(task, nsproxy, cgroup_ns, root_cset, dfl_cgrp, kn);
> struct kernfs_node* proc_kernfs = BPF_CORE_READ(task, cgroups, dfl_cgrp, kn);
>
> +
> +#if __has_builtin(__builtin_preserve_enum_value)
> if (ENABLE_CGROUP_V1_RESOLVER && CONFIG_CGROUP_PIDS) {
> int cgrp_id = bpf_core_enum_value(enum cgroup_subsys_id___local,
> pids_cgrp_id___local);
> @@ -275,6 +277,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> }
> }
> }
> +#endif
>
> cgroup_data->cgroup_root_inode = get_inode_from_kernfs(root_kernfs);
> cgroup_data->cgroup_proc_inode = get_inode_from_kernfs(proc_kernfs);
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] selftest/bpf: fix compilation on clang 11
2020-11-25 3:52 [PATCH bpf-next] selftest/bpf: fix compilation on clang 11 Andrei Matei
2020-11-25 6:28 ` Yonghong Song
2020-11-25 20:20 ` Florian Lehner
@ 2020-11-25 23:37 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2020-11-25 23:37 UTC (permalink / raw)
To: Andrei Matei, bpf; +Cc: andrii
On 11/25/20 4:52 AM, Andrei Matei wrote:
> Before this patch, profiler.inc.h wouldn't compile with clang-11 (before
> the __builtin_preserve_enum_value LLVM builtin was introduced in
> https://reviews.llvm.org/D83242).
> Another test that uses this builtin (test_core_enumval) is conditionally
> skipped if the compiler is too old. In that spirit, this patch inhibits
> part of populate_cgroup_info(), which needs this CO-RE builtin. The
> selftests build again on clang-11. The affected test (the profiler
> test) doesn't pass on clang-11 because it's missing
> https://reviews.llvm.org/D85570, but at least the test suite as a whole
> compiles. The test's expected failure is already called out in the
> README.
>
> Signed-off-by: Andrei Matei <andreimatei1@gmail.com>
Looks good, applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-25 23:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-25 3:52 [PATCH bpf-next] selftest/bpf: fix compilation on clang 11 Andrei Matei
2020-11-25 6:28 ` Yonghong Song
2020-11-25 20:20 ` Florian Lehner
2020-11-25 23:37 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox