BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 4/4] selftests/bpf: Test jited inline of bpf_get_smp_processor_id() for LoongArch
Date: Mon, 15 Jun 2026 10:26:31 +0000	[thread overview]
Message-ID: <20260615102631.EE0521F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260615100506.19558-5-yangtiezhu@loongson.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Broken selftest due to missing kernel JIT implementation and incorrect structural offset
--

commit 8f74b6910905428534e06ac6efaea6a8091a844f
Author: Tiezhu Yang <yangtiezhu@loongson.cn>

selftests/bpf: Test jited inline of bpf_get_smp_processor_id() for LoongArch

This commit adds a BPF selftest for LoongArch to verify that the
bpf_get_smp_processor_id() helper is correctly inlined by the JIT compiler.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> index 8560577f25576..02e562f56f9d3 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> @@ -21,4 +21,15 @@ int inline_bpf_get_current_task(void)
>  	return 0;
>  }
>  
> +SEC("fentry/bpf_fentry_test2")
> +__success __retval(0)
> +__arch_loongarch
> +__jited("	ld.wu	$a5, $tp, 16")

[Severity: Medium]
Will this test fail in the current tree? It appears the kernel-side JIT 
implementation to inline this helper on LoongArch is missing. Without it, 
this test will expect an inline load but the JIT will generate a standard 
function call, causing the assertion to fail.

Also, is the offset 16 correct here? In the current tree's LoongArch layout,
struct thread_info contains a task pointer at offset 0, which means the cpu
field is at offset 24, not 16. The test appears to rely on an out-of-tree
configuration or prerequisite patch where the offset is 16.

> +int inline_bpf_get_smp_processor_id(void)
> +{
> +	bpf_get_smp_processor_id();
> +
> +	return 0;
> +}
> +
>  char _license[] SEC("license") = "GPL";

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260615100506.19558-1-yangtiezhu@loongson.cn?part=4

  reply	other threads:[~2026-06-15 10:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 10:05 [PATCH bpf-next v2 0/4] selftests/bpf: Add some tests for LoongArch Tiezhu Yang
2026-06-15 10:05 ` [PATCH bpf-next v2 1/4] selftests/bpf: Add get_preempt_count() support " Tiezhu Yang
2026-06-15 10:05 ` [PATCH bpf-next v2 2/4] selftests/bpf: Add __arch_loongarch to limit test cases " Tiezhu Yang
2026-06-15 10:05 ` [PATCH bpf-next v2 3/4] selftests/bpf: Test jited inline of bpf_get_current_task() " Tiezhu Yang
2026-06-15 10:25   ` sashiko-bot
2026-06-15 10:05 ` [PATCH bpf-next v2 4/4] selftests/bpf: Test jited inline of bpf_get_smp_processor_id() " Tiezhu Yang
2026-06-15 10:26   ` sashiko-bot [this message]
2026-06-15 15:45 ` [PATCH bpf-next v2 0/4] selftests/bpf: Add some tests " Alexei Starovoitov

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=20260615102631.EE0521F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yangtiezhu@loongson.cn \
    /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