mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pu Lehui <pulehui@huawei.com>
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Björn Töpel" <bjorn@kernel.org>,
	"Puranjay Mohan" <puranjay@kernel.org>
Cc: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v1] selftests/bpf: Test jited inline of bpf_get_smp_processor_id() for RISC-V
Date: Thu, 23 Jul 2026 11:31:23 +0800	[thread overview]
Message-ID: <0c95b1bc-9fd3-48c6-a44e-cd42e38eede1@huawei.com> (raw)
In-Reply-To: <20260722070127.9679-1-yangtiezhu@loongson.cn>


On 2026/7/22 15:01, Tiezhu Yang wrote:
> Add the JITed inline instruction of bpf_get_smp_processor_id() for RISC-V
> to pass the test case.
> 
> On RISC-V, the 'cpu' field of 'struct thread_info' resides at offset 0x20,
> BPF_REG_0 maps to the a5 register, and the thread pointer (tp) is used as
> the base address. Therefore, the JIT compiler emits "lw a5, 0x20(tp)" to
> optimize this helper call.
> 
> Tested on a RISC-V virtual machine.
> 
> Before:
>    $ sudo ./test_progs -t verifier_jit_inline
>    #610/1   verifier_jit_inline/inline_bpf_get_current_task:OK
>    #610/2   verifier_jit_inline/inline_bpf_get_smp_processor_id:SKIP
>    #610     verifier_jit_inline:OK (SKIP: 1/2)
>    Summary: 1/1 PASSED, 1 SKIPPED, 0 FAILED
> 
> After:
>    $ sudo ./test_progs -t verifier_jit_inline
>    #610/1   verifier_jit_inline/inline_bpf_get_current_task:OK
>    #610/2   verifier_jit_inline/inline_bpf_get_smp_processor_id:OK
>    #610     verifier_jit_inline:OK
>    Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>   tools/testing/selftests/bpf/progs/verifier_jit_inline.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> index 02e562f56f9d..c696baa5364b 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> @@ -25,6 +25,8 @@ SEC("fentry/bpf_fentry_test2")
>   __success __retval(0)
>   __arch_loongarch
>   __jited("	ld.wu	$a5, $tp, 16")
> +__arch_riscv64
> +__jited("	lw	a5, 0x20(tp)")
>   int inline_bpf_get_smp_processor_id(void)
>   {
>   	bpf_get_smp_processor_id();

Hi Tiezhu,

There are many places in selftest can be add __arch_riscv64 tag, I think 
we can enable them witch one patch.

      reply	other threads:[~2026-07-23  3:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  7:01 Tiezhu Yang
2026-07-23  3:31 ` Pu Lehui [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=0c95b1bc-9fd3-48c6-a44e-cd42e38eede1@huawei.com \
    --to=pulehui@huawei.com \
    --cc=andrii@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puranjay@kernel.org \
    --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

all inboxes | Powered by JetHome®