lkml.org 
[lkml]   [2023]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] perf lock contention: Fix builtin detection
On Mon, Mar 6, 2023 at 9:56 PM Ian Rogers <irogers@google.com> wrote:
>
> On Mon, Mar 6, 2023 at 8:43 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Hi Ian,
> >
> > On Mon, Mar 6, 2023 at 7:21 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > __has_builtin was passed the macro rather than the actual builtin
> > > feature.
> >
> > Oh, I missed it's a macro define in tools/lib/bpf/bpf_core_read.h file.
> >
> > Looking at some BPF test codes, it seems you also need to check the
> > clang compiler version. Please take a look at the file below:
> >
> > tools/testing/selftests/bpf/progs/test_core_reloc_type_base.c
> >
> > Thanks,
> > Namhyung
>
> Hmm..
>
> tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c:
> ...
> /* Support for the BPF_TYPE_MATCHES argument to the
> * __builtin_preserve_type_info builtin was added at some point during
> * development of clang 15 and it's what we require for this test.
> */
> #if __has_builtin(__builtin_preserve_type_info) && __clang_major__ >= 15
> ...
>
> I'm not sure we need to worry about development clang builds and just
> the __has_builtin is cleaner. Perhaps the BPF folks can chime in.

My understanding is that __builtin_preserve_type_info is supported
before. But clang 15 added BPF_TYPE_MATCHES which is used for
bpf_core_type_matches(). So just checking the builtin would not work.

Thanks,
Namhyung

\
 
 \ /
  Last update: 2023-03-27 00:47    [W:0.604 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site