[PATCH] locking/rwsem: Add configuration dependency constraints consistent with source file

From: sunying
Date: Thu May 11 2023 - 05:55:44 EST


From: Ying Sun <sunying@xxxxxxxxxxxxxx>

"CONFIG_RWSEM_SPIN_ON_OWNER" and "CONFIG_DEBUG_RWSEMS" are used in
kernel/locking/rwsem.c while "#ifndef CONFIG_PREEMPT_RT" is met,
which means they are available only if "CONFIG_PREEMPT_RT" is turned off.

To ensure that the corresponding source code can be compiled
when "CONFIG_RWSEM_SPIN_ON_OWNER" and "CONFIG_DEBUG_RWSEMS" are turned on,
it is recommended to add a dependency constraint on "CONFIG_PREEMPT_RT"
in kconfig.

Suggested-by: Yanjie Ren <renyanjie01@xxxxxxxxx>
Signed-off-by: Ying Sun <sunying@xxxxxxxxxxxxxx>
---
kernel/Kconfig.locks | 2 +-
lib/Kconfig.debug | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
index 4198f0273ecd..0e3462b08543 100644
--- a/kernel/Kconfig.locks
+++ b/kernel/Kconfig.locks
@@ -230,7 +230,7 @@ config MUTEX_SPIN_ON_OWNER

config RWSEM_SPIN_ON_OWNER
def_bool y
- depends on SMP && ARCH_SUPPORTS_ATOMIC_RMW
+ depends on SMP && ARCH_SUPPORTS_ATOMIC_RMW && !PREEMPT_RT

config LOCK_SPIN_ON_OWNER
def_bool y
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f202648dead9..0b392b1bd741 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1342,7 +1342,7 @@ config DEBUG_WW_MUTEX_SLOWPATH

config DEBUG_RWSEMS
bool "RW Semaphore debugging: basic checks"
- depends on DEBUG_KERNEL
+ depends on DEBUG_KERNEL && !PREEMPT_RT
help
This debugging feature allows mismatched rw semaphore locks
and unlocks to be detected and reported.
--
2.17.1