[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7ciO8EYQ_5GoNzRiR=-HWK6K0ihceL+pA4En1N0bhL3TVA@mail.gmail.com>
Date: Tue, 7 Mar 2023 08:52:57 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: bpf@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Martin KaFai Lau <martin.lau@...nel.org>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf lock contention: Fix builtin detection
On Mon, Mar 6, 2023 at 9:56 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Mon, Mar 6, 2023 at 8:43 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > Hi Ian,
> >
> > On Mon, Mar 6, 2023 at 7:21 PM Ian Rogers <irogers@...gle.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
Powered by blists - more mailing lists