Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com> To: Johan Almbladh <johan.almbladh@anyfinetworks.com> Cc: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Tony Ambardar <Tony.Ambardar@gmail.com>, Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org> Subject: Re: [PATCH 10/14] bpf/tests: Add branch conversion JIT test Date: Thu, 29 Jul 2021 08:50:01 -0700 [thread overview] Message-ID: <0feebbb6-7ba7-fe6e-1854-dd1cebfaf1f2@fb.com> (raw) In-Reply-To: <CAM1=_QRN+aioWWNfeS5Tddo2u6UG86bVj66BJoYyzaUDSkDZ1w@mail.gmail.com> On 7/29/21 6:24 AM, Johan Almbladh wrote: > On Thu, Jul 29, 2021 at 2:55 AM Yonghong Song <yhs@fb.com> wrote: >>> +static int bpf_fill_long_jmp(struct bpf_test *self) >>> +{ >>> + unsigned int len = BPF_MAXINSNS; >> >> BPF_MAXINSNS is 4096 as defined in uapi/linux/bpf_common.h. >> Will it be able to trigger a PC relative branch + long >> conditional jump? > > It does, on the MIPS32 JIT. The ALU64 MUL instruction with a large > immediate was chosen since it expands to a lot of MIPS32 instructions: > 2 to load the immediate, 1 to zero/sign extend it, and then 9 for the > 64x64 multiply. Maybe added a comment in the code to mention that with BPF_MAXINSNS PC relative branch + long conditional jump can be triggered on MIPS32 JIT. Other architecture may need a different/larger number? > > Other JITs will be different of course. On the other hand, other > architectures have other limitations that this test may not trigger > anyway. I added the test because I was implementing a non-trivial > iterative branch conversion logic in the MIPS32 JIT. One can argue > that when such complex JIT mechanisms are added, the test suite should > also be updated to cover that, especially if the mechanism handles > something that almost never occur in practice. > > Since I was able to trigger the branch conversion with BPF_MAXINSNS > instructions, and no other test was using more, I left it at that. > However, should I or someone else work on the MIPS64 JIT, I think > updating the test suite so that similar special cases there are > triggered would be a valuable contribution. >
next prev parent reply other threads:[~2021-07-29 15:50 UTC|newest] Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-28 17:04 [PATCH 00/14] bpf/tests: Extend the eBPF test suite Johan Almbladh 2021-07-28 17:04 ` [PATCH 01/14] bpf/tests: Add BPF_JMP32 test cases Johan Almbladh 2021-07-28 22:31 ` Yonghong Song 2021-07-29 21:30 ` Johan Almbladh 2021-07-28 17:04 ` [PATCH 02/14] bpf/tests: Add BPF_MOV tests for zero and sign extension Johan Almbladh 2021-07-28 22:36 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 03/14] bpf/tests: Fix typos in test case descriptions Johan Almbladh 2021-07-28 22:43 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 04/14] bpf/tests: Add more tests of ALU32 and ALU64 bitwise operations Johan Almbladh 2021-07-28 22:53 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 05/14] bpf/tests: Add more ALU32 tests for BPF_LSH/RSH/ARSH Johan Almbladh 2021-07-28 22:57 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 06/14] bpf/tests: Add more BPF_LSH/RSH/ARSH tests for ALU64 Johan Almbladh 2021-07-28 23:30 ` Yonghong Song 2021-07-29 12:34 ` Johan Almbladh 2021-07-29 15:39 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 07/14] bpf/tests: Add more ALU64 BPF_MUL tests Johan Almbladh 2021-07-28 23:32 ` Yonghong Song 2021-07-29 21:21 ` Johan Almbladh 2021-07-28 17:04 ` [PATCH 08/14] bpf/tests: Add tests for ALU operations implemented with function calls Johan Almbladh 2021-07-28 23:52 ` Yonghong Song 2021-07-29 21:17 ` Johan Almbladh 2021-07-29 22:54 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 09/14] bpf/tests: Add word-order tests for load/store of double words Johan Almbladh 2021-07-28 23:54 ` Yonghong Song 2021-07-28 17:04 ` [PATCH 10/14] bpf/tests: Add branch conversion JIT test Johan Almbladh 2021-07-28 23:58 ` Yonghong Song 2021-07-29 12:45 ` Johan Almbladh 2021-07-29 15:46 ` Yonghong Song 2021-07-29 0:55 ` Yonghong Song 2021-07-29 13:24 ` Johan Almbladh 2021-07-29 15:50 ` Yonghong Song [this message] 2021-07-28 17:04 ` [PATCH 11/14] bpf/tests: Add test for 32-bit context pointer argument passing Johan Almbladh 2021-07-29 0:09 ` Yonghong Song 2021-07-29 13:29 ` Johan Almbladh 2021-07-29 15:50 ` Yonghong Song 2021-07-28 17:05 ` [PATCH 12/14] bpf/tests: Add tests for atomic operations Johan Almbladh 2021-07-29 0:36 ` Yonghong Song 2021-07-28 17:05 ` [PATCH 13/14] bpf/tests: Add tests for BPF_CMPXCHG Johan Almbladh 2021-07-29 0:45 ` Yonghong Song 2021-07-28 17:05 ` [PATCH 14/14] bpf/tests: Add tail call test suite Johan Almbladh 2021-07-29 2:56 ` Yonghong Song 2021-07-29 20:44 ` Johan Almbladh
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=0feebbb6-7ba7-fe6e-1854-dd1cebfaf1f2@fb.com \ --to=yhs@fb.com \ --cc=Tony.Ambardar@gmail.com \ --cc=andrii@kernel.org \ --cc=ast@kernel.org \ --cc=bpf@vger.kernel.org \ --cc=daniel@iogearbox.net \ --cc=johan.almbladh@anyfinetworks.com \ --cc=john.fastabend@gmail.com \ --cc=kafai@fb.com \ --cc=kpsingh@kernel.org \ --cc=netdev@vger.kernel.org \ --cc=songliubraving@fb.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).