BPF List
 help / color / mirror / Atom feed
* [PATCH bpf v1] bpf: Use architecture provided res_smp_cond_load_acquire
@ 2025-04-10 14:55 Kumar Kartikeya Dwivedi
  2025-04-10 22:02 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2025-04-10 14:55 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Martin KaFai Lau, Eduard Zingerman, kkd, kernel-team

In v2 of rqspinlock [0], we fixed potential problems with WFE usage in
arm64 to fallback to a version copied from Ankur's series [1]. This
logic was moved into arch-specific headers in v3 [2].

However, we missed using the arch-provided res_smp_cond_load_acquire
in commit ebababcd0372 ("rqspinlock: Hardcode cond_acquire loops for arm64")
due to a rebasing mistake between v2 and v3 of the rqspinlock series.
Fix the typo to fallback to the arm64 definition as we did in v2.

  [0]: https://lore.kernel.org/bpf/20250206105435.2159977-18-memxor@gmail.com
  [1]: https://lore.kernel.org/lkml/20250203214911.898276-1-ankur.a.arora@oracle.com
  [2]: https://lore.kernel.org/bpf/20250303152305.3195648-9-memxor@gmail.com

Fixes: ebababcd0372 ("rqspinlock: Hardcode cond_acquire loops for arm64")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 arch/arm64/include/asm/rqspinlock.h | 2 +-
 kernel/bpf/rqspinlock.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/rqspinlock.h b/arch/arm64/include/asm/rqspinlock.h
index 5b80785324b6..9ea0a74e5892 100644
--- a/arch/arm64/include/asm/rqspinlock.h
+++ b/arch/arm64/include/asm/rqspinlock.h
@@ -86,7 +86,7 @@

 #endif

-#define res_smp_cond_load_acquire_timewait(v, c) smp_cond_load_acquire_timewait(v, c, 0, 1)
+#define res_smp_cond_load_acquire(v, c) smp_cond_load_acquire_timewait(v, c, 0, 1)

 #include <asm-generic/rqspinlock.h>

diff --git a/kernel/bpf/rqspinlock.c b/kernel/bpf/rqspinlock.c
index b896c4a75a5c..338305c8852c 100644
--- a/kernel/bpf/rqspinlock.c
+++ b/kernel/bpf/rqspinlock.c
@@ -253,7 +253,7 @@ static noinline int check_timeout(rqspinlock_t *lock, u32 mask,
 	})
 #else
 #define RES_CHECK_TIMEOUT(ts, ret, mask)			      \
-	({ (ret) = check_timeout(&(ts)); })
+	({ (ret) = check_timeout((lock), (mask), &(ts)); })
 #endif

 /*
--
2.47.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf v1] bpf: Use architecture provided res_smp_cond_load_acquire
  2025-04-10 14:55 [PATCH bpf v1] bpf: Use architecture provided res_smp_cond_load_acquire Kumar Kartikeya Dwivedi
@ 2025-04-10 22:02 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2025-04-10 22:02 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi
  Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Martin KaFai Lau, Eduard Zingerman, kkd, Kernel Team

On Thu, Apr 10, 2025 at 7:55 AM Kumar Kartikeya Dwivedi
<memxor@gmail.com> wrote:
>
> In v2 of rqspinlock [0], we fixed potential problems with WFE usage in
> arm64 to fallback to a version copied from Ankur's series [1]. This
> logic was moved into arch-specific headers in v3 [2].
>
> However, we missed using the arch-provided res_smp_cond_load_acquire
> in commit ebababcd0372 ("rqspinlock: Hardcode cond_acquire loops for arm64")
> due to a rebasing mistake between v2 and v3 of the rqspinlock series.
> Fix the typo to fallback to the arm64 definition as we did in v2.
>
>   [0]: https://lore.kernel.org/bpf/20250206105435.2159977-18-memxor@gmail.com
>   [1]: https://lore.kernel.org/lkml/20250203214911.898276-1-ankur.a.arora@oracle.com
>   [2]: https://lore.kernel.org/bpf/20250303152305.3195648-9-memxor@gmail.com
>
> Fixes: ebababcd0372 ("rqspinlock: Hardcode cond_acquire loops for arm64")
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---
>  arch/arm64/include/asm/rqspinlock.h | 2 +-
>  kernel/bpf/rqspinlock.c             | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

This one and two other selftest patches were applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-10 22:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 14:55 [PATCH bpf v1] bpf: Use architecture provided res_smp_cond_load_acquire Kumar Kartikeya Dwivedi
2025-04-10 22:02 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox