Skip to content

Commit 71535fd

Browse files
fthainKernel Patches Daemon
authored andcommitted
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 is now redundant. Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Andrii Nakryiko <[email protected]> Acked-by: Alexei Starovoitov <[email protected]>
1 parent 9b33bf7 commit 71535fd

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

include/asm-generic/rqspinlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct rqspinlock {
2828
*/
2929
struct bpf_res_spin_lock {
3030
u32 val;
31-
};
31+
} __aligned(__alignof__(struct rqspinlock));
3232

3333
struct qspinlock;
3434
#ifdef CONFIG_QUEUED_SPINLOCKS

kernel/bpf/rqspinlock.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ __bpf_kfunc int bpf_res_spin_lock(struct bpf_res_spin_lock *lock)
689689
int ret;
690690

691691
BUILD_BUG_ON(sizeof(rqspinlock_t) != sizeof(struct bpf_res_spin_lock));
692-
BUILD_BUG_ON(__alignof__(rqspinlock_t) != __alignof__(struct bpf_res_spin_lock));
693692

694693
preempt_disable();
695694
ret = res_spin_lock((rqspinlock_t *)lock);

0 commit comments

Comments
 (0)