Skip to contentSkip to conversation

bpf: Use architecture provided res_smp_cond_load_acquire

PATCH In review Kumar Kartikeya Dwivedi 2 participants 2 messages Apr 10, 2025

Subsystems (2)
lore
Share & tools
lore

Kumar Kartikeya Dwivedi

author maintainer
#0 lore raw

PATCH 1/1 bpf: Use architecture provided res_smp_cond_load_acquire

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/[email protected]
[1]: https://lore.kernel.org/lkml/[email protected]
[2]: https://lore.kernel.org/bpf/[email protected]

Fixes ebababcd0372 ("rqspinlock: Hardcode cond_acquire loops for arm64")
---
 arch/arm64/include/asm/rqspinlock.h | 2 +-
 kernel/bpf/rqspinlock.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/rqspinlock.h +1 -1
index 5b80785324b6..9ea0a74e5892 100644
@@ -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>
 
kernel/bpf/rqspinlock.c +1 -1
index b896c4a75a5c..338305c8852c 100644
@@ -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

#1 lore raw
Quoted 14 lines · Kumar Kartikeya Dwivedi

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/[email protected]
[1]: https://lore.kernel.org/lkml/[email protected]
[2]: https://lore.kernel.org/bpf/[email protected]

Quoted 6 lines
Fixes ebababcd0372 ("rqspinlock: Hardcode cond_acquire loops for arm64")
---
 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.