Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-30 Thread Wangnan (F)



On 2015/6/30 22:34, Arnaldo Carvalho de Melo wrote:

Em Tue, Jun 30, 2015 at 10:29:08AM +0800, Wangnan (F) escreveu:

On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote:

So, what should I do now? I want to have that OFF line turned to "on",
so that I can test this stuff.
But the changelog says nothing about it, lemme check the cover letter,
but having to do that is annoying, one expects to have instructions
related to some specific changeset in its comments...

So, when such build tests fail, we can see why by looking for a file
with a special name in the O= output dir:
[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
  #include 
^
compilation terminated.
[acme@felicio linux]$
  

This patch tries to check the version of bpf.h, because old bpf.h doesn't
define 'kern_version' field for 'union bpf_attr'.

Ok, I realise it needs to find some bpf.h file, but where should it look
for it? What needs to be installed so that this feature test succeeds?
  

I think the problem you meet is caused by missing of kernel headers in your
host system environment. After patch 'perf tools: Make perf depend on
libbpf'

What is precise path to this bpf.h file? What was the cset that
introduced it and in what upstream branch is it?


The exact bpf.h patch 2/50 trying to find should be 
/usr/include/linux/bpf.h, which

can be found from /tmp/build/perf/feature/test-bpf.d:

/tmp/build/perf/feature/test-bpf.bin: test-bpf.c \
 /usr/include/stdc-predef.h \
 /usr/include/bits/predefs.h \
 /usr/include/linux/bpf.h \
 /usr/include/linux/types.h \
 

After applying 3/50, due to the setting of FEATURE_CHECK_CFLAGS-bpf, it
becomes /path/to/kernel/include/uapi/linux/bpf.h, so it won't fail again:

/tmp/build/bpf/feature/test-bpf.bin: test-bpf.c \
 /usr/include/stdc-predef.h \
 /usr/include/bits/predefs.h \
 /path/to/kernel/include/uapi/linux/bpf.h \
 /path/to/kernel/tools/include/linux/types.h \
 ...


this checking should always success because it adds required headers
into MANIFEST and setup FEATURE_CHECK_CFLAGS-bpf.

Also, after applying 3/50 you should see this:

IIRC I tried yesterday, will try again later and let you know, but
when introducing a feature test, please state what is required to be
installed in a system so that it can succeed, where to obtain it, etc.

It is possible to figure this out, but sometimes doing that takes time
that would be beter invested in processing further patches...

- Arnaldo
  

# make O=/tmp/build/bpf/ -C tools/lib/bpf/
  

Auto-detecting system features:
...libelf: [ on  ]
... libelf-getphdrnum: [ on  ]
...   libelf-mmap: [ on  ]
...   bpf: [ on  ]

make: Entering directory `/home/wn/kernel-hydrogen/tools/lib/bpf'
   CC   /tmp/build/bpf/libbpf.o
   LD   /tmp/build/bpf/libbpf-in.o
   LINK /tmp/build/bpf/libbpf.a
   LINK /tmp/build/bpf/libbpf.so
make: Leaving directory `/home/wn/kernel/tools/lib/bpf'

Even if in perf checking bpf should fail in your machine now, checking bpf
feature in
libbpf should success because when build libbpf I have added following
setting to
tools/lib/bpf/Makefile:

   INCLUDES = -I. -I$(srctree)/tools/include
-I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
   FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)

Do you want me to squash 2/30 and 3/50 together and append 'bpf' checker
into FEATURE_TESTS in
tools/build/Makefile.feature in 23/50? Then there should be less confusion:
when compiling perf
before 23/50, bpf feature will never be checked then.

Thank you.


Right, one of the few things that could explain the failure, but:

[acme@felicio linux]$ find . -name bpf.h
./include/linux/bpf.h
./include/uapi/linux/bpf.h
[acme@felicio linux]$

So lemme try doing it in place:

[acme@felicio linux]$ make -C tools/perf/
make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]


Doesn't work as well :-\

Looking at the following patches...

- Arnaldo



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read 

Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-30 Thread Arnaldo Carvalho de Melo
Em Tue, Jun 30, 2015 at 10:29:08AM +0800, Wangnan (F) escreveu:
> On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote:
> >>So, what should I do now? I want to have that OFF line turned to "on",
> >>so that I can test this stuff.

> >>But the changelog says nothing about it, lemme check the cover letter,
> >>but having to do that is annoying, one expects to have instructions
> >>related to some specific changeset in its comments...
> >So, when such build tests fail, we can see why by looking for a file
> >with a special name in the O= output dir:

> >[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
> >test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
> >  #include 
> >^
> >compilation terminated.
> >[acme@felicio linux]$
 
> This patch tries to check the version of bpf.h, because old bpf.h doesn't
> define 'kern_version' field for 'union bpf_attr'.

Ok, I realise it needs to find some bpf.h file, but where should it look
for it? What needs to be installed so that this feature test succeeds?
 
> I think the problem you meet is caused by missing of kernel headers in your
> host system environment. After patch 'perf tools: Make perf depend on
> libbpf'

What is precise path to this bpf.h file? What was the cset that
introduced it and in what upstream branch is it?

> this checking should always success because it adds required headers
> into MANIFEST and setup FEATURE_CHECK_CFLAGS-bpf.
> 
> Also, after applying 3/50 you should see this:

IIRC I tried yesterday, will try again later and let you know, but
when introducing a feature test, please state what is required to be
installed in a system so that it can succeed, where to obtain it, etc.

It is possible to figure this out, but sometimes doing that takes time
that would be beter invested in processing further patches...

- Arnaldo
 
> # make O=/tmp/build/bpf/ -C tools/lib/bpf/
 
> Auto-detecting system features:
> ...libelf: [ on  ]
> ... libelf-getphdrnum: [ on  ]
> ...   libelf-mmap: [ on  ]
> ...   bpf: [ on  ]
> 
> make: Entering directory `/home/wn/kernel-hydrogen/tools/lib/bpf'
>   CC   /tmp/build/bpf/libbpf.o
>   LD   /tmp/build/bpf/libbpf-in.o
>   LINK /tmp/build/bpf/libbpf.a
>   LINK /tmp/build/bpf/libbpf.so
> make: Leaving directory `/home/wn/kernel/tools/lib/bpf'
> 
> Even if in perf checking bpf should fail in your machine now, checking bpf
> feature in
> libbpf should success because when build libbpf I have added following
> setting to
> tools/lib/bpf/Makefile:
> 
>   INCLUDES = -I. -I$(srctree)/tools/include
> -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
>   FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
> 
> Do you want me to squash 2/30 and 3/50 together and append 'bpf' checker
> into FEATURE_TESTS in
> tools/build/Makefile.feature in 23/50? Then there should be less confusion:
> when compiling perf
> before 23/50, bpf feature will never be checked then.
> 
> Thank you.
> 
> >Right, one of the few things that could explain the failure, but:
> >
> >[acme@felicio linux]$ find . -name bpf.h
> >./include/linux/bpf.h
> >./include/uapi/linux/bpf.h
> >[acme@felicio linux]$
> >
> >So lemme try doing it in place:
> >
> >[acme@felicio linux]$ make -C tools/perf/
> >make: Entering directory `/home/acme/git/linux/tools/perf'
> >   BUILD:   Doing 'make -j4' parallel build
> >
> >Auto-detecting system features:
> >... dwarf: [ on  ]
> >... glibc: [ on  ]
> >...  gtk2: [ on  ]
> >...  libaudit: [ on  ]
> >...libbfd: [ on  ]
> >...libelf: [ on  ]
> >...   libnuma: [ on  ]
> >...   libperl: [ on  ]
> >... libpython: [ on  ]
> >...  libslang: [ on  ]
> >... libunwind: [ on  ]
> >...libdw-dwarf-unwind: [ on  ]
> >...  zlib: [ on  ]
> >...  lzma: [ on  ]
> >...   bpf: [ OFF ]
> >
> >
> >Doesn't work as well :-\
> >
> >Looking at the following patches...
> >
> >- Arnaldo
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-30 Thread Wangnan (F)



On 2015/6/30 22:34, Arnaldo Carvalho de Melo wrote:

Em Tue, Jun 30, 2015 at 10:29:08AM +0800, Wangnan (F) escreveu:

On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote:

So, what should I do now? I want to have that OFF line turned to on,
so that I can test this stuff.
But the changelog says nothing about it, lemme check the cover letter,
but having to do that is annoying, one expects to have instructions
related to some specific changeset in its comments...

So, when such build tests fail, we can see why by looking for a file
with a special name in the O= output dir:
[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
  #include linux/bpf.h
^
compilation terminated.
[acme@felicio linux]$
  

This patch tries to check the version of bpf.h, because old bpf.h doesn't
define 'kern_version' field for 'union bpf_attr'.

Ok, I realise it needs to find some bpf.h file, but where should it look
for it? What needs to be installed so that this feature test succeeds?
  

I think the problem you meet is caused by missing of kernel headers in your
host system environment. After patch 'perf tools: Make perf depend on
libbpf'

What is precise path to this bpf.h file? What was the cset that
introduced it and in what upstream branch is it?


The exact bpf.h patch 2/50 trying to find should be 
/usr/include/linux/bpf.h, which

can be found from /tmp/build/perf/feature/test-bpf.d:

/tmp/build/perf/feature/test-bpf.bin: test-bpf.c \
 /usr/include/stdc-predef.h \
 /usr/include/bits/predefs.h \
 /usr/include/linux/bpf.h \
 /usr/include/linux/types.h \
 

After applying 3/50, due to the setting of FEATURE_CHECK_CFLAGS-bpf, it
becomes /path/to/kernel/include/uapi/linux/bpf.h, so it won't fail again:

/tmp/build/bpf/feature/test-bpf.bin: test-bpf.c \
 /usr/include/stdc-predef.h \
 /usr/include/bits/predefs.h \
 /path/to/kernel/include/uapi/linux/bpf.h \
 /path/to/kernel/tools/include/linux/types.h \
 ...


this checking should always success because it adds required headers
into MANIFEST and setup FEATURE_CHECK_CFLAGS-bpf.

Also, after applying 3/50 you should see this:

IIRC I tried yesterday, will try again later and let you know, but
when introducing a feature test, please state what is required to be
installed in a system so that it can succeed, where to obtain it, etc.

It is possible to figure this out, but sometimes doing that takes time
that would be beter invested in processing further patches...

- Arnaldo
  

# make O=/tmp/build/bpf/ -C tools/lib/bpf/
  

Auto-detecting system features:
...libelf: [ on  ]
... libelf-getphdrnum: [ on  ]
...   libelf-mmap: [ on  ]
...   bpf: [ on  ]

make: Entering directory `/home/wn/kernel-hydrogen/tools/lib/bpf'
   CC   /tmp/build/bpf/libbpf.o
   LD   /tmp/build/bpf/libbpf-in.o
   LINK /tmp/build/bpf/libbpf.a
   LINK /tmp/build/bpf/libbpf.so
make: Leaving directory `/home/wn/kernel/tools/lib/bpf'

Even if in perf checking bpf should fail in your machine now, checking bpf
feature in
libbpf should success because when build libbpf I have added following
setting to
tools/lib/bpf/Makefile:

   INCLUDES = -I. -I$(srctree)/tools/include
-I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
   FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)

Do you want me to squash 2/30 and 3/50 together and append 'bpf' checker
into FEATURE_TESTS in
tools/build/Makefile.feature in 23/50? Then there should be less confusion:
when compiling perf
before 23/50, bpf feature will never be checked then.

Thank you.


Right, one of the few things that could explain the failure, but:

[acme@felicio linux]$ find . -name bpf.h
./include/linux/bpf.h
./include/uapi/linux/bpf.h
[acme@felicio linux]$

So lemme try doing it in place:

[acme@felicio linux]$ make -C tools/perf/
make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]


Doesn't work as well :-\

Looking at the following patches...

- Arnaldo



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-30 Thread Arnaldo Carvalho de Melo
Em Tue, Jun 30, 2015 at 10:29:08AM +0800, Wangnan (F) escreveu:
 On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote:
 So, what should I do now? I want to have that OFF line turned to on,
 so that I can test this stuff.

 But the changelog says nothing about it, lemme check the cover letter,
 but having to do that is annoying, one expects to have instructions
 related to some specific changeset in its comments...
 So, when such build tests fail, we can see why by looking for a file
 with a special name in the O= output dir:

 [acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
 test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
   #include linux/bpf.h
 ^
 compilation terminated.
 [acme@felicio linux]$
 
 This patch tries to check the version of bpf.h, because old bpf.h doesn't
 define 'kern_version' field for 'union bpf_attr'.

Ok, I realise it needs to find some bpf.h file, but where should it look
for it? What needs to be installed so that this feature test succeeds?
 
 I think the problem you meet is caused by missing of kernel headers in your
 host system environment. After patch 'perf tools: Make perf depend on
 libbpf'

What is precise path to this bpf.h file? What was the cset that
introduced it and in what upstream branch is it?

 this checking should always success because it adds required headers
 into MANIFEST and setup FEATURE_CHECK_CFLAGS-bpf.
 
 Also, after applying 3/50 you should see this:

IIRC I tried yesterday, will try again later and let you know, but
when introducing a feature test, please state what is required to be
installed in a system so that it can succeed, where to obtain it, etc.

It is possible to figure this out, but sometimes doing that takes time
that would be beter invested in processing further patches...

- Arnaldo
 
 # make O=/tmp/build/bpf/ -C tools/lib/bpf/
 
 Auto-detecting system features:
 ...libelf: [ on  ]
 ... libelf-getphdrnum: [ on  ]
 ...   libelf-mmap: [ on  ]
 ...   bpf: [ on  ]
 
 make: Entering directory `/home/wn/kernel-hydrogen/tools/lib/bpf'
   CC   /tmp/build/bpf/libbpf.o
   LD   /tmp/build/bpf/libbpf-in.o
   LINK /tmp/build/bpf/libbpf.a
   LINK /tmp/build/bpf/libbpf.so
 make: Leaving directory `/home/wn/kernel/tools/lib/bpf'
 
 Even if in perf checking bpf should fail in your machine now, checking bpf
 feature in
 libbpf should success because when build libbpf I have added following
 setting to
 tools/lib/bpf/Makefile:
 
   INCLUDES = -I. -I$(srctree)/tools/include
 -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
   FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
 
 Do you want me to squash 2/30 and 3/50 together and append 'bpf' checker
 into FEATURE_TESTS in
 tools/build/Makefile.feature in 23/50? Then there should be less confusion:
 when compiling perf
 before 23/50, bpf feature will never be checked then.
 
 Thank you.
 
 Right, one of the few things that could explain the failure, but:
 
 [acme@felicio linux]$ find . -name bpf.h
 ./include/linux/bpf.h
 ./include/uapi/linux/bpf.h
 [acme@felicio linux]$
 
 So lemme try doing it in place:
 
 [acme@felicio linux]$ make -C tools/perf/
 make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD:   Doing 'make -j4' parallel build
 
 Auto-detecting system features:
 ... dwarf: [ on  ]
 ... glibc: [ on  ]
 ...  gtk2: [ on  ]
 ...  libaudit: [ on  ]
 ...libbfd: [ on  ]
 ...libelf: [ on  ]
 ...   libnuma: [ on  ]
 ...   libperl: [ on  ]
 ... libpython: [ on  ]
 ...  libslang: [ on  ]
 ... libunwind: [ on  ]
 ...libdw-dwarf-unwind: [ on  ]
 ...  zlib: [ on  ]
 ...  lzma: [ on  ]
 ...   bpf: [ OFF ]
 
 
 Doesn't work as well :-\
 
 Looking at the following patches...
 
 - Arnaldo
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Wangnan (F)



On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote:

Em Mon, Jun 29, 2015 at 04:21:51PM -0300, Arnaldo Carvalho de Melo escreveu:

Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu:

In this patch, eBPF API is checked by compiling a c source file which
uses fields in bpf_attr which will be used by libbpf.

Signed-off-by: Wang Nan 
Acked-by: Alexei Starovoitov 

So, I just applied this and after trying:

[acme@felicio linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
; make O=/tmp/build/perf -C tools/perf  install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]

   MKDIR/tmp/build/perf/util/
   CC   /tmp/build/perf/util/abspath.o



So, what should I do now? I want to have that OFF line turned to "on",
so that I can test this stuff.

But the changelog says nothing about it, lemme check the cover letter,
but having to do that is annoying, one expects to have instructions
related to some specific changeset in its comments...

So, when such build tests fail, we can see why by looking for a file
with a special name in the O= output dir:

[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
  #include 
^
compilation terminated.
[acme@felicio linux]$


This patch tries to check the version of bpf.h, because old bpf.h doesn't
define 'kern_version' field for 'union bpf_attr'.

I think the problem you meet is caused by missing of kernel headers in your
host system environment. After patch 'perf tools: Make perf depend on 
libbpf'

this checking should always success because it adds required headers
into MANIFEST and setup FEATURE_CHECK_CFLAGS-bpf.

Also, after applying 3/50 you should see this:

# make O=/tmp/build/bpf/ -C tools/lib/bpf/

Auto-detecting system features:
...libelf: [ on  ]
... libelf-getphdrnum: [ on  ]
...   libelf-mmap: [ on  ]
...   bpf: [ on  ]

make: Entering directory `/home/wn/kernel-hydrogen/tools/lib/bpf'
  CC   /tmp/build/bpf/libbpf.o
  LD   /tmp/build/bpf/libbpf-in.o
  LINK /tmp/build/bpf/libbpf.a
  LINK /tmp/build/bpf/libbpf.so
make: Leaving directory `/home/wn/kernel/tools/lib/bpf'

Even if in perf checking bpf should fail in your machine now, checking 
bpf feature in
libbpf should success because when build libbpf I have added following 
setting to

tools/lib/bpf/Makefile:

  INCLUDES = -I. -I$(srctree)/tools/include 
-I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi

  FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)

Do you want me to squash 2/30 and 3/50 together and append 'bpf' checker 
into FEATURE_TESTS in
tools/build/Makefile.feature in 23/50? Then there should be less 
confusion: when compiling perf

before 23/50, bpf feature will never be checked then.

Thank you.


Right, one of the few things that could explain the failure, but:

[acme@felicio linux]$ find . -name bpf.h
./include/linux/bpf.h
./include/uapi/linux/bpf.h
[acme@felicio linux]$

So lemme try doing it in place:

[acme@felicio linux]$ make -C tools/perf/
make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]


Doesn't work as well :-\

Looking at the following patches...

- Arnaldo



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the 

Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Arnaldo Carvalho de Melo
Em Mon, Jun 29, 2015 at 04:21:51PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu:
> > In this patch, eBPF API is checked by compiling a c source file which
> > uses fields in bpf_attr which will be used by libbpf.
> > 
> > Signed-off-by: Wang Nan 
> > Acked-by: Alexei Starovoitov 
> 
> So, I just applied this and after trying:
> 
> [acme@felicio linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
> ; make O=/tmp/build/perf -C tools/perf  install-bin
> make: Entering directory `/home/acme/git/linux/tools/perf'
>   BUILD:   Doing 'make -j4' parallel build
> 
> Auto-detecting system features:
> ... dwarf: [ on  ]
> ... glibc: [ on  ]
> ...  gtk2: [ on  ]
> ...  libaudit: [ on  ]
> ...libbfd: [ on  ]
> ...libelf: [ on  ]
> ...   libnuma: [ on  ]
> ...   libperl: [ on  ]
> ... libpython: [ on  ]
> ...  libslang: [ on  ]
> ... libunwind: [ on  ]
> ...libdw-dwarf-unwind: [ on  ]
> ...  zlib: [ on  ]
> ...  lzma: [ on  ]
> ...   bpf: [ OFF ]
> 
>   MKDIR/tmp/build/perf/util/
>   CC   /tmp/build/perf/util/abspath.o
> 
> 
> 
> So, what should I do now? I want to have that OFF line turned to "on",
> so that I can test this stuff.
> 
> But the changelog says nothing about it, lemme check the cover letter,
> but having to do that is annoying, one expects to have instructions
> related to some specific changeset in its comments...

So, when such build tests fail, we can see why by looking for a file
with a special name in the O= output dir:

[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
 #include 
   ^
compilation terminated.
[acme@felicio linux]$

Right, one of the few things that could explain the failure, but:

[acme@felicio linux]$ find . -name bpf.h
./include/linux/bpf.h
./include/uapi/linux/bpf.h
[acme@felicio linux]$ 

So lemme try doing it in place:

[acme@felicio linux]$ make -C tools/perf/
make: Entering directory `/home/acme/git/linux/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]


Doesn't work as well :-\

Looking at the following patches...

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Arnaldo Carvalho de Melo
Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu:
> In this patch, eBPF API is checked by compiling a c source file which
> uses fields in bpf_attr which will be used by libbpf.
> 
> Signed-off-by: Wang Nan 
> Acked-by: Alexei Starovoitov 

So, I just applied this and after trying:

[acme@felicio linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
; make O=/tmp/build/perf -C tools/perf  install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]

  MKDIR/tmp/build/perf/util/
  CC   /tmp/build/perf/util/abspath.o



So, what should I do now? I want to have that OFF line turned to "on",
so that I can test this stuff.

But the changelog says nothing about it, lemme check the cover letter,
but having to do that is annoying, one expects to have instructions
related to some specific changeset in its comments...

- Arnaldo


> ---
>  tools/build/Makefile.feature   |  6 --
>  tools/build/feature/Makefile   |  6 +-
>  tools/build/feature/test-bpf.c | 18 ++
>  3 files changed, 27 insertions(+), 3 deletions(-)
>  create mode 100644 tools/build/feature/test-bpf.c
> 
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 2975632..5ec6b37 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -51,7 +51,8 @@ FEATURE_TESTS ?=\
>   timerfd \
>   libdw-dwarf-unwind  \
>   zlib\
> - lzma
> + lzma\
> + bpf
>  
>  FEATURE_DISPLAY ?=   \
>   dwarf   \
> @@ -67,7 +68,8 @@ FEATURE_DISPLAY ?=  \
>   libunwind   \
>   libdw-dwarf-unwind  \
>   zlib\
> - lzma
> + lzma\
> + bpf
>  
>  # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
>  # If in the future we need per-feature checks/flags for features not
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 463ed8f..1c0d69f 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -33,7 +33,8 @@ FILES=  \
>   test-compile-32.bin \
>   test-compile-x32.bin\
>   test-zlib.bin   \
> - test-lzma.bin
> + test-lzma.bin   \
> + test-bpf.bin
>  
>  CC := $(CROSS_COMPILE)gcc -MD
>  PKG_CONFIG := $(CROSS_COMPILE)pkg-config
> @@ -156,6 +157,9 @@ test-zlib.bin:
>  test-lzma.bin:
>   $(BUILD) -llzma
>  
> +test-bpf.bin:
> + $(BUILD)
> +
>  -include *.d
>  
>  ###
> diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c
> new file mode 100644
> index 000..062bac8
> --- /dev/null
> +++ b/tools/build/feature/test-bpf.c
> @@ -0,0 +1,18 @@
> +#include 
> +
> +int main(void)
> +{
> + union bpf_attr attr;
> +
> + attr.prog_type = BPF_PROG_TYPE_KPROBE;
> + attr.insn_cnt = 0;
> + attr.insns = 0;
> + attr.license = 0;
> + attr.log_buf = 0;
> + attr.log_size = 0;
> + attr.log_level = 0;
> + attr.kern_version = 0;
> +
> + attr = attr;
> + return 0;
> +}
> -- 
> 1.8.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Wangnan (F)



On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote:

Em Mon, Jun 29, 2015 at 04:21:51PM -0300, Arnaldo Carvalho de Melo escreveu:

Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu:

In this patch, eBPF API is checked by compiling a c source file which
uses fields in bpf_attr which will be used by libbpf.

Signed-off-by: Wang Nan wangn...@huawei.com
Acked-by: Alexei Starovoitov a...@plumgrid.com

So, I just applied this and after trying:

[acme@felicio linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
; make O=/tmp/build/perf -C tools/perf  install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]

   MKDIR/tmp/build/perf/util/
   CC   /tmp/build/perf/util/abspath.o



So, what should I do now? I want to have that OFF line turned to on,
so that I can test this stuff.

But the changelog says nothing about it, lemme check the cover letter,
but having to do that is annoying, one expects to have instructions
related to some specific changeset in its comments...

So, when such build tests fail, we can see why by looking for a file
with a special name in the O= output dir:

[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
  #include linux/bpf.h
^
compilation terminated.
[acme@felicio linux]$


This patch tries to check the version of bpf.h, because old bpf.h doesn't
define 'kern_version' field for 'union bpf_attr'.

I think the problem you meet is caused by missing of kernel headers in your
host system environment. After patch 'perf tools: Make perf depend on 
libbpf'

this checking should always success because it adds required headers
into MANIFEST and setup FEATURE_CHECK_CFLAGS-bpf.

Also, after applying 3/50 you should see this:

# make O=/tmp/build/bpf/ -C tools/lib/bpf/

Auto-detecting system features:
...libelf: [ on  ]
... libelf-getphdrnum: [ on  ]
...   libelf-mmap: [ on  ]
...   bpf: [ on  ]

make: Entering directory `/home/wn/kernel-hydrogen/tools/lib/bpf'
  CC   /tmp/build/bpf/libbpf.o
  LD   /tmp/build/bpf/libbpf-in.o
  LINK /tmp/build/bpf/libbpf.a
  LINK /tmp/build/bpf/libbpf.so
make: Leaving directory `/home/wn/kernel/tools/lib/bpf'

Even if in perf checking bpf should fail in your machine now, checking 
bpf feature in
libbpf should success because when build libbpf I have added following 
setting to

tools/lib/bpf/Makefile:

  INCLUDES = -I. -I$(srctree)/tools/include 
-I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi

  FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)

Do you want me to squash 2/30 and 3/50 together and append 'bpf' checker 
into FEATURE_TESTS in
tools/build/Makefile.feature in 23/50? Then there should be less 
confusion: when compiling perf

before 23/50, bpf feature will never be checked then.

Thank you.


Right, one of the few things that could explain the failure, but:

[acme@felicio linux]$ find . -name bpf.h
./include/linux/bpf.h
./include/uapi/linux/bpf.h
[acme@felicio linux]$

So lemme try doing it in place:

[acme@felicio linux]$ make -C tools/perf/
make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]


Doesn't work as well :-\

Looking at the following patches...

- Arnaldo



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Arnaldo Carvalho de Melo
Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu:
 In this patch, eBPF API is checked by compiling a c source file which
 uses fields in bpf_attr which will be used by libbpf.
 
 Signed-off-by: Wang Nan wangn...@huawei.com
 Acked-by: Alexei Starovoitov a...@plumgrid.com

So, I just applied this and after trying:

[acme@felicio linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
; make O=/tmp/build/perf -C tools/perf  install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]

  MKDIR/tmp/build/perf/util/
  CC   /tmp/build/perf/util/abspath.o



So, what should I do now? I want to have that OFF line turned to on,
so that I can test this stuff.

But the changelog says nothing about it, lemme check the cover letter,
but having to do that is annoying, one expects to have instructions
related to some specific changeset in its comments...

- Arnaldo


 ---
  tools/build/Makefile.feature   |  6 --
  tools/build/feature/Makefile   |  6 +-
  tools/build/feature/test-bpf.c | 18 ++
  3 files changed, 27 insertions(+), 3 deletions(-)
  create mode 100644 tools/build/feature/test-bpf.c
 
 diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
 index 2975632..5ec6b37 100644
 --- a/tools/build/Makefile.feature
 +++ b/tools/build/Makefile.feature
 @@ -51,7 +51,8 @@ FEATURE_TESTS ?=\
   timerfd \
   libdw-dwarf-unwind  \
   zlib\
 - lzma
 + lzma\
 + bpf
  
  FEATURE_DISPLAY ?=   \
   dwarf   \
 @@ -67,7 +68,8 @@ FEATURE_DISPLAY ?=  \
   libunwind   \
   libdw-dwarf-unwind  \
   zlib\
 - lzma
 + lzma\
 + bpf
  
  # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
  # If in the future we need per-feature checks/flags for features not
 diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
 index 463ed8f..1c0d69f 100644
 --- a/tools/build/feature/Makefile
 +++ b/tools/build/feature/Makefile
 @@ -33,7 +33,8 @@ FILES=  \
   test-compile-32.bin \
   test-compile-x32.bin\
   test-zlib.bin   \
 - test-lzma.bin
 + test-lzma.bin   \
 + test-bpf.bin
  
  CC := $(CROSS_COMPILE)gcc -MD
  PKG_CONFIG := $(CROSS_COMPILE)pkg-config
 @@ -156,6 +157,9 @@ test-zlib.bin:
  test-lzma.bin:
   $(BUILD) -llzma
  
 +test-bpf.bin:
 + $(BUILD)
 +
  -include *.d
  
  ###
 diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c
 new file mode 100644
 index 000..062bac8
 --- /dev/null
 +++ b/tools/build/feature/test-bpf.c
 @@ -0,0 +1,18 @@
 +#include linux/bpf.h
 +
 +int main(void)
 +{
 + union bpf_attr attr;
 +
 + attr.prog_type = BPF_PROG_TYPE_KPROBE;
 + attr.insn_cnt = 0;
 + attr.insns = 0;
 + attr.license = 0;
 + attr.log_buf = 0;
 + attr.log_size = 0;
 + attr.log_level = 0;
 + attr.kern_version = 0;
 +
 + attr = attr;
 + return 0;
 +}
 -- 
 1.8.3.4
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Arnaldo Carvalho de Melo
Em Mon, Jun 29, 2015 at 04:21:51PM -0300, Arnaldo Carvalho de Melo escreveu:
 Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu:
  In this patch, eBPF API is checked by compiling a c source file which
  uses fields in bpf_attr which will be used by libbpf.
  
  Signed-off-by: Wang Nan wangn...@huawei.com
  Acked-by: Alexei Starovoitov a...@plumgrid.com
 
 So, I just applied this and after trying:
 
 [acme@felicio linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
 ; make O=/tmp/build/perf -C tools/perf  install-bin
 make: Entering directory `/home/acme/git/linux/tools/perf'
   BUILD:   Doing 'make -j4' parallel build
 
 Auto-detecting system features:
 ... dwarf: [ on  ]
 ... glibc: [ on  ]
 ...  gtk2: [ on  ]
 ...  libaudit: [ on  ]
 ...libbfd: [ on  ]
 ...libelf: [ on  ]
 ...   libnuma: [ on  ]
 ...   libperl: [ on  ]
 ... libpython: [ on  ]
 ...  libslang: [ on  ]
 ... libunwind: [ on  ]
 ...libdw-dwarf-unwind: [ on  ]
 ...  zlib: [ on  ]
 ...  lzma: [ on  ]
 ...   bpf: [ OFF ]
 
   MKDIR/tmp/build/perf/util/
   CC   /tmp/build/perf/util/abspath.o
 
 
 
 So, what should I do now? I want to have that OFF line turned to on,
 so that I can test this stuff.
 
 But the changelog says nothing about it, lemme check the cover letter,
 but having to do that is annoying, one expects to have instructions
 related to some specific changeset in its comments...

So, when such build tests fail, we can see why by looking for a file
with a special name in the O= output dir:

[acme@felicio linux]$ cat /tmp/build/perf/feature/test-bpf.make.output
test-bpf.c:1:23: fatal error: linux/bpf.h: No such file or directory
 #include linux/bpf.h
   ^
compilation terminated.
[acme@felicio linux]$

Right, one of the few things that could explain the failure, but:

[acme@felicio linux]$ find . -name bpf.h
./include/linux/bpf.h
./include/uapi/linux/bpf.h
[acme@felicio linux]$ 

So lemme try doing it in place:

[acme@felicio linux]$ make -C tools/perf/
make: Entering directory `/home/acme/git/linux/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]
...   bpf: [ OFF ]


Doesn't work as well :-\

Looking at the following patches...

- Arnaldo
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/