Skip to content

Commit 30ff133

Browse files
kkdwivediAlexei Starovoitov
authored andcommitted
rqspinlock: Add rqspinlock.h header
This header contains the public declarations usable in the rest of the kernel for rqspinlock. Let's also type alias qspinlock to rqspinlock_t to ensure consistent use of the new lock type. We want to remove dependence on the qspinlock type in later patches as we need to provide a test-and-set fallback, hence begin abstracting away from now onwards. Reviewed-by: Barret Rhoden <brho@google.com> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20250316040541.108729-6-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent a8fcf2a commit 30ff133

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

include/asm-generic/rqspinlock.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
/*
3+
* Resilient Queued Spin Lock
4+
*
5+
* (C) Copyright 2024-2025 Meta Platforms, Inc. and affiliates.
6+
*
7+
* Authors: Kumar Kartikeya Dwivedi <memxor@gmail.com>
8+
*/
9+
#ifndef __ASM_GENERIC_RQSPINLOCK_H
10+
#define __ASM_GENERIC_RQSPINLOCK_H
11+
12+
#include <linux/types.h>
13+
14+
struct qspinlock;
15+
typedef struct qspinlock rqspinlock_t;
16+
17+
extern void resilient_queued_spin_lock_slowpath(rqspinlock_t *lock, u32 val);
18+
19+
#endif /* __ASM_GENERIC_RQSPINLOCK_H */

kernel/bpf/rqspinlock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <asm/byteorder.h>
2424
#include <asm/qspinlock.h>
2525
#include <trace/events/lock.h>
26+
#include <asm/rqspinlock.h>
2627

2728
/*
2829
* Include queued spinlock definitions and statistics code
@@ -127,7 +128,7 @@ static __always_inline u32 __pv_wait_head_or_lock(struct qspinlock *lock,
127128
* contended : (*,x,y) +--> (*,0,0) ---> (*,0,1) -' :
128129
* queue : ^--' :
129130
*/
130-
void __lockfunc resilient_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
131+
void __lockfunc resilient_queued_spin_lock_slowpath(rqspinlock_t *lock, u32 val)
131132
{
132133
struct mcs_spinlock *prev, *next, *node;
133134
u32 old, tail;

0 commit comments

Comments
 (0)