From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B41C56201 for ; Wed, 25 Nov 2020 20:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F6552075A for ; Wed, 25 Nov 2020 20:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729040AbgKYUVv (ORCPT ); Wed, 25 Nov 2020 15:21:51 -0500 Received: from mx.der-flo.net ([193.160.39.236]:60856 "EHLO mx.der-flo.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729016AbgKYUVv (ORCPT ); Wed, 25 Nov 2020 15:21:51 -0500 Received: by mx.der-flo.net (Postfix, from userid 110) id CE98D444D0; Wed, 25 Nov 2020 21:21:33 +0100 (CET) Received: from localhost (unknown [IPv6:2a02:1203:ecb0:3930:1751:4157:4d75:a5e2]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.der-flo.net (Postfix) with ESMTPSA id 3A57A439CF; Wed, 25 Nov 2020 21:20:43 +0100 (CET) Date: Wed, 25 Nov 2020 21:20:32 +0100 From: Florian Lehner To: Andrei Matei Cc: bpf@vger.kernel.org, andrii@kernel.org Subject: Re: [PATCH bpf-next] selftest/bpf: fix compilation on clang 11 Message-ID: <20201125202032.GA17524@der-flo.net> References: <20201125035255.17970-1-andreimatei1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201125035255.17970-1-andreimatei1@gmail.com> Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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 Tested-by: Florian Lehner 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 >