* [PATCH] selftests/bpf: Add powerpc support for get_preempt_count() in selftest
@ 2026-01-29 5:40 Saket Kumar Bhaskar
2026-01-29 6:07 ` bot+bpf-ci
2026-01-30 7:41 ` Venkat Rao Bagalkote
0 siblings, 2 replies; 3+ messages in thread
From: Saket Kumar Bhaskar @ 2026-01-29 5:40 UTC (permalink / raw)
To: linux-kernel, linux-kselftest, bpf, linuxppc-dev
Cc: hbathini, sachinpb, venkat88, andrii, eddyz87, ast, daniel,
martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf,
haoluo, jolsa, christophe.leroy, maddy, mpe
get_preempt_count() is enabled to return preempt_count for powerpc,
so that bpf_in_interrupt()/get_preempt_count() works for powerpc as
well.
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
---
tools/testing/selftests/bpf/bpf_experimental.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
index 2cd9165c7348..c3f039a878f3 100644
--- a/tools/testing/selftests/bpf/bpf_experimental.h
+++ b/tools/testing/selftests/bpf/bpf_experimental.h
@@ -630,6 +630,8 @@ static inline int get_preempt_count(void)
return *(int *) bpf_this_cpu_ptr(&__preempt_count);
#elif defined(bpf_target_arm64)
return bpf_get_current_task_btf()->thread_info.preempt.count;
+#elif defined(bpf_target_powerpc)
+ return bpf_get_current_task_btf()->thread_info.preempt_count;
#endif
return 0;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/bpf: Add powerpc support for get_preempt_count() in selftest
2026-01-29 5:40 [PATCH] selftests/bpf: Add powerpc support for get_preempt_count() in selftest Saket Kumar Bhaskar
@ 2026-01-29 6:07 ` bot+bpf-ci
2026-01-30 7:41 ` Venkat Rao Bagalkote
1 sibling, 0 replies; 3+ messages in thread
From: bot+bpf-ci @ 2026-01-29 6:07 UTC (permalink / raw)
To: skb99, linux-kernel, linux-kselftest, bpf, linuxppc-dev
Cc: hbathini, sachinpb, venkat88, andrii, eddyz87, ast, daniel,
martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf,
haoluo, jolsa, christophe.leroy, maddy, mpe, ast, andrii, daniel,
martin.lau, eddyz87, yonghong.song, clm, ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]
> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
> index a39576c8ba..147bbf6cd3 100644
> --- a/tools/testing/selftests/bpf/bpf_experimental.h
> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
> @@ -627,6 +627,8 @@ static inline int get_preempt_count(void)
> return *(int *) bpf_this_cpu_ptr(&__preempt_count);
> #elif defined(bpf_target_arm64)
> return bpf_get_current_task_btf()->thread_info.preempt.count;
> +#elif defined(bpf_target_powerpc)
> + return bpf_get_current_task_btf()->thread_info.preempt_count;
> #endif
> return 0;
> }
Now that get_preempt_count() supports PowerPC, should the documentation
comments for bpf_in_interrupt(), bpf_in_nmi(), bpf_in_hardirq(),
bpf_in_serving_softirq(), and bpf_in_task() be updated to include
PowerPC in their supported architecture lists? Currently these comments
still say "Only works on the following archs: x86, arm64" but they now
also work on PowerPC via this change to get_preempt_count().
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21467281843
AI-authorship-score: low
AI-authorship-explanation: Straightforward kernel patch with natural technical writing style and minimal code changes consistent with human-authored commits.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: Documentation comments not updated to reflect PowerPC support in helper functions; minor documentation mismatch in test code.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/bpf: Add powerpc support for get_preempt_count() in selftest
2026-01-29 5:40 [PATCH] selftests/bpf: Add powerpc support for get_preempt_count() in selftest Saket Kumar Bhaskar
2026-01-29 6:07 ` bot+bpf-ci
@ 2026-01-30 7:41 ` Venkat Rao Bagalkote
1 sibling, 0 replies; 3+ messages in thread
From: Venkat Rao Bagalkote @ 2026-01-30 7:41 UTC (permalink / raw)
To: Saket Kumar Bhaskar, linux-kernel, linux-kselftest, bpf,
linuxppc-dev
Cc: hbathini, sachinpb, andrii, eddyz87, ast, daniel, martin.lau,
song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
christophe.leroy, maddy, mpe
On 29/01/26 11:10 am, Saket Kumar Bhaskar wrote:
> get_preempt_count() is enabled to return preempt_count for powerpc,
> so that bpf_in_interrupt()/get_preempt_count() works for powerpc as
> well.
>
> Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
> ---
> tools/testing/selftests/bpf/bpf_experimental.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
> index 2cd9165c7348..c3f039a878f3 100644
> --- a/tools/testing/selftests/bpf/bpf_experimental.h
> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
> @@ -630,6 +630,8 @@ static inline int get_preempt_count(void)
> return *(int *) bpf_this_cpu_ptr(&__preempt_count);
> #elif defined(bpf_target_arm64)
> return bpf_get_current_task_btf()->thread_info.preempt.count;
> +#elif defined(bpf_target_powerpc)
> + return bpf_get_current_task_btf()->thread_info.preempt_count;
> #endif
> return 0;
> }
Tested this patch by applying on mainline kernel and it passes the below
selftest.
./test_progs -t timer_interrupt
#481 timer_interrupt:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
Please add below tag.
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Regards,
Venkat.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-30 7:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 5:40 [PATCH] selftests/bpf: Add powerpc support for get_preempt_count() in selftest Saket Kumar Bhaskar
2026-01-29 6:07 ` bot+bpf-ci
2026-01-30 7:41 ` Venkat Rao Bagalkote
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox