Re: [PATCH vhost v13 04/12] virtio_ring: support add premapped buf

2024-06-05 Thread Ilya Leoshkevich
On Tue, 2024-06-04 at 18:17 +0200, Alexander Potapenko wrote: > On Tue, Jun 4, 2024 at 6:07 PM Ilya Leoshkevich > wrote: > > > > On Thu, 2023-08-10 at 20:30 +0800, Xuan Zhuo wrote: > > > If the vq is the premapped mode, use the sg_dma_address() > > > direct

Re: [PATCH vhost v13 04/12] virtio_ring: support add premapped buf

2024-06-04 Thread Ilya Leoshkevich
On Thu, 2023-08-10 at 20:30 +0800, Xuan Zhuo wrote: > If the vq is the premapped mode, use the sg_dma_address() directly. > > Signed-off-by: Xuan Zhuo > --- >  drivers/virtio/virtio_ring.c | 19 +-- >  1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/drivers/virti

Re: [PATCH 1/2] tools, bpf_asm: Hard error on out of range jumps.

2021-02-24 Thread Ilya Leoshkevich
intf(stderr, "warning: insn #%d jumps to insn #%d, " > +   if (delta < 0 || delta > 255) { > +   fprintf(stderr, "error: insn #%d jumps to insn #%d, " > "which is out of range\n", i, off); > +   exit(1); > +   } > return (uint8_t) delta; >  } >   Acked-by: Ilya Leoshkevich

Re: More strict error checking in bpf_asm?

2021-02-23 Thread Ilya Leoshkevich
On Tue, 2021-02-23 at 15:26 -0500, Ian Denhardt wrote: > Hi, > > I'm using the `bpf_asm` tool to do some syscall filtering, and found > out > the hard way that its error checking isn't very strict. In particular, > it issues a warning (not an error) when a jump offset overflows the > instruction's

Re: [PATCH] Revert "test_bpf: flag tests that cannot be jited on s390"

2020-07-16 Thread Ilya Leoshkevich
{ { 1, 0xbee } }, > .fill_helper = bpf_fill_ld_abs_get_processor_id, > - .expected_errcode = -ENOTSUPP, > }, > /* >* LD_IND / LD_ABS on fragmented SKBs Thank you for the fix! I tested it and it indeed fixes these 4 failures. I will have a look at the remaining 8 tomorrow. Reviewed-by: Ilya Leoshkevich

Re: [RFC] .BTF section data alignment issue on s390

2020-06-11 Thread Ilya Leoshkevich
On Thu, 2020-06-11 at 22:50 +0200, Jiri Olsa wrote: > hi, > we're hitting a problem on s390 with BTF data alignment. > > When running simple test, we're getting this message from > verifier and console: > > bpf_common.c:91: BROK: Failed verification: in-kernel BTF is > malformed > [ 41.5455

Re: [PATCH bpf-next 1/6] selftests/bpf: undo GCC-specific bpf_helpers.h changes

2019-10-01 Thread Ilya Leoshkevich
\ > struct btf_map_##name { \ > type_key key; \ > -- > 2.17.1 > Acked-by: Ilya Leoshkevich

Re: [PATCH bpf-next v2 0/4] tools: bpftool: improve bpftool build experience

2019-08-30 Thread Ilya Leoshkevich
n-zero (even if binary is successfully produced). > - Run "make clean" from bpf/ and not only bpf/bpftool/ in that same script, > when relevant. > - Add a patch to clean up generated "feature/" and "libbpf/" directories. > > Cc: Lorenz Bauer > C

Re: [PATCH bpf-next 2/3] tools: bpftool: improve and check builds for different make invocations

2019-08-29 Thread Ilya Leoshkevich
> Am 29.08.2019 um 12:56 schrieb Quentin Monnet : > > +make_and_clean() { > + echo -e "\$PWD:$PWD" > + echo -e "command: make -s $* >/dev/null" > + make $J -s $* >/dev/null Would it make sense to set ERROR=1 if make produces a bpftool binary, but still fails with a non-zero RC for

Re: [RESEND][PATCH v3 bpf-next] btf: expose BTF info through sysfs

2019-08-19 Thread Ilya Leoshkevich
> Am 12.08.2019 um 20:39 schrieb Andrii Nakryiko : > > @@ -92,23 +92,34 @@ vmlinux_link() > } > > # generate .BTF typeinfo from DWARF debuginfo > +# ${1} - vmlinux image > +# ${2} - file to dump raw BTF data into > gen_btf() > { > - local pahole_ver; > + local pahole_ver > + local bin

[PATCH bpf] s390/bpf: fix lcgr instruction encoding

2019-08-12 Thread Ilya Leoshkevich
that the wrong opcode was used. Fix by using the correct opcode. Signed-off-by: Ilya Leoshkevich --- arch/s390/net/bpf_jit_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index e636728ab452..6299156f9738 100644

Re: [PATCH bpf-next 1/9] selftests/bpf: prevent headers to be compiled as C code

2019-07-31 Thread Ilya Leoshkevich
> Am 27.07.2019 um 20:53 schrieb Andrii Nakryiko : > > On Fri, Jul 26, 2019 at 3:01 PM Stanislav Fomichev wrote: >> >> On 07/26, Andrii Nakryiko wrote: >>> On Fri, Jul 26, 2019 at 2:21 PM Stanislav Fomichev wrote: On 07/26, Andrii Nakryiko wrote: > Apprently listing header as a n

Re: [PATCH bpf] tools/bpf: fix bpftool build with OUTPUT set

2019-07-23 Thread Ilya Leoshkevich
> Am 19.07.2019 um 20:17 schrieb Jakub Kicinski : > > On Fri, 19 Jul 2019 15:12:24 +0200, Ilya Leoshkevich wrote: >>> Am 18.07.2019 um 20:51 schrieb Jakub Kicinski >>> : >>> >>> We should probably make a script with all the ways of calling make >

Re: [PATCH bpf] tools/bpf: fix bpftool build with OUTPUT set

2019-07-19 Thread Ilya Leoshkevich
> Am 18.07.2019 um 20:51 schrieb Jakub Kicinski : > > We should probably make a script with all the ways of calling make > should work. Otherwise we can lose track too easily. Thanks for the script! I’m trying to make it all pass now, and hitting a weird issue in the Kbuild case. The build print

[PATCH bpf v3] bpf: fix narrower loads on s390

2019-07-19 Thread Ilya Leoshkevich
ft count calculation to account for endianness. Fixes: 31fd85816dbe ("bpf: permits narrower load from bpf program context fields") Signed-off-by: Ilya Leoshkevich --- v1 -> v2: extract endianness-dependent code into a separate function v2 -> v3: rename the function and move i

[PATCH bpf] selftests/bpf: fix sendmsg6_prog on s390

2019-07-19 Thread Ilya Leoshkevich
point of the test, replace two short comparisons with a single int comparison. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/progs/sendmsg6_prog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/sendmsg6_prog.c b/tools/t

[PATCH bpf v2] bpf: fix narrower loads on s390

2019-07-18 Thread Ilya Leoshkevich
ft count calculation to account for endianness. Fixes: 31fd85816dbe ("bpf: permits narrower load from bpf program context fields") Signed-off-by: Ilya Leoshkevich --- include/linux/filter.h | 13 + kernel/bpf/verifier.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deleti

[PATCH bpf] tools/bpf: fix bpftool build with OUTPUT set

2019-07-18 Thread Ilya Leoshkevich
ix by invoking libbpf build in a manner similar to $(call descend) - descend itself cannot be used, since libbpf is a sibling, and not a child, of bpftool. Also, don't link bpftool with libbpf.a twice. Signed-off-by: Ilya Leoshkevich --- tools/bpf/bpftool/Makefile | 17 ++--- 1 fi

[PATCH bpf] selftests/bpf: fix "valid read map access into a read-only array 1" on s390

2019-07-18 Thread Ilya Leoshkevich
This test looks up a 32-bit map element and then loads it using a 64-bit load. This does not work on s390, which is a big-endian machine. Since the point of this test doesn't seem to be loading a smaller value using a larger load, simply use a 32-bit load. Signed-off-by: Ilya Leoshk

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-17 Thread Ilya Leoshkevich
> Am 17.07.2019 um 18:25 schrieb Y Song : > > On Wed, Jul 17, 2019 at 3:36 AM Ilya Leoshkevich wrote: >> >> >> Here is a better one: len=0x11223344 and we would like to do >> ((u8 *)&len)[3]. >> >> len is represented as `11 22 33 44` in me

[PATCH bpf] selftests/bpf: fix test_xdp_noinline on s390

2019-07-17 Thread Ilya Leoshkevich
test_xdp_noinline fails on s390 due to a handful of endianness issues. Use ntohs for parsing eth_proto. Replace bswaps with ntohs/htons. Signed-off-by: Ilya Leoshkevich Acked-by: Vasily Gorbik --- .../selftests/bpf/progs/test_xdp_noinline.c | 17 + 1 file changed, 9

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-17 Thread Ilya Leoshkevich
> Am 17.07.2019 um 11:21 schrieb Ilya Leoshkevich : > >> Am 17.07.2019 um 07:11 schrieb Y Song : >> >> [sorry, resend again as previous one has come text messed out due to >> networking issues] >> >> On Tue, Jul 16, 2019 at 10:08 PM Y Song wrote: >

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-17 Thread Ilya Leoshkevich
> Am 17.07.2019 um 07:11 schrieb Y Song : > > [sorry, resend again as previous one has come text messed out due to > networking issues] > > On Tue, Jul 16, 2019 at 10:08 PM Y Song wrote: >> >> On Tue, Jul 16, 2019 at 4:59 AM Ilya Leoshkevich wrote: >>>

Re: [PATCH bpf] selftests/bpf: make directory prerequisites order-only

2019-07-17 Thread Ilya Leoshkevich
> Am 16.07.2019 um 19:49 schrieb Alexei Starovoitov > : > > On Mon, Jul 15, 2019 at 3:22 PM Daniel Borkmann wrote: >> >> On 7/12/19 3:56 PM, Ilya Leoshkevich wrote: >>> When directories are used as prerequisites in Makefiles, they can cause >>>

[PATCH bpf] selftests/bpf: fix perf_buffer on s390

2019-07-16 Thread Ilya Leoshkevich
perf_buffer test fails for exactly the same reason test_attach_probe used to fail: different nanosleep syscall kprobe name. Reuse the test_attach_probe fix. Fixes: ee5cf82ce04a ("selftests/bpf: test perf buffer API") Signed-off-by: Ilya Leoshkevich --- .../testing/selftests/bpf/

[PATCH bpf] bpf: fix narrower loads on s390

2019-07-16 Thread Ilya Leoshkevich
shift and a bitwise AND, it assumes that the machine is little endian. Adjust shift count calculation to account for endianness. Fixes: 31fd85816dbe ("bpf: permits narrower load from bpf program context fields") Signed-off-by: Ilya Leoshkevich --- kernel/bpf/verifier.c | 8 ++

[PATCH bpf v2] selftests/bpf: skip nmi test when perf hw events are disabled

2019-07-16 Thread Ilya Leoshkevich
Some setups (e.g. virtual machines) might run with hardware perf events disabled. If this is the case, skip the test_send_signal_nmi test. Add a separate test involving a software perf event. This allows testing the perf event path regardless of hardware perf event support. Signed-off-by: Ilya

[PATCH bpf v3] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-16 Thread Ilya Leoshkevich
BPF_LDX_MEM is used to load the least significant byte of the retrieved test_val.index, however, on big-endian machines it ends up retrieving the most significant byte. Change the test to load the whole int in order to make it endianness-independent. Signed-off-by: Ilya Leoshkevich --- v1->

[PATCH bpf] samples/bpf: build with -D__TARGET_ARCH_$(SRCARCH)

2019-07-15 Thread Ilya Leoshkevich
While $ARCH can be relatively flexible (see Makefile and tools/scripts/Makefile.arch), $SRCARCH always corresponds to a directory name under arch/. Therefore, build samples with -D__TARGET_ARCH_$(SRCARCH), since that matches the expectations of bpf_helpers.h. Signed-off-by: Ilya Leoshkevich

[PATCH bpf] selftests/bpf: fix test_send_signal_nmi on s390

2019-07-12 Thread Ilya Leoshkevich
Many s390 setups (most notably, KVM guests) do not have access to hardware performance events. Therefore, use the software event instead. Signed-off-by: Ilya Leoshkevich Acked-by: Vasily Gorbik --- tools/testing/selftests/bpf/prog_tests/send_signal.c | 9 + 1 file changed, 9

[PATCH bpf] selftests/bpf: put test_stub.o into $(OUTPUT)

2019-07-12 Thread Ilya Leoshkevich
Add a rule to put test_stub.o in $(OUTPUT) and change the references to it accordingly. This prevents test_stub.o from being created in the source directory. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/Makefile | 7 +-- 1 file changed, 5 insertions(+), 2 deletions

[PATCH bpf] selftests/bpf: make directory prerequisites order-only

2019-07-12 Thread Ilya Leoshkevich
depends on, which is the case for selftests/bpf, this directory should be specified as an order-only prerequisite: it would still be created in case it does not exist, but it would not trigger a rebuild of a target in case it's considered changed. Signed-off-by: Ilya Leoshkevich --- tools/te

[PATCH bpf] selftests/bpf: fix attach_probe on s390

2019-07-12 Thread Ilya Leoshkevich
ftests/bpf: add kprobe/uprobe selftests") Signed-off-by: Ilya Leoshkevich Acked-by: Vasily Gorbik --- tools/testing/selftests/bpf/prog_tests/attach_probe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c b/tools/testing/selftests

Re: [PATCH v4 bpf-next 1/4] selftests/bpf: compile progs with -D__TARGET_ARCH_$(SRCARCH)

2019-07-12 Thread Ilya Leoshkevich
> Am 12.07.2019 um 02:53 schrieb Andrii Nakryiko : > > On Thu, Jul 11, 2019 at 7:32 AM Ilya Leoshkevich wrote: >> >> This opens up the possibility of accessing registers in an >> arch-independent way. >> >> Signed-off-by: Ilya Leoshkevich >> --

Re: [PATCH v4 bpf-next 0/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-12 Thread Ilya Leoshkevich
> Am 11.07.2019 um 22:35 schrieb Stanislav Fomichev : > > On 07/11, Ilya Leoshkevich wrote: >> Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. >> >> This patch series consists of three preparatory commits, which make it >> possibl

Re: [PATCH v3 bpf] selftests/bpf: do not ignore clang failures

2019-07-11 Thread Ilya Leoshkevich
> Am 11.07.2019 um 16:55 schrieb Andrii Nakryiko : > > On Thu, Jul 11, 2019 at 2:14 AM Ilya Leoshkevich wrote: >> >> >> In addition, pull Kbuild.include in order to get .DELETE_ON_ERROR target, > > In your original patch you explicitly declared .DELETE_ON_

[PATCH v4 bpf-next 4/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-11 Thread Ilya Leoshkevich
Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/progs/loop1.c | 2 +- tools/testing/selftests/bpf/progs/loop2.c | 2 +- tools/testing/selftests/bpf/progs/loop3.c | 2 +- 3 files changed, 3 insertions(+)

[PATCH v4 bpf-next 3/4] selftests/bpf: make PT_REGS_* work in userspace

2019-07-11 Thread Ilya Leoshkevich
;s390/bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type"). Ditto on arm64. On x86, provide userspace versions of PT_REGS_* macros. Unlike s390 and arm64, x86 provides struct pt_regs to both userspace and kernel, however, with different member names. Signed-off-by: Ilya L

[PATCH v4 bpf-next 2/4] selftests/bpf: fix s930 -> s390 typo

2019-07-11 Thread Ilya Leoshkevich
Also check for __s390__ instead of __s390x__, just in case bpf_helpers.h is ever used by 32-bit userspace. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/bpf_helpers.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v4 bpf-next 1/4] selftests/bpf: compile progs with -D__TARGET_ARCH_$(SRCARCH)

2019-07-11 Thread Ilya Leoshkevich
This opens up the possibility of accessing registers in an arch-independent way. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf

[PATCH v4 bpf-next 0/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-11 Thread Ilya Leoshkevich
6", SRCARCH always corresponds to directory names under arch/. v1->v2: Split into multiple patches. v2->v3: Added arm64 support. v3->v4: Added i386 support, use SRCARCH instead of ARCH. Signed-off-by: Ilya Leoshkevich

[PATCH v3 bpf] selftests/bpf: do not ignore clang failures

2019-07-11 Thread Ilya Leoshkevich
tion was chosen over using pipefail, having separate targets or getting rid of llc invocation due to its simplicity. In addition, pull Kbuild.include in order to get .DELETE_ON_ERROR target, which would cause partial .o files to be removed. Signed-off-by: Ilya Leoshkevich --- v1->v2: use in

[PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check

2019-07-10 Thread Ilya Leoshkevich
bpf_helpers.h fails to compile on sparc: the code should be checking for defined(bpf_target_sparc), but checks simply for bpf_target_sparc. Also change #ifdef bpf_target_powerpc to #if defined() for consistency. Signed-off-by: Ilya Leoshkevich --- v1->v2: bpf_target_powerpc change to

Re: [PATCH v3 bpf-next 3/4] selftests/bpf: make PT_REGS_* work in userspace

2019-07-10 Thread Ilya Leoshkevich
> Am 09.07.2019 um 19:48 schrieb Andrii Nakryiko : > > On Tue, Jul 9, 2019 at 8:19 AM Ilya Leoshkevich wrote: >> >> Right now, on certain architectures, these macros are usable only with >> kernel headers. This patch makes it possible to use them with userspace >&

Re: [PATCH] MAINTAINERS: update BPF JIT S390 maintainers

2019-07-10 Thread Ilya Leoshkevich
> Am 10.07.2019 um 12:43 schrieb Vasily Gorbik : > > Ilya Leoshkevich is joining as s390 bpf maintainer. With his background > as gcc developer he would be valuable for the team and community as a > whole. Ilya, have fun! > > Since there is now enough eyes on s390 b

Re: [PATCH bpf] selftests/bpf: fix bpf_target_sparc check

2019-07-10 Thread Ilya Leoshkevich
> Am 09.07.2019 um 19:56 schrieb Andrii Nakryiko : > > On Tue, Jul 9, 2019 at 8:22 AM Ilya Leoshkevich wrote: >> >> bpf_helpers.h fails to compile on sparc: the code should be checking >> for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.

[PATCH bpf] selftests/bpf: fix bpf_target_sparc check

2019-07-09 Thread Ilya Leoshkevich
bpf_helpers.h fails to compile on sparc: the code should be checking for defined(bpf_target_sparc), but checks simply for bpf_target_sparc. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/bpf_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools

[PATCH v3 bpf-next 4/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-09 Thread Ilya Leoshkevich
Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/progs/loop1.c | 2 +- tools/testing/selftests/bpf/progs/loop2.c | 2 +- tools/testing/selftests/bpf/progs/loop3.c | 2 +- 3 files changed, 3 insertions(+)

[PATCH v3 bpf-next 3/4] selftests/bpf: make PT_REGS_* work in userspace

2019-07-09 Thread Ilya Leoshkevich
;s390/bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type"). Ditto on arm64. On x86, provide userspace versions of PT_REGS_* macros. Unlike s390 and arm64, x86 provides struct pt_regs to both userspace and kernel, however, with different member names. Signed-off-by: Ilya L

[PATCH v3 bpf-next 1/4] selftests/bpf: compile progs with -D__TARGET_ARCH_$(ARCH)

2019-07-09 Thread Ilya Leoshkevich
This opens up the possibility of accessing registers in an arch-independent way. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf

[PATCH v3 bpf-next 2/4] selftests/bpf: fix s930 -> s390 typo

2019-07-09 Thread Ilya Leoshkevich
Also check for __s390__ instead of __s390x__, just in case bpf_helpers.h is ever used by 32-bit userspace. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/bpf_helpers.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v3 bpf-next 0/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-09 Thread Ilya Leoshkevich
related build problems, which I will post separately. v1->v2: Split into multiple patches. v2->v3: Added arm64 support. Signed-off-by: Ilya Leoshkevich

Re: [PATCH bpf-next] selftests/bpf: make verifier loop tests arch independent

2019-07-08 Thread Ilya Leoshkevich
> Am 08.07.2019 um 23:20 schrieb Stanislav Fomichev : > > On 07/08, Ilya Leoshkevich wrote: >> >> >>> Am 08.07.2019 um 18:13 schrieb Stanislav Fomichev : >>> >>> On 07/03, Y Song wrote: >>>> On Wed, Jul 3, 2019 at 1:51 PM Stani

Re: [PATCH bpf-next] selftests/bpf: make verifier loop tests arch independent

2019-07-08 Thread Ilya Leoshkevich
g/selftests/bpf/progs/loop3.c >>> index 30a0f6cba080..3a7f12d7186c 100644 >>> --- a/tools/testing/selftests/bpf/progs/loop3.c >>> +++ b/tools/testing/selftests/bpf/progs/loop3.c >>> @@ -14,9 +14,10 @@ SEC("raw_tracepoint/consume_skb") >>> int while_tr

[PATCH v2 bpf-next] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-04 Thread Ilya Leoshkevich
BPF_LDX_MEM is used to load the least significant byte of the retrieved test_val.index, however, on big-endian machines it ends up retrieving the most significant byte. Use the correct least significant byte offset on big-endian machines. Signed-off-by: Ilya Leoshkevich --- v1->v2: -

[PATCH bpf-next] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-03 Thread Ilya Leoshkevich
BPF_LDX_MEM is used to load the least significant byte of the retrieved test_val.index, however, on big-endian machines it ends up retrieving the most significant byte. Use the correct least significant byte offset on big-endian machines. Signed-off-by: Ilya Leoshkevich --- tools/testing

[PATCH v2 bpf-next 1/4] selftests/bpf: compile progs with -D__TARGET_ARCH_$(ARCH)

2019-07-03 Thread Ilya Leoshkevich
This opens up the possibility of accessing registers in an arch-independent way. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf

[PATCH v2 bpf-next 4/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-03 Thread Ilya Leoshkevich
Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/progs/loop1.c | 2 +- tools/testing/selftests/bpf/progs/loop2.c | 2 +- tools/testing/selftests/bpf/progs/loop3.c | 2 +- 3 files changed, 3 insertions(+)

[PATCH v2 bpf-next 3/4] selftests/bpf: make PT_REGS_* work in userspace

2019-07-03 Thread Ilya Leoshkevich
i for BPF_PROG_TYPE_PERF_EVENT program type"). On x86, provide userspace versions of PT_REGS_* macros. Unlike s390, x86 provides struct pt_regs to both userspace and kernel, however, with different member names. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/bpf_help

[PATCH v2 bpf-next 2/4] selftests/bpf: fix s390 -> s390 typo

2019-07-03 Thread Ilya Leoshkevich
Also check for __s390__ instead of __s390x__, just in case bpf_helpers.h is ever used by 32-bit userspace. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/bpf_helpers.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf

[PATCH v2 bpf-next 0/4] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-03 Thread Ilya Leoshkevich
Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. This patch series consists of preparatory commits, which make it possible to use PT_REGS_RC in BPF selftests, followed by the actual fix. Signed-off-by: Ilya Leoshkevich

[PATCH bpf-next] selftests/bpf: fix test_reuseport_array on s390

2019-07-03 Thread Ilya Leoshkevich
Fix endianness issue: passing a pointer to 64-bit fd as a 32-bit key does not work on big-endian architectures. So cast fd to 32-bits when necessary. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/test_maps.c | 21 +++-- 1 file changed, 15 insertions(+), 6

Re: [PATCH bpf-next] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-02 Thread Ilya Leoshkevich
> Am 02.07.2019 um 18:42 schrieb Y Song : > > On Tue, Jul 2, 2019 at 8:40 AM Ilya Leoshkevich wrote: >> >> -#elif defined(__s390x__) >> - #define bpf_target_s930x > > I see in some other places (e.g., bcc) where > macro __s390x__ is also used to indic

[PATCH bpf-next] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-02 Thread Ilya Leoshkevich
ovides struct pt_regs to both userspace and kernel, however, with different field names. Signed-off-by: Ilya Leoshkevich --- tools/testing/selftests/bpf/Makefile | 4 +- tools/testing/selftests/bpf/bpf_helpers.h | 46 +++ tools/testing/selftests/bpf/progs/loop1.c | 2 +-