Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking: Fix rwlock support in <linux/spinlock_up.h>

Architecture support for rwlocks must be available whether or not
CONFIG_DEBUG_SPINLOCK has been defined. Move the definitions of the
arch_{read,write}_{lock,trylock,unlock}() macros such that these become
visbile if CONFIG_DEBUG_SPINLOCK=n.

This patch prepares for converting do_raw_{read,write}_trylock() into
inline functions. Without this patch that conversion triggers a build
failure for UP architectures, e.g. arm-ep93xx. I used the following
kernel configuration to build the kernel for that architecture:

CONFIG_ARCH_MULTIPLATFORM=y
CONFIG_ARCH_MULTI_V7=n
CONFIG_ATAGS=y
CONFIG_MMU=y
CONFIG_ARCH_MULTI_V4T=y
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_ARCH_EP93XX=y

Fixes: fb1c8f93d869 ("[PATCH] spinlock consolidation")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260313171510.230998-2-bvanassche@acm.org

authored by

Bart Van Assche and committed by
Peter Zijlstra
756a0e01 89162697

+10 -10
+10 -10
include/linux/spinlock_up.h
··· 48 48 lock->slock = 1; 49 49 } 50 50 51 - /* 52 - * Read-write spinlocks. No debug version. 53 - */ 54 - #define arch_read_lock(lock) do { barrier(); (void)(lock); } while (0) 55 - #define arch_write_lock(lock) do { barrier(); (void)(lock); } while (0) 56 - #define arch_read_trylock(lock) ({ barrier(); (void)(lock); 1; }) 57 - #define arch_write_trylock(lock) ({ barrier(); (void)(lock); 1; }) 58 - #define arch_read_unlock(lock) do { barrier(); (void)(lock); } while (0) 59 - #define arch_write_unlock(lock) do { barrier(); (void)(lock); } while (0) 60 - 61 51 #else /* DEBUG_SPINLOCK */ 62 52 #define arch_spin_is_locked(lock) ((void)(lock), 0) 63 53 /* for sched/core.c and kernel_lock.c: */ ··· 57 67 #endif /* DEBUG_SPINLOCK */ 58 68 59 69 #define arch_spin_is_contended(lock) (((void)(lock), 0)) 70 + 71 + /* 72 + * Read-write spinlocks. No debug version. 73 + */ 74 + #define arch_read_lock(lock) do { barrier(); (void)(lock); } while (0) 75 + #define arch_write_lock(lock) do { barrier(); (void)(lock); } while (0) 76 + #define arch_read_trylock(lock) ({ barrier(); (void)(lock); 1; }) 77 + #define arch_write_trylock(lock) ({ barrier(); (void)(lock); 1; }) 78 + #define arch_read_unlock(lock) do { barrier(); (void)(lock); } while (0) 79 + #define arch_write_unlock(lock) do { barrier(); (void)(lock); } while (0) 60 80 61 81 #endif /* __LINUX_SPINLOCK_UP_H */