Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Johan Almbladh <johan.almbladh@anyfinetworks.com>,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org,
netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 13/13] bpf/tests: Add tail call limit test with external function call
Date: Wed, 08 Sep 2021 12:10:01 +0200 [thread overview]
Message-ID: <fe04c10b5991a5fb0656fe272c137a73ec7d2472.camel@linux.ibm.com> (raw)
In-Reply-To: <20210907222339.4130924-14-johan.almbladh@anyfinetworks.com>
On Wed, 2021-09-08 at 00:23 +0200, Johan Almbladh wrote:
> This patch adds a tail call limit test where the program also emits
> a BPF_CALL to an external function prior to the tail call. Mainly
> testing that JITed programs preserve its internal register state, for
> example tail call count, across such external calls.
>
> Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
> ---
> lib/test_bpf.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 48 insertions(+), 3 deletions(-)
>
> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
> index 7475abfd2186..6e45b4da9841 100644
> --- a/lib/test_bpf.c
> +++ b/lib/test_bpf.c
> @@ -12259,6 +12259,20 @@ static struct tail_call_test tail_call_tests[]
> = {
> },
> .result = MAX_TAIL_CALL_CNT + 1,
> },
> + {
> + "Tail call count preserved across function calls",
> + .insns = {
> + BPF_ALU64_IMM(BPF_ADD, R1, 1),
> + BPF_STX_MEM(BPF_DW, R10, R1, -8),
> + BPF_CALL_REL(0),
> + BPF_LDX_MEM(BPF_DW, R1, R10, -8),
> + BPF_ALU32_REG(BPF_MOV, R0, R1),
> + TAIL_CALL(0),
> + BPF_EXIT_INSN(),
> + },
> + .stack_depth = 8,
> + .result = MAX_TAIL_CALL_CNT + 1,
> + },
> {
> "Tail call error path, NULL target",
> .insns = {
There seems to be a problem with BPF_CALL_REL(0) on s390, since it
assumes that test_bpf_func and __bpf_call_base are within +-2G of
each other, which is not (yet) the case.
I can't think of a good fix, so how about something like this?
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -12257,6 +12257,7 @@ static struct tail_call_test tail_call_tests[]
= {
},
.result = MAX_TAIL_CALL_CNT + 1,
},
+#ifndef __s390__
{
"Tail call count preserved across function calls",
.insns = {
@@ -12271,6 +12272,7 @@ static struct tail_call_test tail_call_tests[]
= {
.stack_depth = 8,
.result = MAX_TAIL_CALL_CNT + 1,
},
+#endif
{
"Tail call error path, NULL target",
.insns = {
[...]
next prev parent reply other threads:[~2021-09-08 10:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 22:23 [PATCH bpf-next v2 00/13] bpf/tests: Extend JIT test suite coverage Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 01/13] bpf/tests: Allow different number of runs per test case Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 02/13] bpf/tests: Reduce memory footprint of test suite Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 03/13] bpf/tests: Add exhaustive tests of ALU shift values Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 04/13] bpf/tests: Add exhaustive tests of ALU operand magnitudes Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 05/13] bpf/tests: Add exhaustive tests of JMP " Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 06/13] bpf/tests: Add staggered JMP and JMP32 tests Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 07/13] bpf/tests: Add exhaustive test of LD_IMM64 immediate magnitudes Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 08/13] bpf/tests: Add test case flag for verifier zero-extension Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 09/13] bpf/tests: Add JMP tests with small offsets Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 10/13] bpf/tests: Add JMP tests with degenerate conditional Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 11/13] bpf/tests: Expand branch conversion JIT test Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 12/13] bpf/tests: Add more BPF_END byte order conversion tests Johan Almbladh
2021-09-07 22:23 ` [PATCH bpf-next v2 13/13] bpf/tests: Add tail call limit test with external function call Johan Almbladh
2021-09-08 10:10 ` Ilya Leoshkevich [this message]
2021-09-08 10:53 ` Johan Almbladh
2021-09-08 11:46 ` Daniel Borkmann
2021-09-08 11:59 ` 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=fe04c10b5991a5fb0656fe272c137a73ec7d2472.camel@linux.ibm.com \
--to=iii@linux.ibm.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 \
--cc=yhs@fb.com \
--subject='Re: [PATCH bpf-next v2 13/13] bpf/tests: Add tail call limit test with external function call' \
/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: link
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).