Skip to contentSkip to conversation

config: simplify INLINE_SPIN_UNLOCK

PATCH In review Raghavendra K T 3 participants 5 messages Mar 22, 2012 – Mar 23, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config: simplify INLINE_SPIN_UNLOCK

From: Raghavendra K T <[email protected]>

Patch simplifies current INLINE_SPIN_UNLOCK. compile tested on x86_64

Change log:
get rid of INLINE_SPIN_UNLOCK entirely replacing it with UNINLINE_SPIN_UNLOCK instead with the reverse meaning.

whover wants to uninline the spinlocks (like spinlock debugging, paravirt etc all just do select UNINLINE_SPIN_UNLOCK

---
Please refer : https://lkml.org/lkml/2012/3/21/357

 arch/mips/configs/db1300_defconfig  |    2 +-
 arch/tile/configs/tilegx_defconfig  |    2 +-
 arch/tile/configs/tilepro_defconfig |    2 +-
 arch/xtensa/configs/iss_defconfig   |    2 +-
 include/linux/spinlock_api_smp.h    |    2 +-
 kernel/Kconfig.locks                |    4 ++--
 kernel/Kconfig.preempt              |    1 +
 kernel/spinlock.c                   |    2 +-
 lib/Kconfig.debug                   |    1 +
 9 files changed, 10 insertions(+), 8 deletions(-)
arch/mips/configs/db1300_defconfig +1 -1
index c38b190..3590ab5 100644
@@ -133,7 +133,7 @@ CONFIG_BLK_DEV_BSG=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
-CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_UNINLINE_SPIN_UNLOCK is not set
 CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
 CONFIG_INLINE_READ_UNLOCK=y
 CONFIG_INLINE_READ_UNLOCK_IRQ=y
arch/tile/configs/tilegx_defconfig +1 -1
index dafdbba..db93926 100644
@@ -187,7 +187,7 @@ CONFIG_PADATA=y
 # CONFIG_INLINE_SPIN_LOCK_BH is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQ is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_UNINLINE_SPIN_UNLOCK is not set
 # CONFIG_INLINE_SPIN_UNLOCK_BH is not set
 CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
 # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
arch/tile/configs/tilepro_defconfig +1 -1
index 6f05f96..a039032 100644
@@ -153,7 +153,7 @@ CONFIG_DEFAULT_IOSCHED="noop"
 # CONFIG_INLINE_SPIN_LOCK_BH is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQ is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_UNINLINE_SPIN_UNLOCK is not set
 # CONFIG_INLINE_SPIN_UNLOCK_BH is not set
 CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
 # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
arch/xtensa/configs/iss_defconfig +1 -1
index f932b30..ddab37b 100644
@@ -113,7 +113,7 @@ CONFIG_DEFAULT_IOSCHED="noop"
 # CONFIG_INLINE_SPIN_LOCK_BH is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQ is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_UNINLINE_SPIN_UNLOCK is not set
 # CONFIG_INLINE_SPIN_UNLOCK_BH is not set
 CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
 # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
include/linux/spinlock_api_smp.h +1 -1
index e253ccd..51df117 100644
@@ -67,7 +67,7 @@ _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags)
 #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock)
 #endif
 
-#ifdef CONFIG_INLINE_SPIN_UNLOCK
+#ifndef CONFIG_UNINLINE_SPIN_UNLOCK
 #define _raw_spin_unlock(lock) __raw_spin_unlock(lock)
 #endif
 
kernel/Kconfig.locks +2 -2
index 5068e2a..2251882 100644
@@ -124,8 +124,8 @@ config INLINE_SPIN_LOCK_IRQSAVE
 	def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
 		 ARCH_INLINE_SPIN_LOCK_IRQSAVE
 
-config INLINE_SPIN_UNLOCK
-	def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_SPIN_UNLOCK)
+config UNINLINE_SPIN_UNLOCK
+	bool
 
 config INLINE_SPIN_UNLOCK_BH
 	def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_UNLOCK_BH
kernel/Kconfig.preempt +1 -0
index 24e7cb0..3f9c974 100644
@@ -36,6 +36,7 @@ config PREEMPT_VOLUNTARY
 config PREEMPT
 	bool "Preemptible Kernel (Low-Latency Desktop)"
 	select PREEMPT_COUNT
+	select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
 	help
 	  This option reduces the latency of the kernel by making
 	  all kernel code (that is not executing in a critical section)
kernel/spinlock.c +1 -1
index 84c7d96..5cdd806 100644
@@ -163,7 +163,7 @@ void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock)
 EXPORT_SYMBOL(_raw_spin_lock_bh);
 #endif
 
-#ifndef CONFIG_INLINE_SPIN_UNLOCK
+#ifdef CONFIG_UNINLINE_SPIN_UNLOCK
 void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock)
 {
 	__raw_spin_unlock(lock);
lib/Kconfig.debug +1 -0
index 8745ac7..286b8af 100644
@@ -495,6 +495,7 @@ config RT_MUTEX_TESTER
 config DEBUG_SPINLOCK
 	bool "Spinlock and rw-lock debugging: basic checks"
 	depends on DEBUG_KERNEL
+	select UNINLINE_SPIN_UNLOCK
 	help
 	  Say Y here and build SMP to catch missing spinlock initialization
 	  and certain other kinds of spinlock errors commonly made.  This is
#1 lore raw
Quoted 10 lines · Raghavendra K T

From: Raghavendra K T<[email protected]>

Patch simplifies current INLINE_SPIN_UNLOCK. compile tested on x86_64

Change log:
get rid of INLINE_SPIN_UNLOCK entirely replacing it with UNINLINE_SPIN_UNLOCK instead with the reverse meaning.

whover wants to uninline the spinlocks (like spinlock debugging, paravirt etc all just do select UNINLINE_SPIN_UNLOCK

typo:
Whoever wants to uninline the spinlocks (like spinlock debugging, paravirt etc) just do select UNINLINE_SPIN_UNLOCK.

Quoted 5 lines

---
Please refer : https://lkml.org/lkml/2012/3/21/357

Linus, Please let me know if this is what you were looking for or Did I really mess it up :(

#2 lore raw
Quoted 16 lines · Raghavendra K T
Quoted 10 lines · Raghavendra K T

From: Raghavendra K T<[email protected]>

Patch simplifies current INLINE_SPIN_UNLOCK. compile tested on x86_64

Change log:
get rid of INLINE_SPIN_UNLOCK entirely replacing it with UNINLINE_SPIN_UNLOCK instead with the reverse meaning.

whover wants to uninline the spinlocks (like spinlock debugging, paravirt etc all just do select UNINLINE_SPIN_UNLOCK

typo:
Whoever wants to uninline the spinlocks (like spinlock debugging, paravirt etc) just do select UNINLINE_SPIN_UNLOCK.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

---
Please refer : https://lkml.org/lkml/2012/3/21/357

Linus, Please let me know if this is what you were looking for or Did I really mess it up :(

Looks sane to me at first sight - will process it once the merge window calms down a bit.

Thanks,

Ingo

#3 lore raw
In reply to Raghavendra K T
Quoted 3 lines · Raghavendra K T

Linus, Please let me know if this is what you were looking for or Did I really mess it up :(

Yeah, this was what I was looking for. It seems much simpler to me, and allows the individual odd config options to just do the "select uninline" instead of having to have some complex logic about other config options in the inlining option itself.

Linus

#4 lore raw

[tip:x86/urgent] locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage

In reply to Raghavendra K T
Commit-ID:  e335e3eb82dada2765297f6ba501afc7555aba10
Gitweb:     http://git.kernel.org/tip/e335e3eb82dada2765297f6ba501afc7555aba10
Author:     Raghavendra K T <[email protected]>
AuthorDate: Thu, 22 Mar 2012 15:25:08 +0530
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 23 Mar 2012 13:18:57 +0100

locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage

Get rid of INLINE_SPIN_UNLOCK entirely replacing it with UNINLINE_SPIN_UNLOCK instead of the reverse meaning.

Whoever wants to change the default spinlock inlining behavior and uninline the spinlocks for some weird reason, such as spinlock debugging, paravirt etc. can now all just select UNINLINE_SPIN_UNLOCK

Original discussion at: https://lkml.org/lkml/2012/3/21/357

---
 arch/mips/configs/db1300_defconfig |    2 +-
 arch/xtensa/configs/iss_defconfig  |    2 +-
 include/linux/spinlock_api_smp.h   |    2 +-
 kernel/Kconfig.locks               |    4 ++--
 kernel/Kconfig.preempt             |    1 +
 kernel/spinlock.c                  |    2 +-
 lib/Kconfig.debug                  |    1 +
 7 files changed, 8 insertions(+), 6 deletions(-)
arch/mips/configs/db1300_defconfig +1 -1
index c38b190..3590ab5 100644
@@ -133,7 +133,7 @@ CONFIG_BLK_DEV_BSG=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
-CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_UNINLINE_SPIN_UNLOCK is not set
 CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
 CONFIG_INLINE_READ_UNLOCK=y
 CONFIG_INLINE_READ_UNLOCK_IRQ=y
arch/xtensa/configs/iss_defconfig +1 -1
index f932b30..ddab37b 100644
@@ -113,7 +113,7 @@ CONFIG_DEFAULT_IOSCHED="noop"
 # CONFIG_INLINE_SPIN_LOCK_BH is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQ is not set
 # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
+# CONFIG_UNINLINE_SPIN_UNLOCK is not set
 # CONFIG_INLINE_SPIN_UNLOCK_BH is not set
 CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
 # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
include/linux/spinlock_api_smp.h +1 -1
index e253ccd..51df117 100644
@@ -67,7 +67,7 @@ _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags)
 #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock)
 #endif
 
-#ifdef CONFIG_INLINE_SPIN_UNLOCK
+#ifndef CONFIG_UNINLINE_SPIN_UNLOCK
 #define _raw_spin_unlock(lock) __raw_spin_unlock(lock)
 #endif
 
kernel/Kconfig.locks +2 -2
index 5068e2a..2251882 100644
@@ -124,8 +124,8 @@ config INLINE_SPIN_LOCK_IRQSAVE
 	def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
 		 ARCH_INLINE_SPIN_LOCK_IRQSAVE
 
-config INLINE_SPIN_UNLOCK
-	def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_SPIN_UNLOCK)
+config UNINLINE_SPIN_UNLOCK
+	bool
 
 config INLINE_SPIN_UNLOCK_BH
 	def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_UNLOCK_BH
kernel/Kconfig.preempt +1 -0
index 24e7cb0..3f9c974 100644
@@ -36,6 +36,7 @@ config PREEMPT_VOLUNTARY
 config PREEMPT
 	bool "Preemptible Kernel (Low-Latency Desktop)"
 	select PREEMPT_COUNT
+	select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
 	help
 	  This option reduces the latency of the kernel by making
 	  all kernel code (that is not executing in a critical section)
kernel/spinlock.c +1 -1
index 84c7d96..5cdd806 100644
@@ -163,7 +163,7 @@ void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock)
 EXPORT_SYMBOL(_raw_spin_lock_bh);
 #endif
 
-#ifndef CONFIG_INLINE_SPIN_UNLOCK
+#ifdef CONFIG_UNINLINE_SPIN_UNLOCK
 void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock)
 {
 	__raw_spin_unlock(lock);
lib/Kconfig.debug +1 -0
index 05037dc..f32a41f 100644
@@ -499,6 +499,7 @@ config RT_MUTEX_TESTER
 config DEBUG_SPINLOCK
 	bool "Spinlock and rw-lock debugging: basic checks"
 	depends on DEBUG_KERNEL
+	select UNINLINE_SPIN_UNLOCK
 	help
 	  Say Y here and build SMP to catch missing spinlock initialization
 	  and certain other kinds of spinlock errors commonly made.  This is