public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 2/2] bpf/s390: Implement get_preempt_count()
Date: Tue, 17 Feb 2026 17:05:09 +0100	[thread overview]
Message-ID: <20260217160813.100855-3-iii@linux.ibm.com> (raw)
In-Reply-To: <20260217160813.100855-1-iii@linux.ibm.com>

exe_ctx test fails on s390, because get_preempt_count() is not
implemented and its fallback path always returns 0. Implement it
using the new bpf_get_lowcore() kfunc.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/testing/selftests/bpf/bpf_experimental.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
index 4453ad27b2ef7..44466acf80838 100644
--- a/tools/testing/selftests/bpf/bpf_experimental.h
+++ b/tools/testing/selftests/bpf/bpf_experimental.h
@@ -651,6 +651,8 @@ static inline int get_preempt_count(void)
 	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;
+#elif defined(bpf_target_s390)
+	return bpf_get_lowcore()->preempt_count;
 #endif
 	return 0;
 }
@@ -660,6 +662,7 @@ static inline int get_preempt_count(void)
  *	* x86
  *	* arm64
  *	* powerpc64
+ *	* s390x
  */
 static inline int bpf_in_interrupt(void)
 {
@@ -680,6 +683,7 @@ static inline int bpf_in_interrupt(void)
  *	* x86
  *	* arm64
  *	* powerpc64
+ *	* s390x
  */
 static inline int bpf_in_nmi(void)
 {
@@ -691,6 +695,7 @@ static inline int bpf_in_nmi(void)
  *	* x86
  *	* arm64
  *	* powerpc64
+ *	* s390x
  */
 static inline int bpf_in_hardirq(void)
 {
@@ -702,6 +707,7 @@ static inline int bpf_in_hardirq(void)
  *	* x86
  *	* arm64
  *	* powerpc64
+ *	* s390x
  */
 static inline int bpf_in_serving_softirq(void)
 {
@@ -721,6 +727,7 @@ static inline int bpf_in_serving_softirq(void)
  *	* x86
  *	* arm64
  *	* powerpc64
+ *	* s390x
  */
 static inline int bpf_in_task(void)
 {
-- 
2.53.0


  parent reply	other threads:[~2026-02-17 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 16:05 [PATCH 0/2] bpf/s390: Implement get_preempt_count() Ilya Leoshkevich
2026-02-17 16:05 ` [PATCH 1/2] s390: Introduce bpf_get_lowcore() kfunc Ilya Leoshkevich
2026-02-17 16:05 ` Ilya Leoshkevich [this message]
2026-02-17 17:55 ` [PATCH 0/2] bpf/s390: Implement get_preempt_count() Vasily Gorbik
2026-02-17 19:32   ` Alexei Starovoitov
2026-02-17 23:34     ` Ilya Leoshkevich
2026-02-18  0:18       ` Alexei Starovoitov
2026-03-03 16:40 ` patchwork-bot+netdevbpf

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=20260217160813.100855-3-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    /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