selftests/bpf: Add some tests for LoongArch#12148
Open
kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
Open
selftests/bpf: Add some tests for LoongArch#12148kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
Conversation
There is no LoongArch support for get_preempt_count() currently and its fallback path always returns 0, just add it so that bpf_in_interrupt(), bpf_in_nmi(), bpf_in_hardirq(), bpf_in_serving_softirq(), bpf_in_task() work for LoongArch as well. Since LoongArch is transitioning to CONFIG_THREAD_INFO_IN_TASK, use bpf_core_field_exists() to provide compatibility for both legacy and future kernels. A struct flavor "task_struct___local" is introduced to bypass static compiler checks when thread_info is missing from the base task_struct. For the newer kernels that select CONFIG_THREAD_INFO_IN_TASK, it reads preempt_count from the thread_info embedded within task_struct. For the older kernels without selecting CONFIG_THREAD_INFO_IN_TASK, it retrieves the thread_info pointer from the bottom of the kernel stack (task->stack) and then reads the preempt_count. This ensures the BPF selftests remain functional across various LoongArch kernel versions. With this patch, "./test_progs -t exe_ctx" passes on LoongArch regardless of whether CONFIG_THREAD_INFO_IN_TASK is set. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Make it possible to limit certain tests to loongarch, just like it is already done for x86_64, arm64, riscv64, and s390x. This is a follow up patch of: commit ee7fe84 ("selftests/bpf: __arch_* macro to limit test cases to specific archs") commit 1e4e6b9 ("selftests/bpf: Add __arch_s390x macro") Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Author
|
Upstream branch: b1fcdf9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: selftests/bpf: Add some tests for LoongArch
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1098735