From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Hari Bathini <hbathini@linux.ibm.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Cc: Song Liu <songliubraving@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
Martin KaFai Lau <martin.lau@linux.dev>
Subject: Re: [PATCH v3 1/2] powerpc64/bpf: fix tail calls for PCREL addressing
Date: Tue, 2 Apr 2024 11:35:58 +0000 [thread overview]
Message-ID: <a5fb9d59-a2e5-4880-8865-ed897d389bb8@csgroup.eu> (raw)
In-Reply-To: <20240402105806.352037-1-hbathini@linux.ibm.com>
Le 02/04/2024 à 12:58, Hari Bathini a écrit :
> With PCREL addressing, there is no kernel TOC. So, it is not setup in
> prologue when PCREL addressing is used. But the number of instructions
> to skip on a tail call was not adjusted accordingly. That resulted in
> not so obvious failures while using tailcalls. 'tailcalls' selftest
> crashed the system with the below call trace:
>
> bpf_test_run+0xe8/0x3cc (unreliable)
> bpf_prog_test_run_skb+0x348/0x778
> __sys_bpf+0xb04/0x2b00
> sys_bpf+0x28/0x38
> system_call_exception+0x168/0x340
> system_call_vectored_common+0x15c/0x2ec
>
> Fixes: 7e3a68be42e1 ("powerpc/64: vmlinux support building with PCREL addresing")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---
>
> * Changes in v3:
> - New patch to fix tailcall issues with PCREL addressing.
>
>
> arch/powerpc/net/bpf_jit_comp64.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
> index 79f23974a320..7f62ac4b4e65 100644
> --- a/arch/powerpc/net/bpf_jit_comp64.c
> +++ b/arch/powerpc/net/bpf_jit_comp64.c
> @@ -285,8 +285,10 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
> int b2p_index = bpf_to_ppc(BPF_REG_3);
> int bpf_tailcall_prologue_size = 8;
>
> +#ifndef CONFIG_PPC_KERNEL_PCREL
Any reason for not using IS_ENABLED(CONFIG_PPC_KERNEL_PCREL) ?
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2))
> bpf_tailcall_prologue_size += 4; /* skip past the toc load */
> +#endif
>
> /*
> * if (index >= array->map.max_entries)
prev parent reply other threads:[~2024-04-02 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 10:58 [PATCH v3 1/2] powerpc64/bpf: fix tail calls for PCREL addressing Hari Bathini
2024-04-02 10:58 ` [PATCH v3 2/2] powerpc/bpf: enable kfunc call Hari Bathini
2024-04-02 11:38 ` Christophe Leroy
2024-04-15 7:12 ` Naveen N Rao
2024-04-02 11:35 ` Christophe Leroy [this message]
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=a5fb9d59-a2e5-4880-8865-ed897d389bb8@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hbathini@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.lau@linux.dev \
--cc=naveen.n.rao@linux.ibm.com \
--cc=songliubraving@fb.com \
--cc=stable@vger.kernel.org \
/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).