From: Hari Bathini <hbathini@linux.ibm.com>
To: bot+bpf-ci@kernel.org, linuxppc-dev@lists.ozlabs.org
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, skb99@linux.ibm.com, adubey@linux.ibm.com,
martin.lau@kernel.org, eddyz87@gmail.com,
yonghong.song@linux.dev, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH 5/5] powerpc64/bpf: fix handling of BPF stack in exception callback
Date: Mon, 16 Feb 2026 14:06:22 +0530 [thread overview]
Message-ID: <87b92f46-8b05-4061-949c-4c15afc55d29@linux.ibm.com> (raw)
In-Reply-To: <5f92f12e74b1c8d6fa54ec72590d5087a3c8b7ac2d7302309936db6bd196f5cc@mail.kernel.org>
On 16/02/26 1:10 pm, bot+bpf-ci@kernel.org wrote:
>> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
>> --- a/arch/powerpc/net/bpf_jit_comp64.c
>> +++ b/arch/powerpc/net/bpf_jit_comp64.c
>
> [ ... ]
>
>> @@ -287,6 +285,22 @@
>> * program(main prog) as third arg
>> */
>> EMIT(PPC_RAW_MR(_R1, _R5));
>> + /*
>> + * Exception callback reuses the stack frame of exception boundary.
>> + * But BPF stack depth of exception callback and exception boundary
>> + * don't have to be same. If BPF stack depth is different, adjust the
>> + * stack frame size considering BPF stack depth of exception callback.
>> + * The non-volatile register save area remains unchanged. These non-
>> + * volatile registers are restored in exception callback's epilogue.
>> + */
>> + EMIT(PPC_RAW_LD(bpf_to_ppc(TMP_REG_1), _R5, 0));
>> + EMIT(PPC_RAW_SUB(bpf_to_ppc(TMP_REG_2), _R1, bpf_to_ppc(TMP_REG_1)));
>
> Are the operands to PPC_RAW_SUB reversed here? At this point R1 holds
> boundary_sp (set by the MR above) and TMP_REG_1 holds prev_sp (loaded
> from [R5+0]). Since the stack grows downward, boundary_sp < prev_sp.
>
> PPC_RAW_SUB(d, a, b) computes d = a - b, confirmed by how BPF_SUB is
> emitted in bpf_jit_build_body():
>
> case BPF_ALU64 | BPF_SUB | BPF_X: /* dst -= src */
> EMIT(PPC_RAW_SUB(dst_reg, dst_reg, src_reg));
That was a good catch.
"subf Rx,Ry,Rz" vs "sub Rx,Rz,Ry" distinction on how the operation
is interpreted. Will respin.
- Hari
prev parent reply other threads:[~2026-02-16 8:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 6:56 [PATCH 0/5] powerpc64/bpf: various fixes Hari Bathini
2026-02-16 6:56 ` [PATCH 1/5] powerpc64/bpf: do not increment tailcall count when prog is NULL Hari Bathini
2026-02-16 6:56 ` [PATCH 2/5] powerpc64/bpf: fix the address returned by bpf_get_func_ip Hari Bathini
2026-02-16 6:56 ` [PATCH 3/5] powerpc64/bpf: use consistent tailcall offset in trampoline Hari Bathini
2026-02-16 7:30 ` bot+bpf-ci
2026-02-16 6:56 ` [PATCH 4/5] powerpc64/bpf: remove BPF redzone protection in trampoline stack Hari Bathini
2026-02-16 6:56 ` [PATCH 5/5] powerpc64/bpf: fix handling of BPF stack in exception callback Hari Bathini
2026-02-16 7:40 ` bot+bpf-ci
2026-02-16 8:36 ` Hari Bathini [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=87b92f46-8b05-4061-949c-4c15afc55d29@linux.ibm.com \
--to=hbathini@linux.ibm.com \
--cc=adubey@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.lau@kernel.org \
--cc=skb99@linux.ibm.com \
--cc=yonghong.song@linux.dev \
/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