2020-11-04 19:32:31

by Nick Desaulniers

[permalink] [raw]
Subject: [PATCH] compiler-clang: remove version check for BPF Tracing

bpftrace parses the kernel headers and uses Clang under the hood. Remove
the version check when __BPF_TRACING__ is defined (as bpftrace does) so
that this tool can continue to parse kernel headers, even with older
clang sources.

Cc: <[email protected]>
Fixes: commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1")
Reported-by: Chen Yu <[email protected]>
Reported-by: Jarkko Sakkinen <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
include/linux/compiler-clang.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index dd7233c48bf3..98cff1b4b088 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -8,8 +8,10 @@
+ __clang_patchlevel__)

#if CLANG_VERSION < 100001
+#ifndef __BPF_TRACING__
# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
#endif
+#endif

/* Compiler specific definitions for Clang compiler */

--
2.29.1.341.ge80a0c044ae-goog


2020-11-04 21:05:32

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Wed, Nov 04, 2020 at 11:10:51AM -0800, Nick Desaulniers wrote:
> bpftrace parses the kernel headers and uses Clang under the hood. Remove
> the version check when __BPF_TRACING__ is defined (as bpftrace does) so
> that this tool can continue to parse kernel headers, even with older
> clang sources.
>
> Cc: <[email protected]>
> Fixes: commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1")
> Reported-by: Chen Yu <[email protected]>
> Reported-by: Jarkko Sakkinen <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
> ---

Thank you, resolved my issue.

Acked-by: Jarkko Sakkinen <[email protected]>
Tested-by: Jarkko Sakkinen <[email protected]>

> include/linux/compiler-clang.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index dd7233c48bf3..98cff1b4b088 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -8,8 +8,10 @@
> + __clang_patchlevel__)
>
> #if CLANG_VERSION < 100001
> +#ifndef __BPF_TRACING__
> # error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
> #endif
> +#endif
>
> /* Compiler specific definitions for Clang compiler */
>
> --
> 2.29.1.341.ge80a0c044ae-goog
>
>

/Jarkko

2020-11-05 03:50:53

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing



> On Nov 4, 2020, at 12:33 PM, Jarkko Sakkinen <[email protected]> wrote:
>
> On Wed, Nov 04, 2020 at 11:10:51AM -0800, Nick Desaulniers wrote:
>> bpftrace parses the kernel headers and uses Clang under the hood. Remove
>> the version check when __BPF_TRACING__ is defined (as bpftrace does) so
>> that this tool can continue to parse kernel headers, even with older
>> clang sources.
>>
>> Cc: <[email protected]>
>> Fixes: commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1")
>> Reported-by: Chen Yu <[email protected]>
>> Reported-by: Jarkko Sakkinen <[email protected]>
>> Signed-off-by: Nick Desaulniers <[email protected]>
>> ---
>
> Thank you, resolved my issue.
>
> Acked-by: Jarkko Sakkinen <[email protected]>
> Tested-by: Jarkko Sakkinen <[email protected]>

Acked-by: Song Liu <[email protected]>

2020-11-05 03:59:58

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Wed, 4 Nov 2020 11:10:51 -0800 Nick Desaulniers <[email protected]> wrote:

> bpftrace parses the kernel headers and uses Clang under the hood. Remove
> the version check when __BPF_TRACING__ is defined (as bpftrace does) so
> that this tool can continue to parse kernel headers, even with older
> clang sources.
>
> Cc: <[email protected]>
> Fixes: commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1")

1f7a44f63e6c is only in 5.10-rcX, so I shall remove the cc:stable.

2020-11-05 04:00:26

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Wed, Nov 04, 2020 at 11:10:51AM -0800, Nick Desaulniers wrote:
> bpftrace parses the kernel headers and uses Clang under the hood. Remove
> the version check when __BPF_TRACING__ is defined (as bpftrace does) so
> that this tool can continue to parse kernel headers, even with older
> clang sources.
>
> Cc: <[email protected]>
> Fixes: commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1")
> Reported-by: Chen Yu <[email protected]>
> Reported-by: Jarkko Sakkinen <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>

Acked-by: Nathan Chancellor <[email protected]>

> ---
> include/linux/compiler-clang.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index dd7233c48bf3..98cff1b4b088 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -8,8 +8,10 @@
> + __clang_patchlevel__)
>
> #if CLANG_VERSION < 100001
> +#ifndef __BPF_TRACING__
> # error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
> #endif
> +#endif
>
> /* Compiler specific definitions for Clang compiler */
>
> --
> 2.29.1.341.ge80a0c044ae-goog
>

2020-11-05 06:35:47

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Wed, Nov 4, 2020 at 8:11 PM Nick Desaulniers <[email protected]> wrote:
>
> bpftrace parses the kernel headers and uses Clang under the hood. Remove
> the version check when __BPF_TRACING__ is defined (as bpftrace does) so
> that this tool can continue to parse kernel headers, even with older
> clang sources.

Acked-by: Miguel Ojeda <[email protected]>

Cheers,
Miguel

2020-11-06 04:19:33

by Alexei Starovoitov

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Wed, Nov 4, 2020 at 11:11 AM Nick Desaulniers
<[email protected]> wrote:
>
> bpftrace parses the kernel headers and uses Clang under the hood. Remove
> the version check when __BPF_TRACING__ is defined (as bpftrace does) so
> that this tool can continue to parse kernel headers, even with older
> clang sources.
>
> Cc: <[email protected]>
> Fixes: commit 1f7a44f63e6c ("compiler-clang: add build check for clang 10.0.1")
> Reported-by: Chen Yu <[email protected]>
> Reported-by: Jarkko Sakkinen <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
> ---
> include/linux/compiler-clang.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index dd7233c48bf3..98cff1b4b088 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -8,8 +8,10 @@
> + __clang_patchlevel__)
>
> #if CLANG_VERSION < 100001
> +#ifndef __BPF_TRACING__
> # error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
> #endif
> +#endif

I can take it through the bpf tree if no one objects.

2020-11-06 18:57:01

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Thu, Nov 5, 2020 at 8:16 PM Alexei Starovoitov
<[email protected]> wrote:
>
> I can take it through the bpf tree if no one objects.

Doesn't matter to me. You'll need to coordinate with Andrew though,
since I got the email that this was picked up into -mm:

>> This patch should soon appear at
>> https://ozlabs.org/~akpm/mmots/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch
>> and later at
>> https://ozlabs.org/~akpm/mmotm/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch
--
Thanks,
~Nick Desaulniers

2020-11-06 22:36:41

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] compiler-clang: remove version check for BPF Tracing

On Fri, Nov 06, 2020 at 10:52:50AM -0800, Nick Desaulniers wrote:
> On Thu, Nov 5, 2020 at 8:16 PM Alexei Starovoitov
> <[email protected]> wrote:
> >
> > I can take it through the bpf tree if no one objects.
>
> Doesn't matter to me. You'll need to coordinate with Andrew though,
> since I got the email that this was picked up into -mm:
>
> >> This patch should soon appear at
> >> https://ozlabs.org/~akpm/mmots/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch
> >> and later at
> >> https://ozlabs.org/~akpm/mmotm/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch

Thanks a lot for quick response to everyone :-) This ebpf tracing has
been a great help lately with the SGX patch set. Hope I get chance to
contribute to this work at some point in future.

> --
> Thanks,
> ~Nick Desaulniers

/Jarkko