mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: jiangfeng@kylinos.cn,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,luke.r.nels@gmail.com,xi.wang@gmail.com,bjorn@kernel.org,pulehui@huawei.com,puranjay@kernel.org,pjw@kernel.org,palmer@dabbelt.com,aou@eecs.berkeley.edu,alex@ghiti.fr,shuah@kernel.org,nathan@kernel.org,ndesaulniers@google.com,morbo@google.com,justinstitt@google.com
Cc: bpf@vger.kernel.org,linux-riscv@lists.infradead.org,linux-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,llvm@lists.linux.dev,jiangfeng@kylinos.cn,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 1/2] bpf, riscv: Add BPF stack arguments support for RV64 JIT
Date: Thu, 13 Aug 2026 08:25:59 +0000 (UTC)	[thread overview]
Message-ID: <b9781ebbc70ad4c748f4c08d94bbe6994b4e0fde867a8bf252b5d0f08a985dee@mail.kernel.org> (raw)
In-Reply-To: <20260813-bpf-riscv-stack-args-v2-1-efea8f9b3fe1@kylinos.cn>

[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]

>     bpf, riscv: Add BPF stack arguments support for RV64 JIT
>
>     Add bpf_jit_supports_stack_args() for the RV64 JIT so BPF subprograms
>     and kfuncs can receive more than 5 arguments via the stack
>     (BPF_REG_PARAMS / r11).
>
>     For BPF-to-BPF calls the caller writes outgoing arguments at the
>     bottom of its frame (SP-relative). The callee reads them with
>     FP-relative loads. Its FP is set to the caller SP in the prologue,
>     so the offsets match.
>
>     The RISC-V ABI puts arguments 6-8 in A5-A7 and arguments 9+ at
>     SP+0. Before each kfunc call, load arguments 6-8 from the outgoing
>     area into A5-A7 and copy any remaining arguments down so argument 9
>     lands at SP+0.
>
>     A5 (BPF_REG_0), A6 (TCC) and A7 are safe to clobber here: R0 is not
>     live before a call, TCC is backed up on the stack, and A7 is unused
>     by the JIT.
>
>     Limit the existing kfunc sign-extension loop to MAX_BPF_FUNC_REG_ARGS
>     iterations; otherwise idx >= 5 resolves to S1-S5 (BPF_R6-FP) and
>     corrupts callee-saved registers.
>
>     Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>

This looks like a bug fix for stack argument support. The commit message
describes how the sign-extension loop was limited to prevent corruption
of callee-saved registers S1-S5 when idx >= 5. This fixes an issue
introduced by commit 443574b03387 ("riscv, bpf: Fix kfunc parameters
incompatibility between bpf and riscv abi"), which added the
sign-extension loop without limiting it to MAX_BPF_FUNC_REG_ARGS.

Should this include:

  Fixes: 443574b03387 ("riscv, bpf: Fix kfunc parameters incompatibility between bpf and riscv abi")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31677823910

  reply	other threads:[~2026-08-13  8:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  7:18 [PATCH bpf-next v2 0/2] " Feng Jiang
2026-08-13  7:18 ` [PATCH bpf-next v2 1/2] " Feng Jiang
2026-08-13  8:25   ` bot+bpf-ci [this message]
2026-08-13 11:35     ` Feng Jiang
2026-08-13  7:18 ` [PATCH bpf-next v2 2/2] selftests/bpf: Enable stack argument tests for RV64 Feng Jiang
2026-08-13  8:11   ` bot+bpf-ci

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=b9781ebbc70ad4c748f4c08d94bbe6994b4e0fde867a8bf252b5d0f08a985dee@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=andrii@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jiangfeng@kylinos.cn \
    --cc=jolsa@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=luke.r.nels@gmail.com \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=pulehui@huawei.com \
    --cc=puranjay@kernel.org \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=xi.wang@gmail.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

all inboxes | Powered by JetHome®