diff mbox series

[for-next,v1] locking: Add __percpu tag to decode_tail qnode argument

Message ID 20250319133523.641009-1-memxor@gmail.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series [for-next,v1] locking: Add __percpu tag to decode_tail qnode argument | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Kumar Kartikeya Dwivedi March 19, 2025, 1:35 p.m. UTC
The decode_tail function now takes a qnode argument to use distinct
qnodes for qspinlock and rqspinlock. Add a __percpu tag to avoid
warnings and errors and reflect that the qnodes are per-cpu. There
is no actual bug here as the value was not dereferenced directly and
passed to per_cpu_ptr, so this is just to suppress the warning/errors
at compile time.

Fixes: 06988910ee2d ("locking: Move common qspinlock helpers to a private header")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 kernel/locking/qspinlock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.47.1

Comments

Alexei Starovoitov March 19, 2025, 3:06 p.m. UTC | #1
On Wed, Mar 19, 2025 at 6:35 AM Kumar Kartikeya Dwivedi
<memxor@gmail.com> wrote:
>
> The decode_tail function now takes a qnode argument to use distinct
> qnodes for qspinlock and rqspinlock. Add a __percpu tag to avoid
> warnings and errors and reflect that the qnodes are per-cpu. There
> is no actual bug here as the value was not dereferenced directly and
> passed to per_cpu_ptr, so this is just to suppress the warning/errors
> at compile time.
>
> Fixes: 06988910ee2d ("locking: Move common qspinlock helpers to a private header")
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---
>  kernel/locking/qspinlock.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/locking/qspinlock.h b/kernel/locking/qspinlock.h
> index d4ceb9490365..f63b6e04ddd4 100644
> --- a/kernel/locking/qspinlock.h
> +++ b/kernel/locking/qspinlock.h
> @@ -59,7 +59,7 @@ static inline __pure u32 encode_tail(int cpu, int idx)
>         return tail;
>  }
>
> -static inline __pure struct mcs_spinlock *decode_tail(u32 tail, struct qnode *qnodes)
> +static inline __pure struct mcs_spinlock *decode_tail(u32 tail, struct qnode __percpu *qnodes)

Applied. Decided to squash it in and adjusted to
new line to make it shorter.
diff mbox series

Patch

diff --git a/kernel/locking/qspinlock.h b/kernel/locking/qspinlock.h
index d4ceb9490365..f63b6e04ddd4 100644
--- a/kernel/locking/qspinlock.h
+++ b/kernel/locking/qspinlock.h
@@ -59,7 +59,7 @@  static inline __pure u32 encode_tail(int cpu, int idx)
 	return tail;
 }

-static inline __pure struct mcs_spinlock *decode_tail(u32 tail, struct qnode *qnodes)
+static inline __pure struct mcs_spinlock *decode_tail(u32 tail, struct qnode __percpu *qnodes)
 {
 	int cpu = (tail >> _Q_TAIL_CPU_OFFSET) - 1;
 	int idx = (tail &  _Q_TAIL_IDX_MASK) >> _Q_TAIL_IDX_OFFSET;