Re: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Daniel Wagner
On 12/18/2015 02:50 PM, pi3orama wrote:
>> Could it be that $(srcdir) somehow is not correct? I exchanged
>>
>>feature_dir := $(srctree)/tools/build/feature
>> to
>>feature_dir := /home/wagi/src/linux/tools/build/feature
>>
> 
> Can you remember the patch set I skipped?
> 
> http://lkml.kernel.org/g/1450316632-152513-4-git-send-email-wangn...@huawei.com
> 

I'll give them a try next week.

> I thought that patch set is independent with this one but I was wrong.
> The reason
> of your problem is the missing of srctree. Could you please add the
> definition of
> srctree and try again? Like this:
> 
> +ifeq ($(srctree),)
> +srctree := $(patsubst %/,%,$(dir $(shell pwd)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +#$(info Determined 'srctree' to be $(srctree))
> +endif
> 
> At the head of tools/lib/bpf/Makefile

I tried that one but it didn't change unfortunately. I saw that code
snipped is already in tools/lib/bpf/Makefile line 62. It exists since

1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature
check")

--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread pi3orama


发自我的 iPhone

> 在 2015年12月18日,下午8:55,Daniel Wagner  写道:
> 
>> On 12/18/2015 12:03 PM, Wangnan (F) wrote:
>> That's good. This is not a magic.
> 
> That is what you say! :)
> 
>> I guess something in your top makefile
>> causes this feature check failure. I sent a patch on feature checker to
>> you.
>> It will appear as [1] soon. Could you please apply it and try again?
> 
> Sure.
> 
>> This time you will see test-*.make.output and test-*.make.makeoutput.
>> test-*.make.output lists your PATH, PWD and the gcc command you use for
>> feature check. test-*.make.makeoutput is the output of 'make' itself. I
>> think
>> from these information we can find the root cause easier.
> 
> $ ls samples/bpf/libbpf/feature.libbpf/*
> samples/bpf/libbpf/feature.libbpf/test-all.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-bpf.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-libelf-getphdrnum.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-libelf.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-libelf-mmap.make.makeoutput
> 
> $ cat samples/bpf/libbpf/feature.libbpf/*
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> 

Thank you for your information.

I think the reason of the failure is the missing of srctree. I skipped a patch 
[1]
because I think it is independent with this patchset, but I was wrong.

Could you please add the srctree setting code block from [1] to your
tools/lib/bpf/Makefile and try again? You don't need other part of it,
or you have to apply the whole patchset because it moves a file.

[1] 
http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com

Thank you.


--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Daniel Wagner
On 12/18/2015 12:03 PM, Wangnan (F) wrote:
> That's good. This is not a magic.

That is what you say! :)

> I guess something in your top makefile
> causes this feature check failure. I sent a patch on feature checker to
> you.
> It will appear as [1] soon. Could you please apply it and try again?

Sure.

> This time you will see test-*.make.output and test-*.make.makeoutput.
> test-*.make.output lists your PATH, PWD and the gcc command you use for
> feature check. test-*.make.makeoutput is the output of 'make' itself. I
> think
> from these information we can find the root cause easier.

$ ls samples/bpf/libbpf/feature.libbpf/*
samples/bpf/libbpf/feature.libbpf/test-all.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-bpf.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-libelf-getphdrnum.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-libelf.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-libelf-mmap.make.makeoutput

$ cat samples/bpf/libbpf/feature.libbpf/*
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.

$ find -name *.make.output
./tools/build/feature/test-gtk2.make.output
./tools/build/feature/test-libpython.make.output
./tools/build/feature/test-libunwind.make.output
./tools/build/feature/test-bionic.make.output
./tools/build/feature/test-libelf-mmap.make.output
./tools/build/feature/test-numa_num_possible_cpus.make.output
./tools/build/feature/test-libaudit.make.output
./tools/build/feature/test-libslang.make.output
./tools/build/feature/test-libdw-dwarf-unwind.make.output
./tools/build/feature/test-libbfd.make.output
./tools/build/feature/test-get_cpuid.make.output
./tools/build/feature/test-zlib.make.output
./tools/build/feature/test-libelf.make.output
./tools/build/feature/test-libperl.make.output
./tools/build/feature/test-bpf.make.output
./tools/build/feature/test-dwarf.make.output
./tools/build/feature/test-libnuma.make.output
./tools/build/feature/test-glibc.make.output
./tools/build/feature/test-cplus-demangle.make.output
./tools/build/feature/test-libelf-getphdrnum.make.output
./tools/build/feature/test-all.make.output
./tools/build/feature/test-lzma.make.output


$ ls -l  tools/build/feature/*.make.output
-rw-rw-r-- 1 wagi wagi 419 Dec 17 14:39 tools/build/feature/test-all.make.output
-rw-rw-r-- 1 wagi wagi 104 Oct 20 09:59 
tools/build/feature/test-bionic.make.output
-rw-rw-r-- 1 wagi wagi   0 Dec 17 09:01 tools/build/feature/test-bpf.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-cplus-demangle.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-dwarf.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-get_cpuid.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-glibc.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-gtk2.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libaudit.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libbfd.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libdw-dwarf-unwind.make.output
-rw-rw-r-- 1 wagi wagi   0 Dec 17 09:01 
tools/build/feature/test-libelf-getphdrnum.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libelf.make.output
-rw-rw-r-- 1 wagi wagi   0 Dec 17 09:01 
tools/build/feature/test-libelf-mmap.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libnuma.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libperl.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libpython.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libslang.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libunwind.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-lzma.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-numa_num_possible_cpus.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-zlib.make.output

$ cat tools/build/feature/test-all.make.output
In file included from /usr/include/Python.h:7:0,
 from test-libpython.c:1,
 from test-all.c:13:
/usr/lib64/perl5/CORE/patchlevel.h:135:2: error: ‘NULL’ undeclared here (not in 
a function)
  NULL
  ^
In file included from test-libpython.c:1:0,
 from test-all.c:13:
/usr/include/Python.h:8:22: fatal error: pyconfig.h: No such file or directory
compilation terminated.

$ cat tools/build/feature/test-bionic.make.output
test-bionic.c:1:31: fatal error: android/api-level.h: No such file or directory

Re: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Wangnan (F)



On 2015/12/18 16:49, Daniel Wagner wrote:

On 12/18/2015 04:04 AM, Wangnan (F) wrote:

On 2015/12/17 21:46, Daniel Wagner wrote:

On 12/17/2015 11:09 AM, Wangnan (F) wrote:

On 2015/12/17 16:29, Daniel Wagner wrote:

On 12/17/2015 08:03 AM, Daniel Wagner wrote:
Patch number 2 didn't apply cleanly.

When you see this, could you please have a look at:

/home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output

?

test-libpython.c:1:20: fatal error: Python.h: No such file or directory

So it is the content in test-all.make.output ? Then it is
not a problem. It is only a fastpath which tries to check
all features by one test. On most platform it would fail.

I see.


BPF related feature check is not in test-all. It is a potential
bug, but I don't think it causes your problem.

Another problem is you didn't see this in the first failure:

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

This only happen when you already have a FEATURE-DUMP.libbpf in that
directory and it is same as the feature check result.

Could you please remove samples/bpf in your building tree and
try again? After you see the failure, what's the content of

/home/wagi/src/linux/samples/bpf/libbpf/FEATURE-* ?

I cleanup up my tree (rm samples/bpf/ and git checkout samples/bpf) and then

$ make samples/bpf/
   CHK include/config/kernel.release
   CHK include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   CHK include/generated/bounds.h
   CHK include/generated/timeconst.h
   CHK include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   LD  samples/bpf/built-in.o
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a

Auto-detecting system features:
...libelf: [ OFF ]
...   bpf: [ OFF ]


That's good. This is not a magic. I guess something in your top makefile
causes this feature check failure. I sent a patch on feature checker to you.
It will appear as [1] soon. Could you please apply it and try again?

This time you will see test-*.make.output and test-*.make.makeoutput.
test-*.make.output lists your PATH, PWD and the gcc command you use for
feature check. test-*.make.makeoutput is the output of 'make' itself. I 
think

from these information we can find the root cause easier.

Thank you.

[1] 
http://lkml.kernel.org/g/1450436211-170447-1-git-send-email-wangn...@huawei.com




--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Daniel Wagner
On 12/18/2015 04:04 AM, Wangnan (F) wrote:
> On 2015/12/17 21:46, Daniel Wagner wrote:
>> On 12/17/2015 11:09 AM, Wangnan (F) wrote:
>>> On 2015/12/17 16:29, Daniel Wagner wrote:
 On 12/17/2015 08:03 AM, Daniel Wagner wrote:
 Patch number 2 didn't apply cleanly.
>>> When you see this, could you please have a look at:
>>>
>>> /home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output
>>>
>>> ?
>> test-libpython.c:1:20: fatal error: Python.h: No such file or directory
> 
> So it is the content in test-all.make.output ? Then it is
> not a problem. It is only a fastpath which tries to check
> all features by one test. On most platform it would fail.

I see. 

> BPF related feature check is not in test-all. It is a potential
> bug, but I don't think it causes your problem.
> 
> Another problem is you didn't see this in the first failure:
> 
> Auto-detecting system features:
> ...libelf: [ on  ]
> ...   bpf: [ on  ]
> 
> This only happen when you already have a FEATURE-DUMP.libbpf in that
> directory and it is same as the feature check result.
> 
> Could you please remove samples/bpf in your building tree and
> try again? After you see the failure, what's the content of
> 
> /home/wagi/src/linux/samples/bpf/libbpf/FEATURE-* ?

I cleanup up my tree (rm samples/bpf/ and git checkout samples/bpf) and then

$ make samples/bpf/ 
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
  LD  samples/bpf/built-in.o
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a

Auto-detecting system features:
...libelf: [ OFF ]
...   bpf: [ OFF ]

No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target 'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2

$ cat /home/wagi/src/linux/samples/bpf/libbpf/FEATURE-*
feature-libelf(0) feature-bpf(0)

$ make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

make -f /home/wagi/src/linux/tools/build/Makefile.build dir=. obj=libbpf
  gcc 
-Wp,-MD,/home/wagi/src/linux/samples/bpf/libbpf/.libbpf.o.d,-MT,/home/wagi/src/linux/samples/bpf/libbpf/libbpf.o
  -DHAVE_LIBELF_MMAP_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -Wbad-function-cast 
-Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow 
-Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef 
-Wwrite-strings -Wformat -Werror -Wall -fPIC -I. 
-I/home/wagi/src/linux/tools/include -I/home/wagi/src/linux/arch//include/uapi 
-I/home/wagi/src/linux/include/uapi -D"BUILD_STR(s)=#s"   -c -o 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.o libbpf.c
  gcc 
-Wp,-MD,/home/wagi/src/linux/samples/bpf/libbpf/.bpf.o.d,-MT,/home/wagi/src/linux/samples/bpf/libbpf/bpf.o
  -DHAVE_LIBELF_MMAP_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -Wbad-function-cast 
-Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow 
-Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef 
-Wwrite-strings -Wformat -Werror -Wall -fPIC -I. 
-I/home/wagi/src/linux/tools/include -I/home/wagi/src/linux/arch//include/uapi 
-I/home/wagi/src/linux/include/uapi -D"BUILD_STR(s)=#s"   -c -o 
/home/wagi/src/linux/samples/bpf/libbpf/bpf.o bpf.c
   ld -r -o /home/wagi/src/linux/samples/bpf/libbpf/libbpf-in.o  
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.o 
/home/wagi/src/linux/samples/bpf/libbpf/bpf.o
rm -f /home/wagi/src/linux/samples/bpf/libbpf/libbpf.a; ar rcs 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf-in.o
make: Leaving directory '/home/wagi/src/linux/tools/lib/bpf' 

$  make samples/bpf/
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALL

Re: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Daniel Wagner
On 12/18/2015 04:04 AM, Wangnan (F) wrote:
> On 2015/12/17 21:46, Daniel Wagner wrote:
>> On 12/17/2015 11:09 AM, Wangnan (F) wrote:
>>> On 2015/12/17 16:29, Daniel Wagner wrote:
 On 12/17/2015 08:03 AM, Daniel Wagner wrote:
 Patch number 2 didn't apply cleanly.
>>> When you see this, could you please have a look at:
>>>
>>> /home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output
>>>
>>> ?
>> test-libpython.c:1:20: fatal error: Python.h: No such file or directory
> 
> So it is the content in test-all.make.output ? Then it is
> not a problem. It is only a fastpath which tries to check
> all features by one test. On most platform it would fail.

I see. 

> BPF related feature check is not in test-all. It is a potential
> bug, but I don't think it causes your problem.
> 
> Another problem is you didn't see this in the first failure:
> 
> Auto-detecting system features:
> ...libelf: [ on  ]
> ...   bpf: [ on  ]
> 
> This only happen when you already have a FEATURE-DUMP.libbpf in that
> directory and it is same as the feature check result.
> 
> Could you please remove samples/bpf in your building tree and
> try again? After you see the failure, what's the content of
> 
> /home/wagi/src/linux/samples/bpf/libbpf/FEATURE-* ?

I cleanup up my tree (rm samples/bpf/ and git checkout samples/bpf) and then

$ make samples/bpf/ 
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
  LD  samples/bpf/built-in.o
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a

Auto-detecting system features:
...libelf: [ OFF ]
...   bpf: [ OFF ]

No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target 'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2

$ cat /home/wagi/src/linux/samples/bpf/libbpf/FEATURE-*
feature-libelf(0) feature-bpf(0)

$ make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

make -f /home/wagi/src/linux/tools/build/Makefile.build dir=. obj=libbpf
  gcc 
-Wp,-MD,/home/wagi/src/linux/samples/bpf/libbpf/.libbpf.o.d,-MT,/home/wagi/src/linux/samples/bpf/libbpf/libbpf.o
  -DHAVE_LIBELF_MMAP_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -Wbad-function-cast 
-Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow 
-Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef 
-Wwrite-strings -Wformat -Werror -Wall -fPIC -I. 
-I/home/wagi/src/linux/tools/include -I/home/wagi/src/linux/arch//include/uapi 
-I/home/wagi/src/linux/include/uapi -D"BUILD_STR(s)=#s"   -c -o 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.o libbpf.c
  gcc 
-Wp,-MD,/home/wagi/src/linux/samples/bpf/libbpf/.bpf.o.d,-MT,/home/wagi/src/linux/samples/bpf/libbpf/bpf.o
  -DHAVE_LIBELF_MMAP_SUPPORT -DHAVE_ELF_GETPHDRNUM_SUPPORT -Wbad-function-cast 
-Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self 
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs 
-Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow 
-Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef 
-Wwrite-strings -Wformat -Werror -Wall -fPIC -I. 
-I/home/wagi/src/linux/tools/include -I/home/wagi/src/linux/arch//include/uapi 
-I/home/wagi/src/linux/include/uapi -D"BUILD_STR(s)=#s"   -c -o 
/home/wagi/src/linux/samples/bpf/libbpf/bpf.o bpf.c
   ld -r -o /home/wagi/src/linux/samples/bpf/libbpf/libbpf-in.o  
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.o 
/home/wagi/src/linux/samples/bpf/libbpf/bpf.o
rm -f /home/wagi/src/linux/samples/bpf/libbpf/libbpf.a; ar rcs 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf-in.o
make: Leaving directory '/home/wagi/src/linux/tools/lib/bpf' 

$  make samples/bpf/
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALL

Re: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Wangnan (F)



On 2015/12/18 16:49, Daniel Wagner wrote:

On 12/18/2015 04:04 AM, Wangnan (F) wrote:

On 2015/12/17 21:46, Daniel Wagner wrote:

On 12/17/2015 11:09 AM, Wangnan (F) wrote:

On 2015/12/17 16:29, Daniel Wagner wrote:

On 12/17/2015 08:03 AM, Daniel Wagner wrote:
Patch number 2 didn't apply cleanly.

When you see this, could you please have a look at:

/home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output

?

test-libpython.c:1:20: fatal error: Python.h: No such file or directory

So it is the content in test-all.make.output ? Then it is
not a problem. It is only a fastpath which tries to check
all features by one test. On most platform it would fail.

I see.


BPF related feature check is not in test-all. It is a potential
bug, but I don't think it causes your problem.

Another problem is you didn't see this in the first failure:

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

This only happen when you already have a FEATURE-DUMP.libbpf in that
directory and it is same as the feature check result.

Could you please remove samples/bpf in your building tree and
try again? After you see the failure, what's the content of

/home/wagi/src/linux/samples/bpf/libbpf/FEATURE-* ?

I cleanup up my tree (rm samples/bpf/ and git checkout samples/bpf) and then

$ make samples/bpf/
   CHK include/config/kernel.release
   CHK include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   CHK include/generated/bounds.h
   CHK include/generated/timeconst.h
   CHK include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   LD  samples/bpf/built-in.o
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a

Auto-detecting system features:
...libelf: [ OFF ]
...   bpf: [ OFF ]


That's good. This is not a magic. I guess something in your top makefile
causes this feature check failure. I sent a patch on feature checker to you.
It will appear as [1] soon. Could you please apply it and try again?

This time you will see test-*.make.output and test-*.make.makeoutput.
test-*.make.output lists your PATH, PWD and the gcc command you use for
feature check. test-*.make.makeoutput is the output of 'make' itself. I 
think

from these information we can find the root cause easier.

Thank you.

[1] 
http://lkml.kernel.org/g/1450436211-170447-1-git-send-email-wangn...@huawei.com




--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Daniel Wagner
On 12/18/2015 12:03 PM, Wangnan (F) wrote:
> That's good. This is not a magic.

That is what you say! :)

> I guess something in your top makefile
> causes this feature check failure. I sent a patch on feature checker to
> you.
> It will appear as [1] soon. Could you please apply it and try again?

Sure.

> This time you will see test-*.make.output and test-*.make.makeoutput.
> test-*.make.output lists your PATH, PWD and the gcc command you use for
> feature check. test-*.make.makeoutput is the output of 'make' itself. I
> think
> from these information we can find the root cause easier.

$ ls samples/bpf/libbpf/feature.libbpf/*
samples/bpf/libbpf/feature.libbpf/test-all.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-bpf.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-libelf-getphdrnum.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-libelf.make.makeoutput
samples/bpf/libbpf/feature.libbpf/test-libelf-mmap.make.makeoutput

$ cat samples/bpf/libbpf/feature.libbpf/*
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.
make[2]: *** tools/build/feature: No such file or directory.  Stop.

$ find -name *.make.output
./tools/build/feature/test-gtk2.make.output
./tools/build/feature/test-libpython.make.output
./tools/build/feature/test-libunwind.make.output
./tools/build/feature/test-bionic.make.output
./tools/build/feature/test-libelf-mmap.make.output
./tools/build/feature/test-numa_num_possible_cpus.make.output
./tools/build/feature/test-libaudit.make.output
./tools/build/feature/test-libslang.make.output
./tools/build/feature/test-libdw-dwarf-unwind.make.output
./tools/build/feature/test-libbfd.make.output
./tools/build/feature/test-get_cpuid.make.output
./tools/build/feature/test-zlib.make.output
./tools/build/feature/test-libelf.make.output
./tools/build/feature/test-libperl.make.output
./tools/build/feature/test-bpf.make.output
./tools/build/feature/test-dwarf.make.output
./tools/build/feature/test-libnuma.make.output
./tools/build/feature/test-glibc.make.output
./tools/build/feature/test-cplus-demangle.make.output
./tools/build/feature/test-libelf-getphdrnum.make.output
./tools/build/feature/test-all.make.output
./tools/build/feature/test-lzma.make.output


$ ls -l  tools/build/feature/*.make.output
-rw-rw-r-- 1 wagi wagi 419 Dec 17 14:39 tools/build/feature/test-all.make.output
-rw-rw-r-- 1 wagi wagi 104 Oct 20 09:59 
tools/build/feature/test-bionic.make.output
-rw-rw-r-- 1 wagi wagi   0 Dec 17 09:01 tools/build/feature/test-bpf.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-cplus-demangle.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-dwarf.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-get_cpuid.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-glibc.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-gtk2.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libaudit.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libbfd.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libdw-dwarf-unwind.make.output
-rw-rw-r-- 1 wagi wagi   0 Dec 17 09:01 
tools/build/feature/test-libelf-getphdrnum.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libelf.make.output
-rw-rw-r-- 1 wagi wagi   0 Dec 17 09:01 
tools/build/feature/test-libelf-mmap.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libnuma.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libperl.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libpython.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libslang.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-libunwind.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-lzma.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-numa_num_possible_cpus.make.output
-rw-rw-r-- 1 wagi wagi   0 Oct 20 09:59 
tools/build/feature/test-zlib.make.output

$ cat tools/build/feature/test-all.make.output
In file included from /usr/include/Python.h:7:0,
 from test-libpython.c:1,
 from test-all.c:13:
/usr/lib64/perl5/CORE/patchlevel.h:135:2: error: ‘NULL’ undeclared here (not in 
a function)
  NULL
  ^
In file included from test-libpython.c:1:0,
 from test-all.c:13:
/usr/include/Python.h:8:22: fatal error: pyconfig.h: No such file or directory
compilation terminated.

$ cat tools/build/feature/test-bionic.make.output
test-bionic.c:1:31: fatal error: android/api-level.h: No such file or directory

Re: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread Daniel Wagner
On 12/18/2015 02:50 PM, pi3orama wrote:
>> Could it be that $(srcdir) somehow is not correct? I exchanged
>>
>>feature_dir := $(srctree)/tools/build/feature
>> to
>>feature_dir := /home/wagi/src/linux/tools/build/feature
>>
> 
> Can you remember the patch set I skipped?
> 
> http://lkml.kernel.org/g/1450316632-152513-4-git-send-email-wangn...@huawei.com
> 

I'll give them a try next week.

> I thought that patch set is independent with this one but I was wrong.
> The reason
> of your problem is the missing of srctree. Could you please add the
> definition of
> srctree and try again? Like this:
> 
> +ifeq ($(srctree),)
> +srctree := $(patsubst %/,%,$(dir $(shell pwd)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +#$(info Determined 'srctree' to be $(srctree))
> +endif
> 
> At the head of tools/lib/bpf/Makefile

I tried that one but it didn't change unfortunately. I saw that code
snipped is already in tools/lib/bpf/Makefile line 62. It exists since

1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature
check")

--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-18 Thread pi3orama


发自我的 iPhone

> 在 2015年12月18日,下午8:55,Daniel Wagner  写道:
> 
>> On 12/18/2015 12:03 PM, Wangnan (F) wrote:
>> That's good. This is not a magic.
> 
> That is what you say! :)
> 
>> I guess something in your top makefile
>> causes this feature check failure. I sent a patch on feature checker to
>> you.
>> It will appear as [1] soon. Could you please apply it and try again?
> 
> Sure.
> 
>> This time you will see test-*.make.output and test-*.make.makeoutput.
>> test-*.make.output lists your PATH, PWD and the gcc command you use for
>> feature check. test-*.make.makeoutput is the output of 'make' itself. I
>> think
>> from these information we can find the root cause easier.
> 
> $ ls samples/bpf/libbpf/feature.libbpf/*
> samples/bpf/libbpf/feature.libbpf/test-all.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-bpf.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-libelf-getphdrnum.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-libelf.make.makeoutput
> samples/bpf/libbpf/feature.libbpf/test-libelf-mmap.make.makeoutput
> 
> $ cat samples/bpf/libbpf/feature.libbpf/*
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> make[2]: *** tools/build/feature: No such file or directory.  Stop.
> 

Thank you for your information.

I think the reason of the failure is the missing of srctree. I skipped a patch 
[1]
because I think it is independent with this patchset, but I was wrong.

Could you please add the srctree setting code block from [1] to your
tools/lib/bpf/Makefile and try again? You don't need other part of it,
or you have to apply the whole patchset because it moves a file.

[1] 
http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com

Thank you.


--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Wangnan (F)



On 2015/12/17 21:46, Daniel Wagner wrote:

On 12/17/2015 11:09 AM, Wangnan (F) wrote:

On 2015/12/17 16:29, Daniel Wagner wrote:

On 12/17/2015 08:03 AM, Daniel Wagner wrote:
Patch number 2 didn't apply cleanly.

Because I have another patch in my local tree which also modifis bpf
Makefile:

http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com

sorry.

Ah, that explains it this problem.


After fixing this manually
I was able to continue to the build step:

$ make samples/bpf/
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALLscripts/checksyscalls.sh
make -C /home/wagi/src/linux/tools/lib/bpf
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target
'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2

When you see this, could you please have a look at:

/home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output

?

test-libpython.c:1:20: fatal error: Python.h: No such file or directory


So it is the content in test-all.make.output ? Then it is
not a problem. It is only a fastpath which tries to check
all features by one test. On most platform it would fail.

BPF related feature check is not in test-all. It is a potential
bug, but I don't think it causes your problem.

Another problem is you didn't see this in the first failure:

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

This only happen when you already have a FEATURE-DUMP.libbpf in that
directory and it is same as the feature check result.

Could you please remove samples/bpf in your building tree and
try again? After you see the failure, what's the content of

/home/wagi/src/linux/samples/bpf/libbpf/FEATURE-* ?

Thank you.

--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Daniel Wagner
On 12/17/2015 11:09 AM, Wangnan (F) wrote:
> On 2015/12/17 16:29, Daniel Wagner wrote:
>> On 12/17/2015 08:03 AM, Daniel Wagner wrote:
>> Patch number 2 didn't apply cleanly.
> 
> Because I have another patch in my local tree which also modifis bpf
> Makefile:
> 
> http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com
> 
> sorry.

Ah, that explains it this problem.

>> After fixing this manually
>> I was able to continue to the build step:
>>
>> $ make samples/bpf/
>>CHK include/config/kernel.release
>>CHK include/generated/uapi/linux/version.h
>>CHK include/generated/utsrelease.h
>>CHK include/generated/bounds.h
>>CHK include/generated/timeconst.h
>>CHK include/generated/asm-offsets.h
>>CALLscripts/checksyscalls.sh
>> make -C /home/wagi/src/linux/tools/lib/bpf
>> O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1
>> /home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
>> No libelf found
>> Makefile:203: recipe for target 'elfdep' failed
>> make[2]: *** [elfdep] Error 255
>> samples/bpf/Makefile:10: recipe for target
>> 'samples/bpf/libbpf/libbpf.a' failed
>> make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
>> Makefile:1550: recipe for target 'samples/bpf/' failed
>> make: *** [samples/bpf/] Error 2
> 
> When you see this, could you please have a look at:
> 
> /home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output
> 
> ?

test-libpython.c:1:20: fatal error: Python.h: No such file or directory

$ find /usr/include -name Python.h
/usr/include/python3.4m/Python.h
/usr/include/python2.7/Python.h

Adding a symlink to /usr/include/Python.h to
/usr/include/python2.7/Python.h didn't help.

> This error means it can't find libelf on your platform, but it is not
> true obviously.

Yeah look like. Funny thing though is if I build libelf directly

$  make -C tools/lib/bpf/
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

  CC   fixdep.o
  LD   fixdep-in.o
  LINK fixdep
  CC   libbpf.o
  CC   bpf.o
  LD   libbpf-in.o
  LINK libbpf.a
  LINK libbpf.so
make: Leaving directory '/home/wagi/src/linux/tools/lib/bpf'

all is fine.

>> fds_example.c:(.text.startup+0x20e): undefined reference to
>> `bpf_pin_object'
>> fds_example.c:(.text.startup+0x2b0): undefined reference to
>> `bpf_pin_object'
>> fds_example.c:(.text.startup+0x2f3): undefined reference to
>> `bpf_get_pinned_object'
>> fds_example.c:(.text.startup+0x344): undefined reference to
>> `bpf_get_pinned_object'
>> collect2: error: ld returned 1 exit status
>>
> 
> Could you please check whether this patch:
> 
>  bpf tools: Support BPF_OBJ_PIN and BPF_OBJ_GET
> 
> is applied properly?

No it wasn't. Sorry about that one. I didn't pay enough attention when
applying them. The v2 of 6 did upset my workflow.
--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Wangnan (F)



On 2015/12/17 16:29, Daniel Wagner wrote:

On 12/17/2015 08:03 AM, Daniel Wagner wrote:

On 12/17/2015 07:51 AM, Wangnan (F) wrote:

On 2015/12/17 14:38, Daniel Wagner wrote:

On 12/17/2015 06:23 AM, Wang Nan wrote:

Since we already have libbpf in tools/lib, we don't need to maintain
another bpf loader and operations library in samples/bpf.

In patchset:

   Patch 1/10 - 7/10 improves libbpf, add missing features to support
   samples,

   Patch 8/10 adds utils.[ch], which creates similar API like old
   bpf_load.c and libbpf.c.

   Patch 9/10 replace all sampels to use API provides by utils.[ch] and
   libbpf.

   Patch 10/10 removes unneeded files.

Which tree did you use for your patches? I tried to apply them against
mainline and net-next which didn't really work out.

These patches based on Arnaldo's 'perf/core' because of those libbpf
changes.

Okay, I'll try with this one.

I applied those patches on top of

5c560cfcf1c0 ("tools subcmd: Rename subcmd header include guards")

Patch number 2 didn't apply cleanly.


Because I have another patch in my local tree which also modifis bpf 
Makefile:


http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com

sorry.


After fixing this manually
I was able to continue to the build step:

$ make samples/bpf/
   CHK include/config/kernel.release
   CHK include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   CHK include/generated/bounds.h
   CHK include/generated/timeconst.h
   CHK include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target 'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2


When you see this, could you please have a look at:

/home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output

?

This error means it can't find libelf on your platform, but it is not true 
obviously.




Executing the above command line by myself in order
to figure out what's going on ended in this mess:


$ make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

[...]

samples/bpf/fds_example.c: In function ‘bpf_do_map’:
samples/bpf/fds_example.c:78:9: warning: implicit declaration of function 
‘bpf_pin_object’ [-Wimplicit-function-declaration]
ret = bpf_pin_object(fd, file);
  ^
samples/bpf/fds_example.c:82:8: warning: implicit declaration of function 
‘bpf_get_pinned_object’ [-Wimplicit-function-declaration]
fd = bpf_get_pinned_object(file);
 ^
   gcc -Lsamples/bpf/libbpf -o samples/bpf/fds_example samples/bpf/utils.o 
samples/bpf/fds_example.o -lelf -lbpf
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:100: recipe for target 'samples/bpf/fds_example' failed
make[1]: *** [samples/bpf/fds_example] Error 1
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2
[wagi@handman linux (bpf-test)]$ make samples/bpf/
   CHK include/config/kernel.release
   CHK include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   CHK include/generated/bounds.h
   CHK include/generated/timeconst.h
   CHK include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   HOSTLD  samples/bpf/fds_example
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status



Could you please check whether this patch:

 bpf tools: Support BPF_OBJ_PIN and BPF_OBJ_GET

is applied properly?

Thank you.

--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Daniel Wagner
On 12/17/2015 08:03 AM, Daniel Wagner wrote:
> On 12/17/2015 07:51 AM, Wangnan (F) wrote:
>> On 2015/12/17 14:38, Daniel Wagner wrote:
>>> On 12/17/2015 06:23 AM, Wang Nan wrote:
 Since we already have libbpf in tools/lib, we don't need to maintain
 another bpf loader and operations library in samples/bpf.

 In patchset:

   Patch 1/10 - 7/10 improves libbpf, add missing features to support
   samples,

   Patch 8/10 adds utils.[ch], which creates similar API like old
   bpf_load.c and libbpf.c.

   Patch 9/10 replace all sampels to use API provides by utils.[ch] and
   libbpf.

   Patch 10/10 removes unneeded files.
>>> Which tree did you use for your patches? I tried to apply them against
>>> mainline and net-next which didn't really work out.
>>
>> These patches based on Arnaldo's 'perf/core' because of those libbpf
>> changes.
> 
> Okay, I'll try with this one.

I applied those patches on top of

5c560cfcf1c0 ("tools subcmd: Rename subcmd header include guards")

Patch number 2 didn't apply cleanly. After fixing this manually 
I was able to continue to the build step:

$ make samples/bpf/
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target 'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2


Executing the above command line by myself in order 
to figure out what's going on ended in this mess:


$ make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

[...]

samples/bpf/fds_example.c: In function ‘bpf_do_map’:
samples/bpf/fds_example.c:78:9: warning: implicit declaration of function 
‘bpf_pin_object’ [-Wimplicit-function-declaration]
   ret = bpf_pin_object(fd, file);
 ^
samples/bpf/fds_example.c:82:8: warning: implicit declaration of function 
‘bpf_get_pinned_object’ [-Wimplicit-function-declaration]
   fd = bpf_get_pinned_object(file);
^
  gcc -Lsamples/bpf/libbpf -o samples/bpf/fds_example samples/bpf/utils.o 
samples/bpf/fds_example.o -lelf -lbpf 
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:100: recipe for target 'samples/bpf/fds_example' failed
make[1]: *** [samples/bpf/fds_example] Error 1
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2
[wagi@handman linux (bpf-test)]$ make samples/bpf/
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
  HOSTLD  samples/bpf/fds_example
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status


What is the canonical why to build the samples? I must doing something
really stupid I guess.


cheers,
daniel
--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Daniel Wagner
On 12/17/2015 08:03 AM, Daniel Wagner wrote:
> On 12/17/2015 07:51 AM, Wangnan (F) wrote:
>> On 2015/12/17 14:38, Daniel Wagner wrote:
>>> On 12/17/2015 06:23 AM, Wang Nan wrote:
 Since we already have libbpf in tools/lib, we don't need to maintain
 another bpf loader and operations library in samples/bpf.

 In patchset:

   Patch 1/10 - 7/10 improves libbpf, add missing features to support
   samples,

   Patch 8/10 adds utils.[ch], which creates similar API like old
   bpf_load.c and libbpf.c.

   Patch 9/10 replace all sampels to use API provides by utils.[ch] and
   libbpf.

   Patch 10/10 removes unneeded files.
>>> Which tree did you use for your patches? I tried to apply them against
>>> mainline and net-next which didn't really work out.
>>
>> These patches based on Arnaldo's 'perf/core' because of those libbpf
>> changes.
> 
> Okay, I'll try with this one.

I applied those patches on top of

5c560cfcf1c0 ("tools subcmd: Rename subcmd header include guards")

Patch number 2 didn't apply cleanly. After fixing this manually 
I was able to continue to the build step:

$ make samples/bpf/
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target 'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2


Executing the above command line by myself in order 
to figure out what's going on ended in this mess:


$ make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

[...]

samples/bpf/fds_example.c: In function ‘bpf_do_map’:
samples/bpf/fds_example.c:78:9: warning: implicit declaration of function 
‘bpf_pin_object’ [-Wimplicit-function-declaration]
   ret = bpf_pin_object(fd, file);
 ^
samples/bpf/fds_example.c:82:8: warning: implicit declaration of function 
‘bpf_get_pinned_object’ [-Wimplicit-function-declaration]
   fd = bpf_get_pinned_object(file);
^
  gcc -Lsamples/bpf/libbpf -o samples/bpf/fds_example samples/bpf/utils.o 
samples/bpf/fds_example.o -lelf -lbpf 
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:100: recipe for target 'samples/bpf/fds_example' failed
make[1]: *** [samples/bpf/fds_example] Error 1
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2
[wagi@handman linux (bpf-test)]$ make samples/bpf/
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
  HOSTLD  samples/bpf/fds_example
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status


What is the canonical why to build the samples? I must doing something
really stupid I guess.


cheers,
daniel
--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Wangnan (F)



On 2015/12/17 16:29, Daniel Wagner wrote:

On 12/17/2015 08:03 AM, Daniel Wagner wrote:

On 12/17/2015 07:51 AM, Wangnan (F) wrote:

On 2015/12/17 14:38, Daniel Wagner wrote:

On 12/17/2015 06:23 AM, Wang Nan wrote:

Since we already have libbpf in tools/lib, we don't need to maintain
another bpf loader and operations library in samples/bpf.

In patchset:

   Patch 1/10 - 7/10 improves libbpf, add missing features to support
   samples,

   Patch 8/10 adds utils.[ch], which creates similar API like old
   bpf_load.c and libbpf.c.

   Patch 9/10 replace all sampels to use API provides by utils.[ch] and
   libbpf.

   Patch 10/10 removes unneeded files.

Which tree did you use for your patches? I tried to apply them against
mainline and net-next which didn't really work out.

These patches based on Arnaldo's 'perf/core' because of those libbpf
changes.

Okay, I'll try with this one.

I applied those patches on top of

5c560cfcf1c0 ("tools subcmd: Rename subcmd header include guards")

Patch number 2 didn't apply cleanly.


Because I have another patch in my local tree which also modifis bpf 
Makefile:


http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com

sorry.


After fixing this manually
I was able to continue to the build step:

$ make samples/bpf/
   CHK include/config/kernel.release
   CHK include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   CHK include/generated/bounds.h
   CHK include/generated/timeconst.h
   CHK include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target 'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2


When you see this, could you please have a look at:

/home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output

?

This error means it can't find libelf on your platform, but it is not true 
obviously.




Executing the above command line by myself in order
to figure out what's going on ended in this mess:


$ make -C /home/wagi/src/linux/tools/lib/bpf 
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1 
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

[...]

samples/bpf/fds_example.c: In function ‘bpf_do_map’:
samples/bpf/fds_example.c:78:9: warning: implicit declaration of function 
‘bpf_pin_object’ [-Wimplicit-function-declaration]
ret = bpf_pin_object(fd, file);
  ^
samples/bpf/fds_example.c:82:8: warning: implicit declaration of function 
‘bpf_get_pinned_object’ [-Wimplicit-function-declaration]
fd = bpf_get_pinned_object(file);
 ^
   gcc -Lsamples/bpf/libbpf -o samples/bpf/fds_example samples/bpf/utils.o 
samples/bpf/fds_example.o -lelf -lbpf
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:100: recipe for target 'samples/bpf/fds_example' failed
make[1]: *** [samples/bpf/fds_example] Error 1
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2
[wagi@handman linux (bpf-test)]$ make samples/bpf/
   CHK include/config/kernel.release
   CHK include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   CHK include/generated/bounds.h
   CHK include/generated/timeconst.h
   CHK include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   HOSTLD  samples/bpf/fds_example
samples/bpf/fds_example.o: In function `main':
fds_example.c:(.text.startup+0x20e): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2b0): undefined reference to `bpf_pin_object'
fds_example.c:(.text.startup+0x2f3): undefined reference to 
`bpf_get_pinned_object'
fds_example.c:(.text.startup+0x344): undefined reference to 
`bpf_get_pinned_object'
collect2: error: ld returned 1 exit status



Could you please check whether this patch:

 bpf tools: Support BPF_OBJ_PIN and BPF_OBJ_GET

is applied properly?

Thank you.

--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Daniel Wagner
On 12/17/2015 11:09 AM, Wangnan (F) wrote:
> On 2015/12/17 16:29, Daniel Wagner wrote:
>> On 12/17/2015 08:03 AM, Daniel Wagner wrote:
>> Patch number 2 didn't apply cleanly.
> 
> Because I have another patch in my local tree which also modifis bpf
> Makefile:
> 
> http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com
> 
> sorry.

Ah, that explains it this problem.

>> After fixing this manually
>> I was able to continue to the build step:
>>
>> $ make samples/bpf/
>>CHK include/config/kernel.release
>>CHK include/generated/uapi/linux/version.h
>>CHK include/generated/utsrelease.h
>>CHK include/generated/bounds.h
>>CHK include/generated/timeconst.h
>>CHK include/generated/asm-offsets.h
>>CALLscripts/checksyscalls.sh
>> make -C /home/wagi/src/linux/tools/lib/bpf
>> O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1
>> /home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
>> No libelf found
>> Makefile:203: recipe for target 'elfdep' failed
>> make[2]: *** [elfdep] Error 255
>> samples/bpf/Makefile:10: recipe for target
>> 'samples/bpf/libbpf/libbpf.a' failed
>> make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
>> Makefile:1550: recipe for target 'samples/bpf/' failed
>> make: *** [samples/bpf/] Error 2
> 
> When you see this, could you please have a look at:
> 
> /home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output
> 
> ?

test-libpython.c:1:20: fatal error: Python.h: No such file or directory

$ find /usr/include -name Python.h
/usr/include/python3.4m/Python.h
/usr/include/python2.7/Python.h

Adding a symlink to /usr/include/Python.h to
/usr/include/python2.7/Python.h didn't help.

> This error means it can't find libelf on your platform, but it is not
> true obviously.

Yeah look like. Funny thing though is if I build libelf directly

$  make -C tools/lib/bpf/
make: Entering directory '/home/wagi/src/linux/tools/lib/bpf'

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

  CC   fixdep.o
  LD   fixdep-in.o
  LINK fixdep
  CC   libbpf.o
  CC   bpf.o
  LD   libbpf-in.o
  LINK libbpf.a
  LINK libbpf.so
make: Leaving directory '/home/wagi/src/linux/tools/lib/bpf'

all is fine.

>> fds_example.c:(.text.startup+0x20e): undefined reference to
>> `bpf_pin_object'
>> fds_example.c:(.text.startup+0x2b0): undefined reference to
>> `bpf_pin_object'
>> fds_example.c:(.text.startup+0x2f3): undefined reference to
>> `bpf_get_pinned_object'
>> fds_example.c:(.text.startup+0x344): undefined reference to
>> `bpf_get_pinned_object'
>> collect2: error: ld returned 1 exit status
>>
> 
> Could you please check whether this patch:
> 
>  bpf tools: Support BPF_OBJ_PIN and BPF_OBJ_GET
> 
> is applied properly?

No it wasn't. Sorry about that one. I didn't pay enough attention when
applying them. The v2 of 6 did upset my workflow.
--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-17 Thread Wangnan (F)



On 2015/12/17 21:46, Daniel Wagner wrote:

On 12/17/2015 11:09 AM, Wangnan (F) wrote:

On 2015/12/17 16:29, Daniel Wagner wrote:

On 12/17/2015 08:03 AM, Daniel Wagner wrote:
Patch number 2 didn't apply cleanly.

Because I have another patch in my local tree which also modifis bpf
Makefile:

http://lkml.kernel.org/g/1450316632-152513-1-git-send-email-wangn...@huawei.com

sorry.

Ah, that explains it this problem.


After fixing this manually
I was able to continue to the build step:

$ make samples/bpf/
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALLscripts/checksyscalls.sh
make -C /home/wagi/src/linux/tools/lib/bpf
O=/home/wagi/src/linux/samples/bpf/libbpf CFLAGS= LDFLAGS= V=1
/home/wagi/src/linux/samples/bpf/libbpf/libbpf.a
No libelf found
Makefile:203: recipe for target 'elfdep' failed
make[2]: *** [elfdep] Error 255
samples/bpf/Makefile:10: recipe for target
'samples/bpf/libbpf/libbpf.a' failed
make[1]: *** [samples/bpf/libbpf/libbpf.a] Error 2
Makefile:1550: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2

When you see this, could you please have a look at:

/home/wagi/src/linux/samples/bpf/libbpf/feature/test-*.make.output

?

test-libpython.c:1:20: fatal error: Python.h: No such file or directory


So it is the content in test-all.make.output ? Then it is
not a problem. It is only a fastpath which tries to check
all features by one test. On most platform it would fail.

BPF related feature check is not in test-all. It is a potential
bug, but I don't think it causes your problem.

Another problem is you didn't see this in the first failure:

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

This only happen when you already have a FEATURE-DUMP.libbpf in that
directory and it is same as the feature check result.

Could you please remove samples/bpf in your building tree and
try again? After you see the failure, what's the content of

/home/wagi/src/linux/samples/bpf/libbpf/FEATURE-* ?

Thank you.

--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Daniel Wagner
On 12/17/2015 07:51 AM, Wangnan (F) wrote:
> On 2015/12/17 14:38, Daniel Wagner wrote:
>> On 12/17/2015 06:23 AM, Wang Nan wrote:
>>> Since we already have libbpf in tools/lib, we don't need to maintain
>>> another bpf loader and operations library in samples/bpf.
>>>
>>> In patchset:
>>>
>>>   Patch 1/10 - 7/10 improves libbpf, add missing features to support
>>>   samples,
>>>
>>>   Patch 8/10 adds utils.[ch], which creates similar API like old
>>>   bpf_load.c and libbpf.c.
>>>
>>>   Patch 9/10 replace all sampels to use API provides by utils.[ch] and
>>>   libbpf.
>>>
>>>   Patch 10/10 removes unneeded files.
>> Which tree did you use for your patches? I tried to apply them against
>> mainline and net-next which didn't really work out.
> 
> These patches based on Arnaldo's 'perf/core' because of those libbpf
> changes.

Okay, I'll try with this one.

> Which tree is the right one for this? net-next?

The patches I was involved were routed via net-next but I don't know if
that is the right tree for this patch set.

cheers,
daniel
--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Wangnan (F)



On 2015/12/17 14:38, Daniel Wagner wrote:

Hi,

On 12/17/2015 06:23 AM, Wang Nan wrote:

Since we already have libbpf in tools/lib, we don't need to maintain
another bpf loader and operations library in samples/bpf.

In patchset:

  Patch 1/10 - 7/10 improves libbpf, add missing features to support
  samples,

  Patch 8/10 adds utils.[ch], which creates similar API like old
  bpf_load.c and libbpf.c.

  Patch 9/10 replace all sampels to use API provides by utils.[ch] and
  libbpf.

  Patch 10/10 removes unneeded files.

Which tree did you use for your patches? I tried to apply them against
mainline and net-next which didn't really work out.


These patches based on Arnaldo's 'perf/core' because of those libbpf
changes.

Which tree is the right one for this? net-next?

Thank you.


cheers,
daniel



--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Daniel Wagner
Hi,

On 12/17/2015 06:23 AM, Wang Nan wrote:
> Since we already have libbpf in tools/lib, we don't need to maintain
> another bpf loader and operations library in samples/bpf.
> 
> In patchset:
> 
>  Patch 1/10 - 7/10 improves libbpf, add missing features to support
>  samples,
> 
>  Patch 8/10 adds utils.[ch], which creates similar API like old
>  bpf_load.c and libbpf.c.
> 
>  Patch 9/10 replace all sampels to use API provides by utils.[ch] and
>  libbpf.
> 
>  Patch 10/10 removes unneeded files.

Which tree did you use for your patches? I tried to apply them against
mainline and net-next which didn't really work out.

cheers,
daniel
--
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/


[PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Wang Nan
Since we already have libbpf in tools/lib, we don't need to maintain
another bpf loader and operations library in samples/bpf.

In patchset:

 Patch 1/10 - 7/10 improves libbpf, add missing features to support
 samples,

 Patch 8/10 adds utils.[ch], which creates similar API like old
 bpf_load.c and libbpf.c.

 Patch 9/10 replace all sampels to use API provides by utils.[ch] and
 libbpf.

 Patch 10/10 removes unneeded files.

 Cc: Alexei Starovoitov 
 Cc: Alex Gartrell 
 Cc: Arnaldo Carvalho de Melo 
 Cc: Brenden Blanco 
 Cc: Daniel Borkmann 
 Cc: Daniel Wagner 
 Cc: David S. Miller 
 Cc: Ingo Molnar 
 Cc: Jiri Olsa 
 Cc: Kaixu Xia 
 Cc: Michael Holzheu 
 Cc: Yang Shi 

Wang Nan (10):
  bpf samples: bpf: Fix tracex5_kern.c compiling error
  bpf tools: Define LD and RM in Makefile for 'make -R'
  bpf tools: Add const decoretor to 'license' and 'insns' for
bpf_load_program()
  bpf tools: Switch to uapi style type names
  bpf tools: Support load different type of programs
  bpf tools: Support new map operations
  bpf tools: Support BPF_OBJ_PIN and BPF_OBJ_GET
  bpf samples: Add utils.[ch] for using BPF
  bpf samples: Uses libbpf in tools/lib to deal with BPF operations
  bpf samples: Remove old BPF helpers

 samples/bpf/Makefile  |  65 +++
 samples/bpf/bpf_load.c| 345 --
 samples/bpf/bpf_load.h|  27 ---
 samples/bpf/fds_example.c |  26 +--
 samples/bpf/include/linux/err.h   |  56 +++
 samples/bpf/lathist_user.c|  13 +-
 samples/bpf/libbpf.c  | 154 -
 samples/bpf/sock_example.c|  13 +-
 samples/bpf/sockex1_kern.c|   2 +
 samples/bpf/sockex1_user.c|  27 +--
 samples/bpf/sockex2_kern.c|   2 +
 samples/bpf/sockex2_user.c|  26 +--
 samples/bpf/sockex3_kern.c|   2 +
 samples/bpf/sockex3_user.c|  23 ++-
 samples/bpf/test_maps.c   |  80 -
 samples/bpf/test_verifier.c   |  13 +-
 samples/bpf/trace_output_user.c   |  17 +-
 samples/bpf/tracex1_user.c|   9 +-
 samples/bpf/tracex2_user.c|  31 ++--
 samples/bpf/tracex3_user.c|  15 +-
 samples/bpf/tracex4_user.c|  15 +-
 samples/bpf/tracex5_kern.c|   1 +
 samples/bpf/tracex5_user.c|   9 +-
 samples/bpf/tracex6_user.c|  16 +-
 samples/bpf/utils.c   | 276 ++
 samples/bpf/{libbpf.h => utils.h} |  58 ---
 tools/lib/bpf/Makefile|   2 +
 tools/lib/bpf/bpf.c   |  65 ++-
 tools/lib/bpf/bpf.h   |  16 +-
 tools/lib/bpf/libbpf.c|  43 -
 tools/lib/bpf/libbpf.h|  16 ++
 31 files changed, 718 insertions(+), 745 deletions(-)
 delete mode 100644 samples/bpf/bpf_load.c
 delete mode 100644 samples/bpf/bpf_load.h
 create mode 100644 samples/bpf/include/linux/err.h
 delete mode 100644 samples/bpf/libbpf.c
 create mode 100644 samples/bpf/utils.c
 rename samples/bpf/{libbpf.h => utils.h} (81%)

-- 
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/


[PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Wang Nan
Since we already have libbpf in tools/lib, we don't need to maintain
another bpf loader and operations library in samples/bpf.

In patchset:

 Patch 1/10 - 7/10 improves libbpf, add missing features to support
 samples,

 Patch 8/10 adds utils.[ch], which creates similar API like old
 bpf_load.c and libbpf.c.

 Patch 9/10 replace all sampels to use API provides by utils.[ch] and
 libbpf.

 Patch 10/10 removes unneeded files.

 Cc: Alexei Starovoitov 
 Cc: Alex Gartrell 
 Cc: Arnaldo Carvalho de Melo 
 Cc: Brenden Blanco 
 Cc: Daniel Borkmann 
 Cc: Daniel Wagner 
 Cc: David S. Miller 
 Cc: Ingo Molnar 
 Cc: Jiri Olsa 
 Cc: Kaixu Xia 
 Cc: Michael Holzheu 
 Cc: Yang Shi 

Wang Nan (10):
  bpf samples: bpf: Fix tracex5_kern.c compiling error
  bpf tools: Define LD and RM in Makefile for 'make -R'
  bpf tools: Add const decoretor to 'license' and 'insns' for
bpf_load_program()
  bpf tools: Switch to uapi style type names
  bpf tools: Support load different type of programs
  bpf tools: Support new map operations
  bpf tools: Support BPF_OBJ_PIN and BPF_OBJ_GET
  bpf samples: Add utils.[ch] for using BPF
  bpf samples: Uses libbpf in tools/lib to deal with BPF operations
  bpf samples: Remove old BPF helpers

 samples/bpf/Makefile  |  65 +++
 samples/bpf/bpf_load.c| 345 --
 samples/bpf/bpf_load.h|  27 ---
 samples/bpf/fds_example.c |  26 +--
 samples/bpf/include/linux/err.h   |  56 +++
 samples/bpf/lathist_user.c|  13 +-
 samples/bpf/libbpf.c  | 154 -
 samples/bpf/sock_example.c|  13 +-
 samples/bpf/sockex1_kern.c|   2 +
 samples/bpf/sockex1_user.c|  27 +--
 samples/bpf/sockex2_kern.c|   2 +
 samples/bpf/sockex2_user.c|  26 +--
 samples/bpf/sockex3_kern.c|   2 +
 samples/bpf/sockex3_user.c|  23 ++-
 samples/bpf/test_maps.c   |  80 -
 samples/bpf/test_verifier.c   |  13 +-
 samples/bpf/trace_output_user.c   |  17 +-
 samples/bpf/tracex1_user.c|   9 +-
 samples/bpf/tracex2_user.c|  31 ++--
 samples/bpf/tracex3_user.c|  15 +-
 samples/bpf/tracex4_user.c|  15 +-
 samples/bpf/tracex5_kern.c|   1 +
 samples/bpf/tracex5_user.c|   9 +-
 samples/bpf/tracex6_user.c|  16 +-
 samples/bpf/utils.c   | 276 ++
 samples/bpf/{libbpf.h => utils.h} |  58 ---
 tools/lib/bpf/Makefile|   2 +
 tools/lib/bpf/bpf.c   |  65 ++-
 tools/lib/bpf/bpf.h   |  16 +-
 tools/lib/bpf/libbpf.c|  43 -
 tools/lib/bpf/libbpf.h|  16 ++
 31 files changed, 718 insertions(+), 745 deletions(-)
 delete mode 100644 samples/bpf/bpf_load.c
 delete mode 100644 samples/bpf/bpf_load.h
 create mode 100644 samples/bpf/include/linux/err.h
 delete mode 100644 samples/bpf/libbpf.c
 create mode 100644 samples/bpf/utils.c
 rename samples/bpf/{libbpf.h => utils.h} (81%)

-- 
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Daniel Wagner
Hi,

On 12/17/2015 06:23 AM, Wang Nan wrote:
> Since we already have libbpf in tools/lib, we don't need to maintain
> another bpf loader and operations library in samples/bpf.
> 
> In patchset:
> 
>  Patch 1/10 - 7/10 improves libbpf, add missing features to support
>  samples,
> 
>  Patch 8/10 adds utils.[ch], which creates similar API like old
>  bpf_load.c and libbpf.c.
> 
>  Patch 9/10 replace all sampels to use API provides by utils.[ch] and
>  libbpf.
> 
>  Patch 10/10 removes unneeded files.

Which tree did you use for your patches? I tried to apply them against
mainline and net-next which didn't really work out.

cheers,
daniel
--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Wangnan (F)



On 2015/12/17 14:38, Daniel Wagner wrote:

Hi,

On 12/17/2015 06:23 AM, Wang Nan wrote:

Since we already have libbpf in tools/lib, we don't need to maintain
another bpf loader and operations library in samples/bpf.

In patchset:

  Patch 1/10 - 7/10 improves libbpf, add missing features to support
  samples,

  Patch 8/10 adds utils.[ch], which creates similar API like old
  bpf_load.c and libbpf.c.

  Patch 9/10 replace all sampels to use API provides by utils.[ch] and
  libbpf.

  Patch 10/10 removes unneeded files.

Which tree did you use for your patches? I tried to apply them against
mainline and net-next which didn't really work out.


These patches based on Arnaldo's 'perf/core' because of those libbpf
changes.

Which tree is the right one for this? net-next?

Thank you.


cheers,
daniel



--
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: [PATCH 00/10] bpf samples: Uses libbpf in tools/lib to do BPF operations

2015-12-16 Thread Daniel Wagner
On 12/17/2015 07:51 AM, Wangnan (F) wrote:
> On 2015/12/17 14:38, Daniel Wagner wrote:
>> On 12/17/2015 06:23 AM, Wang Nan wrote:
>>> Since we already have libbpf in tools/lib, we don't need to maintain
>>> another bpf loader and operations library in samples/bpf.
>>>
>>> In patchset:
>>>
>>>   Patch 1/10 - 7/10 improves libbpf, add missing features to support
>>>   samples,
>>>
>>>   Patch 8/10 adds utils.[ch], which creates similar API like old
>>>   bpf_load.c and libbpf.c.
>>>
>>>   Patch 9/10 replace all sampels to use API provides by utils.[ch] and
>>>   libbpf.
>>>
>>>   Patch 10/10 removes unneeded files.
>> Which tree did you use for your patches? I tried to apply them against
>> mainline and net-next which didn't really work out.
> 
> These patches based on Arnaldo's 'perf/core' because of those libbpf
> changes.

Okay, I'll try with this one.

> Which tree is the right one for this? net-next?

The patches I was involved were routed via net-next but I don't know if
that is the right tree for this patch set.

cheers,
daniel
--
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/