From: sashiko-bot@kernel.org
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RFC bpf-next 2/2] selftests/bpf: Add LoongArch support for get_preempt_count()
Date: Mon, 20 Apr 2026 13:35:31 +0000 [thread overview]
Message-ID: <20260420133532.4973DC2BCB4@smtp.kernel.org> (raw)
In-Reply-To: <20260420111516.19982-3-yangtiezhu@loongson.cn>
Sashiko AI review found 1 potential issue(s):
- [High] BPF programs including `bpf_experimental.h` will fail to compile on LoongArch due to a non-existent `thread_info` field in `struct task_struct`.
--
commit 82453686fe5eacd9f219e2a050dc016b297cfc79
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
selftests/bpf: Add LoongArch support for get_preempt_count()
This commit adds LoongArch support for get_preempt_count() in the BPF
experimental helpers. It enables bpf_in_interrupt() and related macros to
work properly on LoongArch systems.
> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
> index e5c039bc44cb4..5847bbf12d240 100644
> --- a/tools/testing/selftests/bpf/bpf_experimental.h
> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
> @@ -507,6 +507,8 @@ static inline int get_preempt_count(void)
> return bpf_get_lowcore()->preempt_count;
> #elif defined(bpf_target_riscv)
> return bpf_get_current_task_btf()->thread_info.preempt_count;
> +#elif defined(bpf_target_loongarch)
> + return bpf_get_current_task_btf()->thread_info.preempt_count;
Will this compile successfully on LoongArch?
Since LoongArch does not select CONFIG_THREAD_INFO_IN_TASK, struct
thread_info is allocated on the kernel stack rather than being embedded
within struct task_struct. Because of this, the generated BTF and vmlinux.h
for LoongArch will not contain a thread_info field in task_struct.
Could this lead to a compiler error indicating that there is no member named
thread_info in struct task_struct when building BPF selftests?
> #endif
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260420111516.19982-1-yangtiezhu@loongson.cn?part=2
next prev parent reply other threads:[~2026-04-20 13:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 11:15 [PATCH RFC bpf-next 0/2] selftests/bpf: Add support for get_preempt_count() Tiezhu Yang
2026-04-20 11:15 ` [PATCH RFC bpf-next 1/2] selftests/bpf: Add riscv " Tiezhu Yang
2026-04-20 11:15 ` [PATCH RFC bpf-next 2/2] selftests/bpf: Add LoongArch " Tiezhu Yang
2026-04-20 13:35 ` sashiko-bot [this message]
2026-04-21 0:47 ` Tiezhu Yang
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=20260420133532.4973DC2BCB4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko@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