loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: loongarch@lists.linux.dev, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH RFC bpf-next 3/3] selftests/bpf: Test jited inline of bpf_get_smp_processor_id()
Date: Tue, 28 Apr 2026 16:00:51 +0800	[thread overview]
Message-ID: <20260428080051.20938-4-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <20260428080051.20938-1-yangtiezhu@loongson.cn>

Add the testcase for the jited inline of bpf_get_smp_processor_id(),
only for LoongArch currently.

Here is the test result on LoongArch:

  $ sudo ./test_progs -t verifier_jit_inline
  #570/1   verifier_jit_inline/inline_bpf_get_current_task:OK
  #570/2   verifier_jit_inline/inline_bpf_get_smp_processor_id:OK
  #570     verifier_jit_inline:OK
  Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED

Note that this test will pass only after the JIT inline support for
bpf_get_smp_processor_id is merged. While the JIT inlining is still
in the pipeline, adding the changes now will not introduce any build
regressions. It serves to define the expected JIT output for future
validation.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 .../testing/selftests/bpf/progs/verifier_jit_inline.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
index 913a1699e42b..e4d683c8cb06 100644
--- a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
+++ b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
@@ -19,4 +19,15 @@ int inline_bpf_get_current_task(void)
 	return 0;
 }
 
+SEC("fentry/bpf_fentry_test2")
+__success __retval(0)
+__arch_loongarch
+__jited("	ld.w	$a5, $tp, 8")
+int inline_bpf_get_smp_processor_id(void)
+{
+	bpf_get_smp_processor_id();
+
+	return 0;
+}
+
 char _license[] SEC("license") = "GPL";
-- 
2.42.0


      parent reply	other threads:[~2026-04-28  8:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  8:00 [PATCH RFC bpf-next 0/3] selftests/bpf: Test inline helpers for LoongArch Tiezhu Yang
2026-04-28  8:00 ` [PATCH RFC bpf-next 1/3] selftests/bpf: Add __arch_loongarch macro to limit test cases Tiezhu Yang
2026-04-28  8:00 ` [PATCH RFC bpf-next 2/3] selftests/bpf: Test inline_bpf_get_current_task() for LoongArch Tiezhu Yang
2026-04-28  8:00 ` Tiezhu Yang [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=20260428080051.20938-4-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).