diff options
Diffstat (limited to 'debian/patches-rt/rtmutex-wire-up-RT-s-locking.patch')
-rw-r--r-- | debian/patches-rt/rtmutex-wire-up-RT-s-locking.patch | 203 |
1 files changed, 151 insertions, 52 deletions
diff --git a/debian/patches-rt/rtmutex-wire-up-RT-s-locking.patch b/debian/patches-rt/rtmutex-wire-up-RT-s-locking.patch index 01f1d9b70..29efb5146 100644 --- a/debian/patches-rt/rtmutex-wire-up-RT-s-locking.patch +++ b/debian/patches-rt/rtmutex-wire-up-RT-s-locking.patch @@ -1,22 +1,43 @@ From: Thomas Gleixner <tglx@linutronix.de> Date: Thu, 12 Oct 2017 17:31:14 +0200 Subject: rtmutex: wire up RT's locking -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patches-5.2.17-rt9.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patches-5.4.3-rt1.tar.xz Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- + include/Kbuild | 7 +++++++ include/linux/mutex.h | 20 +++++++++++++------- - include/linux/rwsem.h | 11 +++++++++++ + include/linux/percpu-rwsem.h | 4 ++-- + include/linux/rwsem.h | 12 ++++++++++++ include/linux/spinlock.h | 12 +++++++++++- include/linux/spinlock_api_smp.h | 4 +++- include/linux/spinlock_types.h | 11 ++++++++--- - kernel/locking/Makefile | 10 +++++++++- + kernel/locking/Makefile | 10 +++++++--- + kernel/locking/rwsem.c | 8 ++++++++ kernel/locking/rwsem.h | 2 ++ kernel/locking/spinlock.c | 7 +++++++ kernel/locking/spinlock_debug.c | 5 +++++ - 9 files changed, 69 insertions(+), 13 deletions(-) + 12 files changed, 85 insertions(+), 17 deletions(-) +--- a/include/Kbuild ++++ b/include/Kbuild +@@ -1158,8 +1158,15 @@ header-test- += xen/xenbus.h + # Do not include directly + header-test- += linux/compiler-clang.h + header-test- += linux/compiler-gcc.h ++header-test- += linux/mutex_rt.h + header-test- += linux/patchkey.h + header-test- += linux/rwlock_api_smp.h ++header-test- += linux/rwlock_rt.h ++header-test- += linux/rwlock_types_rt.h ++header-test- += linux/rwsem-rt.h ++header-test- += linux/spinlock_rt.h ++header-test- += linux/spinlock_types_nort.h ++header-test- += linux/spinlock_types_rt.h + header-test- += linux/spinlock_types_up.h + header-test- += linux/spinlock_up.h + header-test- += linux/wimax/debug.h --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -22,6 +22,17 @@ @@ -30,14 +51,14 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +# define __DEP_MAP_MUTEX_INITIALIZER(lockname) +#endif + -+#ifdef CONFIG_PREEMPT_RT_FULL ++#ifdef CONFIG_PREEMPT_RT +# include <linux/mutex_rt.h> +#else + /* * Simple, straightforward mutexes with strict semantics: * -@@ -118,13 +129,6 @@ do { \ +@@ -108,13 +119,6 @@ do { \ __mutex_init((mutex), #mutex, &__key); \ } while (0) @@ -51,31 +72,52 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #define __MUTEX_INITIALIZER(lockname) \ { .owner = ATOMIC_LONG_INIT(0) \ , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \ -@@ -229,4 +233,6 @@ mutex_trylock_recursive(struct mutex *lo - return mutex_trylock(lock); - } +@@ -210,4 +214,6 @@ enum mutex_trylock_recursive_enum { + extern /* __deprecated */ __must_check enum mutex_trylock_recursive_enum + mutex_trylock_recursive(struct mutex *lock); -+#endif /* !PREEMPT_RT_FULL */ ++#endif /* !PREEMPT_RT */ + #endif /* __LINUX_MUTEX_H */ +--- a/include/linux/percpu-rwsem.h ++++ b/include/linux/percpu-rwsem.h +@@ -119,7 +119,7 @@ static inline void percpu_rwsem_release( + bool read, unsigned long ip) + { + lock_release(&sem->rw_sem.dep_map, 1, ip); +-#ifdef CONFIG_RWSEM_SPIN_ON_OWNER ++#if defined(CONFIG_RWSEM_SPIN_ON_OWNER) && !defined(CONFIG_PREEMPT_RT) + if (!read) + atomic_long_set(&sem->rw_sem.owner, RWSEM_OWNER_UNKNOWN); + #endif +@@ -129,7 +129,7 @@ static inline void percpu_rwsem_acquire( + bool read, unsigned long ip) + { + lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); +-#ifdef CONFIG_RWSEM_SPIN_ON_OWNER ++#if defined(CONFIG_RWSEM_SPIN_ON_OWNER) && !defined(CONFIG_PREEMPT_RT) + if (!read) + atomic_long_set(&sem->rw_sem.owner, (long)current); + #endif --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h -@@ -20,6 +20,10 @@ - #include <linux/osq_lock.h> - #endif - -+#ifdef CONFIG_PREEMPT_RT_FULL +@@ -16,6 +16,11 @@ + #include <linux/spinlock.h> + #include <linux/atomic.h> + #include <linux/err.h> ++ ++#ifdef CONFIG_PREEMPT_RT +#include <linux/rwsem-rt.h> -+#else /* PREEMPT_RT_FULL */ ++#else /* PREEMPT_RT */ + - /* - * For an uncontended rwsem, count and owner are the only fields a task - * needs to touch when acquiring the rwsem. So they are put next to each -@@ -109,6 +113,13 @@ static inline int rwsem_is_contended(str + #ifdef CONFIG_RWSEM_SPIN_ON_OWNER + #include <linux/osq_lock.h> + #endif +@@ -121,6 +126,13 @@ static inline int rwsem_is_contended(str return !list_empty(&sem->wait_list); } -+#endif /* !PREEMPT_RT_FULL */ ++#endif /* !PREEMPT_RT */ + +/* + * The functions below are the same for all rwsem implementations including @@ -92,7 +134,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* Include rwlock functions */ -#include <linux/rwlock.h> -+#ifdef CONFIG_PREEMPT_RT_FULL ++#ifdef CONFIG_PREEMPT_RT +# include <linux/rwlock_rt.h> +#else +# include <linux/rwlock.h> @@ -104,9 +146,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> # include <linux/spinlock_api_up.h> #endif -+#ifdef CONFIG_PREEMPT_RT_FULL ++#ifdef CONFIG_PREEMPT_RT +# include <linux/spinlock_rt.h> -+#else /* PREEMPT_RT_FULL */ ++#else /* PREEMPT_RT */ + /* * Map the spin_lock functions to the raw variants for PREEMPT_RT=n @@ -115,7 +157,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) -+#endif /* !PREEMPT_RT_FULL */ ++#endif /* !PREEMPT_RT */ + /* * Pull the atomic_t declaration: @@ -127,7 +169,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } -#include <linux/rwlock_api_smp.h> -+#ifndef CONFIG_PREEMPT_RT_FULL ++#ifndef CONFIG_PREEMPT_RT +# include <linux/rwlock_api_smp.h> +#endif @@ -141,7 +183,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> -#include <linux/spinlock_types_nort.h> - -#include <linux/rwlock_types.h> -+#ifndef CONFIG_PREEMPT_RT_FULL ++#ifndef CONFIG_PREEMPT_RT +# include <linux/spinlock_types_nort.h> +# include <linux/rwlock_types.h> +#else @@ -157,49 +199,106 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> # and is generally not a function of system call inputs. KCOV_INSTRUMENT := n --obj-y += mutex.o semaphore.o rwsem.o percpu-rwsem.o rwsem-xadd.o -+obj-y += semaphore.o percpu-rwsem.o +-obj-y += mutex.o semaphore.o rwsem.o percpu-rwsem.o ++obj-y += semaphore.o rwsem.o percpu-rwsem.o ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_lockdep.o = $(CC_FLAGS_FTRACE) -@@ -12,7 +12,11 @@ CFLAGS_REMOVE_mutex-debug.o = $(CC_FLAGS +@@ -12,19 +12,23 @@ CFLAGS_REMOVE_mutex-debug.o = $(CC_FLAGS CFLAGS_REMOVE_rtmutex-debug.o = $(CC_FLAGS_FTRACE) endif -+ifneq ($(CONFIG_PREEMPT_RT_FULL),y) -+obj-y += mutex.o - obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o -+endif -+obj-y += rwsem.o +-obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o obj-$(CONFIG_LOCKDEP) += lockdep.o ifeq ($(CONFIG_PROC_FS),y) obj-$(CONFIG_LOCKDEP) += lockdep_proc.o -@@ -25,6 +29,10 @@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.o + endif + obj-$(CONFIG_SMP) += spinlock.o +-obj-$(CONFIG_LOCK_SPIN_ON_OWNER) += osq_lock.o + obj-$(CONFIG_PROVE_LOCKING) += spinlock.o + obj-$(CONFIG_QUEUED_SPINLOCKS) += qspinlock.o + obj-$(CONFIG_RT_MUTEXES) += rtmutex.o obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o -+ifneq ($(CONFIG_PREEMPT_RT_FULL),y) -+obj-y += mutex.o rwsem.o rwsem-xadd.o ++ifneq ($(CONFIG_PREEMPT_RT),y) ++obj-y += mutex.o ++obj-$(CONFIG_LOCK_SPIN_ON_OWNER) += osq_lock.o ++obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o +endif -+obj-$(CONFIG_PREEMPT_RT_FULL) += mutex-rt.o rwsem-rt.o rwlock-rt.o ++obj-$(CONFIG_PREEMPT_RT) += mutex-rt.o rwsem-rt.o rwlock-rt.o obj-$(CONFIG_QUEUED_RWLOCKS) += qrwlock.o obj-$(CONFIG_LOCK_TORTURE_TEST) += locktorture.o obj-$(CONFIG_WW_MUTEX_SELFTEST) += test-ww_mutex.o ---- a/kernel/locking/rwsem.h -+++ b/kernel/locking/rwsem.h -@@ -169,6 +169,7 @@ extern struct rw_semaphore *rwsem_down_w - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); +--- a/kernel/locking/rwsem.c ++++ b/kernel/locking/rwsem.c +@@ -29,6 +29,8 @@ + #include <linux/atomic.h> + + #include "rwsem.h" ++ ++#ifndef CONFIG_PREEMPT_RT + #include "lock_events.h" + + /* +@@ -1335,6 +1337,7 @@ static struct rw_semaphore *rwsem_downgr + return sem; + } -+#ifndef CONFIG_PREEMPT_RT_FULL ++ /* * lock for reading */ -@@ -302,3 +303,4 @@ static inline void __downgrade_write(str - if (tmp < 0) +@@ -1485,6 +1488,7 @@ static inline void __downgrade_write(str + if (tmp & RWSEM_FLAG_WAITERS) rwsem_downgrade_wake(sem); } +#endif + + /* + * lock for reading +@@ -1616,6 +1620,7 @@ void _down_write_nest_lock(struct rw_sem + } + EXPORT_SYMBOL(_down_write_nest_lock); + ++#ifndef CONFIG_PREEMPT_RT + void down_read_non_owner(struct rw_semaphore *sem) + { + might_sleep(); +@@ -1623,6 +1628,7 @@ void down_read_non_owner(struct rw_semap + __rwsem_set_reader_owned(sem, NULL); + } + EXPORT_SYMBOL(down_read_non_owner); ++#endif + + void down_write_nested(struct rw_semaphore *sem, int subclass) + { +@@ -1647,11 +1653,13 @@ int __sched down_write_killable_nested(s + } + EXPORT_SYMBOL(down_write_killable_nested); + ++#ifndef CONFIG_PREEMPT_RT + void up_read_non_owner(struct rw_semaphore *sem) + { + DEBUG_RWSEMS_WARN_ON(!is_rwsem_reader_owned(sem), sem); + __up_read(sem); + } + EXPORT_SYMBOL(up_read_non_owner); ++#endif + + #endif +--- a/kernel/locking/rwsem.h ++++ b/kernel/locking/rwsem.h +@@ -4,7 +4,9 @@ + #define __INTERNAL_RWSEM_H + #include <linux/rwsem.h> + ++#ifndef CONFIG_PREEMPT_RT + extern void __down_read(struct rw_semaphore *sem); + extern void __up_read(struct rw_semaphore *sem); ++#endif + + #endif /* __INTERNAL_RWSEM_H */ --- a/kernel/locking/spinlock.c +++ b/kernel/locking/spinlock.c @@ -124,8 +124,11 @@ void __lockfunc __raw_##op##_lock_bh(loc @@ -207,7 +306,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> */ BUILD_LOCK_OPS(spin, raw_spinlock); + -+#ifndef CONFIG_PREEMPT_RT_FULL ++#ifndef CONFIG_PREEMPT_RT BUILD_LOCK_OPS(read, rwlock); BUILD_LOCK_OPS(write, rwlock); +#endif @@ -218,7 +317,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> EXPORT_SYMBOL(_raw_spin_unlock_bh); #endif -+#ifndef CONFIG_PREEMPT_RT_FULL ++#ifndef CONFIG_PREEMPT_RT + #ifndef CONFIG_INLINE_READ_TRYLOCK int __lockfunc _raw_read_trylock(rwlock_t *lock) @@ -227,7 +326,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> EXPORT_SYMBOL(_raw_write_unlock_bh); #endif -+#endif /* !PREEMPT_RT_FULL */ ++#endif /* !PREEMPT_RT */ + #ifdef CONFIG_DEBUG_LOCK_ALLOC @@ -238,7 +337,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> EXPORT_SYMBOL(__raw_spin_lock_init); -+#ifndef CONFIG_PREEMPT_RT_FULL ++#ifndef CONFIG_PREEMPT_RT void __rwlock_init(rwlock_t *lock, const char *name, struct lock_class_key *key) { @@ -254,7 +353,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> arch_spin_unlock(&lock->raw_lock); } -+#ifndef CONFIG_PREEMPT_RT_FULL ++#ifndef CONFIG_PREEMPT_RT static void rwlock_bug(rwlock_t *lock, const char *msg) { if (!debug_locks_off()) |