From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: "Shubham Bansal" <illusionist.neo@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"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>, "Yonghong Song" <yhs@fb.com>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>,
"Zi Shen Lim" <zlim.lnx@gmail.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Paul Burton" <paulburton@kernel.org>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
naveen.n.rao@linux.ibm.com,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Luke Nelson" <luke.r.nels@gmail.com>,
"Xi Wang" <xi.wang@gmail.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Björn Töpel" <bjorn@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Johan Almbladh" <johan.almbladh@anyfinetworks.com>,
"Paul Chaignon" <paul@cilium.io>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
"open list" <linux-kernel@vger.kernel.org>,
linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-riscv@lists.infradead.org, sparclinux@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Change value of MAX_TAIL_CALL_CNT from 32 to 33
Date: Wed, 8 Sep 2021 22:50:24 -0700 [thread overview]
Message-ID: <CAEf4BzZqoVZ7keWCLmC=A5oPPwj_xMNRWDkJUcjWn9yE_z1gSg@mail.gmail.com> (raw)
In-Reply-To: <1631158350-3661-1-git-send-email-yangtiezhu@loongson.cn>
On Wed, Sep 8, 2021 at 8:33 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> In the current code, the actual max tail call count is 33 which is greater
> than MAX_TAIL_CALL_CNT (defined as 32), the actual limit is not consistent
> with the meaning of MAX_TAIL_CALL_CNT, there is some confusion and need to
> spend some time to think the reason at the first glance.
think *about* the reason
>
> We can see the historical evolution from commit 04fd61ab36ec ("bpf: allow
> bpf programs to tail-call other bpf programs") and commit f9dabe016b63
> ("bpf: Undo off-by-one in interpreter tail call count limit").
>
> In order to avoid changing existing behavior, the actual limit is 33 now,
> this is resonable.
typo: reasonable
>
> After commit 874be05f525e ("bpf, tests: Add tail call test suite"), we can
> see there exists failed testcase.
>
> On all archs when CONFIG_BPF_JIT_ALWAYS_ON is not set:
> # echo 0 > /proc/sys/net/core/bpf_jit_enable
> # modprobe test_bpf
> # dmesg | grep -w FAIL
> Tail call error path, max count reached jited:0 ret 34 != 33 FAIL
>
> On some archs:
> # echo 1 > /proc/sys/net/core/bpf_jit_enable
> # modprobe test_bpf
> # dmesg | grep -w FAIL
> Tail call error path, max count reached jited:1 ret 34 != 33 FAIL
>
> So it is necessary to change the value of MAX_TAIL_CALL_CNT from 32 to 33,
> then do some small changes of the related code.
>
> With this patch, it does not change the current limit, MAX_TAIL_CALL_CNT
> can reflect the actual max tail call count, and the above failed testcase
> can be fixed.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
This change breaks selftests ([0]), please fix them at the same time
as you are changing the kernel behavior:
test_tailcall_2:PASS:tailcall 128 nsec
test_tailcall_2:PASS:tailcall 128 nsec
test_tailcall_2:FAIL:tailcall err 0 errno 2 retval 4
#135/2 tailcalls/tailcall_2:FAIL
test_tailcall_3:PASS:tailcall 128 nsec
test_tailcall_3:FAIL:tailcall count err 0 errno 2 count 34
test_tailcall_3:PASS:tailcall 128 nsec
#135/3 tailcalls/tailcall_3:FAIL
#135/4 tailcalls/tailcall_4:OK
#135/5 tailcalls/tailcall_5:OK
#135/6 tailcalls/tailcall_bpf2bpf_1:OK
test_tailcall_bpf2bpf_2:PASS:tailcall 128 nsec
test_tailcall_bpf2bpf_2:FAIL:tailcall count err 0 errno 2 count 34
test_tailcall_bpf2bpf_2:PASS:tailcall 128 nsec
#135/7 tailcalls/tailcall_bpf2bpf_2:FAIL
#135/8 tailcalls/tailcall_bpf2bpf_3:OK
test_tailcall_bpf2bpf_4:PASS:tailcall 54 nsec
test_tailcall_bpf2bpf_4:FAIL:tailcall count err 0 errno 2 count 32
#135/9 tailcalls/tailcall_bpf2bpf_4:FAIL
test_tailcall_bpf2bpf_4:PASS:tailcall 54 nsec
test_tailcall_bpf2bpf_4:FAIL:tailcall count err 0 errno 2 count 32
#135/10 tailcalls/tailcall_bpf2bpf_5:FAIL
#135 tailcalls:FAIL
[0] https://github.com/kernel-patches/bpf/pull/1747/checks?check_run_id=3552002906
> arch/arm/net/bpf_jit_32.c | 11 ++++++-----
> arch/arm64/net/bpf_jit_comp.c | 7 ++++---
> arch/mips/net/ebpf_jit.c | 4 ++--
> arch/powerpc/net/bpf_jit_comp32.c | 4 ++--
> arch/powerpc/net/bpf_jit_comp64.c | 12 ++++++------
> arch/riscv/net/bpf_jit_comp32.c | 4 ++--
> arch/riscv/net/bpf_jit_comp64.c | 4 ++--
> arch/sparc/net/bpf_jit_comp_64.c | 8 ++++----
> include/linux/bpf.h | 2 +-
> kernel/bpf/core.c | 4 ++--
> 10 files changed, 31 insertions(+), 29 deletions(-)
>
[...]
next prev parent reply other threads:[~2021-09-09 5:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 3:32 [PATCH bpf-next] bpf: Change value of MAX_TAIL_CALL_CNT from 32 to 33 Tiezhu Yang
2021-09-09 5:50 ` Andrii Nakryiko [this message]
2021-09-09 7:57 ` Daniel Borkmann
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='CAEf4BzZqoVZ7keWCLmC=A5oPPwj_xMNRWDkJUcjWn9yE_z1gSg@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=illusionist.neo@gmail.com \
--cc=johan.almbladh@anyfinetworks.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luke.r.nels@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=paul@cilium.io \
--cc=paulburton@kernel.org \
--cc=paulus@samba.org \
--cc=songliubraving@fb.com \
--cc=sparclinux@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=will@kernel.org \
--cc=xi.wang@gmail.com \
--cc=yangtiezhu@loongson.cn \
--cc=yhs@fb.com \
--cc=zlim.lnx@gmail.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: link
Be 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).