]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: Add get_preempt_count() support for LoongArch
authorTiezhu Yang <yangtiezhu@loongson.cn>
Thu, 25 Jun 2026 05:08:57 +0000 (13:08 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Thu, 25 Jun 2026 05:08:57 +0000 (13:08 +0800)
commitedc5cb8b2b617b67c35777e4e7dc3e8e6c275cfd
tree12becb413f65410effe0ef15336b048dd97bec9f
parenteae0693d13da2f95d687c8003a5d4dd8f521670a
selftests/bpf: Add get_preempt_count() support for LoongArch

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.

The latest kernels select CONFIG_THREAD_INFO_IN_TASK, it can just read
preempt_count from the thread_info which is embedded within task_struct.

With this patch, "./test_progs -t exe_ctx" passes on LoongArch.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
tools/testing/selftests/bpf/bpf_experimental.h