mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: JaeJoon Jung <rgbi3307@gmail.com>
To: bjorn.topel@gmail.com
Cc: JaeJoon Jung <rgbi3307@gmail.com>,
	rgbi3307@nate.com, luke.r.nels@gmail.com, xi.wang@gmail.com,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] riscv: net: bpf: add bpf_jit_supports_private_stack()
Date: Mon, 10 Aug 2026 12:14:11 +0900	[thread overview]
Message-ID: <20260810031418.95364-1-rgbi3307@gmail.com> (raw)

The bpf_jit_supports_private_stack() function is defined with the __weak
attribute in kernel/bpf/core.c as shown below, and returns false.

include/linux/filter.h:1191:bool bpf_jit_supports_private_stack(void);
kernel/bpf/core.c:3381:bool __weak bpf_jit_supports_private_stack(void)

However, if this function is not defined in the corresponding architecture to
return true, an error occurs when loading BPF as follows, and it is not loaded.

$ cd tools/sched_ext
$ make
$ sudo ./build/bin/scx_simple

libbpf: prog 'simple_dispatch': BPF program load failed: -EACCES
libbpf: prog 'simple_dispatch': -- BEGIN PROG LOAD LOG --
Private stack not supported by jit

arm64, powerpc, and x86 are defined as follows and return true.

arch/arm64/net/bpf_jit_comp.c:2318:bool bpf_jit_supports_private_stack(void)
arch/powerpc/net/bpf_jit_comp.c:530:bool bpf_jit_supports_private_stack(void)
arch/x86/net/bpf_jit_comp.c:4111:bool bpf_jit_supports_private_stack(void)

It seems that it should be defined in the same way in RISCV as well.

Signed-off-by: JaeJoon Jung <rgbi3307@gmail.com>
---
 arch/riscv/net/bpf_jit_comp64.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
index 8fe8969fb8a0..c3e8d91836f1 100644
--- a/arch/riscv/net/bpf_jit_comp64.c
+++ b/arch/riscv/net/bpf_jit_comp64.c
@@ -2171,3 +2171,8 @@ bool bpf_jit_supports_timed_may_goto(void)
 {
 	return true;
 }
+
+bool bpf_jit_supports_private_stack(void)
+{
+        return true;
+}
--
2.43.0


             reply	other threads:[~2026-08-10  3:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10  3:14 JaeJoon Jung [this message]
2026-09-24  6:19 ` Chen Pei

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=20260810031418.95364-1-rgbi3307@gmail.com \
    --to=rgbi3307@gmail.com \
    --cc=bjorn.topel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=luke.r.nels@gmail.com \
    --cc=rgbi3307@nate.com \
    --cc=xi.wang@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

all inboxes | Powered by JetHome®