Skip to contentSkip to conversation

locking/Kconfig: Add INLINE_SPINLOCKS & INLINE_RWLOCKS

PATCH Will Deacon 1 participant 1 message Oct 28, 2019 2 messages not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Will Deacon

author Acked-by
#2 lore raw

[I thought I replied to this already but I can't find any evidence of that.
Apologies if you receive this twice!]

Quoted 46 lines · Waiman Long

Both the arm64 and s390 architectures decide to inline all the spinlock and rwlock functions except the read_trylock() and write_trylock() functions for arm64. As other architectures are contemplating about inlining those locking functions as well, it makes sense to make it easier and less error-prone to do this.

Two new Kconfig options INLINE_SPINLOCKS and INLINE_RWLOCKS and their ARCH_* counterparts are now added to streamline this process. The s390 and arm64's Kconfig files are modified to use the new Kconfig options.

There is no functional change for s390. For arm64, both read_trylock() and write_trylock() are now inlined as well.

---
 arch/arm64/Kconfig   | 28 ++-------------------------
 arch/s390/Kconfig    | 30 ++---------------------------
 kernel/Kconfig.locks | 45 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 48 insertions(+), 55 deletions(-)
arch/arm64/Kconfig +0 -17
index 950a56b71ff0..e440d85dd8f1 100644
@@ -35,32 +35,8 @@ config ARM64
 	select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
-	select ARCH_INLINE_READ_LOCK if !PREEMPT
-	select ARCH_INLINE_READ_LOCK_BH if !PREEMPT
-	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPT
-	select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPT
-	select ARCH_INLINE_READ_UNLOCK if !PREEMPT
-	select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPT
-	select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPT
-	select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPT
-	select ARCH_INLINE_WRITE_LOCK if !PREEMPT
-	select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPT
-	select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPT
-	select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPT
-	select ARCH_INLINE_WRITE_UNLOCK if !PREEMPT
-	select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPT
-	select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPT
-	select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPT
-	select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPT

arch/arm64/Kconfig config ARM64 · line 38

Quoted 10 lines
arch/arm64/Kconfig +1 -9
-	select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPT
-	select ARCH_INLINE_SPIN_LOCK if !PREEMPT
-	select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPT
-	select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPT
-	select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPT
-	select ARCH_INLINE_SPIN_UNLOCK if !PREEMPT
-	select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPT
-	select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPT
-	select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPT
+	select ARCH_INLINE_RWLOCKS if !PREEMPT

This is a change in behaviour, since you're now selecting both ARCH_INLINE_READ_TRYLOCK and ARCH_INLINE_WRITE_TRYLOCK for arm64.

However, I /think/ that's probably just because I missed that when enabling the others, so cautiously:

Will