Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-17 Thread Andrew Morton
On Tue, 17 Nov 2020 19:31:18 -0700 Nathan Chancellor  
wrote:

> On Tue, Nov 17, 2020 at 10:46:29AM -0800, Nick Desaulniers wrote:
> > On Mon, Nov 16, 2020 at 7:04 PM John Hubbard  wrote:
> > >
> > > Hi,
> > >
> > > I just ran into this and it's a real pain to figure out, because even
> > > with the very latest Fedora 33 on my test machine, which provides clang
> > > version 11.0.0:
> > 
> > Hi John,
> > Thanks for the report.  The patch was picked up by AKPM and is in the -mm 
> > tree:
> > https://ozlabs.org/~akpm/mmots/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch
> 
> This should probably go to Linus as a regression fix in the next wave,
> if that is possible.

Yes, I'll sent it along later this week.


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-17 Thread Nathan Chancellor
On Tue, Nov 17, 2020 at 10:46:29AM -0800, Nick Desaulniers wrote:
> On Mon, Nov 16, 2020 at 7:04 PM John Hubbard  wrote:
> >
> > Hi,
> >
> > I just ran into this and it's a real pain to figure out, because even
> > with the very latest Fedora 33 on my test machine, which provides clang
> > version 11.0.0:
> 
> Hi John,
> Thanks for the report.  The patch was picked up by AKPM and is in the -mm 
> tree:
> https://ozlabs.org/~akpm/mmots/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch

This should probably go to Linus as a regression fix in the next wave,
if that is possible.

Cheers,
Nathan


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-17 Thread Nick Desaulniers
On Mon, Nov 16, 2020 at 7:04 PM John Hubbard  wrote:
>
> Hi,
>
> I just ran into this and it's a real pain to figure out, because even
> with the very latest Fedora 33 on my test machine, which provides clang
> version 11.0.0:

Hi John,
Thanks for the report.  The patch was picked up by AKPM and is in the -mm tree:
https://ozlabs.org/~akpm/mmots/broken-out/compiler-clang-remove-version-check-for-bpf-tracing.patch
-- 
Thanks,
~Nick Desaulniers


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-16 Thread John Hubbard
Hi,

I just ran into this and it's a real pain to figure out, because even
with the very latest Fedora 33 on my test machine, which provides clang
version 11.0.0:

$ clang --version
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu

...the bpftrace program still chokes on some, but not all commands, in
ways that invisible to normal debugging. For example:

$ sudo bpftrace -e 'tracepoint:syscalls:sys_enter_vmsplice { @[kstack()]
= count(); }'
/lib/modules/5.10.0-rc4-hubbard-github+/source/include/linux/compiler-clang.h:12:3:
error: Sorry, your version of Clang is too old - please use 10.0.1 or
newer.

But Jarkko's recommended fix works! In other words, applying the diff
below fixes it for me. So I'm replying in order to note that the problem
is real and hoping that the fix is applied soon.


diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index dd7233c48bf3..c2228b957fd7 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -7,9 +7,11 @@
 + __clang_minor__ * 100\
 + __clang_patchlevel__)
 
+#ifndef __BPF_TRACING__
 #if CLANG_VERSION < 11
 # error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
 #endif
+#endif
 
 /* Compiler specific definitions for Clang compiler */
 


thanks,
--
John Hubbard
NVIDIA


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-03 Thread Jarkko Sakkinen
On Wed, Nov 04, 2020 at 03:34:49AM +0200, Jarkko Sakkinen wrote:
> Shouldn't "#ifndef" be before the whole version check? Otherwise,
> LGTM. Please CC me once there is a properly formed patch to try out.

(to my kernel org address).

/Jarkko


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-03 Thread Jarkko Sakkinen
On Tue, Nov 03, 2020 at 05:18:38PM -0800, Nick Desaulniers wrote:
> On Tue, Nov 3, 2020 at 4:38 PM Jarkko Sakkinen  wrote:
> >
> > On Tue, Nov 03, 2020 at 10:48:27AM -0800, Nick Desaulniers wrote:
> > > On Mon, Nov 2, 2020 at 8:55 PM Jarkko Sakkinen  wrote:
> > > >
> > > > On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > > > > +#define CLANG_VERSION (__clang_major__ * 1   \
> > > > > +  + __clang_minor__ * 100\
> > > > > +  + __clang_patchlevel__)
> > > > > +
> > > > > +#if CLANG_VERSION < 11
> > > > > +# error Sorry, your version of Clang is too old - please use 10.0.1 
> > > > > or newer.
> > > > > +#endif
> > > >
> > > >
> > > > I'm trying to compile a BPF enabled test kernel for a live system and I
> > > > get this error even though I have much newer clang:
> > > >
> > > > ➜  ~ (master) ✔ clang --version
> > > > Ubuntu clang version 11.0.0-2
> > > > Target: x86_64-pc-linux-gnu
> > > > Thread model: posix
> > > > InstalledDir: /usr/bin
> > > >
> > > > Tried to Google for troubleshooter tips but this patch is basically the
> > > > only hit I get :-)
> > >
> > > To check the values of the above preprocessor defines, please run:
> > > $ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
> > >
> > > If you have multiple versions of clang installed, you might not be
> > > running the version you think you are.  Particularly, if you're using
> > > bcc, idk if it includes a copy of clang?  If that's the case, we may
> > > have to work out how we can support older versions of clang for the
> > > express purposes of bpf.
> >
> > ➜  ~ (master) ✔ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
> > #define __clang_major__ 11
> > #define __clang_minor__ 0
> > #define __clang_patchlevel__ 0
> >
> > I'm compiling the kernel itself with GCC.
> >
> > Here's an example BPF script that fails on me:
> >
> > struct sgx_enclave_add_pages {
> > unsigned long src;
> > unsigned long offset;
> > unsigned long length;
> > unsigned long secinfo;
> > unsigned long flags;
> > unsigned long count;
> > };
> >
> > kprobe:sgx_ioctl
> > {
> > if (arg1 == 0xc030a401) {
> > printf("sgx_ioctl: %d, %lu\n", pid, ((struct 
> > sgx_enclave_add_pages *)(arg2))->offset);
> > }
> >
> > }
> > Note that it relies on code not yet in the mainline.
> >
> > If I don't declare structs, things work just fine. E.g. the following
> > works:
> >
> > kprobe:sgx_encl_get_backing
> > {
> > printf("%s\n", func)
> > }
> >
> > BTW, I don't really understand how scripts/clang-version.sh is even
> > supposed to work, if you compile the kernel itself with GCC. In that
> > case there would be no output, right? And thus version gets set to
> > zero...
> 
> That script is only used by KBUILD.  include/linux/compiler-clang.h is
> what's included into include/linux/compiler_types.h and causes the
> error.  The eBFP tools must be including kernel headers and defining
> `__clang__`.  Forgive my complete ignorance of eBPF, but how do you
> build that script?  I assume the tool is using Clang, since eBPF

Thanks a lot for helping with this :-)

I'm using bpftrace as the frontend.

> relies on the LLVM backend (not sure if the GCC eBPF backend is good
> to go quite yet), and that version of clang is older.
> 
> I wonder if we should guard the version check with __BPF_TRACING__
> similar to arch/x86/include/asm/cpufeature.h? Care to test:


Before I received this response, I did git revert for this commit
and things started working again.

> ```
> 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 < 11
> +#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 */
> ```
> -- 

Shouldn't "#ifndef" be before the whole version check? Otherwise,
LGTM. Please CC me once there is a properly formed patch to try out.

> Thanks,
> ~Nick Desaulniers

/Jarkko


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-03 Thread Nick Desaulniers
On Tue, Nov 3, 2020 at 4:38 PM Jarkko Sakkinen  wrote:
>
> On Tue, Nov 03, 2020 at 10:48:27AM -0800, Nick Desaulniers wrote:
> > On Mon, Nov 2, 2020 at 8:55 PM Jarkko Sakkinen  wrote:
> > >
> > > On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > > > +#define CLANG_VERSION (__clang_major__ * 1   \
> > > > +  + __clang_minor__ * 100\
> > > > +  + __clang_patchlevel__)
> > > > +
> > > > +#if CLANG_VERSION < 11
> > > > +# error Sorry, your version of Clang is too old - please use 10.0.1 or 
> > > > newer.
> > > > +#endif
> > >
> > >
> > > I'm trying to compile a BPF enabled test kernel for a live system and I
> > > get this error even though I have much newer clang:
> > >
> > > ➜  ~ (master) ✔ clang --version
> > > Ubuntu clang version 11.0.0-2
> > > Target: x86_64-pc-linux-gnu
> > > Thread model: posix
> > > InstalledDir: /usr/bin
> > >
> > > Tried to Google for troubleshooter tips but this patch is basically the
> > > only hit I get :-)
> >
> > To check the values of the above preprocessor defines, please run:
> > $ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
> >
> > If you have multiple versions of clang installed, you might not be
> > running the version you think you are.  Particularly, if you're using
> > bcc, idk if it includes a copy of clang?  If that's the case, we may
> > have to work out how we can support older versions of clang for the
> > express purposes of bpf.
>
> ➜  ~ (master) ✔ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
> #define __clang_major__ 11
> #define __clang_minor__ 0
> #define __clang_patchlevel__ 0
>
> I'm compiling the kernel itself with GCC.
>
> Here's an example BPF script that fails on me:
>
> struct sgx_enclave_add_pages {
> unsigned long src;
> unsigned long offset;
> unsigned long length;
> unsigned long secinfo;
> unsigned long flags;
> unsigned long count;
> };
>
> kprobe:sgx_ioctl
> {
> if (arg1 == 0xc030a401) {
> printf("sgx_ioctl: %d, %lu\n", pid, ((struct 
> sgx_enclave_add_pages *)(arg2))->offset);
> }
>
> }
> Note that it relies on code not yet in the mainline.
>
> If I don't declare structs, things work just fine. E.g. the following
> works:
>
> kprobe:sgx_encl_get_backing
> {
> printf("%s\n", func)
> }
>
> BTW, I don't really understand how scripts/clang-version.sh is even
> supposed to work, if you compile the kernel itself with GCC. In that
> case there would be no output, right? And thus version gets set to
> zero...

That script is only used by KBUILD.  include/linux/compiler-clang.h is
what's included into include/linux/compiler_types.h and causes the
error.  The eBFP tools must be including kernel headers and defining
`__clang__`.  Forgive my complete ignorance of eBPF, but how do you
build that script?  I assume the tool is using Clang, since eBPF
relies on the LLVM backend (not sure if the GCC eBPF backend is good
to go quite yet), and that version of clang is older.

I wonder if we should guard the version check with __BPF_TRACING__
similar to arch/x86/include/asm/cpufeature.h? Care to test:
```
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 < 11
+#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 */
```
-- 
Thanks,
~Nick Desaulniers


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-03 Thread Jarkko Sakkinen
On Tue, Nov 03, 2020 at 10:48:27AM -0800, Nick Desaulniers wrote:
> On Mon, Nov 2, 2020 at 8:55 PM Jarkko Sakkinen  wrote:
> >
> > On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > > +#define CLANG_VERSION (__clang_major__ * 1   \
> > > +  + __clang_minor__ * 100\
> > > +  + __clang_patchlevel__)
> > > +
> > > +#if CLANG_VERSION < 11
> > > +# error Sorry, your version of Clang is too old - please use 10.0.1 or 
> > > newer.
> > > +#endif
> >
> >
> > I'm trying to compile a BPF enabled test kernel for a live system and I
> > get this error even though I have much newer clang:
> >
> > ➜  ~ (master) ✔ clang --version
> > Ubuntu clang version 11.0.0-2
> > Target: x86_64-pc-linux-gnu
> > Thread model: posix
> > InstalledDir: /usr/bin
> >
> > Tried to Google for troubleshooter tips but this patch is basically the
> > only hit I get :-)
> 
> To check the values of the above preprocessor defines, please run:
> $ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
> 
> If you have multiple versions of clang installed, you might not be
> running the version you think you are.  Particularly, if you're using
> bcc, idk if it includes a copy of clang?  If that's the case, we may
> have to work out how we can support older versions of clang for the
> express purposes of bpf.

➜  ~ (master) ✔ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p
#define __clang_major__ 11
#define __clang_minor__ 0
#define __clang_patchlevel__ 0

I'm compiling the kernel itself with GCC.

Here's an example BPF script that fails on me:

struct sgx_enclave_add_pages {
unsigned long src;
unsigned long offset;
unsigned long length;
unsigned long secinfo;
unsigned long flags;
unsigned long count;
};

kprobe:sgx_ioctl
{
if (arg1 == 0xc030a401) {
printf("sgx_ioctl: %d, %lu\n", pid, ((struct 
sgx_enclave_add_pages *)(arg2))->offset);
}

}
Note that it relies on code not yet in the mainline.

If I don't declare structs, things work just fine. E.g. the following
works:

kprobe:sgx_encl_get_backing
{
printf("%s\n", func)
}

BTW, I don't really understand how scripts/clang-version.sh is even
supposed to work, if you compile the kernel itself with GCC. In that
case there would be no output, right? And thus version gets set to
zero...

> -- 
> Thanks,
> ~Nick Desaulniers

/Jarkko


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-03 Thread Nick Desaulniers
On Mon, Nov 2, 2020 at 8:55 PM Jarkko Sakkinen  wrote:
>
> On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > +#define CLANG_VERSION (__clang_major__ * 1   \
> > +  + __clang_minor__ * 100\
> > +  + __clang_patchlevel__)
> > +
> > +#if CLANG_VERSION < 11
> > +# error Sorry, your version of Clang is too old - please use 10.0.1 or 
> > newer.
> > +#endif
>
>
> I'm trying to compile a BPF enabled test kernel for a live system and I
> get this error even though I have much newer clang:
>
> ➜  ~ (master) ✔ clang --version
> Ubuntu clang version 11.0.0-2
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
>
> Tried to Google for troubleshooter tips but this patch is basically the
> only hit I get :-)

To check the values of the above preprocessor defines, please run:
$ clang -dM -E - < /dev/null | grep -e __clang_m -e __clang_p

If you have multiple versions of clang installed, you might not be
running the version you think you are.  Particularly, if you're using
bcc, idk if it includes a copy of clang?  If that's the case, we may
have to work out how we can support older versions of clang for the
express purposes of bpf.
-- 
Thanks,
~Nick Desaulniers


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-03 Thread Jarkko Sakkinen
On Mon, Nov 02, 2020 at 11:38:14PM -0700, Nathan Chancellor wrote:
> On Tue, Nov 03, 2020 at 06:55:21AM +0200, Jarkko Sakkinen wrote:
> > On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > > During Plumbers 2020, we voted to just support the latest release of
> > > Clang for now.  Add a compile time check for this.
> > > 
> > > We plan to remove workarounds for older versions now, which will break
> > > in subtle and not so subtle ways.
> > > 
> > > Suggested-by: Sedat Dilek 
> > > Suggested-by: Nathan Chancellor 
> > > Suggested-by: Kees Cook 
> > > Signed-off-by: Nick Desaulniers 
> > > Tested-by: Sedat Dilek 
> > > Reviewed-by: Kees Cook 
> > > Reviewed-by: Miguel Ojeda 
> > > Reviewed-by: Sedat Dilek 
> > > Acked-by: Marco Elver 
> > > Acked-by: Nathan Chancellor 
> > > Acked-by: Sedat Dilek 
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/9
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/941
> > > ---
> > >  include/linux/compiler-clang.h | 8 
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/include/linux/compiler-clang.h 
> > > b/include/linux/compiler-clang.h
> > > index cee0c728d39a..230604e7f057 100644
> > > --- a/include/linux/compiler-clang.h
> > > +++ b/include/linux/compiler-clang.h
> > > @@ -3,6 +3,14 @@
> > >  #error "Please don't include  directly, include 
> > >  instead."
> > >  #endif
> > >  
> > > +#define CLANG_VERSION (__clang_major__ * 1   \
> > > +  + __clang_minor__ * 100\
> > > +  + __clang_patchlevel__)
> > > +
> > > +#if CLANG_VERSION < 11
> > > +# error Sorry, your version of Clang is too old - please use 10.0.1 or 
> > > newer.
> > > +#endif
> > 
> > 
> > I'm trying to compile a BPF enabled test kernel for a live system and I
> > get this error even though I have much newer clang:
> > 
> > ➜  ~ (master) ✔ clang --version  
> > Ubuntu clang version 11.0.0-2
> > Target: x86_64-pc-linux-gnu
> > Thread model: posix
> > InstalledDir: /usr/bin
> > 
> > Tried to Google for troubleshooter tips but this patch is basically the
> > only hit I get :-)
> 
> Do you have a .config and command to reproduce the error?

Attached.

> Cheers,
> Nathan

/Jarkko
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.10.0-rc1 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=100200
CONFIG_LD_VERSION=23501
CONFIG_CLANG_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
CONFIG_CC_HAS_ASM_GOTO=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_HAVE_KERNEL_ZSTD=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_ZSTD is not set
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
# CONFIG_WATCH_QUEUE is not set
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_USELIB=y
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
CONFIG_IRQ_MSI_IOMMU=y
CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y
CONFIG_GENERIC_IRQ_RESERVATION_MODE=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
# CONFIG_GENERIC_IRQ_DEBUGFS is not set
# end of IRQ subsystem

CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_INIT=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y
CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
# end of Timers subsystem

# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_COUNT=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y

Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-02 Thread Nathan Chancellor
On Tue, Nov 03, 2020 at 06:55:21AM +0200, Jarkko Sakkinen wrote:
> On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> > During Plumbers 2020, we voted to just support the latest release of
> > Clang for now.  Add a compile time check for this.
> > 
> > We plan to remove workarounds for older versions now, which will break
> > in subtle and not so subtle ways.
> > 
> > Suggested-by: Sedat Dilek 
> > Suggested-by: Nathan Chancellor 
> > Suggested-by: Kees Cook 
> > Signed-off-by: Nick Desaulniers 
> > Tested-by: Sedat Dilek 
> > Reviewed-by: Kees Cook 
> > Reviewed-by: Miguel Ojeda 
> > Reviewed-by: Sedat Dilek 
> > Acked-by: Marco Elver 
> > Acked-by: Nathan Chancellor 
> > Acked-by: Sedat Dilek 
> > Link: https://github.com/ClangBuiltLinux/linux/issues/9
> > Link: https://github.com/ClangBuiltLinux/linux/issues/941
> > ---
> >  include/linux/compiler-clang.h | 8 
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> > index cee0c728d39a..230604e7f057 100644
> > --- a/include/linux/compiler-clang.h
> > +++ b/include/linux/compiler-clang.h
> > @@ -3,6 +3,14 @@
> >  #error "Please don't include  directly, include 
> >  instead."
> >  #endif
> >  
> > +#define CLANG_VERSION (__clang_major__ * 1 \
> > ++ __clang_minor__ * 100\
> > ++ __clang_patchlevel__)
> > +
> > +#if CLANG_VERSION < 11
> > +# error Sorry, your version of Clang is too old - please use 10.0.1 or 
> > newer.
> > +#endif
> 
> 
> I'm trying to compile a BPF enabled test kernel for a live system and I
> get this error even though I have much newer clang:
> 
> ➜  ~ (master) ✔ clang --version  
> Ubuntu clang version 11.0.0-2
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
> 
> Tried to Google for troubleshooter tips but this patch is basically the
> only hit I get :-)

Do you have a .config and command to reproduce the error?

Cheers,
Nathan


Re: [PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-11-02 Thread Jarkko Sakkinen
On Wed, Sep 02, 2020 at 03:59:05PM -0700, Nick Desaulniers wrote:
> During Plumbers 2020, we voted to just support the latest release of
> Clang for now.  Add a compile time check for this.
> 
> We plan to remove workarounds for older versions now, which will break
> in subtle and not so subtle ways.
> 
> Suggested-by: Sedat Dilek 
> Suggested-by: Nathan Chancellor 
> Suggested-by: Kees Cook 
> Signed-off-by: Nick Desaulniers 
> Tested-by: Sedat Dilek 
> Reviewed-by: Kees Cook 
> Reviewed-by: Miguel Ojeda 
> Reviewed-by: Sedat Dilek 
> Acked-by: Marco Elver 
> Acked-by: Nathan Chancellor 
> Acked-by: Sedat Dilek 
> Link: https://github.com/ClangBuiltLinux/linux/issues/9
> Link: https://github.com/ClangBuiltLinux/linux/issues/941
> ---
>  include/linux/compiler-clang.h | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index cee0c728d39a..230604e7f057 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -3,6 +3,14 @@
>  #error "Please don't include  directly, include 
>  instead."
>  #endif
>  
> +#define CLANG_VERSION (__clang_major__ * 1   \
> +  + __clang_minor__ * 100\
> +  + __clang_patchlevel__)
> +
> +#if CLANG_VERSION < 11
> +# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
> +#endif


I'm trying to compile a BPF enabled test kernel for a live system and I
get this error even though I have much newer clang:

➜  ~ (master) ✔ clang --version  
Ubuntu clang version 11.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Tried to Google for troubleshooter tips but this patch is basically the
only hit I get :-)


> +
>  /* Compiler specific definitions for Clang compiler */
>  
>  /* same as gcc, this was present in clang-2.6 so we can assume it works
> -- 
> 2.28.0.402.g5ffc5be6b7-goog
> 

/Jarkko


[PATCH v3 1/7] compiler-clang: add build check for clang 10.0.1

2020-09-02 Thread Nick Desaulniers
During Plumbers 2020, we voted to just support the latest release of
Clang for now.  Add a compile time check for this.

We plan to remove workarounds for older versions now, which will break
in subtle and not so subtle ways.

Suggested-by: Sedat Dilek 
Suggested-by: Nathan Chancellor 
Suggested-by: Kees Cook 
Signed-off-by: Nick Desaulniers 
Tested-by: Sedat Dilek 
Reviewed-by: Kees Cook 
Reviewed-by: Miguel Ojeda 
Reviewed-by: Sedat Dilek 
Acked-by: Marco Elver 
Acked-by: Nathan Chancellor 
Acked-by: Sedat Dilek 
Link: https://github.com/ClangBuiltLinux/linux/issues/9
Link: https://github.com/ClangBuiltLinux/linux/issues/941
---
 include/linux/compiler-clang.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index cee0c728d39a..230604e7f057 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -3,6 +3,14 @@
 #error "Please don't include  directly, include 
 instead."
 #endif
 
+#define CLANG_VERSION (__clang_major__ * 1 \
++ __clang_minor__ * 100\
++ __clang_patchlevel__)
+
+#if CLANG_VERSION < 11
+# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
+#endif
+
 /* Compiler specific definitions for Clang compiler */
 
 /* same as gcc, this was present in clang-2.6 so we can assume it works
-- 
2.28.0.402.g5ffc5be6b7-goog