[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5803c4a180975f102bc8f78a3251540f0396fa46.1767169542.git.fthain@linux-m68k.org>
Date: Wed, 31 Dec 2025 19:25:42 +1100
From: Finn Thain <fthain@...ux-m68k.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Mark Rutland <mark.rutland@....com>,
linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-m68k@...ts.linux-m68k.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>,
Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
bpf@...r.kernel.org
Subject: [PATCH v6 1/4] bpf: Explicitly align bpf_res_spin_lock
Align bpf_res_spin_lock to avoid a BUILD_BUG_ON() when the alignment
changes, as it will do on m68k when, in a subsequent patch, the minimum
alignment of the atomic_t member of struct rqspinlock gets increased
from 2 to 4. Drop the BUILD_BUG_ON() as it becomes redundant.
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: linux-m68k@...ts.linux-m68k.org
Acked-by: Alexei Starovoitov <ast@...nel.org>
Reviewed-by: Arnd Bergmann <arnd@...db.de>
Signed-off-by: Finn Thain <fthain@...ux-m68k.org>
---
Changed since v5:
- Added tag from Arnd Bergmann.
---
include/asm-generic/rqspinlock.h | 2 +-
kernel/bpf/rqspinlock.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/asm-generic/rqspinlock.h b/include/asm-generic/rqspinlock.h
index 0f2dcbbfee2f..dd36ac96bf66 100644
--- a/include/asm-generic/rqspinlock.h
+++ b/include/asm-generic/rqspinlock.h
@@ -28,7 +28,7 @@ struct rqspinlock {
*/
struct bpf_res_spin_lock {
u32 val;
-};
+} __aligned(__alignof__(struct rqspinlock));
struct qspinlock;
#ifdef CONFIG_QUEUED_SPINLOCKS
diff --git a/kernel/bpf/rqspinlock.c b/kernel/bpf/rqspinlock.c
index f7d0c8d4644e..8d892fb099ac 100644
--- a/kernel/bpf/rqspinlock.c
+++ b/kernel/bpf/rqspinlock.c
@@ -694,7 +694,6 @@ __bpf_kfunc int bpf_res_spin_lock(struct bpf_res_spin_lock *lock)
int ret;
BUILD_BUG_ON(sizeof(rqspinlock_t) != sizeof(struct bpf_res_spin_lock));
- BUILD_BUG_ON(__alignof__(rqspinlock_t) != __alignof__(struct bpf_res_spin_lock));
preempt_disable();
ret = res_spin_lock((rqspinlock_t *)lock);
--
2.49.1
Powered by blists - more mailing lists