From: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
To: bpf@vger.kernel.org
Cc: Siddharth Chintamaneni <sidchintamaneni@gmail.com>,
Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Anton Protopopov <a.s.protopopov@gmail.com>,
Puranjay Mohan <puranjay@kernel.org>,
linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
linux-riscv@lists.infradead.org, rlmenge@gmail.com,
hargar@linux.microsoft.com, apais@microsoft.com
Subject: [PATCH bpf-next v1 5/7] bpf, riscv: Use resolved pointer for timed may_goto
Date: Fri, 4 Sep 2026 19:51:30 +0000 [thread overview]
Message-ID: <20260904195132.141068-6-sidchintamaneni@gmail.com> (raw)
In-Reply-To: <20260904195132.141068-1-sidchintamaneni@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through
BPF_REG_AX instead of a stack offset.
Copy the pointer directly into the first argument register rather than
adding it to the BPF frame pointer again.
Fixes: 6ef8ff20c30b ("bpf, riscv: Add support for timed may_goto")
Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr>
Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/
Assisted-by: Copilot:gpt-5.6-sol
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
---
arch/riscv/net/bpf_timed_may_goto.S | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/net/bpf_timed_may_goto.S b/arch/riscv/net/bpf_timed_may_goto.S
index 02c637d87420..8c03e272e0bf 100644
--- a/arch/riscv/net/bpf_timed_may_goto.S
+++ b/arch/riscv/net/bpf_timed_may_goto.S
@@ -6,12 +6,11 @@
/*
* Trampoline for the BPF timed may_goto loop bound. Custom calling convention:
- * - input: stack offset in BPF_REG_AX (t0)
+ * - input: count and timestamp pointer in BPF_REG_AX (t0)
* - output: updated count in BPF_REG_AX (t0)
*
- * Calls bpf_check_timed_may_goto(ptr) with the standard RISC-V ABI, where
- * ptr = BPF_REG_FP (s5) + BPF_REG_AX (t0). BPF R0-R5 (a5, a0-a4) are saved
- * across the call; BPF_REG_FP (s5) is callee-saved and needs no saving.
+ * Calls bpf_check_timed_may_goto(ptr) with the standard RISC-V ABI.
+ * BPF R0-R5 (a5, a0-a4) are saved across the call.
*/
SYM_FUNC_START(arch_bpf_timed_may_goto)
@@ -28,7 +27,11 @@ SYM_FUNC_START(arch_bpf_timed_may_goto)
REG_S a3, 1*SZREG(sp)
REG_S a4, 0*SZREG(sp)
- add a0, t0, s5
+ /*
+ * BPF_REG_AX (t0) contains the count and timestamp pointer; pass it as
+ * the first argument in a0.
+ */
+ mv a0, t0
call bpf_check_timed_may_goto
mv t0, a0
--
2.43.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
To: bpf@vger.kernel.org
Cc: Siddharth Chintamaneni <sidchintamaneni@gmail.com>,
Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Anton Protopopov <a.s.protopopov@gmail.com>,
Puranjay Mohan <puranjay@kernel.org>,
linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
linux-riscv@lists.infradead.org, rlmenge@gmail.com,
hargar@linux.microsoft.com, apais@microsoft.com
Subject: [PATCH bpf-next v1 5/7] bpf, riscv: Use resolved pointer for timed may_goto
Date: Fri, 4 Sep 2026 19:51:30 +0000 [thread overview]
Message-ID: <20260904195132.141068-6-sidchintamaneni@gmail.com> (raw)
In-Reply-To: <20260904195132.141068-1-sidchintamaneni@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through
BPF_REG_AX instead of a stack offset.
Copy the pointer directly into the first argument register rather than
adding it to the BPF frame pointer again.
Fixes: 6ef8ff20c30b ("bpf, riscv: Add support for timed may_goto")
Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr>
Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/
Assisted-by: Copilot:gpt-5.6-sol
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
---
arch/riscv/net/bpf_timed_may_goto.S | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/net/bpf_timed_may_goto.S b/arch/riscv/net/bpf_timed_may_goto.S
index 02c637d87420..8c03e272e0bf 100644
--- a/arch/riscv/net/bpf_timed_may_goto.S
+++ b/arch/riscv/net/bpf_timed_may_goto.S
@@ -6,12 +6,11 @@
/*
* Trampoline for the BPF timed may_goto loop bound. Custom calling convention:
- * - input: stack offset in BPF_REG_AX (t0)
+ * - input: count and timestamp pointer in BPF_REG_AX (t0)
* - output: updated count in BPF_REG_AX (t0)
*
- * Calls bpf_check_timed_may_goto(ptr) with the standard RISC-V ABI, where
- * ptr = BPF_REG_FP (s5) + BPF_REG_AX (t0). BPF R0-R5 (a5, a0-a4) are saved
- * across the call; BPF_REG_FP (s5) is callee-saved and needs no saving.
+ * Calls bpf_check_timed_may_goto(ptr) with the standard RISC-V ABI.
+ * BPF R0-R5 (a5, a0-a4) are saved across the call.
*/
SYM_FUNC_START(arch_bpf_timed_may_goto)
@@ -28,7 +27,11 @@ SYM_FUNC_START(arch_bpf_timed_may_goto)
REG_S a3, 1*SZREG(sp)
REG_S a4, 0*SZREG(sp)
- add a0, t0, s5
+ /*
+ * BPF_REG_AX (t0) contains the count and timestamp pointer; pass it as
+ * the first argument in a0.
+ */
+ mv a0, t0
call bpf_check_timed_may_goto
mv t0, a0
--
2.43.0
next prev parent reply other threads:[~2026-09-04 19:51 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 19:51 [PATCH bpf-next v1 0/7] Fix timed may_goto with private stacks Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 19:51 ` [PATCH bpf-next v1 1/7] bpf: Fix timed may_goto stack pointer for " Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 19:58 ` sashiko-bot
2026-09-04 19:51 ` [PATCH bpf-next v1 2/7] bpf, x86: Use resolved pointer for timed may_goto Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 20:02 ` sashiko-bot
2026-09-04 20:33 ` bot+bpf-ci
2026-09-04 20:33 ` bot+bpf-ci
2026-09-09 16:34 ` Siddharth Chintamaneni
2026-09-09 16:34 ` Siddharth Chintamaneni
2026-09-04 19:51 ` [PATCH bpf-next v1 3/7] bpf, arm64: " Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 20:01 ` sashiko-bot
2026-09-04 19:51 ` [PATCH bpf-next v1 4/7] bpf, powerpc64: " Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 19:58 ` sashiko-bot
2026-09-04 19:51 ` Siddharth Chintamaneni [this message]
2026-09-04 19:51 ` [PATCH bpf-next v1 5/7] bpf, riscv: " Siddharth Chintamaneni
2026-09-04 19:57 ` sashiko-bot
2026-09-04 20:33 ` bot+bpf-ci
2026-09-04 20:33 ` bot+bpf-ci
2026-09-04 19:51 ` [PATCH bpf-next v1 6/7] bpf, s390: " Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 19:59 ` sashiko-bot
2026-09-04 20:33 ` bot+bpf-ci
2026-09-04 20:33 ` bot+bpf-ci
2026-09-04 19:51 ` [PATCH bpf-next v1 7/7] selftests/bpf: Test timed may_goto with private stacks Siddharth Chintamaneni
2026-09-04 19:51 ` Siddharth Chintamaneni
2026-09-04 19:58 ` sashiko-bot
2026-09-21 3:48 ` [PATCH bpf-next v1 0/7] Fix " Kumar Kartikeya Dwivedi
2026-09-21 3:48 ` Kumar Kartikeya Dwivedi
2026-09-21 16:24 ` Siddharth Chintamaneni
2026-09-21 16:24 ` Siddharth Chintamaneni
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=20260904195132.141068-6-sidchintamaneni@gmail.com \
--to=sidchintamaneni@gmail.com \
--cc=a.s.protopopov@gmail.com \
--cc=andrii@kernel.org \
--cc=apais@microsoft.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=hargar@linux.microsoft.com \
--cc=ihor.solodrai@linux.dev \
--cc=jeremy.jean@oss.cyber.gouv.fr \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=puranjay@kernel.org \
--cc=rlmenge@gmail.com \
--cc=song@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.