[PATCH RFC bpf-next 09/10] arm: include: asm: swab: mask rev16 instruction for clang

2019-08-29 Thread Ivan Khoronzhuk
/tc_l2_redirect_kern.o :1:2: error: invalid register/token name rev16 r3, r0 This decision is arguable, probably there is another way, but it doesn't have impact on samples/bpf, so it's easier just ignore it for clang, at least for now. Signed-off-by: Ivan Khoronzhuk --- arch/arm/include/asm/swab.h | 3 +++ 1

[PATCH RFC bpf-next 04/10] samples: bpf: use own EXTRA_CFLAGS for clang commands

2019-08-29 Thread Ivan Khoronzhuk
It can overlap with CFLAGS used for libraries built with gcc if not now then in following patches. Correct it here for simplicity. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bpf/Makefile b/samples

[PATCH RFC bpf-next 07/10] samples: bpf: add makefile.prog for separate CC build

2019-08-29 Thread Ivan Khoronzhuk
eded for samples/bpf, potentially can be reused and sophisticated for other prog sets later and now needed only for unblocking tricky samples/bpf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.prog | 77 +++ 1 file changed, 77 insertions(+)

[PATCH RFC bpf-next 01/10] samples: bpf: Makefile: use --target from cross-compile

2019-08-29 Thread Ivan Khoronzhuk
For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH RFC bpf-next 10/10] arm: include: asm: unified: mask .syntax unified for clang

2019-08-29 Thread Ivan Khoronzhuk
verified it on clang 5, 6 ,7, 8, 9, 10 as on native platform as for cross-compiling. This decision is arguable, but it doesn't have impact on samples/bpf so it's easier just ignore it for clang, at least for now... Signed-off-by: Ivan Khoronzhuk --- arch/arm/include/asm/unified.h | 6 +- 1

[PATCH RFC bpf-next 03/10] libbpf: Makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets

2019-08-29 Thread Ivan Khoronzhuk
In case of LDFLAGS and EXTRA_CC flags there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf. In follow patches this is used for samples/bpf cross-compiling. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf

[PATCH RFC bpf-next 05/10] samples: bpf: Makefile: use vars from KBUILD_CFLAGS to handle linux headers

2019-08-29 Thread Ivan Khoronzhuk
The kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete configuration for clang. One of such configurations is __LINUX_ARM_ARCH__ min version used as instruction set selector. In another case an error like "SMP is not supported" for arm and others errors

Re: [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo"

2019-09-13 Thread Ivan Khoronzhuk
On Wed, Sep 11, 2019 at 02:02:11PM +0300, Sergei Shtylyov wrote: On 10.09.2019 17:54, Ivan Khoronzhuk wrote: Hello! On 10.09.2019 13:38, Ivan Khoronzhuk wrote: echo should be replaced on echo -e to handle \n correctly, but instead,  s/on/with/? s/echo/printf/ instead of s/echo/echo -e

Re: [PATCH bpf-next 05/11] samples: bpf: makefile: use D vars from KBUILD_CFLAGS to handle headers

2019-09-13 Thread Ivan Khoronzhuk
On Fri, Sep 13, 2019 at 09:12:01PM +, Yonghong Song wrote: On 9/10/19 11:38 AM, Ivan Khoronzhuk wrote: The kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete arch configuration for clang. But CLANG-bpf cmds are sensitive for assembler part taken

Re: [PATCH bpf-next 02/11] samples: bpf: makefile: fix cookie_uid_helper_example obj build

2019-09-13 Thread Ivan Khoronzhuk
On Fri, Sep 13, 2019 at 08:48:37PM +, Yonghong Song wrote: On 9/10/19 11:38 AM, Ivan Khoronzhuk wrote: Don't list userspace "cookie_uid_helper_example" object in list for bpf objects. per_socket_stats_example-opjs is used to list additional dependencies s/opjs/objs for

Re: [PATCH bpf-next 07/11] samples: bpf: add makefile.prog for separate CC build

2019-09-13 Thread Ivan Khoronzhuk
On Fri, Sep 13, 2019 at 09:33:58PM +, Yonghong Song wrote: On 9/10/19 11:38 AM, Ivan Khoronzhuk wrote: The makefile.prog is added only, will be used in sample/bpf/Makefile later in order to switch cross-compiling on CC from HOSTCC. The HOSTCC is supposed to build binaries and tools

Re: [PATCH bpf-next 08/11] samples: bpf: makefile: base progs build on makefile.progs

2019-09-13 Thread Ivan Khoronzhuk
On Fri, Sep 13, 2019 at 09:41:25PM +, Yonghong Song wrote: On 9/10/19 11:38 AM, Ivan Khoronzhuk wrote: The main reason for that - HOSTCC and CC have different aims. It was tested for arm cross compilation, based on linaro toolchain, but should work for others. In order to split cross

Re: [PATCH bpf-next 10/11] libbpf: makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets

2019-09-13 Thread Ivan Khoronzhuk
On Fri, Sep 13, 2019 at 09:43:22PM +, Yonghong Song wrote: On 9/10/19 11:38 AM, Ivan Khoronzhuk wrote: In case of LDFLAGS and EXTRA_CC/CXX flags there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf, wich

Re: [PATCH bpf-next 11/11] samples: bpf: makefile: add sysroot support

2019-09-13 Thread Ivan Khoronzhuk
On Fri, Sep 13, 2019 at 09:45:31PM +, Yonghong Song wrote: On 9/10/19 11:38 AM, Ivan Khoronzhuk wrote: Basically it only enables that was added by previous couple fixes. For sure, just make tools/include to be included after sysroot headers. export ARCH=arm export CROSS_COMPILE=arm-linux

[PATCH v3 bpf-next 02/14] samples: bpf: makefile: fix cookie_uid_helper_example obj build

2019-09-16 Thread Ivan Khoronzhuk
ve `always += cookie_uid_helper_example.o`, which avoids breaking cross compilation due to mismatched includes. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f50ca852c2a8..43dee90df

[PATCH v3 bpf-next 01/14] samples: bpf: makefile: fix HDR_PROBE "echo"

2019-09-16 Thread Ivan Khoronzhuk
echo should be replaced with echo -e to handle '\n' correctly, but instead, replace it with printf as some systems can't handle echo -e. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf

[PATCH v3 bpf-next 08/14] samples: bpf: makefile: base target programs rules on Makefile.target

2019-09-16 Thread Ivan Khoronzhuk
compilation (CC) with host build (HOSTCC), lets base samples on Makefile.target. It allows to cross-compile samples/bpf programs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 135 ++- 1

[PATCH v3 bpf-next 10/14] samples: bpf: makefile: use target CC environment for HDR_PROBE

2019-09-16 Thread Ivan Khoronzhuk
No need in hacking HOSTCC to be cross-compiler any more, so drop this trick and use target CC for HDR_PROBE. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index

[PATCH v3 bpf-next 07/14] samples: bpf: add makefile.target for separate CC target build

2019-09-16 Thread Ivan Khoronzhuk
pf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.target | 75 + 1 file changed, 75 insertions(+) create mode 100644 samples/bpf/Makefile.target diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target new fi

[PATCH v3 bpf-next 11/14] libbpf: makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets

2019-09-16 Thread Ivan Khoronzhuk
. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index c6f94cffe06e..bccfa556ef4e 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -94,6

[PATCH v3 bpf-next 13/14] samples: bpf: makefile: add sysroot support

2019-09-16 Thread Ivan Khoronzhuk
clean configure and install headers: make ARCH=arm defconfig make ARCH=arm headers_install build samples/bpf: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- samples/bpf/ \ SYSROOT="path/to/sysroot" Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 + 1 fi

[PATCH v3 bpf-next 14/14] samples: bpf: README: add preparation steps and sysroot info

2019-09-16 Thread Ivan Khoronzhuk
Add couple preparation steps: clean and configuration. Also add newly added sysroot support info to cross-compile section. --- samples/bpf/README.rst | 41 - 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/samples/bpf/README.rst

[PATCH v3 bpf-next 05/14] samples: bpf: makefile: use __LINUX_ARM_ARCH__ selector for arm

2019-09-16 Thread Ivan Khoronzhuk
For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction set selector and is absolutely required while parsing some parts of headers. It's present in KBUILD_CFLAGS but not in autoconf.h, so let's retrieve it from and add to programs cflags. In another case errors like "SMP is not

[PATCH v3 bpf-next 12/14] samples: bpf: makefile: provide C/CXX/LD flags to libbpf

2019-09-16 Thread Ivan Khoronzhuk
In order to build libs using C/CXX/LD flags of target arch, provide them to libbpf make. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 18ec22e7b444

[PATCH v3 bpf-next 09/14] samples: bpf: makefile: use own flags but not host when cross compile

2019-09-16 Thread Ivan Khoronzhuk
potential option mistmatches for existent environments. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 9 + 1 file changed, 9 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1579cc16a1c2..b5c87a8b8b51 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf

[PATCH v3 bpf-next 04/14] samples: bpf: use own EXTRA_CFLAGS for clang commands

2019-09-16 Thread Ivan Khoronzhuk
It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf

[PATCH v3 bpf-next 06/14] samples: bpf: makefile: drop unnecessarily inclusion for bpf_load

2019-09-16 Thread Ivan Khoronzhuk
Drop inclusion for bpf_load -I$(objtree)/usr/include as it is included for all objects anyway, with above line: KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf

[PATCH v3 bpf-next 03/14] samples: bpf: makefile: use --target from cross-compile

2019-09-16 Thread Ivan Khoronzhuk
For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v3 bpf-next 00/14] samples: bpf: improve/fix cross-compilation

2019-09-16 Thread Ivan Khoronzhuk
uild" - added fix: "samples: bpf: makefile: fix cookie_uid_helper_example obj build" - limited -D option filter only for arm - improved comments - added couple instructions to verify cross compilation for arm and arm64 arches based on TI am57xx and am65xx sdks. - corrected i

[PATCH bpf-next 1/2] selftests/bpf: add static to enable_all_controllers()

2019-10-02 Thread Ivan Khoronzhuk
. Signed-off-by: Ivan Khoronzhuk --- tools/testing/selftests/bpf/cgroup_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c index e95c33e333a4..4d74f3c4619b 100644 --- a/tools

[PATCH bpf-next 0/2] selftest/bpf: remove warns for enable_all_controllers

2019-10-02 Thread Ivan Khoronzhuk
This micro series fixes annoying warn described in patches while samples/bpf build. Second patch fixes new warn that comes after fixing warn of first patch, that was masked. Ivan Khoronzhuk (2): selftests/bpf: add static to enable_all_controllers() selftests/bpf: correct path to include msg

[PATCH bpf-next 2/2] selftests/bpf: correct path to include msg + path

2019-10-02 Thread Ivan Khoronzhuk
th); " In order to avoid warns, lets decrease buf size for cgroup workdir on 24 bytes with assumption to include also "/cgroup.subtree_control" to the address. The cut will never happen anyway. Signed-off-by: Ivan Khoronzhuk --- tools/testing/selftests/bpf/cgroup_helpers.c | 2

[PATCH bpf] libbpf: fix version identification on busybox

2019-09-19 Thread Ivan Khoronzhuk
][opts][,end[.offset][opts]] [-t CHAR] [FILE]... Lets modify command a little to avoid -V option. Fixes: dadb81d0afe732 ("libbpf: make libbpf.map source of truth for libbpf version") Signed-off-by: Ivan Khoronzhuk --- Based on bpf/master tools/lib/bpf/Makefile | 2 +- 1 file changed, 1

Re: [PATCH bpf] libbpf: fix version identification on busybox

2019-09-19 Thread Ivan Khoronzhuk
On Thu, Sep 19, 2019 at 07:05:18PM +0300, Ivan Khoronzhuk wrote: It's very often for embedded to have stripped version of sort in busybox, when no -V option present. It breaks build natively on target board causing recursive loop. BusyBox v1.24.1 (2019-04-06 04:09:16 UTC) multi-call binary

Re: [PATCH bpf] libbpf: fix version identification on busybox

2019-09-20 Thread Ivan Khoronzhuk
On Thu, Sep 19, 2019 at 01:02:40PM -0700, Andrii Nakryiko wrote: On Thu, Sep 19, 2019 at 11:22 AM Ivan Khoronzhuk wrote: It's very often for embedded to have stripped version of sort in busybox, when no -V option present. It breaks build natively on target board causing recursive loop

Re: [PATCH bpf] libbpf: fix version identification on busybox

2019-09-20 Thread Ivan Khoronzhuk
On Fri, Sep 20, 2019 at 09:41:54AM -0700, Andrii Nakryiko wrote: On Fri, Sep 20, 2019 at 1:22 AM Ivan Khoronzhuk wrote: On Thu, Sep 19, 2019 at 01:02:40PM -0700, Andrii Nakryiko wrote: >On Thu, Sep 19, 2019 at 11:22 AM Ivan Khoronzhuk > wrote: >> >> It's very often fo

Re: [PATCH bpf] libbpf: fix version identification on busybox

2019-09-20 Thread Ivan Khoronzhuk
On Fri, Sep 20, 2019 at 09:34:51PM +0300, Ivan Khoronzhuk wrote: On Fri, Sep 20, 2019 at 09:41:54AM -0700, Andrii Nakryiko wrote: On Fri, Sep 20, 2019 at 1:22 AM Ivan Khoronzhuk wrote: On Thu, Sep 19, 2019 at 01:02:40PM -0700, Andrii Nakryiko wrote: On Thu, Sep 19, 2019 at 11:22 AM Ivan

Re: [PATCH bpf] libbpf: fix version identification on busybox

2019-09-20 Thread Ivan Khoronzhuk
On Fri, Sep 20, 2019 at 10:19:43PM +0300, Ivan Khoronzhuk wrote: On Fri, Sep 20, 2019 at 09:34:51PM +0300, Ivan Khoronzhuk wrote: On Fri, Sep 20, 2019 at 09:41:54AM -0700, Andrii Nakryiko wrote: On Fri, Sep 20, 2019 at 1:22 AM Ivan Khoronzhuk wrote: On Thu, Sep 19, 2019 at 01:02:40PM -0700

Re: [PATCH bpf] libbpf: fix version identification on busybox

2019-09-20 Thread Ivan Khoronzhuk
On Fri, Sep 20, 2019 at 02:51:14PM -0700, Andrii Nakryiko wrote: On Fri, Sep 20, 2019 at 12:19 PM Ivan Khoronzhuk wrote: On Fri, Sep 20, 2019 at 09:34:51PM +0300, Ivan Khoronzhuk wrote: >On Fri, Sep 20, 2019 at 09:41:54AM -0700, Andrii Nakryiko wrote: >>On Fri, Sep 20, 2019 at 1:2

Re: [PATCH v2 bpf-next] mm: mmap: increase sockets maximum memory size pgoff for 32bits

2019-08-13 Thread Ivan Khoronzhuk
On Tue, Aug 13, 2019 at 10:02:54AM +0200, Magnus Karlsson wrote: On Mon, Aug 12, 2019 at 2:45 PM Ivan Khoronzhuk wrote: The AF_XDP sockets umem mapping interface uses XDP_UMEM_PGOFF_FILL_RING and XDP_UMEM_PGOFF_COMPLETION_RING offsets. The offsets seems like are established already

[PATCH bpf-next 3/3] samples: bpf: syscal_nrs: use mmap2 if defined

2019-08-13 Thread Ivan Khoronzhuk
For arm32 xdp sockets mmap2 is preferred, so use it if it's defined. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/syscall_nrs.c | 5 + samples/bpf/tracex5_kern.c | 11 +++ 2 files changed, 16 insertions(+) diff --git a/samples/bpf/syscall_nrs.c b/samples/bpf/syscall_nrs.c index

[PATCH bpf-next 2/3] xdp: xdp_umem: replace kmap on vmap for umem map

2019-08-13 Thread Ivan Khoronzhuk
block and should be used rather for dynamic mm. Signed-off-by: Ivan Khoronzhuk --- net/xdp/xdp_umem.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index a0607969f8c0..907c9019fe21 100644 --- a/net/xdp/xdp_umem.c +++ b

[PATCH bpf-next 0/3] xdpsock: allow mmap2 usage for 32bits

2019-08-13 Thread Ivan Khoronzhuk
uot; https://lkml.org/lkml/2019/8/12/549 Based on bpf-next/master Ivan Khoronzhuk (3): libbpf: add asm/unistd.h to xsk to get __NR_mmap2 xdp: xdp_umem: replace kmap on vmap for umem map samples: bpf: syscal_nrs: use mmap2 if defined net/xdp/xdp_umem.c | 16 s

[PATCH bpf-next 1/3] libbpf: add asm/unistd.h to xsk to get __NR_mmap2

2019-08-13 Thread Ivan Khoronzhuk
That's needed to get __NR_mmap2 when mmap2 syscall is used. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/xsk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index 5007b5d4fd2c..f2fc40f9804c 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf

Re: [PATCH bpf-next 2/3] xdp: xdp_umem: replace kmap on vmap for umem map

2019-08-13 Thread Ivan Khoronzhuk
On Tue, Aug 13, 2019 at 10:42:18AM -0700, Jonathan Lemon wrote: On 13 Aug 2019, at 3:23, Ivan Khoronzhuk wrote: For 64-bit there is no reason to use vmap/vunmap, so use page_address as it was initially. For 32 bits, in some apps, like in samples xdpsock_user.c when number of pgs in use

Re: [PATCH bpf-next 3/3] samples: bpf: syscal_nrs: use mmap2 if defined

2019-08-13 Thread Ivan Khoronzhuk
On Tue, Aug 13, 2019 at 10:41:54AM -0700, Jonathan Lemon wrote: On 13 Aug 2019, at 3:23, Ivan Khoronzhuk wrote: For arm32 xdp sockets mmap2 is preferred, so use it if it's defined. Signed-off-by: Ivan Khoronzhuk Doesn't this change the application API? -- Jonathan From what I know

Re: [PATCH bpf-next 1/3] libbpf: add asm/unistd.h to xsk to get __NR_mmap2

2019-08-14 Thread Ivan Khoronzhuk
On Tue, Aug 13, 2019 at 04:38:13PM -0700, Andrii Nakryiko wrote: Hi, Andrii On Tue, Aug 13, 2019 at 3:24 AM Ivan Khoronzhuk wrote: That's needed to get __NR_mmap2 when mmap2 syscall is used. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/xsk.c | 1 + 1 file changed, 1 insertion

Re: [PATCH bpf-next 1/3] libbpf: add asm/unistd.h to xsk to get __NR_mmap2

2019-08-14 Thread Ivan Khoronzhuk
On Wed, Aug 14, 2019 at 12:32:41AM +, Yonghong Song wrote: Hi, Yonghong Song On 8/13/19 3:23 AM, Ivan Khoronzhuk wrote: That's needed to get __NR_mmap2 when mmap2 syscall is used. It seems I did not have this issue on x64 machine e.g., Fedora 29. My glibc version is 2.28. gcc 8.2.1

Re: [PATCH bpf-next 1/3] libbpf: add asm/unistd.h to xsk to get __NR_mmap2

2019-08-14 Thread Ivan Khoronzhuk
On Wed, Aug 14, 2019 at 12:24:05PM +0300, Ivan Khoronzhuk wrote: On Tue, Aug 13, 2019 at 04:38:13PM -0700, Andrii Nakryiko wrote: Hi, Andrii On Tue, Aug 13, 2019 at 3:24 AM Ivan Khoronzhuk wrote: That's needed to get __NR_mmap2 when mmap2 syscall is used. Signed-off-by: Ivan Khoronzhuk

Re: [PATCH v2 bpf-next] mm: mmap: increase sockets maximum memory size pgoff for 32bits

2019-08-14 Thread Ivan Khoronzhuk
On Mon, Aug 12, 2019 at 02:19:24PM -0700, Andrew Morton wrote: Hi, Andrew On Mon, 12 Aug 2019 15:43:26 +0300 Ivan Khoronzhuk wrote: The AF_XDP sockets umem mapping interface uses XDP_UMEM_PGOFF_FILL_RING and XDP_UMEM_PGOFF_COMPLETION_RING offsets. The offsets seems like are established

Re: [PATCH bpf-next 1/3] libbpf: add asm/unistd.h to xsk to get __NR_mmap2

2019-08-14 Thread Ivan Khoronzhuk
On Wed, Aug 14, 2019 at 03:32:24PM +0200, Björn Töpel wrote: On Wed, 14 Aug 2019 at 13:57, Ivan Khoronzhuk wrote: On Wed, Aug 14, 2019 at 12:24:05PM +0300, Ivan Khoronzhuk wrote: >On Tue, Aug 13, 2019 at 04:38:13PM -0700, Andrii Nakryiko wrote: > >Hi, Andrii > >>On Tue, Au

[PATCH bpf-next] mm: mmap: increase sockets maximum memory size pgoff for 32bits

2019-08-12 Thread Ivan Khoronzhuk
maximum allowed file size verification. The offsets can be tuned ofc, but instead of changing existent interface - extend max allowed file size for sockets. The 64-bit systems seems like ok with this, so extend threshold only for 32-bits for now. Signed-off-by: Ivan Khoronzhuk --- Based on bpf-next

[PATCH v2 bpf-next] mm: mmap: increase sockets maximum memory size pgoff for 32bits

2019-08-12 Thread Ivan Khoronzhuk
maximum allowed file size verification. The offsets can be tuned ofc, but instead of changing existent interface - extend max allowed file size for sockets. Signed-off-by: Ivan Khoronzhuk --- Based on bpf-next/master v2..v1: removed not necessarily #ifdev as ULL and UL for 64 has same size

[PATCH v4 bpf-next 00/15] samples: bpf: improve/fix cross-compilation

2019-10-09 Thread Ivan Khoronzhuk
ited -D option filter only for arm - improved comments - added couple instructions to verify cross compilation for arm and arm64 arches based on TI am57xx and am65xx sdks. - corrected include a little order Ivan Khoronzhuk (15): samples/bpf: fix HDR_PROBE "echo" samples/bpf: fi

[PATCH v4 bpf-next 04/15] samples/bpf: use own EXTRA_CFLAGS for clang commands

2019-10-09 Thread Ivan Khoronzhuk
It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/samples

[PATCH v4 bpf-next 03/15] samples/bpf: use --target from cross-compile

2019-10-09 Thread Ivan Khoronzhuk
For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1

[PATCH v4 bpf-next 09/15] samples/bpf: use own flags but not HOSTCFLAGS

2019-10-09 Thread Ivan Khoronzhuk
-Wmissing-prototypes -Wstrict-prototypes So, add them as they were verified and used before adding Makefile.target and lets omit "-fomit-frame-pointer" as were proposed while review, as no sense in such optimization for samples. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 6

[PATCH v4 bpf-next 10/15] samples/bpf: use target CC environment for HDR_PROBE

2019-10-09 Thread Ivan Khoronzhuk
No need in hacking HOSTCC to be cross-compiler any more, so drop this trick and use target CC for HDR_PROBE. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/bpf/Makefile b/samples

[PATCH v4 bpf-next 14/15] samples/bpf: add sysroot support

2019-10-09 Thread Ivan Khoronzhuk
clean configure and install headers: make ARCH=arm defconfig make ARCH=arm headers_install build samples/bpf: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- samples/bpf/ \ SYSROOT="path/to/sysroot" Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 +++

[PATCH v4 bpf-next 12/15] libbpf: add C/LDFLAGS to libbpf.so and test_libpf targets

2019-10-09 Thread Ivan Khoronzhuk
In case of C/LDFLAGS there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf, wich can be absent in toolchain. This can be used for samples/bpf cross-compiling allowing to get elf lib from sysroot. Signed-off-by: Ivan

[PATCH v4 bpf-next 13/15] samples/bpf: provide C/LDFLAGS to libbpf

2019-10-09 Thread Ivan Khoronzhuk
In order to build lib using C/LD flags of target arch, provide them to libbpf make. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index a6c33496e8ca..6b161326ac67 100644

[PATCH v4 bpf-next 15/15] samples/bpf: add preparation steps and sysroot info to readme

2019-10-09 Thread Ivan Khoronzhuk
Add couple preparation steps: clean and configuration. Also add newly added sysroot support info to cross-compile section. --- samples/bpf/README.rst | 41 - 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/samples/bpf/README.rst

[PATCH v4 bpf-next 11/15] libbpf: don't use cxx to test_libpf target

2019-10-09 Thread Ivan Khoronzhuk
lso remove spaces at start of the lines to keep same style and avoid warns while apply. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 18 +- .../lib/bpf/{test_libbpf.cpp => test_libbpf.c} | 14 -- 2 files changed, 13 insertions(+),

[PATCH v4 bpf-next 06/15] samples/bpf: drop unnecessarily inclusion for bpf_load

2019-10-09 Thread Ivan Khoronzhuk
Drop inclusion for bpf_load -I$(objtree)/usr/include as it is included for all objects anyway, with above line: KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v4 bpf-next 07/15] samples/bpf: add makefile.target for separate CC target build

2019-10-09 Thread Ivan Khoronzhuk
pf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.target | 75 + 1 file changed, 75 insertions(+) create mode 100644 samples/bpf/Makefile.target diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target new fi

[PATCH v4 bpf-next 08/15] samples/bpf: base target programs rules on Makefile.target

2019-10-09 Thread Ivan Khoronzhuk
compilation (CC) with host build (HOSTCC), lets base samples on Makefile.target. It allows to cross-compile samples/bpf programs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 135 ++- 1

[PATCH v4 bpf-next 05/15] samples/bpf: use __LINUX_ARM_ARCH__ selector for arm

2019-10-09 Thread Ivan Khoronzhuk
For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction set selector and is absolutely required while parsing some parts of headers. It's present in KBUILD_CFLAGS but not in autoconf.h, so let's retrieve it from and add to programs cflags. In another case errors like "SMP is not

[PATCH v4 bpf-next 02/15] samples/bpf: fix cookie_uid_helper_example obj build

2019-10-09 Thread Ivan Khoronzhuk
ve `always += cookie_uid_helper_example.o`, which avoids breaking cross compilation due to mismatched includes. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4f

[PATCH v4 bpf-next 01/15] samples/bpf: fix HDR_PROBE "echo"

2019-10-09 Thread Ivan Khoronzhuk
echo should be replaced with echo -e to handle '\n' correctly, but instead, replace it with printf as some systems can't handle echo -e. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf

[PATCH v5 bpf-next 01/15] samples/bpf: fix HDR_PROBE "echo"

2019-10-10 Thread Ivan Khoronzhuk
echo should be replaced with echo -e to handle '\n' correctly, but instead, replace it with printf as some systems can't handle echo -e. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples

[PATCH v5 bpf-next 15/15] samples/bpf: add preparation steps and sysroot info to readme

2019-10-10 Thread Ivan Khoronzhuk
Add couple preparation steps: clean and configuration. Also add newly added sysroot support info to cross-compile section. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/README.rst | 41 - 1 file changed, 36 insertions(+), 5 deletions(-) diff --git

[PATCH v5 bpf-next 04/15] samples/bpf: use own EXTRA_CFLAGS for clang commands

2019-10-10 Thread Ivan Khoronzhuk
It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/samples

[PATCH v5 bpf-next 14/15] samples/bpf: add sysroot support

2019-10-10 Thread Ivan Khoronzhuk
clean configure and install headers: make ARCH=arm defconfig make ARCH=arm headers_install build samples/bpf: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- samples/bpf/ \ SYSROOT="path/to/sysroot" Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 +++

Re: [PATCH v4 bpf-next 00/15] samples: bpf: improve/fix cross-compilation

2019-10-10 Thread Ivan Khoronzhuk
On Fri, Oct 11, 2019 at 02:00:56AM +0200, Daniel Borkmann wrote: On Wed, Oct 09, 2019 at 11:41:19PM +0300, Ivan Khoronzhuk wrote: This series contains mainly fixes/improvements for cross-compilation but not only, tested for arm, arm64, and intended for any arch. Also verified on native build

[PATCH v5 bpf-next 11/15] libbpf: don't use cxx to test_libpf target

2019-10-10 Thread Ivan Khoronzhuk
lso remove spaces at start of the lines to keep same style and avoid warns while apply. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 18 +- .../lib/bpf/{test_libbpf.cpp => test_libbpf.c} | 14 -- 2 file

[PATCH v5 bpf-next 05/15] samples/bpf: use __LINUX_ARM_ARCH__ selector for arm

2019-10-10 Thread Ivan Khoronzhuk
t;SMP is not supported" for armv7 and bunch of other errors are issued resulting to incorrect final object. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 8 1 file changed, 8 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index cf882e43648a..9b33e7395

[PATCH v5 bpf-next 13/15] samples/bpf: provide C/LDFLAGS to libbpf

2019-10-10 Thread Ivan Khoronzhuk
In order to build lib using C/LD flags of target arch, provide them to libbpf make. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index a6c33496e8ca..6b161326ac67 100644

[PATCH v5 bpf-next 02/15] samples/bpf: fix cookie_uid_helper_example obj build

2019-10-10 Thread Ivan Khoronzhuk
ve `always += cookie_uid_helper_example.o`, which avoids breaking cross compilation due to mismatched includes. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 4f

[PATCH v5 bpf-next 08/15] samples/bpf: base target programs rules on Makefile.target

2019-10-10 Thread Ivan Khoronzhuk
compilation (CC) with host build (HOSTCC), lets base samples on Makefile.target. It allows to cross-compile samples/bpf programs with CC while auxialry tools running on host built with HOSTCC. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 135 ++- 1

[PATCH v5 bpf-next 09/15] samples/bpf: use own flags but not HOSTCFLAGS

2019-10-10 Thread Ivan Khoronzhuk
-Wmissing-prototypes -Wstrict-prototypes So, add them as they were verified and used before adding Makefile.target and lets omit "-fomit-frame-pointer" as were proposed while review, as no sense in such optimization for samples. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 6

[PATCH v5 bpf-next 12/15] libbpf: add C/LDFLAGS to libbpf.so and test_libpf targets

2019-10-10 Thread Ivan Khoronzhuk
In case of C/LDFLAGS there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf, wich can be absent in toolchain. This can be used for samples/bpf cross-compiling allowing to get elf lib from sysroot. Signed-off-by: Ivan

[PATCH v5 bpf-next 06/15] samples/bpf: drop unnecessarily inclusion for bpf_load

2019-10-10 Thread Ivan Khoronzhuk
Drop inclusion for bpf_load -I$(objtree)/usr/include as it is included for all objects anyway, with above line: KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v5 bpf-next 07/15] samples/bpf: add makefile.target for separate CC target build

2019-10-10 Thread Ivan Khoronzhuk
pf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.target | 75 + 1 file changed, 75 insertions(+) create mode 100644 samples/bpf/Makefile.target diff --git a/samples/bpf/Makefile.target b/samples/bpf/Makefile.target new fi

[PATCH v5 bpf-next 10/15] samples/bpf: use target CC environment for HDR_PROBE

2019-10-10 Thread Ivan Khoronzhuk
No need in hacking HOSTCC to be cross-compiler any more, so drop this trick and use target CC for HDR_PROBE. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/bpf/Makefile b/samples

[PATCH v5 bpf-next 00/15] samples: bpf: improve/fix cross-compilation

2019-10-10 Thread Ivan Khoronzhuk
ile: fix cookie_uid_helper_example obj build" - limited -D option filter only for arm - improved comments - added couple instructions to verify cross compilation for arm and arm64 arches based on TI am57xx and am65xx sdks. - corrected include a little order Ivan Khoronzhuk (15): samples/bpf: fix

[PATCH v5 bpf-next 03/15] samples/bpf: use --target from cross-compile

2019-10-10 Thread Ivan Khoronzhuk
For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Acked-by: Andrii Nakryiko Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1

Re: [PATCH v5 bpf-next 05/15] samples/bpf: use __LINUX_ARM_ARCH__ selector for arm

2019-10-11 Thread Ivan Khoronzhuk
On Fri, Oct 11, 2019 at 11:46:54AM +0300, Sergei Shtylyov wrote: Hello! Sorry, didn't comment on v4... On 11.10.2019 3:27, Ivan Khoronzhuk wrote: For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction set selector and is absolutely required while parsing some parts of headers

Re: [PATCH v5 bpf-next 09/15] samples/bpf: use own flags but not HOSTCFLAGS

2019-10-11 Thread Ivan Khoronzhuk
On Fri, Oct 11, 2019 at 11:49:38AM +0300, Sergei Shtylyov wrote: More grammar nitpicking... On 11.10.2019 3:28, Ivan Khoronzhuk wrote: While compiling natively, the host's cflags and ldflags are equal to ones used from HOSTCFLAGS and HOSTLDFLAGS. When cross compiling it should have own

Re: [PATCH v5 bpf-next 09/15] samples/bpf: use own flags but not HOSTCFLAGS

2019-10-12 Thread Ivan Khoronzhuk
On Fri, Oct 11, 2019 at 02:16:05PM +0300, Sergei Shtylyov wrote: On 10/11/2019 12:57 PM, Ivan Khoronzhuk wrote: While compiling natively, the host's cflags and ldflags are equal to ones used from HOSTCFLAGS and HOSTLDFLAGS. When cross compiling it should have own, used for target arch. While

[PATCH bpf-next 2/8] samples: bpf: Makefile: remove target for native build

2019-09-04 Thread Ivan Khoronzhuk
-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 61b7394b811e..a2953357927e 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -197,8 +197,6 @@ BTF_PAHOLE ?= pahole ifdef CROSS_COMPILE

[PATCH bpf-next 1/8] samples: bpf: Makefile: use --target from cross-compile

2019-09-04 Thread Ivan Khoronzhuk
For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH bpf-next 5/8] samples: bpf: Makefile: use vars from KBUILD_CFLAGS to handle linux headers

2019-09-04 Thread Ivan Khoronzhuk
The kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete configuration for clang. One of such configurations is __LINUX_ARM_ARCH__ min version used as instruction set selector. In another case an error like "SMP is not supported" for arm and others errors

[PATCH bpf-next 3/8] libbpf: Makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets

2019-09-04 Thread Ivan Khoronzhuk
In case of LDFLAGS and EXTRA_CC flags there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf. In follow up patches this is used for samples/bpf cross-compiling getting elf lib from sysroot. Signed-off-by: Ivan

[PATCH bpf-next 7/8] samples: bpf: add makefile.prog for separate CC build

2019-09-04 Thread Ivan Khoronzhuk
eded for samples/bpf, potentially can be reused and extended for other prog sets later and now needed only for unblocking tricky samples/bpf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.prog | 77 +++ 1 file changed, 77 insertions(+) create

[PATCH bpf-next 6/8] samples: bpf: makefile: fix HDR_PROBE "echo"

2019-09-04 Thread Ivan Khoronzhuk
echo should be replaced on echo -e to handle \n correctly, but instead, replace it on printf as some systems can't handle echo -e. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf

[PATCH bpf-next 8/8] samples: bpf: Makefile: base progs build on Makefile.progs

2019-09-04 Thread Ivan Khoronzhuk
ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- make samples/bpf/ SYSROOT="path/to/sysroot" Sysroot contains correct headers installed ofc. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 164 - samples/bpf/README.rst | 7 ++ 2 fil

[PATCH bpf-next 4/8] samples: bpf: use own EXTRA_CFLAGS for clang commands

2019-09-04 Thread Ivan Khoronzhuk
It can overlap with CFLAGS used for libraries built with gcc if not now then in next patches. Correct it here for simplicity. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf

[PATCH bpf-next 0/8] samples: bpf: improve/fix cross-compilation

2019-09-04 Thread Ivan Khoronzhuk
, some warn options could be tuned also. Ivan Khoronzhuk (8): samples: bpf: Makefile: use --target from cross-compile samples: bpf: Makefile: remove target for native build libbpf: Makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets samples: bpf: use own EXTRA_CFLAGS

Re: [PATCH bpf-next 2/8] samples: bpf: Makefile: remove target for native build

2019-09-06 Thread Ivan Khoronzhuk
On Fri, Sep 06, 2019 at 04:31:39PM -0700, Alexei Starovoitov wrote: On Thu, Sep 05, 2019 at 12:22:06AM +0300, Ivan Khoronzhuk wrote: No need to set --target for native build, at least for arm, the default target will be used anyway. In case of arm, for at least clang 5 - 10 it causes error like

Re: [PATCH bpf-next 2/8] samples: bpf: Makefile: remove target for native build

2019-09-06 Thread Ivan Khoronzhuk
On Fri, Sep 06, 2019 at 05:04:08PM -0700, Alexei Starovoitov wrote: On Fri, Sep 6, 2019 at 4:52 PM Ivan Khoronzhuk wrote: On Fri, Sep 06, 2019 at 04:31:39PM -0700, Alexei Starovoitov wrote: >On Thu, Sep 05, 2019 at 12:22:06AM +0300, Ivan Khoronzhuk wrote: >> No need to set --target f

<    4   5   6   7   8   9   10   11   12   13   >