History

Merge tag 'locking_core_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking updates from Borislav Petkov: "Lots of cleanups and preparation. Highlights: - futex: Cleanup and remove runtime futex_cmpxchg detection - rtmutex: Some fixes for the PREEMPT_RT locking infrastructure - kcsan: Share owner_on_cpu() between mutex,rtmutex and rwsem and annotate the racy owner->on_cpu access *once*. - atomic64: Dead-Code-Elemination" [ Description above by Peter Zijlstra ] * tag 'locking_core_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/atomic: atomic64: Remove unusable atomic ops futex: Fix additional regressions locking: Allow to include asm/spinlock_types.h from linux/spinlock_types_raw.h x86/mm: Include spinlock_t definition in pgtable. locking: Mark racy reads of owner->on_cpu locking: Make owner_on_cpu() into <linux/sched.h> lockdep/selftests: Adapt ww-tests for PREEMPT_RT lockdep/selftests: Skip the softirq related tests on PREEMPT_RT lockdep/selftests: Unbalanced migrate_disable() & rcu_read_lock(). lockdep/selftests: Avoid using local_lock_{acquire|release}(). lockdep: Remove softirq accounting on PREEMPT_RT. locking/rtmutex: Add rt_mutex_lock_nest_lock() and rt_mutex_lock_killable(). locking/rtmutex: Squash self-deadlock check for ww_rt_mutex. locking: Remove rt_rwlock_is_contended(). sched: Trigger warning if ->migration_disabled counter underflows. futex: Fix sparc32/m68k/nds32 build regression futex: Remove futex_cmpxchg detection futex: Ensure futex_atomic_cmpxchg_inatomic() is present kernel/locking: Use a pointer in ww_mutex_trylock().

Linus Torvalds committed 4 years ago

Commit daadb3b2 parents 6ae7143 f16cc9845 files · +240 −225Browse files

Unified · Split

45 files
  1. arch/alpha/include/asm/spinlock_types.h +1 −1
  2. arch/arc/Kconfig +0 −1
  3. arch/arm/Kconfig +0 −1
  4. arch/arm/include/asm/spinlock_types.h +1 −1
  5. arch/arm64/Kconfig +0 −1
  6. arch/arm64/include/asm/spinlock_types.h +1 −1
  7. arch/csky/Kconfig +0 −1
  8. arch/csky/include/asm/spinlock_types.h +1 −1
  9. arch/hexagon/include/asm/spinlock_types.h +1 −1
  10. arch/ia64/include/asm/spinlock_types.h +1 −1
  11. arch/m68k/Kconfig +0 −1
  12. arch/mips/include/asm/futex.h +17 −10
  13. arch/powerpc/include/asm/simple_spinlock_types.h +1 −1
  14. arch/powerpc/include/asm/spinlock_types.h +1 −1
  15. arch/riscv/Kconfig +0 −1
  16. arch/riscv/include/asm/spinlock_types.h +1 −1
  17. arch/s390/Kconfig +0 −1
  18. arch/s390/include/asm/spinlock_types.h +1 −1
  19. arch/sh/Kconfig +0 −1
  20. arch/sh/include/asm/spinlock_types.h +1 −1
  21. arch/um/Kconfig +0 −1
  22. arch/um/kernel/skas/uaccess.c +0 −1
  23. arch/xtensa/Kconfig +0 −1
  24. arch/xtensa/include/asm/futex.h +6 −2
  25. arch/xtensa/include/asm/spinlock_types.h +1 −1
  26. include/asm-generic/futex.h +11 −20
  27. include/linux/irqflags.h +15 −8
  28. include/linux/ratelimit_types.h +1 −1
  29. include/linux/rtmutex.h +9 −0
  30. include/linux/sched.h +9 −0
  31. include/linux/spinlock_types_up.h +1 −1
  32. init/Kconfig +1 −8
  33. kernel/futex/core.c +0 −35
  34. kernel/futex/futex.h +0 −6
  35. kernel/futex/syscalls.c +0 −22
  36. kernel/locking/lockdep.c +2 −0
  37. kernel/locking/mutex.c +2 −9
  38. kernel/locking/rtmutex.c +6 −4
  39. kernel/locking/rtmutex_api.c +26 −4
  40. kernel/locking/rwsem.c +0 −9
  41. kernel/locking/spinlock_rt.c +0 −6
  42. kernel/locking/ww_rt_mutex.c +1 −1
  43. kernel/sched/core.c +3 −0
  44. lib/atomic64.c +0 −2
  45. lib/locking-selftest.c +118 −54
arch/alpha/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _ALPHA_SPINLOCK_TYPES_H
33 #define _ALPHA_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/arc/Kconfig+0−1
@@ -32,7 +32,6 @@ config ARC · 31 unmodified lines
3232 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARC_MMU_V4
3333 select HAVE_DEBUG_STACKOVERFLOW
3434 select HAVE_DEBUG_KMEMLEAK
35− select HAVE_FUTEX_CMPXCHG if FUTEX
3635 select HAVE_IOREMAP_PROT
3736 select HAVE_KERNEL_GZIP
3837 select HAVE_KERNEL_LZMA
arch/arm/Kconfig+0−1
@@ -93,7 +93,6 @@ config ARM · 92 unmodified lines
9393 select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
9494 select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
9595 select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !(THUMB2_KERNEL && CC_IS_CLANG)
96− select HAVE_FUTEX_CMPXCHG if FUTEX
9796 select HAVE_GCC_PLUGINS
9897 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
9998 select HAVE_IRQ_TIME_ACCOUNTING
arch/arm/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef __ASM_SPINLOCK_TYPES_H
33 #define __ASM_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/arm64/Kconfig+0−1
@@ -196,7 +196,6 @@ config ARM64 · 195 unmodified lines
196196 select HAVE_REGS_AND_STACK_ACCESS_API
197197 select HAVE_POSIX_CPU_TIMERS_TASK_WORK
198198 select HAVE_FUNCTION_ARG_ACCESS_API
199− select HAVE_FUTEX_CMPXCHG if FUTEX
200199 select MMU_GATHER_RCU_TABLE_FREE
201200 select HAVE_RSEQ
202201 select HAVE_STACKPROTECTOR
arch/arm64/include/asm/spinlock_types.h+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 #ifndef __ASM_SPINLOCK_TYPES_H
66 #define __ASM_SPINLOCK_TYPES_H
77
8−#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
8+#if !defined(__LINUX_SPINLOCK_TYPES_RAW_H) && !defined(__ASM_SPINLOCK_H)
99 # error "please don't include this file directly"
1010 #endif
1111
arch/csky/Kconfig+0−1
@@ -52,7 +52,6 @@ config CSKY · 51 unmodified lines
5252 select HAVE_FUNCTION_TRACER
5353 select HAVE_FUNCTION_GRAPH_TRACER
5454 select HAVE_FUNCTION_ERROR_INJECTION
55− select HAVE_FUTEX_CMPXCHG if FUTEX && SMP
5655 select HAVE_FTRACE_MCOUNT_RECORD
5756 select HAVE_KERNEL_GZIP
5857 select HAVE_KERNEL_LZO
arch/csky/include/asm/spinlock_types.h+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 #ifndef __ASM_CSKY_SPINLOCK_TYPES_H
44 #define __ASM_CSKY_SPINLOCK_TYPES_H
55
6−#ifndef __LINUX_SPINLOCK_TYPES_H
6+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
77 # error "please don't include this file directly"
88 #endif
99
arch/hexagon/include/asm/spinlock_types.h+1−1
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 #ifndef _ASM_SPINLOCK_TYPES_H
99 #define _ASM_SPINLOCK_TYPES_H
1010
11−#ifndef __LINUX_SPINLOCK_TYPES_H
11+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
1212 # error "please don't include this file directly"
1313 #endif
1414
arch/ia64/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _ASM_IA64_SPINLOCK_TYPES_H
33 #define _ASM_IA64_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/m68k/Kconfig+0−1
@@ -21,7 +21,6 @@ config M68K · 20 unmodified lines
2121 select HAVE_ASM_MODVERSIONS
2222 select HAVE_DEBUG_BUGVERBOSE
2323 select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_HAS_NO_UNALIGNED
24− select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
2524 select HAVE_MOD_ARCH_SPECIFIC
2625 select HAVE_UID16
2726 select MMU_GATHER_NO_RANGE if MMU
arch/mips/include/asm/futex.h+17−10
@@ -19,7 +19,11 @@ · 18 unmodified lines
1919 #include <asm/sync.h>
2020 #include <asm/war.h>
2121
22−#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
22+#define arch_futex_atomic_op_inuser arch_futex_atomic_op_inuser
23+#define futex_atomic_cmpxchg_inatomic futex_atomic_cmpxchg_inatomic
24+#include <asm-generic/futex.h>
25+
26+#define __futex_atomic_op(op, insn, ret, oldval, uaddr, oparg) \
2327 { \
2428 if (cpu_has_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) { \
2529 __asm__ __volatile__( \
@@ -80,8 +84,10 @@ · 54 unmodified lines
8084 : "0" (0), GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oparg), \
8185 "i" (-EFAULT) \
8286 : "memory"); \
83− } else \
84− ret = -ENOSYS; \
87+ } else { \
88+ /* fallback for non-SMP */ \
89+ ret = futex_atomic_op_inuser_local(op, oparg, oval, uaddr); \
90+ } \
8591 }
8692
8793 static inline int
@@ -94,23 +100,23 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) · 6 unmodified lines
94100
95101 switch (op) {
96102 case FUTEX_OP_SET:
97− __futex_atomic_op("move $1, %z5", ret, oldval, uaddr, oparg);
103+ __futex_atomic_op(op, "move $1, %z5", ret, oldval, uaddr, oparg);
98104 break;
99105
100106 case FUTEX_OP_ADD:
101− __futex_atomic_op("addu $1, %1, %z5",
107+ __futex_atomic_op(op, "addu $1, %1, %z5",
102108 ret, oldval, uaddr, oparg);
103109 break;
104110 case FUTEX_OP_OR:
105− __futex_atomic_op("or $1, %1, %z5",
111+ __futex_atomic_op(op, "or $1, %1, %z5",
106112 ret, oldval, uaddr, oparg);
107113 break;
108114 case FUTEX_OP_ANDN:
109− __futex_atomic_op("and $1, %1, %z5",
115+ __futex_atomic_op(op, "and $1, %1, %z5",
110116 ret, oldval, uaddr, ~oparg);
111117 break;
112118 case FUTEX_OP_XOR:
113− __futex_atomic_op("xor $1, %1, %z5",
119+ __futex_atomic_op(op, "xor $1, %1, %z5",
114120 ret, oldval, uaddr, oparg);
115121 break;
116122 default:
@@ -193,8 +199,9 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 76 unmodified lines
193199 : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval),
194200 "i" (-EFAULT)
195201 : "memory");
196− } else
197− return -ENOSYS;
202+ } else {
203+ return futex_atomic_cmpxchg_inatomic_local(uval, uaddr, oldval, newval);
204+ }
198205
199206 *uval = val;
200207 return ret;
arch/powerpc/include/asm/simple_spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _ASM_POWERPC_SIMPLE_SPINLOCK_TYPES_H
33 #define _ASM_POWERPC_SIMPLE_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/powerpc/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _ASM_POWERPC_SPINLOCK_TYPES_H
33 #define _ASM_POWERPC_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/riscv/Kconfig+0−1
@@ -83,7 +83,6 @@ config RISCV · 82 unmodified lines
8383 select HAVE_DMA_CONTIGUOUS if MMU
8484 select HAVE_EBPF_JIT if MMU
8585 select HAVE_FUNCTION_ERROR_INJECTION
86− select HAVE_FUTEX_CMPXCHG if FUTEX
8786 select HAVE_GCC_PLUGINS
8887 select HAVE_GENERIC_VDSO if MMU && 64BIT
8988 select HAVE_IRQ_TIME_ACCOUNTING
arch/riscv/include/asm/spinlock_types.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 #ifndef _ASM_RISCV_SPINLOCK_TYPES_H
77 #define _ASM_RISCV_SPINLOCK_TYPES_H
88
9−#ifndef __LINUX_SPINLOCK_TYPES_H
9+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
1010 # error "please don't include this file directly"
1111 #endif
1212
arch/s390/Kconfig+0−1
@@ -165,7 +165,6 @@ config S390 · 164 unmodified lines
165165 select HAVE_FUNCTION_ERROR_INJECTION
166166 select HAVE_FUNCTION_GRAPH_TRACER
167167 select HAVE_FUNCTION_TRACER
168− select HAVE_FUTEX_CMPXCHG if FUTEX
169168 select HAVE_GCC_PLUGINS
170169 select HAVE_GENERIC_VDSO
171170 select HAVE_IOREMAP_PROT if PCI
arch/s390/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef __ASM_SPINLOCK_TYPES_H
33 #define __ASM_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/sh/Kconfig+0−1
@@ -34,7 +34,6 @@ config SUPERH · 33 unmodified lines
3434 select HAVE_FAST_GUP if MMU
3535 select HAVE_FUNCTION_GRAPH_TRACER
3636 select HAVE_FUNCTION_TRACER
37− select HAVE_FUTEX_CMPXCHG if FUTEX
3837 select HAVE_FTRACE_MCOUNT_RECORD
3938 select HAVE_HW_BREAKPOINT
4039 select HAVE_IOREMAP_PROT if MMU && !X2TLB
arch/sh/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef __ASM_SH_SPINLOCK_TYPES_H
33 #define __ASM_SH_SPINLOCK_TYPES_H
44
5−#ifndef __LINUX_SPINLOCK_TYPES_H
5+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
66 # error "please don't include this file directly"
77 #endif
88
arch/um/Kconfig+0−1
@@ -14,7 +14,6 @@ config UML · 13 unmodified lines
1414 select HAVE_ARCH_SECCOMP_FILTER
1515 select HAVE_ASM_MODVERSIONS
1616 select HAVE_UID16
17− select HAVE_FUTEX_CMPXCHG if FUTEX
1817 select HAVE_DEBUG_KMEMLEAK
1918 select HAVE_DEBUG_BUGVERBOSE
2019 select NO_DMA if !UML_DMA_EMULATION
arch/um/kernel/skas/uaccess.c+0−1
@@ -323,7 +323,6 @@ EXPORT_SYMBOL(arch_futex_atomic_op_inuser); · 322 unmodified lines
323323 * 0 - On success
324324 * -EFAULT - User access resulted in a page fault
325325 * -EAGAIN - Atomic operation was unable to complete due to contention
326− * -ENOSYS - Function not implemented (only if !HAVE_FUTEX_CMPXCHG)
327326 */
328327
329328 int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
arch/xtensa/Kconfig+0−1
@@ -31,7 +31,6 @@ config XTENSA · 30 unmodified lines
3131 select HAVE_DMA_CONTIGUOUS
3232 select HAVE_EXIT_THREAD
3333 select HAVE_FUNCTION_TRACER
34− select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX
3534 select HAVE_HW_BREAKPOINT if PERF_EVENTS
3635 select HAVE_IRQ_TIME_ACCOUNTING
3736 select HAVE_PCI
arch/xtensa/include/asm/futex.h+6−2
@@ -16,6 +16,10 @@ · 15 unmodified lines
1616 #include <linux/uaccess.h>
1717 #include <linux/errno.h>
1818
19+#define arch_futex_atomic_op_inuser arch_futex_atomic_op_inuser
20+#define futex_atomic_cmpxchg_inatomic futex_atomic_cmpxchg_inatomic
21+#include <asm-generic/futex.h>
22+
1923 #if XCHAL_HAVE_EXCLUSIVE
2024 #define __futex_atomic_op(insn, ret, old, uaddr, arg) \
2125 __asm__ __volatile( \
@@ -105,7 +109,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, · 83 unmodified lines
105109
106110 return ret;
107111 #else
108− return -ENOSYS;
112+ return futex_atomic_op_inuser_local(op, oparg, oval, uaddr);
109113 #endif
110114 }
111115
@@ -156,7 +160,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 44 unmodified lines
156160
157161 return ret;
158162 #else
159− return -ENOSYS;
163+ return futex_atomic_cmpxchg_inatomic_local(uval, uaddr, oldval, newval);
160164 #endif
161165 }
162166
arch/xtensa/include/asm/spinlock_types.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef __ASM_SPINLOCK_TYPES_H
33 #define __ASM_SPINLOCK_TYPES_H
44
5−#if !defined(__LINUX_SPINLOCK_TYPES_H) && !defined(__ASM_SPINLOCK_H)
5+#if !defined(__LINUX_SPINLOCK_TYPES_RAW_H) && !defined(__ASM_SPINLOCK_H)
66 # error "please don't include this file directly"
77 #endif
88
include/asm-generic/futex.h+11−20
@@ -6,15 +6,22 @@ · 5 unmodified lines
66 #include <linux/uaccess.h>
77 #include <asm/errno.h>
88
9+#ifndef futex_atomic_cmpxchg_inatomic
910 #ifndef CONFIG_SMP
1011 /*
1112 * The following implementation only for uniprocessor machines.
1213 * It relies on preempt_disable() ensuring mutual exclusion.
1314 *
1415 */
16+#define futex_atomic_cmpxchg_inatomic(uval, uaddr, oldval, newval) \
17+ futex_atomic_cmpxchg_inatomic_local(uval, uaddr, oldval, newval)
18+#define arch_futex_atomic_op_inuser(op, oparg, oval, uaddr) \
19+ futex_atomic_op_inuser_local(op, oparg, oval, uaddr)
20+#endif /* CONFIG_SMP */
21+#endif
1522
1623 /**
17− * arch_futex_atomic_op_inuser() - Atomic arithmetic operation with constant
24+ * futex_atomic_op_inuser_local() - Atomic arithmetic operation with constant
1825 * argument and comparison of the previous
1926 * futex value with another constant.
2027 *
@@ -28,7 +35,7 @@ · 7 unmodified lines
2835 * -ENOSYS - Operation not supported
2936 */
3037 static inline int
31−arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
38+futex_atomic_op_inuser_local(int op, u32 oparg, int *oval, u32 __user *uaddr)
3239 {
3340 int oldval, ret;
3441 u32 tmp;
@@ -75,7 +82,7 @@ out_pagefault_enable: · 40 unmodified lines
7582 }
7683
7784 /**
78− * futex_atomic_cmpxchg_inatomic() - Compare and exchange the content of the
85+ * futex_atomic_cmpxchg_inatomic_local() - Compare and exchange the content of the
7986 * uaddr with newval if the current value is
8087 * oldval.
8188 * @uval: pointer to store content of @uaddr
@@ -87,10 +94,9 @@ out_pagefault_enable: · 5 unmodified lines
8794 * 0 - On success
8895 * -EFAULT - User access resulted in a page fault
8996 * -EAGAIN - Atomic operation was unable to complete due to contention
90− * -ENOSYS - Function not implemented (only if !HAVE_FUTEX_CMPXCHG)
9197 */
9298 static inline int
93−futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
99+futex_atomic_cmpxchg_inatomic_local(u32 *uval, u32 __user *uaddr,
94100 u32 oldval, u32 newval)
95101 {
96102 u32 val;
@@ -112,19 +118,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 15 unmodified lines
112118 return 0;
113119 }
114120
115−#else
116−static inline int
117−arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
118−{
119− return -ENOSYS;
120−}
121−
122−static inline int
123−futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
124− u32 oldval, u32 newval)
125−{
126− return -ENOSYS;
127−}
128−
129−#endif /* CONFIG_SMP */
130121 #endif
include/linux/irqflags.h+15−8
@@ -71,14 +71,6 @@ do { \ · 70 unmodified lines
7171 do { \
7272 __this_cpu_dec(hardirq_context); \
7373 } while (0)
74−# define lockdep_softirq_enter() \
75−do { \
76− current->softirq_context++; \
77−} while (0)
78−# define lockdep_softirq_exit() \
79−do { \
80− current->softirq_context--; \
81−} while (0)
8274
8375 # define lockdep_hrtimer_enter(__hrtimer) \
8476 ({ \
@@ -140,6 +132,21 @@ do { \ · 55 unmodified lines
140132 # define lockdep_irq_work_exit(__work) do { } while (0)
141133 #endif
142134
135+#if defined(CONFIG_TRACE_IRQFLAGS) && !defined(CONFIG_PREEMPT_RT)
136+# define lockdep_softirq_enter() \
137+do { \
138+ current->softirq_context++; \
139+} while (0)
140+# define lockdep_softirq_exit() \
141+do { \
142+ current->softirq_context--; \
143+} while (0)
144+
145+#else
146+# define lockdep_softirq_enter() do { } while (0)
147+# define lockdep_softirq_exit() do { } while (0)
148+#endif
149+
143150 #if defined(CONFIG_IRQSOFF_TRACER) || \
144151 defined(CONFIG_PREEMPT_TRACER)
145152 extern void stop_critical_timings(void);
include/linux/ratelimit_types.h+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44
55 #include <linux/bits.h>
66 #include <linux/param.h>
7−#include <linux/spinlock_types.h>
7+#include <linux/spinlock_types_raw.h>
88
99 #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
1010 #define DEFAULT_RATELIMIT_BURST 10
include/linux/rtmutex.h+9−0
@@ -99,13 +99,22 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock · 98 unmodified lines
9999
100100 #ifdef CONFIG_DEBUG_LOCK_ALLOC
101101 extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass);
102+extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock);
102103 #define rt_mutex_lock(lock) rt_mutex_lock_nested(lock, 0)
104+#define rt_mutex_lock_nest_lock(lock, nest_lock) \
105+ do { \
106+ typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
107+ _rt_mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \
108+ } while (0)
109+
103110 #else
104111 extern void rt_mutex_lock(struct rt_mutex *lock);
105112 #define rt_mutex_lock_nested(lock, subclass) rt_mutex_lock(lock)
113+#define rt_mutex_lock_nest_lock(lock, nest_lock) rt_mutex_lock(lock)
106114 #endif
107115
108116 extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
117+extern int rt_mutex_lock_killable(struct rt_mutex *lock);
109118 extern int rt_mutex_trylock(struct rt_mutex *lock);
110119
111120 extern void rt_mutex_unlock(struct rt_mutex *lock);
include/linux/sched.h+9−0
@@ -2178,6 +2178,15 @@ extern long sched_getaffinity(pid_t pid, struct cpumask *mask); · 2177 unmodified lines
21782178 #endif
21792179
21802180 #ifdef CONFIG_SMP
2181+static inline bool owner_on_cpu(struct task_struct *owner)
2182+{
2183+ /*
2184+ * As lock holder preemption issue, we both skip spinning if
2185+ * task is not on cpu or its cpu is preempted
2186+ */
2187+ return READ_ONCE(owner->on_cpu) && !vcpu_is_preempted(task_cpu(owner));
2188+}
2189+
21812190 /* Returns effective CPU energy utilization, as seen by the scheduler */
21822191 unsigned long sched_cpu_util(int cpu, unsigned long max);
21832192 #endif /* CONFIG_SMP */
include/linux/spinlock_types_up.h+1−1
@@ -1,7 +1,7 @@
11 #ifndef __LINUX_SPINLOCK_TYPES_UP_H
22 #define __LINUX_SPINLOCK_TYPES_UP_H
33
4−#ifndef __LINUX_SPINLOCK_TYPES_H
4+#ifndef __LINUX_SPINLOCK_TYPES_RAW_H
55 # error "please don't include this file directly"
66 #endif
77
init/Kconfig+1−8
@@ -1579,6 +1579,7 @@ config BASE_FULL · 1578 unmodified lines
15791579
15801580 config FUTEX
15811581 bool "Enable futex support" if EXPERT
1582+ depends on !(SPARC32 && SMP)
15821583 default y
15831584 imply RT_MUTEXES
15841585 help
@@ -1591,14 +1592,6 @@ config FUTEX_PI · 6 unmodified lines
15911592 depends on FUTEX && RT_MUTEXES
15921593 default y
15931594
1594−config HAVE_FUTEX_CMPXCHG
1595− bool
1596− depends on FUTEX
1597− help
1598− Architectures should select this if futex_atomic_cmpxchg_inatomic()
1599− is implemented and always working. This removes a couple of runtime
1600− checks.
1601−
16021595 config EPOLL
16031596 bool "Enable eventpoll support" if EXPERT
16041597 default y
kernel/futex/core.c+0−35
@@ -41,11 +41,6 @@ · 40 unmodified lines
4141 #include "futex.h"
4242 #include "../locking/rtmutex_common.h"
4343
44−#ifndef CONFIG_HAVE_FUTEX_CMPXCHG
45−int __read_mostly futex_cmpxchg_enabled;
46−#endif
47−
48−
4944 /*
5045 * The base of the bucket array and its size are always used together
5146 * (after initialization only in futex_hash()), so ensure that they
@@ -776,9 +771,6 @@ static void exit_robust_list(struct task_struct *curr) · 724 unmodified lines
776771 unsigned long futex_offset;
777772 int rc;
778773
779− if (!futex_cmpxchg_enabled)
780− return;
781−
782774 /*
783775 * Fetch the list head (which was registered earlier, via
784776 * sys_set_robust_list()):
@@ -874,9 +866,6 @@ static void compat_exit_robust_list(struct task_struct *curr) · 89 unmodified lines
874866 compat_long_t futex_offset;
875867 int rc;
876868
877− if (!futex_cmpxchg_enabled)
878− return;
879−
880869 /*
881870 * Fetch the list head (which was registered earlier, via
882871 * sys_set_robust_list()):
@@ -950,8 +939,6 @@ static void exit_pi_state_list(struct task_struct *curr) · 67 unmodified lines
950939 struct futex_hash_bucket *hb;
951940 union futex_key key = FUTEX_KEY_INIT;
952941
953− if (!futex_cmpxchg_enabled)
954− return;
955942 /*
956943 * We are a ZOMBIE and nobody can enqueue itself on
957944 * pi_state_list anymore, but we have to be careful
@@ -1125,26 +1112,6 @@ void futex_exit_release(struct task_struct *tsk) · 167 unmodified lines
11251112 futex_cleanup_end(tsk, FUTEX_STATE_DEAD);
11261113 }
11271114
1128−static void __init futex_detect_cmpxchg(void)
1129−{
1130−#ifndef CONFIG_HAVE_FUTEX_CMPXCHG
1131− u32 curval;
1132−
1133− /*
1134− * This will fail and we want it. Some arch implementations do
1135− * runtime detection of the futex_atomic_cmpxchg_inatomic()
1136− * functionality. We want to know that before we call in any
1137− * of the complex code paths. Also we want to prevent
1138− * registration of robust lists in that case. NULL is
1139− * guaranteed to fault and we get -EFAULT on functional
1140− * implementation, the non-functional ones will return
1141− * -ENOSYS.
1142− */
1143− if (futex_cmpxchg_value_locked(&curval, NULL, 0, 0) == -EFAULT)
1144− futex_cmpxchg_enabled = 1;
1145−#endif
1146−}
1147−
11481115 static int __init futex_init(void)
11491116 {
11501117 unsigned int futex_shift;
@@ -1163,8 +1130,6 @@ static int __init futex_init(void) · 12 unmodified lines
11631130 futex_hashsize, futex_hashsize);
11641131 futex_hashsize = 1UL << futex_shift;
11651132
1166− futex_detect_cmpxchg();
1167−
11681133 for (i = 0; i < futex_hashsize; i++) {
11691134 atomic_set(&futex_queues[i].waiters, 0);
11701135 plist_head_init(&futex_queues[i].chain);
kernel/futex/futex.h+0−6
@@ -27,12 +27,6 @@ · 26 unmodified lines
2727 #define FLAGS_CLOCKRT 0x02
2828 #define FLAGS_HAS_TIMEOUT 0x04
2929
30−#ifdef CONFIG_HAVE_FUTEX_CMPXCHG
31−#define futex_cmpxchg_enabled 1
32−#else
33−extern int __read_mostly futex_cmpxchg_enabled;
34−#endif
35−
3630 #ifdef CONFIG_FAIL_FUTEX
3731 extern bool should_fail_futex(bool fshared);
3832 #else
kernel/futex/syscalls.c+0−22
@@ -29,8 +29,6 @@ · 28 unmodified lines
2929 SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
3030 size_t, len)
3131 {
32− if (!futex_cmpxchg_enabled)
33− return -ENOSYS;
3432 /*
3533 * The kernel knows only one size for now:
3634 */
@@ -56,9 +54,6 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, · 19 unmodified lines
5654 unsigned long ret;
5755 struct task_struct *p;
5856
59− if (!futex_cmpxchg_enabled)
60− return -ENOSYS;
61−
6257 rcu_read_lock();
6358
6459 ret = -ESRCH;
@@ -103,17 +98,6 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, · 38 unmodified lines
10398 return -ENOSYS;
10499 }
105100
106− switch (cmd) {
107− case FUTEX_LOCK_PI:
108− case FUTEX_LOCK_PI2:
109− case FUTEX_UNLOCK_PI:
110− case FUTEX_TRYLOCK_PI:
111− case FUTEX_WAIT_REQUEUE_PI:
112− case FUTEX_CMP_REQUEUE_PI:
113− if (!futex_cmpxchg_enabled)
114− return -ENOSYS;
115− }
116−
117101 switch (cmd) {
118102 case FUTEX_WAIT:
119103 val3 = FUTEX_BITSET_MATCH_ANY;
@@ -323,9 +307,6 @@ COMPAT_SYSCALL_DEFINE2(set_robust_list, · 203 unmodified lines
323307 struct compat_robust_list_head __user *, head,
324308 compat_size_t, len)
325309 {
326− if (!futex_cmpxchg_enabled)
327− return -ENOSYS;
328−
329310 if (unlikely(len != sizeof(*head)))
330311 return -EINVAL;
331312
@@ -342,9 +323,6 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, · 10 unmodified lines
342323 unsigned long ret;
343324 struct task_struct *p;
344325
345− if (!futex_cmpxchg_enabled)
346− return -ENOSYS;
347−
348326 rcu_read_lock();
349327
350328 ret = -ESRCH;
kernel/locking/lockdep.c+2−0
@@ -5485,6 +5485,7 @@ static noinstr void check_flags(unsigned long flags) · 5484 unmodified lines
54855485 }
54865486 }
54875487
5488+#ifndef CONFIG_PREEMPT_RT
54885489 /*
54895490 * We dont accurately track softirq state in e.g.
54905491 * hardirq contexts (such as on 4KSTACKS), so only
@@ -5499,6 +5500,7 @@ static noinstr void check_flags(unsigned long flags) · 8 unmodified lines
54995500 DEBUG_LOCKS_WARN_ON(!current->softirqs_enabled);
55005501 }
55015502 }
5503+#endif
55025504
55035505 if (!debug_locks)
55045506 print_irqtrace_events(current);
kernel/locking/mutex.c+2−9
@@ -367,8 +367,7 @@ bool mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner, · 366 unmodified lines
367367 /*
368368 * Use vcpu_is_preempted to detect lock holder preemption issue.
369369 */
370− if (!owner->on_cpu || need_resched() ||
371− vcpu_is_preempted(task_cpu(owner))) {
370+ if (!owner_on_cpu(owner) || need_resched()) {
372371 ret = false;
373372 break;
374373 }
@@ -403,14 +402,8 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock) · 28 unmodified lines
403402 * structure won't go away during the spinning period.
404403 */
405404 owner = __mutex_owner(lock);
406−
407− /*
408− * As lock holder preemption issue, we both skip spinning if task is not
409− * on cpu or its cpu is preempted
410− */
411−
412405 if (owner)
413− retval = owner->on_cpu && !vcpu_is_preempted(task_cpu(owner));
406+ retval = owner_on_cpu(owner);
414407
415408 /*
416409 * If lock->owner is not set, the mutex has been released. Return true
kernel/locking/rtmutex.c+6−4
@@ -1103,8 +1103,11 @@ static int __sched task_blocks_on_rt_mutex(struct rt_mutex_base *lock, · 1102 unmodified lines
11031103 * the other will detect the deadlock and return -EDEADLOCK,
11041104 * which is wrong, as the other waiter is not in a deadlock
11051105 * situation.
1106+ *
1107+ * Except for ww_mutex, in that case the chain walk must already deal
1108+ * with spurious cycles, see the comments at [3] and [6].
11061109 */
1107− if (owner == task)
1110+ if (owner == task && !(build_ww_mutex() && ww_ctx))
11081111 return -EDEADLK;
11091112
11101113 raw_spin_lock(&task->pi_lock);
@@ -1379,9 +1382,8 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock, · 268 unmodified lines
13791382 * for CONFIG_PREEMPT_RCU=y)
13801383 * - the VCPU on which owner runs is preempted
13811384 */
1382− if (!owner->on_cpu || need_resched() ||
1383− !rt_mutex_waiter_is_top_waiter(lock, waiter) ||
1384− vcpu_is_preempted(task_cpu(owner))) {
1385+ if (!owner_on_cpu(owner) || need_resched() ||
1386+ !rt_mutex_waiter_is_top_waiter(lock, waiter)) {
13851387 res = false;
13861388 break;
13871389 }
kernel/locking/rtmutex_api.c+26−4
@@ -21,12 +21,13 @@ int max_lock_depth = 1024; · 20 unmodified lines
2121 */
2222 static __always_inline int __rt_mutex_lock_common(struct rt_mutex *lock,
2323 unsigned int state,
24+ struct lockdep_map *nest_lock,
2425 unsigned int subclass)
2526 {
2627 int ret;
2728
2829 might_sleep();
29− mutex_acquire(&lock->dep_map, subclass, 0, _RET_IP_);
30+ mutex_acquire_nest(&lock->dep_map, subclass, 0, nest_lock, _RET_IP_);
3031 ret = __rt_mutex_lock(&lock->rtmutex, state);
3132 if (ret)
3233 mutex_release(&lock->dep_map, _RET_IP_);
@@ -48,10 +49,16 @@ EXPORT_SYMBOL(rt_mutex_base_init); · 15 unmodified lines
4849 */
4950 void __sched rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass)
5051 {
51− __rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, subclass);
52+ __rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, NULL, subclass);
5253 }
5354 EXPORT_SYMBOL_GPL(rt_mutex_lock_nested);
5455
56+void __sched _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock)
57+{
58+ __rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, nest_lock, 0);
59+}
60+EXPORT_SYMBOL_GPL(_rt_mutex_lock_nest_lock);
61+
5562 #else /* !CONFIG_DEBUG_LOCK_ALLOC */
5663
5764 /**
@@ -61,7 +68,7 @@ EXPORT_SYMBOL_GPL(rt_mutex_lock_nested); · 3 unmodified lines
6168 */
6269 void __sched rt_mutex_lock(struct rt_mutex *lock)
6370 {
64− __rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, 0);
71+ __rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, NULL, 0);
6572 }
6673 EXPORT_SYMBOL_GPL(rt_mutex_lock);
6774 #endif
@@ -77,10 +84,25 @@ EXPORT_SYMBOL_GPL(rt_mutex_lock); · 9 unmodified lines
7784 */
7885 int __sched rt_mutex_lock_interruptible(struct rt_mutex *lock)
7986 {
80− return __rt_mutex_lock_common(lock, TASK_INTERRUPTIBLE, 0);
87+ return __rt_mutex_lock_common(lock, TASK_INTERRUPTIBLE, NULL, 0);
8188 }
8289 EXPORT_SYMBOL_GPL(rt_mutex_lock_interruptible);
8390
91+/**
92+ * rt_mutex_lock_killable - lock a rt_mutex killable
93+ *
94+ * @lock: the rt_mutex to be locked
95+ *
96+ * Returns:
97+ * 0 on success
98+ * -EINTR when interrupted by a signal
99+ */
100+int __sched rt_mutex_lock_killable(struct rt_mutex *lock)
101+{
102+ return __rt_mutex_lock_common(lock, TASK_KILLABLE, NULL, 0);
103+}
104+EXPORT_SYMBOL_GPL(rt_mutex_lock_killable);
105+
84106 /**
85107 * rt_mutex_trylock - try to lock a rt_mutex
86108 *
kernel/locking/rwsem.c+0−9
@@ -658,15 +658,6 @@ static inline bool rwsem_try_write_lock_unqueued(struct rw_semaphore *sem) · 657 unmodified lines
658658 return false;
659659 }
660660
661−static inline bool owner_on_cpu(struct task_struct *owner)
662−{
663− /*
664− * As lock holder preemption issue, we both skip spinning if
665− * task is not on cpu or its cpu is preempted
666− */
667− return owner->on_cpu && !vcpu_is_preempted(task_cpu(owner));
668−}
669−
670661 static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)
671662 {
672663 struct task_struct *owner;
kernel/locking/spinlock_rt.c+0−6
@@ -257,12 +257,6 @@ void __sched rt_write_unlock(rwlock_t *rwlock) · 256 unmodified lines
257257 }
258258 EXPORT_SYMBOL(rt_write_unlock);
259259
260−int __sched rt_rwlock_is_contended(rwlock_t *rwlock)
261−{
262− return rw_base_is_contended(&rwlock->rwbase);
263−}
264−EXPORT_SYMBOL(rt_rwlock_is_contended);
265−
266260 #ifdef CONFIG_DEBUG_LOCK_ALLOC
267261 void __rt_rwlock_init(rwlock_t *rwlock, const char *name,
268262 struct lock_class_key *key)
kernel/locking/ww_rt_mutex.c+1−1
@@ -26,7 +26,7 @@ int ww_mutex_trylock(struct ww_mutex *lock, struct ww_acquire_ctx *ww_ctx) · 25 unmodified lines
2626
2727 if (__rt_mutex_trylock(&rtm->rtmutex)) {
2828 ww_mutex_set_context_fastpath(lock, ww_ctx);
29− mutex_acquire_nest(&rtm->dep_map, 0, 1, ww_ctx->dep_map, _RET_IP_);
29+ mutex_acquire_nest(&rtm->dep_map, 0, 1, &ww_ctx->dep_map, _RET_IP_);
3030 return 1;
3131 }
3232
kernel/sched/core.c+3−0
@@ -2184,6 +2184,9 @@ void migrate_enable(void) · 2183 unmodified lines
21842184 return;
21852185 }
21862186
2187+ if (WARN_ON_ONCE(!p->migration_disabled))
2188+ return;
2189+
21872190 /*
21882191 * Ensure stop_task runs either before or after this, and that
21892192 * __set_cpus_allowed_ptr(SCA_MIGRATE_ENABLE) doesn't schedule().
lib/atomic64.c+0−2
@@ -118,7 +118,6 @@ ATOMIC64_OPS(sub, -=) · 117 unmodified lines
118118 #undef ATOMIC64_OPS
119119 #define ATOMIC64_OPS(op, c_op) \
120120 ATOMIC64_OP(op, c_op) \
121− ATOMIC64_OP_RETURN(op, c_op) \
122121 ATOMIC64_FETCH_OP(op, c_op)
123122
124123 ATOMIC64_OPS(and, &=)
@@ -127,7 +126,6 @@ ATOMIC64_OPS(xor, ^=) · 2 unmodified lines
127126
128127 #undef ATOMIC64_OPS
129128 #undef ATOMIC64_FETCH_OP
130−#undef ATOMIC64_OP_RETURN
131129 #undef ATOMIC64_OP
132130
133131 s64 generic_atomic64_dec_if_positive(atomic64_t *v)
lib/locking-selftest.c+118−54
@@ -26,6 +26,12 @@ · 25 unmodified lines
2626 #include <linux/rtmutex.h>
2727 #include <linux/local_lock.h>
2828
29+#ifdef CONFIG_PREEMPT_RT
30+# define NON_RT(...)
31+#else
32+# define NON_RT(...) __VA_ARGS__
33+#endif
34+
2935 /*
3036 * Change this to 1 if you want to see the failure printouts:
3137 */
@@ -139,7 +145,7 @@ static DEFINE_RT_MUTEX(rtmutex_Z2); · 107 unmodified lines
139145
140146 #endif
141147
142−static local_lock_t local_A = INIT_LOCAL_LOCK(local_A);
148+static DEFINE_PER_CPU(local_lock_t, local_A);
143149
144150 /*
145151 * non-inlined runtime initializers, to let separate locks share
@@ -712,12 +718,18 @@ GENERATE_TESTCASE(ABCDBCDA_rtmutex); · 566 unmodified lines
712718
713719 #undef E
714720
721+#ifdef CONFIG_PREEMPT_RT
722+# define RT_PREPARE_DBL_UNLOCK() { migrate_disable(); rcu_read_lock(); }
723+#else
724+# define RT_PREPARE_DBL_UNLOCK()
725+#endif
715726 /*
716727 * Double unlock:
717728 */
718729 #define E() \
719730 \
720731 LOCK(A); \
732+ RT_PREPARE_DBL_UNLOCK(); \
721733 UNLOCK(A); \
722734 UNLOCK(A); /* fail */
723735
@@ -802,6 +814,7 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_hard_rlock) · 78 unmodified lines
802814 #include "locking-selftest-wlock-hardirq.h"
803815 GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_hard_wlock)
804816
817+#ifndef CONFIG_PREEMPT_RT
805818 #include "locking-selftest-spin-softirq.h"
806819 GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_spin)
807820
@@ -810,10 +823,12 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_rlock) · 2 unmodified lines
810823
811824 #include "locking-selftest-wlock-softirq.h"
812825 GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_wlock)
826+#endif
813827
814828 #undef E1
815829 #undef E2
816830
831+#ifndef CONFIG_PREEMPT_RT
817832 /*
818833 * Enabling hardirqs with a softirq-safe lock held:
819834 */
@@ -846,6 +861,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2A_rlock) · 26 unmodified lines
846861 #undef E1
847862 #undef E2
848863
864+#endif
865+
849866 /*
850867 * Enabling irqs with an irq-safe lock held:
851868 */
@@ -875,6 +892,7 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_hard_rlock) · 23 unmodified lines
875892 #include "locking-selftest-wlock-hardirq.h"
876893 GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_hard_wlock)
877894
895+#ifndef CONFIG_PREEMPT_RT
878896 #include "locking-selftest-spin-softirq.h"
879897 GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_spin)
880898
@@ -883,6 +901,7 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_rlock) · 2 unmodified lines
883901
884902 #include "locking-selftest-wlock-softirq.h"
885903 GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_wlock)
904+#endif
886905
887906 #undef E1
888907 #undef E2
@@ -921,6 +940,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_hard_rlock) · 32 unmodified lines
921940 #include "locking-selftest-wlock-hardirq.h"
922941 GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_hard_wlock)
923942
943+#ifndef CONFIG_PREEMPT_RT
924944 #include "locking-selftest-spin-softirq.h"
925945 GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_spin)
926946
@@ -929,6 +949,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_rlock) · 2 unmodified lines
929949
930950 #include "locking-selftest-wlock-softirq.h"
931951 GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_wlock)
952+#endif
932953
933954 #undef E1
934955 #undef E2
@@ -969,6 +990,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_hard_rlock) · 34 unmodified lines
969990 #include "locking-selftest-wlock-hardirq.h"
970991 GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_hard_wlock)
971992
993+#ifndef CONFIG_PREEMPT_RT
972994 #include "locking-selftest-spin-softirq.h"
973995 GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_spin)
974996
@@ -977,6 +999,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_rlock) · 2 unmodified lines
977999
9781000 #include "locking-selftest-wlock-softirq.h"
9791001 GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_wlock)
1002+#endif
9801003
9811004 #undef E1
9821005 #undef E2
@@ -1031,6 +1054,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_hard_rlock) · 48 unmodified lines
10311054 #include "locking-selftest-wlock-hardirq.h"
10321055 GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_hard_wlock)
10331056
1057+#ifndef CONFIG_PREEMPT_RT
10341058 #include "locking-selftest-spin-softirq.h"
10351059 GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_soft_spin)
10361060
@@ -1039,6 +1063,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_soft_rlock) · 2 unmodified lines
10391063
10401064 #include "locking-selftest-wlock-softirq.h"
10411065 GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_soft_wlock)
1066+#endif
10421067
10431068 #undef E1
10441069 #undef E2
@@ -1206,12 +1231,14 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_hard_rlock) · 161 unmodified lines
12061231 #include "locking-selftest-wlock.h"
12071232 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_hard_wlock)
12081233
1234+#ifndef CONFIG_PREEMPT_RT
12091235 #include "locking-selftest-softirq.h"
12101236 #include "locking-selftest-rlock.h"
12111237 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft_rlock)
12121238
12131239 #include "locking-selftest-wlock.h"
12141240 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft_wlock)
1241+#endif
12151242
12161243 #undef E1
12171244 #undef E2
@@ -1252,12 +1279,14 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_hard_rlock) · 34 unmodified lines
12521279 #include "locking-selftest-wlock.h"
12531280 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_hard_wlock)
12541281
1282+#ifndef CONFIG_PREEMPT_RT
12551283 #include "locking-selftest-softirq.h"
12561284 #include "locking-selftest-rlock.h"
12571285 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_soft_rlock)
12581286
12591287 #include "locking-selftest-wlock.h"
12601288 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion2_soft_wlock)
1289+#endif
12611290
12621291 #undef E1
12631292 #undef E2
@@ -1306,12 +1335,14 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion3_hard_rlock) · 42 unmodified lines
13061335 #include "locking-selftest-wlock.h"
13071336 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion3_hard_wlock)
13081337
1338+#ifndef CONFIG_PREEMPT_RT
13091339 #include "locking-selftest-softirq.h"
13101340 #include "locking-selftest-rlock.h"
13111341 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion3_soft_rlock)
13121342
13131343 #include "locking-selftest-wlock.h"
13141344 GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion3_soft_wlock)
1345+#endif
13151346
13161347 #ifdef CONFIG_DEBUG_LOCK_ALLOC
13171348 # define I_SPINLOCK(x) lockdep_reset_lock(&lock_##x.dep_map)
@@ -1320,7 +1351,7 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion3_soft_wlock) · 2 unmodified lines
13201351 # define I_MUTEX(x) lockdep_reset_lock(&mutex_##x.dep_map)
13211352 # define I_RWSEM(x) lockdep_reset_lock(&rwsem_##x.dep_map)
13221353 # define I_WW(x) lockdep_reset_lock(&x.dep_map)
1323−# define I_LOCAL_LOCK(x) lockdep_reset_lock(&local_##x.dep_map)
1354+# define I_LOCAL_LOCK(x) lockdep_reset_lock(this_cpu_ptr(&local_##x.dep_map))
13241355 #ifdef CONFIG_RT_MUTEXES
13251356 # define I_RTMUTEX(x) lockdep_reset_lock(&rtmutex_##x.dep_map)
13261357 #endif
@@ -1380,7 +1411,7 @@ static void reset_locks(void) · 53 unmodified lines
13801411 init_shared_classes();
13811412 raw_spin_lock_init(&raw_lock_A);
13821413 raw_spin_lock_init(&raw_lock_B);
1383− local_lock_init(&local_A);
1414+ local_lock_init(this_cpu_ptr(&local_A));
13841415
13851416 ww_mutex_init(&o, &ww_lockdep); ww_mutex_init(&o2, &ww_lockdep); ww_mutex_init(&o3, &ww_lockdep);
13861417 memset(&t, 0, sizeof(t)); memset(&t2, 0, sizeof(t2));
@@ -1398,7 +1429,13 @@ static int unexpected_testcase_failures; · 11 unmodified lines
13981429
13991430 static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask)
14001431 {
1401− unsigned long saved_preempt_count = preempt_count();
1432+ int saved_preempt_count = preempt_count();
1433+#ifdef CONFIG_PREEMPT_RT
1434+#ifdef CONFIG_SMP
1435+ int saved_mgd_count = current->migration_disabled;
1436+#endif
1437+ int saved_rcu_count = current->rcu_read_lock_nesting;
1438+#endif
14021439
14031440 WARN_ON(irqs_disabled());
14041441
@@ -1432,6 +1469,18 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask) · 27 unmodified lines
14321469 * count, so restore it:
14331470 */
14341471 preempt_count_set(saved_preempt_count);
1472+
1473+#ifdef CONFIG_PREEMPT_RT
1474+#ifdef CONFIG_SMP
1475+ while (current->migration_disabled > saved_mgd_count)
1476+ migrate_enable();
1477+#endif
1478+
1479+ while (current->rcu_read_lock_nesting > saved_rcu_count)
1480+ rcu_read_unlock();
1481+ WARN_ON_ONCE(current->rcu_read_lock_nesting < saved_rcu_count);
1482+#endif
1483+
14351484 #ifdef CONFIG_TRACE_IRQFLAGS
14361485 if (softirq_count())
14371486 current->softirqs_enabled = 0;
@@ -1499,7 +1548,7 @@ static inline void print_testname(const char *testname) · 61 unmodified lines
14991548
15001549 #define DO_TESTCASE_2x2RW(desc, name, nr) \
15011550 DO_TESTCASE_2RW("hard-"desc, name##_hard, nr) \
1502− DO_TESTCASE_2RW("soft-"desc, name##_soft, nr) \
1551+ NON_RT(DO_TESTCASE_2RW("soft-"desc, name##_soft, nr)) \
15031552
15041553 #define DO_TESTCASE_6x2x2RW(desc, name) \
15051554 DO_TESTCASE_2x2RW(desc, name, 123); \
@@ -1547,19 +1596,19 @@ static inline void print_testname(const char *testname) · 41 unmodified lines
15471596
15481597 #define DO_TESTCASE_2I(desc, name, nr) \
15491598 DO_TESTCASE_1("hard-"desc, name##_hard, nr); \
1550− DO_TESTCASE_1("soft-"desc, name##_soft, nr);
1599+ NON_RT(DO_TESTCASE_1("soft-"desc, name##_soft, nr));
15511600
15521601 #define DO_TESTCASE_2IB(desc, name, nr) \
15531602 DO_TESTCASE_1B("hard-"desc, name##_hard, nr); \
1554− DO_TESTCASE_1B("soft-"desc, name##_soft, nr);
1603+ NON_RT(DO_TESTCASE_1B("soft-"desc, name##_soft, nr));
15551604
15561605 #define DO_TESTCASE_6I(desc, name, nr) \
15571606 DO_TESTCASE_3("hard-"desc, name##_hard, nr); \
1558− DO_TESTCASE_3("soft-"desc, name##_soft, nr);
1607+ NON_RT(DO_TESTCASE_3("soft-"desc, name##_soft, nr));
15591608
15601609 #define DO_TESTCASE_6IRW(desc, name, nr) \
15611610 DO_TESTCASE_3RW("hard-"desc, name##_hard, nr); \
1562− DO_TESTCASE_3RW("soft-"desc, name##_soft, nr);
1611+ NON_RT(DO_TESTCASE_3RW("soft-"desc, name##_soft, nr));
15631612
15641613 #define DO_TESTCASE_2x3(desc, name) \
15651614 DO_TESTCASE_3(desc, name, 12); \
@@ -1651,6 +1700,22 @@ static void ww_test_fail_acquire(void) · 85 unmodified lines
16511700 #endif
16521701 }
16531702
1703+#ifdef CONFIG_PREEMPT_RT
1704+#define ww_mutex_base_lock(b) rt_mutex_lock(b)
1705+#define ww_mutex_base_trylock(b) rt_mutex_trylock(b)
1706+#define ww_mutex_base_lock_nest_lock(b, b2) rt_mutex_lock_nest_lock(b, b2)
1707+#define ww_mutex_base_lock_interruptible(b) rt_mutex_lock_interruptible(b)
1708+#define ww_mutex_base_lock_killable(b) rt_mutex_lock_killable(b)
1709+#define ww_mutex_base_unlock(b) rt_mutex_unlock(b)
1710+#else
1711+#define ww_mutex_base_lock(b) mutex_lock(b)
1712+#define ww_mutex_base_trylock(b) mutex_trylock(b)
1713+#define ww_mutex_base_lock_nest_lock(b, b2) mutex_lock_nest_lock(b, b2)
1714+#define ww_mutex_base_lock_interruptible(b) mutex_lock_interruptible(b)
1715+#define ww_mutex_base_lock_killable(b) mutex_lock_killable(b)
1716+#define ww_mutex_base_unlock(b) mutex_unlock(b)
1717+#endif
1718+
16541719 static void ww_test_normal(void)
16551720 {
16561721 int ret;
@@ -1665,50 +1730,50 @@ static void ww_test_normal(void) · 8 unmodified lines
16651730
16661731 /* mutex_lock (and indirectly, mutex_lock_nested) */
16671732 o.ctx = (void *)~0UL;
1668− mutex_lock(&o.base);
1669− mutex_unlock(&o.base);
1733+ ww_mutex_base_lock(&o.base);
1734+ ww_mutex_base_unlock(&o.base);
16701735 WARN_ON(o.ctx != (void *)~0UL);
16711736
16721737 /* mutex_lock_interruptible (and *_nested) */
16731738 o.ctx = (void *)~0UL;
1674− ret = mutex_lock_interruptible(&o.base);
1739+ ret = ww_mutex_base_lock_interruptible(&o.base);
16751740 if (!ret)
1676− mutex_unlock(&o.base);
1741+ ww_mutex_base_unlock(&o.base);
16771742 else
16781743 WARN_ON(1);
16791744 WARN_ON(o.ctx != (void *)~0UL);
16801745
16811746 /* mutex_lock_killable (and *_nested) */
16821747 o.ctx = (void *)~0UL;
1683− ret = mutex_lock_killable(&o.base);
1748+ ret = ww_mutex_base_lock_killable(&o.base);
16841749 if (!ret)
1685− mutex_unlock(&o.base);
1750+ ww_mutex_base_unlock(&o.base);
16861751 else
16871752 WARN_ON(1);
16881753 WARN_ON(o.ctx != (void *)~0UL);
16891754
16901755 /* trylock, succeeding */
16911756 o.ctx = (void *)~0UL;
1692− ret = mutex_trylock(&o.base);
1757+ ret = ww_mutex_base_trylock(&o.base);
16931758 WARN_ON(!ret);
16941759 if (ret)
1695− mutex_unlock(&o.base);
1760+ ww_mutex_base_unlock(&o.base);
16961761 else
16971762 WARN_ON(1);
16981763 WARN_ON(o.ctx != (void *)~0UL);
16991764
17001765 /* trylock, failing */
17011766 o.ctx = (void *)~0UL;
1702− mutex_lock(&o.base);
1703− ret = mutex_trylock(&o.base);
1767+ ww_mutex_base_lock(&o.base);
1768+ ret = ww_mutex_base_trylock(&o.base);
17041769 WARN_ON(ret);
1705− mutex_unlock(&o.base);
1770+ ww_mutex_base_unlock(&o.base);
17061771 WARN_ON(o.ctx != (void *)~0UL);
17071772
17081773 /* nest_lock */
17091774 o.ctx = (void *)~0UL;
1710− mutex_lock_nest_lock(&o.base, &t);
1711− mutex_unlock(&o.base);
1775+ ww_mutex_base_lock_nest_lock(&o.base, &t);
1776+ ww_mutex_base_unlock(&o.base);
17121777 WARN_ON(o.ctx != (void *)~0UL);
17131778 }
17141779
@@ -1721,7 +1786,7 @@ static void ww_test_two_contexts(void) · 6 unmodified lines
17211786 static void ww_test_diff_class(void)
17221787 {
17231788 WWAI(&t);
1724−#ifdef CONFIG_DEBUG_MUTEXES
1789+#ifdef DEBUG_WW_MUTEXES
17251790 t.ww_class = NULL;
17261791 #endif
17271792 WWL(&o, &t);
@@ -1785,7 +1850,7 @@ static void ww_test_edeadlk_normal(void) · 57 unmodified lines
17851850 {
17861851 int ret;
17871852
1788− mutex_lock(&o2.base);
1853+ ww_mutex_base_lock(&o2.base);
17891854 o2.ctx = &t2;
17901855 mutex_release(&o2.base.dep_map, _THIS_IP_);
17911856
@@ -1801,7 +1866,7 @@ static void ww_test_edeadlk_normal(void) · 9 unmodified lines
18011866
18021867 o2.ctx = NULL;
18031868 mutex_acquire(&o2.base.dep_map, 0, 1, _THIS_IP_);
1804− mutex_unlock(&o2.base);
1869+ ww_mutex_base_unlock(&o2.base);
18051870 WWU(&o);
18061871
18071872 WWL(&o2, &t);
@@ -1811,7 +1876,7 @@ static void ww_test_edeadlk_normal_slow(void) · 3 unmodified lines
18111876 {
18121877 int ret;
18131878
1814− mutex_lock(&o2.base);
1879+ ww_mutex_base_lock(&o2.base);
18151880 mutex_release(&o2.base.dep_map, _THIS_IP_);
18161881 o2.ctx = &t2;
18171882
@@ -1827,7 +1892,7 @@ static void ww_test_edeadlk_normal_slow(void) · 9 unmodified lines
18271892
18281893 o2.ctx = NULL;
18291894 mutex_acquire(&o2.base.dep_map, 0, 1, _THIS_IP_);
1830− mutex_unlock(&o2.base);
1895+ ww_mutex_base_unlock(&o2.base);
18311896 WWU(&o);
18321897
18331898 ww_mutex_lock_slow(&o2, &t);
@@ -1837,7 +1902,7 @@ static void ww_test_edeadlk_no_unlock(void) · 3 unmodified lines
18371902 {
18381903 int ret;
18391904
1840− mutex_lock(&o2.base);
1905+ ww_mutex_base_lock(&o2.base);
18411906 o2.ctx = &t2;
18421907 mutex_release(&o2.base.dep_map, _THIS_IP_);
18431908
@@ -1853,7 +1918,7 @@ static void ww_test_edeadlk_no_unlock(void) · 9 unmodified lines
18531918
18541919 o2.ctx = NULL;
18551920 mutex_acquire(&o2.base.dep_map, 0, 1, _THIS_IP_);
1856− mutex_unlock(&o2.base);
1921+ ww_mutex_base_unlock(&o2.base);
18571922
18581923 WWL(&o2, &t);
18591924 }
@@ -1862,7 +1927,7 @@ static void ww_test_edeadlk_no_unlock_slow(void) · 2 unmodified lines
18621927 {
18631928 int ret;
18641929
1865− mutex_lock(&o2.base);
1930+ ww_mutex_base_lock(&o2.base);
18661931 mutex_release(&o2.base.dep_map, _THIS_IP_);
18671932 o2.ctx = &t2;
18681933
@@ -1878,7 +1943,7 @@ static void ww_test_edeadlk_no_unlock_slow(void) · 9 unmodified lines
18781943
18791944 o2.ctx = NULL;
18801945 mutex_acquire(&o2.base.dep_map, 0, 1, _THIS_IP_);
1881− mutex_unlock(&o2.base);
1946+ ww_mutex_base_unlock(&o2.base);
18821947
18831948 ww_mutex_lock_slow(&o2, &t);
18841949 }
@@ -1887,7 +1952,7 @@ static void ww_test_edeadlk_acquire_more(void) · 2 unmodified lines
18871952 {
18881953 int ret;
18891954
1890− mutex_lock(&o2.base);
1955+ ww_mutex_base_lock(&o2.base);
18911956 mutex_release(&o2.base.dep_map, _THIS_IP_);
18921957 o2.ctx = &t2;
18931958
@@ -1908,7 +1973,7 @@ static void ww_test_edeadlk_acquire_more_slow(void) · 14 unmodified lines
19081973 {
19091974 int ret;
19101975
1911− mutex_lock(&o2.base);
1976+ ww_mutex_base_lock(&o2.base);
19121977 mutex_release(&o2.base.dep_map, _THIS_IP_);
19131978 o2.ctx = &t2;
19141979
@@ -1929,11 +1994,11 @@ static void ww_test_edeadlk_acquire_more_edeadlk(void) · 14 unmodified lines
19291994 {
19301995 int ret;
19311996
1932− mutex_lock(&o2.base);
1997+ ww_mutex_base_lock(&o2.base);
19331998 mutex_release(&o2.base.dep_map, _THIS_IP_);
19341999 o2.ctx = &t2;
19352000
1936− mutex_lock(&o3.base);
2001+ ww_mutex_base_lock(&o3.base);
19372002 mutex_release(&o3.base.dep_map, _THIS_IP_);
19382003 o3.ctx = &t2;
19392004
@@ -1955,11 +2020,11 @@ static void ww_test_edeadlk_acquire_more_edeadlk_slow(void) · 15 unmodified lines
19552020 {
19562021 int ret;
19572022
1958− mutex_lock(&o2.base);
2023+ ww_mutex_base_lock(&o2.base);
19592024 mutex_release(&o2.base.dep_map, _THIS_IP_);
19602025 o2.ctx = &t2;
19612026
1962− mutex_lock(&o3.base);
2027+ ww_mutex_base_lock(&o3.base);
19632028 mutex_release(&o3.base.dep_map, _THIS_IP_);
19642029 o3.ctx = &t2;
19652030
@@ -1980,7 +2045,7 @@ static void ww_test_edeadlk_acquire_wrong(void) · 14 unmodified lines
19802045 {
19812046 int ret;
19822047
1983− mutex_lock(&o2.base);
2048+ ww_mutex_base_lock(&o2.base);
19842049 mutex_release(&o2.base.dep_map, _THIS_IP_);
19852050 o2.ctx = &t2;
19862051
@@ -2005,7 +2070,7 @@ static void ww_test_edeadlk_acquire_wrong_slow(void) · 18 unmodified lines
20052070 {
20062071 int ret;
20072072
2008− mutex_lock(&o2.base);
2073+ ww_mutex_base_lock(&o2.base);
20092074 mutex_release(&o2.base.dep_map, _THIS_IP_);
20102075 o2.ctx = &t2;
20112076
@@ -2646,8 +2711,8 @@ static void wait_context_tests(void) · 634 unmodified lines
26462711
26472712 static void local_lock_2(void)
26482713 {
2649− local_lock_acquire(&local_A); /* IRQ-ON */
2650− local_lock_release(&local_A);
2714+ local_lock(&local_A); /* IRQ-ON */
2715+ local_unlock(&local_A);
26512716
26522717 HARDIRQ_ENTER();
26532718 spin_lock(&lock_A); /* IN-IRQ */
@@ -2656,18 +2721,18 @@ static void local_lock_2(void) · 2 unmodified lines
26562721
26572722 HARDIRQ_DISABLE();
26582723 spin_lock(&lock_A);
2659− local_lock_acquire(&local_A); /* IN-IRQ <-> IRQ-ON cycle, false */
2660− local_lock_release(&local_A);
2724+ local_lock(&local_A); /* IN-IRQ <-> IRQ-ON cycle, false */
2725+ local_unlock(&local_A);
26612726 spin_unlock(&lock_A);
26622727 HARDIRQ_ENABLE();
26632728 }
26642729
26652730 static void local_lock_3A(void)
26662731 {
2667− local_lock_acquire(&local_A); /* IRQ-ON */
2732+ local_lock(&local_A); /* IRQ-ON */
26682733 spin_lock(&lock_B); /* IRQ-ON */
26692734 spin_unlock(&lock_B);
2670− local_lock_release(&local_A);
2735+ local_unlock(&local_A);
26712736
26722737 HARDIRQ_ENTER();
26732738 spin_lock(&lock_A); /* IN-IRQ */
@@ -2676,18 +2741,18 @@ static void local_lock_3A(void) · 2 unmodified lines
26762741
26772742 HARDIRQ_DISABLE();
26782743 spin_lock(&lock_A);
2679− local_lock_acquire(&local_A); /* IN-IRQ <-> IRQ-ON cycle only if we count local_lock(), false */
2680− local_lock_release(&local_A);
2744+ local_lock(&local_A); /* IN-IRQ <-> IRQ-ON cycle only if we count local_lock(), false */
2745+ local_unlock(&local_A);
26812746 spin_unlock(&lock_A);
26822747 HARDIRQ_ENABLE();
26832748 }
26842749
26852750 static void local_lock_3B(void)
26862751 {
2687− local_lock_acquire(&local_A); /* IRQ-ON */
2752+ local_lock(&local_A); /* IRQ-ON */
26882753 spin_lock(&lock_B); /* IRQ-ON */
26892754 spin_unlock(&lock_B);
2690− local_lock_release(&local_A);
2755+ local_unlock(&local_A);
26912756
26922757 HARDIRQ_ENTER();
26932758 spin_lock(&lock_A); /* IN-IRQ */
@@ -2696,8 +2761,8 @@ static void local_lock_3B(void) · 2 unmodified lines
26962761
26972762 HARDIRQ_DISABLE();
26982763 spin_lock(&lock_A);
2699− local_lock_acquire(&local_A); /* IN-IRQ <-> IRQ-ON cycle only if we count local_lock(), false */
2700− local_lock_release(&local_A);
2764+ local_lock(&local_A); /* IN-IRQ <-> IRQ-ON cycle only if we count local_lock(), false */
2765+ local_unlock(&local_A);
27012766 spin_unlock(&lock_A);
27022767 HARDIRQ_ENABLE();
27032768
@@ -2812,7 +2877,7 @@ void locking_selftest(void) · 108 unmodified lines
28122877 printk("------------------------\n");
28132878 printk("| Locking API testsuite:\n");
28142879 printk("----------------------------------------------------------------------------\n");
2815− printk(" | spin |wlock |rlock |mutex | wsem | rsem |\n");
2880+ printk(" | spin |wlock |rlock |mutex | wsem | rsem |rtmutex\n");
28162881 printk(" --------------------------------------------------------------------------\n");
28172882
28182883 init_shared_classes();
@@ -2885,12 +2950,11 @@ void locking_selftest(void) · 66 unmodified lines
28852950 DO_TESTCASE_6x1RR("rlock W1R2/R2R3/W3W1", W1R2_R2R3_W3W1);
28862951
28872952 printk(" --------------------------------------------------------------------------\n");
2888−
28892953 /*
28902954 * irq-context testcases:
28912955 */
28922956 DO_TESTCASE_2x6("irqs-on + irq-safe-A", irqsafe1);
2893− DO_TESTCASE_2x3("sirq-safe-A => hirqs-on", irqsafe2A);
2957+ NON_RT(DO_TESTCASE_2x3("sirq-safe-A => hirqs-on", irqsafe2A));
28942958 DO_TESTCASE_2x6("safe-A + irqs-on", irqsafe2B);
28952959 DO_TESTCASE_6x6("safe-A + unsafe-B #1", irqsafe3);
28962960 DO_TESTCASE_6x6("safe-A + unsafe-B #2", irqsafe4);