Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
rtmutex: tester: Remove the remaining BKL leftovers
lockdep/timers: Explain in detail the locking problems del_timer_sync() may cause
rtmutex: Simplify PI algorithm and make highest prio task get lock
rwsem: Remove redundant asmregparm annotation
rwsem: Move duplicate function prototypes to linux/rwsem.h
rwsem: Unify the duplicate rwsem_is_locked() inlines
rwsem: Move duplicate init macros and functions to linux/rwsem.h
rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
x86: Cleanup rwsem_count_t typedef
rwsem: Cleanup includes
locking: Remove deprecated lock initializers
cred: Replace deprecated spinlock initialization
kthread: Replace deprecated spinlock initialization
xtensa: Replace deprecated spinlock initialization
um: Replace deprecated spinlock initialization
sparc: Replace deprecated spinlock initialization
mips: Replace deprecated spinlock initialization
cris: Replace deprecated spinlock initialization
alpha: Replace deprecated spinlock initialization
rtmutex-tester: Remove BKL tests

+228 -816
+1 -23
Documentation/spinlocks.txt
··· 86 86 87 87 The routines look the same as above: 88 88 89 - rwlock_t xxx_lock = RW_LOCK_UNLOCKED; 89 + rwlock_t xxx_lock = __RW_LOCK_UNLOCKED(xxx_lock); 90 90 91 91 unsigned long flags; 92 92 ··· 196 196 197 197 For static initialization, use DEFINE_SPINLOCK() / DEFINE_RWLOCK() or 198 198 __SPIN_LOCK_UNLOCKED() / __RW_LOCK_UNLOCKED() as appropriate. 199 - 200 - SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated. These interfere 201 - with lockdep state tracking. 202 - 203 - Most of the time, you can simply turn: 204 - static spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED; 205 - into: 206 - static DEFINE_SPINLOCK(xxx_lock); 207 - 208 - Static structure member variables go from: 209 - 210 - struct foo bar { 211 - .lock = SPIN_LOCK_UNLOCKED; 212 - }; 213 - 214 - to: 215 - 216 - struct foo bar { 217 - .lock = __SPIN_LOCK_UNLOCKED(bar.lock); 218 - }; 219 - 220 - Declaration of static rw_locks undergo a similar transformation.
-36
arch/alpha/include/asm/rwsem.h
··· 13 13 #ifdef __KERNEL__ 14 14 15 15 #include <linux/compiler.h> 16 - #include <linux/list.h> 17 - #include <linux/spinlock.h> 18 16 19 - struct rwsem_waiter; 20 - 21 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 22 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 23 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); 24 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 25 - 26 - /* 27 - * the semaphore definition 28 - */ 29 - struct rw_semaphore { 30 - long count; 31 17 #define RWSEM_UNLOCKED_VALUE 0x0000000000000000L 32 18 #define RWSEM_ACTIVE_BIAS 0x0000000000000001L 33 19 #define RWSEM_ACTIVE_MASK 0x00000000ffffffffL 34 20 #define RWSEM_WAITING_BIAS (-0x0000000100000000L) 35 21 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 36 22 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 37 - spinlock_t wait_lock; 38 - struct list_head wait_list; 39 - }; 40 - 41 - #define __RWSEM_INITIALIZER(name) \ 42 - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 43 - LIST_HEAD_INIT((name).wait_list) } 44 - 45 - #define DECLARE_RWSEM(name) \ 46 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 47 - 48 - static inline void init_rwsem(struct rw_semaphore *sem) 49 - { 50 - sem->count = RWSEM_UNLOCKED_VALUE; 51 - spin_lock_init(&sem->wait_lock); 52 - INIT_LIST_HEAD(&sem->wait_list); 53 - } 54 23 55 24 static inline void __down_read(struct rw_semaphore *sem) 56 25 { ··· 217 248 218 249 return ret; 219 250 #endif 220 - } 221 - 222 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 223 - { 224 - return (sem->count != 0); 225 251 } 226 252 227 253 #endif /* __KERNEL__ */
+3 -1
arch/cris/arch-v32/kernel/smp.c
··· 26 26 #define FLUSH_ALL (void*)0xffffffff 27 27 28 28 /* Vector of locks used for various atomic operations */ 29 - spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED}; 29 + spinlock_t cris_atomic_locks[] = { 30 + [0 ... LOCK_COUNT - 1] = __SPIN_LOCK_UNLOCKED(cris_atomic_locks) 31 + }; 30 32 31 33 /* CPU masks */ 32 34 cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
-37
arch/ia64/include/asm/rwsem.h
··· 25 25 #error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead." 26 26 #endif 27 27 28 - #include <linux/list.h> 29 - #include <linux/spinlock.h> 30 - 31 28 #include <asm/intrinsics.h> 32 - 33 - /* 34 - * the semaphore definition 35 - */ 36 - struct rw_semaphore { 37 - signed long count; 38 - spinlock_t wait_lock; 39 - struct list_head wait_list; 40 - }; 41 29 42 30 #define RWSEM_UNLOCKED_VALUE __IA64_UL_CONST(0x0000000000000000) 43 31 #define RWSEM_ACTIVE_BIAS (1L) ··· 33 45 #define RWSEM_WAITING_BIAS (-0x100000000L) 34 46 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 35 47 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 36 - 37 - #define __RWSEM_INITIALIZER(name) \ 38 - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 39 - LIST_HEAD_INIT((name).wait_list) } 40 - 41 - #define DECLARE_RWSEM(name) \ 42 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 43 - 44 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 45 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 46 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 47 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 48 - 49 - static inline void 50 - init_rwsem (struct rw_semaphore *sem) 51 - { 52 - sem->count = RWSEM_UNLOCKED_VALUE; 53 - spin_lock_init(&sem->wait_lock); 54 - INIT_LIST_HEAD(&sem->wait_list); 55 - } 56 48 57 49 /* 58 50 * lock for reading ··· 141 173 */ 142 174 #define rwsem_atomic_add(delta, sem) atomic64_add(delta, (atomic64_t *)(&(sem)->count)) 143 175 #define rwsem_atomic_update(delta, sem) atomic64_add_return(delta, (atomic64_t *)(&(sem)->count)) 144 - 145 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 146 - { 147 - return (sem->count != 0); 148 - } 149 176 150 177 #endif /* _ASM_IA64_RWSEM_H */
-51
arch/powerpc/include/asm/rwsem.h
··· 13 13 * by Paul Mackerras <paulus@samba.org>. 14 14 */ 15 15 16 - #include <linux/list.h> 17 - #include <linux/spinlock.h> 18 - #include <asm/atomic.h> 19 - #include <asm/system.h> 20 - 21 16 /* 22 17 * the semaphore definition 23 18 */ ··· 27 32 #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) 28 33 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 29 34 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 30 - 31 - struct rw_semaphore { 32 - long count; 33 - spinlock_t wait_lock; 34 - struct list_head wait_list; 35 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 36 - struct lockdep_map dep_map; 37 - #endif 38 - }; 39 - 40 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 41 - # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 42 - #else 43 - # define __RWSEM_DEP_MAP_INIT(lockname) 44 - #endif 45 - 46 - #define __RWSEM_INITIALIZER(name) \ 47 - { \ 48 - RWSEM_UNLOCKED_VALUE, \ 49 - __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 50 - LIST_HEAD_INIT((name).wait_list) \ 51 - __RWSEM_DEP_MAP_INIT(name) \ 52 - } 53 - 54 - #define DECLARE_RWSEM(name) \ 55 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 56 - 57 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 58 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 59 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 60 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 61 - 62 - extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 63 - struct lock_class_key *key); 64 - 65 - #define init_rwsem(sem) \ 66 - do { \ 67 - static struct lock_class_key __key; \ 68 - \ 69 - __init_rwsem((sem), #sem, &__key); \ 70 - } while (0) 71 35 72 36 /* 73 37 * lock for reading ··· 126 172 static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) 127 173 { 128 174 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count); 129 - } 130 - 131 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 132 - { 133 - return sem->count != 0; 134 175 } 135 176 136 177 #endif /* __KERNEL__ */
-63
arch/s390/include/asm/rwsem.h
··· 43 43 44 44 #ifdef __KERNEL__ 45 45 46 - #include <linux/list.h> 47 - #include <linux/spinlock.h> 48 - 49 - struct rwsem_waiter; 50 - 51 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *); 52 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *); 53 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); 54 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *); 55 - extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *); 56 - 57 - /* 58 - * the semaphore definition 59 - */ 60 - struct rw_semaphore { 61 - signed long count; 62 - spinlock_t wait_lock; 63 - struct list_head wait_list; 64 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 65 - struct lockdep_map dep_map; 66 - #endif 67 - }; 68 - 69 46 #ifndef __s390x__ 70 47 #define RWSEM_UNLOCKED_VALUE 0x00000000 71 48 #define RWSEM_ACTIVE_BIAS 0x00000001 ··· 56 79 #endif /* __s390x__ */ 57 80 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 58 81 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 59 - 60 - /* 61 - * initialisation 62 - */ 63 - 64 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 65 - # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 66 - #else 67 - # define __RWSEM_DEP_MAP_INIT(lockname) 68 - #endif 69 - 70 - #define __RWSEM_INITIALIZER(name) \ 71 - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait.lock), \ 72 - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } 73 - 74 - #define DECLARE_RWSEM(name) \ 75 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 76 - 77 - static inline void init_rwsem(struct rw_semaphore *sem) 78 - { 79 - sem->count = RWSEM_UNLOCKED_VALUE; 80 - spin_lock_init(&sem->wait_lock); 81 - INIT_LIST_HEAD(&sem->wait_list); 82 - } 83 - 84 - extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 85 - struct lock_class_key *key); 86 - 87 - #define init_rwsem(sem) \ 88 - do { \ 89 - static struct lock_class_key __key; \ 90 - \ 91 - __init_rwsem((sem), #sem, &__key); \ 92 - } while (0) 93 - 94 82 95 83 /* 96 84 * lock for reading ··· 317 375 : "Q" (sem->count), "d" (delta) 318 376 : "cc", "memory"); 319 377 return new; 320 - } 321 - 322 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 323 - { 324 - return (sem->count != 0); 325 378 } 326 379 327 380 #endif /* __KERNEL__ */
-56
arch/sh/include/asm/rwsem.h
··· 11 11 #endif 12 12 13 13 #ifdef __KERNEL__ 14 - #include <linux/list.h> 15 - #include <linux/spinlock.h> 16 - #include <asm/atomic.h> 17 - #include <asm/system.h> 18 14 19 - /* 20 - * the semaphore definition 21 - */ 22 - struct rw_semaphore { 23 - long count; 24 15 #define RWSEM_UNLOCKED_VALUE 0x00000000 25 16 #define RWSEM_ACTIVE_BIAS 0x00000001 26 17 #define RWSEM_ACTIVE_MASK 0x0000ffff 27 18 #define RWSEM_WAITING_BIAS (-0x00010000) 28 19 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 29 20 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 30 - spinlock_t wait_lock; 31 - struct list_head wait_list; 32 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 33 - struct lockdep_map dep_map; 34 - #endif 35 - }; 36 - 37 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 38 - # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 39 - #else 40 - # define __RWSEM_DEP_MAP_INIT(lockname) 41 - #endif 42 - 43 - #define __RWSEM_INITIALIZER(name) \ 44 - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 45 - LIST_HEAD_INIT((name).wait_list) \ 46 - __RWSEM_DEP_MAP_INIT(name) } 47 - 48 - #define DECLARE_RWSEM(name) \ 49 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 50 - 51 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 52 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 53 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 54 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 55 - 56 - extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 57 - struct lock_class_key *key); 58 - 59 - #define init_rwsem(sem) \ 60 - do { \ 61 - static struct lock_class_key __key; \ 62 - \ 63 - __init_rwsem((sem), #sem, &__key); \ 64 - } while (0) 65 - 66 - static inline void init_rwsem(struct rw_semaphore *sem) 67 - { 68 - sem->count = RWSEM_UNLOCKED_VALUE; 69 - spin_lock_init(&sem->wait_lock); 70 - INIT_LIST_HEAD(&sem->wait_list); 71 - } 72 21 73 22 /* 74 23 * lock for reading ··· 126 177 { 127 178 smp_mb(); 128 179 return atomic_add_return(delta, (atomic_t *)(&sem->count)); 129 - } 130 - 131 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 132 - { 133 - return (sem->count != 0); 134 180 } 135 181 136 182 #endif /* __KERNEL__ */
-46
arch/sparc/include/asm/rwsem.h
··· 13 13 14 14 #ifdef __KERNEL__ 15 15 16 - #include <linux/list.h> 17 - #include <linux/spinlock.h> 18 - 19 - struct rwsem_waiter; 20 - 21 - struct rw_semaphore { 22 - signed long count; 23 16 #define RWSEM_UNLOCKED_VALUE 0x00000000L 24 17 #define RWSEM_ACTIVE_BIAS 0x00000001L 25 18 #define RWSEM_ACTIVE_MASK 0xffffffffL 26 19 #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) 27 20 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 28 21 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 29 - spinlock_t wait_lock; 30 - struct list_head wait_list; 31 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 32 - struct lockdep_map dep_map; 33 - #endif 34 - }; 35 - 36 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 37 - # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 38 - #else 39 - # define __RWSEM_DEP_MAP_INIT(lockname) 40 - #endif 41 - 42 - #define __RWSEM_INITIALIZER(name) \ 43 - { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 44 - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } 45 - 46 - #define DECLARE_RWSEM(name) \ 47 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 48 - 49 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 50 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 51 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 52 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 53 - 54 - extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 55 - struct lock_class_key *key); 56 - 57 - #define init_rwsem(sem) \ 58 - do { \ 59 - static struct lock_class_key __key; \ 60 - \ 61 - __init_rwsem((sem), #sem, &__key); \ 62 - } while (0) 63 22 64 23 /* 65 24 * lock for reading ··· 117 158 static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) 118 159 { 119 160 return atomic64_add_return(delta, (atomic64_t *)(&sem->count)); 120 - } 121 - 122 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 123 - { 124 - return (sem->count != 0); 125 161 } 126 162 127 163 #endif /* __KERNEL__ */
+1 -1
arch/sparc/lib/atomic32.c
··· 16 16 #define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)]) 17 17 18 18 spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = { 19 - [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED 19 + [0 ... (ATOMIC_HASH_SIZE-1)] = __SPIN_LOCK_UNLOCKED(__atomic_hash) 20 20 }; 21 21 22 22 #else /* SMP */
+1 -1
arch/um/drivers/ubd_kern.c
··· 185 185 .no_cow = 0, \ 186 186 .shared = 0, \ 187 187 .cow = DEFAULT_COW, \ 188 - .lock = SPIN_LOCK_UNLOCKED, \ 188 + .lock = __SPIN_LOCK_UNLOCKED(ubd_devs.lock), \ 189 189 .request = NULL, \ 190 190 .start_sg = 0, \ 191 191 .end_sg = 0, \
+9 -71
arch/x86/include/asm/rwsem.h
··· 37 37 #endif 38 38 39 39 #ifdef __KERNEL__ 40 - 41 - #include <linux/list.h> 42 - #include <linux/spinlock.h> 43 - #include <linux/lockdep.h> 44 40 #include <asm/asm.h> 45 41 46 - struct rwsem_waiter; 47 - 48 - extern asmregparm struct rw_semaphore * 49 - rwsem_down_read_failed(struct rw_semaphore *sem); 50 - extern asmregparm struct rw_semaphore * 51 - rwsem_down_write_failed(struct rw_semaphore *sem); 52 - extern asmregparm struct rw_semaphore * 53 - rwsem_wake(struct rw_semaphore *); 54 - extern asmregparm struct rw_semaphore * 55 - rwsem_downgrade_wake(struct rw_semaphore *sem); 56 - 57 42 /* 58 - * the semaphore definition 59 - * 60 43 * The bias values and the counter type limits the number of 61 44 * potential readers/writers to 32767 for 32 bits and 2147483647 62 45 * for 64 bits. ··· 56 73 #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) 57 74 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 58 75 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 59 - 60 - typedef signed long rwsem_count_t; 61 - 62 - struct rw_semaphore { 63 - rwsem_count_t count; 64 - spinlock_t wait_lock; 65 - struct list_head wait_list; 66 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 67 - struct lockdep_map dep_map; 68 - #endif 69 - }; 70 - 71 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 72 - # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 73 - #else 74 - # define __RWSEM_DEP_MAP_INIT(lockname) 75 - #endif 76 - 77 - 78 - #define __RWSEM_INITIALIZER(name) \ 79 - { \ 80 - RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ 81 - LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) \ 82 - } 83 - 84 - #define DECLARE_RWSEM(name) \ 85 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 86 - 87 - extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 88 - struct lock_class_key *key); 89 - 90 - #define init_rwsem(sem) \ 91 - do { \ 92 - static struct lock_class_key __key; \ 93 - \ 94 - __init_rwsem((sem), #sem, &__key); \ 95 - } while (0) 96 76 97 77 /* 98 78 * lock for reading ··· 79 133 */ 80 134 static inline int __down_read_trylock(struct rw_semaphore *sem) 81 135 { 82 - rwsem_count_t result, tmp; 136 + long result, tmp; 83 137 asm volatile("# beginning __down_read_trylock\n\t" 84 138 " mov %0,%1\n\t" 85 139 "1:\n\t" ··· 101 155 */ 102 156 static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) 103 157 { 104 - rwsem_count_t tmp; 158 + long tmp; 105 159 asm volatile("# beginning down_write\n\t" 106 160 LOCK_PREFIX " xadd %1,(%2)\n\t" 107 161 /* adds 0xffff0001, returns the old value */ ··· 126 180 */ 127 181 static inline int __down_write_trylock(struct rw_semaphore *sem) 128 182 { 129 - rwsem_count_t ret = cmpxchg(&sem->count, 130 - RWSEM_UNLOCKED_VALUE, 131 - RWSEM_ACTIVE_WRITE_BIAS); 183 + long ret = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, 184 + RWSEM_ACTIVE_WRITE_BIAS); 132 185 if (ret == RWSEM_UNLOCKED_VALUE) 133 186 return 1; 134 187 return 0; ··· 138 193 */ 139 194 static inline void __up_read(struct rw_semaphore *sem) 140 195 { 141 - rwsem_count_t tmp; 196 + long tmp; 142 197 asm volatile("# beginning __up_read\n\t" 143 198 LOCK_PREFIX " xadd %1,(%2)\n\t" 144 199 /* subtracts 1, returns the old value */ ··· 156 211 */ 157 212 static inline void __up_write(struct rw_semaphore *sem) 158 213 { 159 - rwsem_count_t tmp; 214 + long tmp; 160 215 asm volatile("# beginning __up_write\n\t" 161 216 LOCK_PREFIX " xadd %1,(%2)\n\t" 162 217 /* subtracts 0xffff0001, returns the old value */ ··· 192 247 /* 193 248 * implement atomic add functionality 194 249 */ 195 - static inline void rwsem_atomic_add(rwsem_count_t delta, 196 - struct rw_semaphore *sem) 250 + static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) 197 251 { 198 252 asm volatile(LOCK_PREFIX _ASM_ADD "%1,%0" 199 253 : "+m" (sem->count) ··· 202 258 /* 203 259 * implement exchange and add functionality 204 260 */ 205 - static inline rwsem_count_t rwsem_atomic_update(rwsem_count_t delta, 206 - struct rw_semaphore *sem) 261 + static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) 207 262 { 208 - rwsem_count_t tmp = delta; 263 + long tmp = delta; 209 264 210 265 asm volatile(LOCK_PREFIX "xadd %0,%1" 211 266 : "+r" (tmp), "+m" (sem->count) 212 267 : : "memory"); 213 268 214 269 return tmp + delta; 215 - } 216 - 217 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 218 - { 219 - return (sem->count != 0); 220 270 } 221 271 222 272 #endif /* __KERNEL__ */
-37
arch/xtensa/include/asm/rwsem.h
··· 17 17 #error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead." 18 18 #endif 19 19 20 - #include <linux/list.h> 21 - #include <linux/spinlock.h> 22 - #include <asm/atomic.h> 23 - #include <asm/system.h> 24 - 25 - /* 26 - * the semaphore definition 27 - */ 28 - struct rw_semaphore { 29 - signed long count; 30 20 #define RWSEM_UNLOCKED_VALUE 0x00000000 31 21 #define RWSEM_ACTIVE_BIAS 0x00000001 32 22 #define RWSEM_ACTIVE_MASK 0x0000ffff 33 23 #define RWSEM_WAITING_BIAS (-0x00010000) 34 24 #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 35 25 #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 36 - spinlock_t wait_lock; 37 - struct list_head wait_list; 38 - }; 39 - 40 - #define __RWSEM_INITIALIZER(name) \ 41 - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 42 - LIST_HEAD_INIT((name).wait_list) } 43 - 44 - #define DECLARE_RWSEM(name) \ 45 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 46 - 47 - extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 48 - extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 49 - extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 50 - extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 51 - 52 - static inline void init_rwsem(struct rw_semaphore *sem) 53 - { 54 - sem->count = RWSEM_UNLOCKED_VALUE; 55 - spin_lock_init(&sem->wait_lock); 56 - INIT_LIST_HEAD(&sem->wait_list); 57 - } 58 26 59 27 /* 60 28 * lock for reading ··· 126 158 { 127 159 smp_mb(); 128 160 return atomic_add_return(delta, (atomic_t *)(&sem->count)); 129 - } 130 - 131 - static inline int rwsem_is_locked(struct rw_semaphore *sem) 132 - { 133 - return (sem->count != 0); 134 161 } 135 162 136 163 #endif /* _XTENSA_RWSEM_H */
+1 -1
include/linux/kthread.h
··· 64 64 }; 65 65 66 66 #define KTHREAD_WORKER_INIT(worker) { \ 67 - .lock = SPIN_LOCK_UNLOCKED, \ 67 + .lock = __SPIN_LOCK_UNLOCKED((worker).lock), \ 68 68 .work_list = LIST_HEAD_INIT((worker).work_list), \ 69 69 } 70 70
-8
include/linux/rwlock_types.h
··· 43 43 RW_DEP_MAP_INIT(lockname) } 44 44 #endif 45 45 46 - /* 47 - * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence 48 - * deprecated. 49 - * 50 - * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate. 51 - */ 52 - #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) 53 - 54 46 #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) 55 47 56 48 #endif /* __LINUX_RWLOCK_TYPES_H */
+1 -30
include/linux/rwsem-spinlock.h
··· 12 12 #error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead" 13 13 #endif 14 14 15 - #include <linux/spinlock.h> 16 - #include <linux/list.h> 17 - 18 15 #ifdef __KERNEL__ 19 - 20 - #include <linux/types.h> 21 - 22 - struct rwsem_waiter; 23 - 24 16 /* 25 17 * the rw-semaphore definition 26 18 * - if activity is 0 then there are no active readers or writers ··· 29 37 #endif 30 38 }; 31 39 32 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 33 - # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 34 - #else 35 - # define __RWSEM_DEP_MAP_INIT(lockname) 36 - #endif 37 - 38 - #define __RWSEM_INITIALIZER(name) \ 39 - { 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \ 40 - __RWSEM_DEP_MAP_INIT(name) } 41 - 42 - #define DECLARE_RWSEM(name) \ 43 - struct rw_semaphore name = __RWSEM_INITIALIZER(name) 44 - 45 - extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 46 - struct lock_class_key *key); 47 - 48 - #define init_rwsem(sem) \ 49 - do { \ 50 - static struct lock_class_key __key; \ 51 - \ 52 - __init_rwsem((sem), #sem, &__key); \ 53 - } while (0) 40 + #define RWSEM_UNLOCKED_VALUE 0x00000000 54 41 55 42 extern void __down_read(struct rw_semaphore *sem); 56 43 extern int __down_read_trylock(struct rw_semaphore *sem);
+52 -1
include/linux/rwsem.h
··· 11 11 12 12 #include <linux/types.h> 13 13 #include <linux/kernel.h> 14 + #include <linux/list.h> 15 + #include <linux/spinlock.h> 16 + 14 17 #include <asm/system.h> 15 18 #include <asm/atomic.h> 16 19 ··· 22 19 #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK 23 20 #include <linux/rwsem-spinlock.h> /* use a generic implementation */ 24 21 #else 25 - #include <asm/rwsem.h> /* use an arch-specific implementation */ 22 + /* All arch specific implementations share the same struct */ 23 + struct rw_semaphore { 24 + long count; 25 + spinlock_t wait_lock; 26 + struct list_head wait_list; 27 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 28 + struct lockdep_map dep_map; 26 29 #endif 30 + }; 31 + 32 + extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 33 + extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 34 + extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); 35 + extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 36 + 37 + /* Include the arch specific part */ 38 + #include <asm/rwsem.h> 39 + 40 + /* In all implementations count != 0 means locked */ 41 + static inline int rwsem_is_locked(struct rw_semaphore *sem) 42 + { 43 + return sem->count != 0; 44 + } 45 + 46 + #endif 47 + 48 + /* Common initializer macros and functions */ 49 + 50 + #ifdef CONFIG_DEBUG_LOCK_ALLOC 51 + # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } 52 + #else 53 + # define __RWSEM_DEP_MAP_INIT(lockname) 54 + #endif 55 + 56 + #define __RWSEM_INITIALIZER(name) \ 57 + { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock), \ 58 + LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } 59 + 60 + #define DECLARE_RWSEM(name) \ 61 + struct rw_semaphore name = __RWSEM_INITIALIZER(name) 62 + 63 + extern void __init_rwsem(struct rw_semaphore *sem, const char *name, 64 + struct lock_class_key *key); 65 + 66 + #define init_rwsem(sem) \ 67 + do { \ 68 + static struct lock_class_key __key; \ 69 + \ 70 + __init_rwsem((sem), #sem, &__key); \ 71 + } while (0) 27 72 28 73 /* 29 74 * lock for reading
-8
include/linux/spinlock_types.h
··· 81 81 #define __SPIN_LOCK_UNLOCKED(lockname) \ 82 82 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) 83 83 84 - /* 85 - * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence 86 - * deprecated. 87 - * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as 88 - * appropriate. 89 - */ 90 - #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) 91 - 92 84 #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) 93 85 94 86 #include <linux/rwlock_types.h>
+1 -1
kernel/cred.c
··· 35 35 static struct thread_group_cred init_tgcred = { 36 36 .usage = ATOMIC_INIT(2), 37 37 .tgid = 0, 38 - .lock = SPIN_LOCK_UNLOCKED, 38 + .lock = __SPIN_LOCK_UNLOCKED(init_cred.tgcred.lock), 39 39 }; 40 40 #endif 41 41
+12 -10
kernel/futex.c
··· 1555 1555 1556 1556 /* 1557 1557 * We are here either because we stole the rtmutex from the 1558 - * pending owner or we are the pending owner which failed to 1559 - * get the rtmutex. We have to replace the pending owner TID 1560 - * in the user space variable. This must be atomic as we have 1561 - * to preserve the owner died bit here. 1558 + * previous highest priority waiter or we are the highest priority 1559 + * waiter but failed to get the rtmutex the first time. 1560 + * We have to replace the newowner TID in the user space variable. 1561 + * This must be atomic as we have to preserve the owner died bit here. 1562 1562 * 1563 1563 * Note: We write the user space value _before_ changing the pi_state 1564 1564 * because we can fault here. Imagine swapped out pages or a fork ··· 1605 1605 1606 1606 /* 1607 1607 * To handle the page fault we need to drop the hash bucket 1608 - * lock here. That gives the other task (either the pending 1609 - * owner itself or the task which stole the rtmutex) the 1608 + * lock here. That gives the other task (either the highest priority 1609 + * waiter itself or the task which stole the rtmutex) the 1610 1610 * chance to try the fixup of the pi_state. So once we are 1611 1611 * back from handling the fault we need to check the pi_state 1612 1612 * after reacquiring the hash bucket lock and before trying to ··· 1682 1682 /* 1683 1683 * pi_state is incorrect, some other task did a lock steal and 1684 1684 * we returned due to timeout or signal without taking the 1685 - * rt_mutex. Too late. We can access the rt_mutex_owner without 1686 - * locking, as the other task is now blocked on the hash bucket 1687 - * lock. Fix the state up. 1685 + * rt_mutex. Too late. 1688 1686 */ 1687 + raw_spin_lock(&q->pi_state->pi_mutex.wait_lock); 1689 1688 owner = rt_mutex_owner(&q->pi_state->pi_mutex); 1689 + if (!owner) 1690 + owner = rt_mutex_next_owner(&q->pi_state->pi_mutex); 1691 + raw_spin_unlock(&q->pi_state->pi_mutex.wait_lock); 1690 1692 ret = fixup_pi_state_owner(uaddr, q, owner); 1691 1693 goto out; 1692 1694 } 1693 1695 1694 1696 /* 1695 1697 * Paranoia check. If we did not take the lock, then we should not be 1696 - * the owner, nor the pending owner, of the rt_mutex. 1698 + * the owner of the rt_mutex. 1697 1699 */ 1698 1700 if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) 1699 1701 printk(KERN_ERR "fixup_owner: ret = %d pi-mutex: %p "
-1
kernel/rtmutex-debug.c
··· 215 215 put_pid(waiter->deadlock_task_pid); 216 216 TRACE_WARN_ON(!plist_node_empty(&waiter->list_entry)); 217 217 TRACE_WARN_ON(!plist_node_empty(&waiter->pi_list_entry)); 218 - TRACE_WARN_ON(waiter->task); 219 218 memset(waiter, 0x22, sizeof(*waiter)); 220 219 } 221 220
+4 -36
kernel/rtmutex-tester.c
··· 9 9 #include <linux/kthread.h> 10 10 #include <linux/module.h> 11 11 #include <linux/sched.h> 12 - #include <linux/smp_lock.h> 13 12 #include <linux/spinlock.h> 14 13 #include <linux/sysdev.h> 15 14 #include <linux/timer.h> ··· 26 27 int opcode; 27 28 int opdata; 28 29 int mutexes[MAX_RT_TEST_MUTEXES]; 29 - int bkl; 30 30 int event; 31 31 struct sys_device sysdev; 32 32 }; ··· 44 46 RTTEST_LOCKINTNOWAIT, /* 6 Lock interruptible no wait in wakeup, data = lockindex */ 45 47 RTTEST_LOCKCONT, /* 7 Continue locking after the wakeup delay */ 46 48 RTTEST_UNLOCK, /* 8 Unlock, data = lockindex */ 47 - RTTEST_LOCKBKL, /* 9 Lock BKL */ 48 - RTTEST_UNLOCKBKL, /* 10 Unlock BKL */ 49 - RTTEST_SIGNAL, /* 11 Signal other test thread, data = thread id */ 49 + /* 9, 10 - reserved for BKL commemoration */ 50 + RTTEST_SIGNAL = 11, /* 11 Signal other test thread, data = thread id */ 50 51 RTTEST_RESETEVENT = 98, /* 98 Reset event counter */ 51 52 RTTEST_RESET = 99, /* 99 Reset all pending operations */ 52 53 }; ··· 70 73 rt_mutex_unlock(&mutexes[i]); 71 74 td->mutexes[i] = 0; 72 75 } 73 - } 74 - 75 - if (!lockwakeup && td->bkl == 4) { 76 - #ifdef CONFIG_LOCK_KERNEL 77 - unlock_kernel(); 78 - #endif 79 - td->bkl = 0; 80 76 } 81 77 return 0; 82 78 ··· 121 131 td->mutexes[id] = 0; 122 132 return 0; 123 133 124 - case RTTEST_LOCKBKL: 125 - if (td->bkl) 126 - return 0; 127 - td->bkl = 1; 128 - #ifdef CONFIG_LOCK_KERNEL 129 - lock_kernel(); 130 - #endif 131 - td->bkl = 4; 132 - return 0; 133 - 134 - case RTTEST_UNLOCKBKL: 135 - if (td->bkl != 4) 136 - break; 137 - #ifdef CONFIG_LOCK_KERNEL 138 - unlock_kernel(); 139 - #endif 140 - td->bkl = 0; 141 - return 0; 142 - 143 134 default: 144 135 break; 145 136 } ··· 167 196 td->event = atomic_add_return(1, &rttest_event); 168 197 break; 169 198 170 - case RTTEST_LOCKBKL: 171 199 default: 172 200 break; 173 201 } ··· 199 229 td->event = atomic_add_return(1, &rttest_event); 200 230 return; 201 231 202 - case RTTEST_LOCKBKL: 203 - return; 204 232 default: 205 233 return; 206 234 } ··· 348 380 spin_lock(&rttest_lock); 349 381 350 382 curr += sprintf(curr, 351 - "O: %4d, E:%8d, S: 0x%08lx, P: %4d, N: %4d, B: %p, K: %d, M:", 383 + "O: %4d, E:%8d, S: 0x%08lx, P: %4d, N: %4d, B: %p, M:", 352 384 td->opcode, td->event, tsk->state, 353 385 (MAX_RT_PRIO - 1) - tsk->prio, 354 386 (MAX_RT_PRIO - 1) - tsk->normal_prio, 355 - tsk->pi_blocked_on, td->bkl); 387 + tsk->pi_blocked_on); 356 388 357 389 for (i = MAX_RT_TEST_MUTEXES - 1; i >=0 ; i--) 358 390 curr += sprintf(curr, "%d", td->mutexes[i]);
+113 -205
kernel/rtmutex.c
··· 20 20 /* 21 21 * lock->owner state tracking: 22 22 * 23 - * lock->owner holds the task_struct pointer of the owner. Bit 0 and 1 24 - * are used to keep track of the "owner is pending" and "lock has 25 - * waiters" state. 23 + * lock->owner holds the task_struct pointer of the owner. Bit 0 24 + * is used to keep track of the "lock has waiters" state. 26 25 * 27 - * owner bit1 bit0 28 - * NULL 0 0 lock is free (fast acquire possible) 29 - * NULL 0 1 invalid state 30 - * NULL 1 0 Transitional State* 31 - * NULL 1 1 invalid state 32 - * taskpointer 0 0 lock is held (fast release possible) 33 - * taskpointer 0 1 task is pending owner 34 - * taskpointer 1 0 lock is held and has waiters 35 - * taskpointer 1 1 task is pending owner and lock has more waiters 36 - * 37 - * Pending ownership is assigned to the top (highest priority) 38 - * waiter of the lock, when the lock is released. The thread is woken 39 - * up and can now take the lock. Until the lock is taken (bit 0 40 - * cleared) a competing higher priority thread can steal the lock 41 - * which puts the woken up thread back on the waiters list. 26 + * owner bit0 27 + * NULL 0 lock is free (fast acquire possible) 28 + * NULL 1 lock is free and has waiters and the top waiter 29 + * is going to take the lock* 30 + * taskpointer 0 lock is held (fast release possible) 31 + * taskpointer 1 lock is held and has waiters** 42 32 * 43 33 * The fast atomic compare exchange based acquire and release is only 44 - * possible when bit 0 and 1 of lock->owner are 0. 34 + * possible when bit 0 of lock->owner is 0. 45 35 * 46 - * (*) There's a small time where the owner can be NULL and the 47 - * "lock has waiters" bit is set. This can happen when grabbing the lock. 48 - * To prevent a cmpxchg of the owner releasing the lock, we need to set this 49 - * bit before looking at the lock, hence the reason this is a transitional 50 - * state. 36 + * (*) It also can be a transitional state when grabbing the lock 37 + * with ->wait_lock is held. To prevent any fast path cmpxchg to the lock, 38 + * we need to set the bit0 before looking at the lock, and the owner may be 39 + * NULL in this small time, hence this can be a transitional state. 40 + * 41 + * (**) There is a small time when bit 0 is set but there are no 42 + * waiters. This can happen when grabbing the lock in the slow path. 43 + * To prevent a cmpxchg of the owner releasing the lock, we need to 44 + * set this bit before looking at the lock. 51 45 */ 52 46 53 47 static void 54 - rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner, 55 - unsigned long mask) 48 + rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner) 56 49 { 57 - unsigned long val = (unsigned long)owner | mask; 50 + unsigned long val = (unsigned long)owner; 58 51 59 52 if (rt_mutex_has_waiters(lock)) 60 53 val |= RT_MUTEX_HAS_WAITERS; ··· 196 203 * reached or the state of the chain has changed while we 197 204 * dropped the locks. 198 205 */ 199 - if (!waiter || !waiter->task) 206 + if (!waiter) 200 207 goto out_unlock_pi; 201 208 202 209 /* 203 210 * Check the orig_waiter state. After we dropped the locks, 204 - * the previous owner of the lock might have released the lock 205 - * and made us the pending owner: 211 + * the previous owner of the lock might have released the lock. 206 212 */ 207 - if (orig_waiter && !orig_waiter->task) 213 + if (orig_waiter && !rt_mutex_owner(orig_lock)) 208 214 goto out_unlock_pi; 209 215 210 216 /* ··· 246 254 247 255 /* Release the task */ 248 256 raw_spin_unlock_irqrestore(&task->pi_lock, flags); 257 + if (!rt_mutex_owner(lock)) { 258 + /* 259 + * If the requeue above changed the top waiter, then we need 260 + * to wake the new top waiter up to try to get the lock. 261 + */ 262 + 263 + if (top_waiter != rt_mutex_top_waiter(lock)) 264 + wake_up_process(rt_mutex_top_waiter(lock)->task); 265 + raw_spin_unlock(&lock->wait_lock); 266 + goto out_put_task; 267 + } 249 268 put_task_struct(task); 250 269 251 270 /* Grab the next task */ ··· 299 296 } 300 297 301 298 /* 302 - * Optimization: check if we can steal the lock from the 303 - * assigned pending owner [which might not have taken the 304 - * lock yet]: 305 - */ 306 - static inline int try_to_steal_lock(struct rt_mutex *lock, 307 - struct task_struct *task) 308 - { 309 - struct task_struct *pendowner = rt_mutex_owner(lock); 310 - struct rt_mutex_waiter *next; 311 - unsigned long flags; 312 - 313 - if (!rt_mutex_owner_pending(lock)) 314 - return 0; 315 - 316 - if (pendowner == task) 317 - return 1; 318 - 319 - raw_spin_lock_irqsave(&pendowner->pi_lock, flags); 320 - if (task->prio >= pendowner->prio) { 321 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 322 - return 0; 323 - } 324 - 325 - /* 326 - * Check if a waiter is enqueued on the pending owners 327 - * pi_waiters list. Remove it and readjust pending owners 328 - * priority. 329 - */ 330 - if (likely(!rt_mutex_has_waiters(lock))) { 331 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 332 - return 1; 333 - } 334 - 335 - /* No chain handling, pending owner is not blocked on anything: */ 336 - next = rt_mutex_top_waiter(lock); 337 - plist_del(&next->pi_list_entry, &pendowner->pi_waiters); 338 - __rt_mutex_adjust_prio(pendowner); 339 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 340 - 341 - /* 342 - * We are going to steal the lock and a waiter was 343 - * enqueued on the pending owners pi_waiters queue. So 344 - * we have to enqueue this waiter into 345 - * task->pi_waiters list. This covers the case, 346 - * where task is boosted because it holds another 347 - * lock and gets unboosted because the booster is 348 - * interrupted, so we would delay a waiter with higher 349 - * priority as task->normal_prio. 350 - * 351 - * Note: in the rare case of a SCHED_OTHER task changing 352 - * its priority and thus stealing the lock, next->task 353 - * might be task: 354 - */ 355 - if (likely(next->task != task)) { 356 - raw_spin_lock_irqsave(&task->pi_lock, flags); 357 - plist_add(&next->pi_list_entry, &task->pi_waiters); 358 - __rt_mutex_adjust_prio(task); 359 - raw_spin_unlock_irqrestore(&task->pi_lock, flags); 360 - } 361 - return 1; 362 - } 363 - 364 - /* 365 299 * Try to take an rt-mutex 366 300 * 367 - * This fails 368 - * - when the lock has a real owner 369 - * - when a different pending owner exists and has higher priority than current 370 - * 371 301 * Must be called with lock->wait_lock held. 302 + * 303 + * @lock: the lock to be acquired. 304 + * @task: the task which wants to acquire the lock 305 + * @waiter: the waiter that is queued to the lock's wait list. (could be NULL) 372 306 */ 373 - static int try_to_take_rt_mutex(struct rt_mutex *lock) 307 + static int try_to_take_rt_mutex(struct rt_mutex *lock, struct task_struct *task, 308 + struct rt_mutex_waiter *waiter) 374 309 { 375 310 /* 376 311 * We have to be careful here if the atomic speedups are ··· 331 390 */ 332 391 mark_rt_mutex_waiters(lock); 333 392 334 - if (rt_mutex_owner(lock) && !try_to_steal_lock(lock, current)) 393 + if (rt_mutex_owner(lock)) 335 394 return 0; 395 + 396 + /* 397 + * It will get the lock because of one of these conditions: 398 + * 1) there is no waiter 399 + * 2) higher priority than waiters 400 + * 3) it is top waiter 401 + */ 402 + if (rt_mutex_has_waiters(lock)) { 403 + if (task->prio >= rt_mutex_top_waiter(lock)->list_entry.prio) { 404 + if (!waiter || waiter != rt_mutex_top_waiter(lock)) 405 + return 0; 406 + } 407 + } 408 + 409 + if (waiter || rt_mutex_has_waiters(lock)) { 410 + unsigned long flags; 411 + struct rt_mutex_waiter *top; 412 + 413 + raw_spin_lock_irqsave(&task->pi_lock, flags); 414 + 415 + /* remove the queued waiter. */ 416 + if (waiter) { 417 + plist_del(&waiter->list_entry, &lock->wait_list); 418 + task->pi_blocked_on = NULL; 419 + } 420 + 421 + /* 422 + * We have to enqueue the top waiter(if it exists) into 423 + * task->pi_waiters list. 424 + */ 425 + if (rt_mutex_has_waiters(lock)) { 426 + top = rt_mutex_top_waiter(lock); 427 + top->pi_list_entry.prio = top->list_entry.prio; 428 + plist_add(&top->pi_list_entry, &task->pi_waiters); 429 + } 430 + raw_spin_unlock_irqrestore(&task->pi_lock, flags); 431 + } 336 432 337 433 /* We got the lock. */ 338 434 debug_rt_mutex_lock(lock); 339 435 340 - rt_mutex_set_owner(lock, current, 0); 436 + rt_mutex_set_owner(lock, task); 341 437 342 - rt_mutex_deadlock_account_lock(lock, current); 438 + rt_mutex_deadlock_account_lock(lock, task); 343 439 344 440 return 1; 345 441 } ··· 414 436 415 437 raw_spin_unlock_irqrestore(&task->pi_lock, flags); 416 438 439 + if (!owner) 440 + return 0; 441 + 417 442 if (waiter == rt_mutex_top_waiter(lock)) { 418 443 raw_spin_lock_irqsave(&owner->pi_lock, flags); 419 444 plist_del(&top_waiter->pi_list_entry, &owner->pi_waiters); ··· 453 472 /* 454 473 * Wake up the next waiter on the lock. 455 474 * 456 - * Remove the top waiter from the current tasks waiter list and from 457 - * the lock waiter list. Set it as pending owner. Then wake it up. 475 + * Remove the top waiter from the current tasks waiter list and wake it up. 458 476 * 459 477 * Called with lock->wait_lock held. 460 478 */ 461 479 static void wakeup_next_waiter(struct rt_mutex *lock) 462 480 { 463 481 struct rt_mutex_waiter *waiter; 464 - struct task_struct *pendowner; 465 482 unsigned long flags; 466 483 467 484 raw_spin_lock_irqsave(&current->pi_lock, flags); 468 485 469 486 waiter = rt_mutex_top_waiter(lock); 470 - plist_del(&waiter->list_entry, &lock->wait_list); 471 487 472 488 /* 473 489 * Remove it from current->pi_waiters. We do not adjust a ··· 473 495 * lock->wait_lock. 474 496 */ 475 497 plist_del(&waiter->pi_list_entry, &current->pi_waiters); 476 - pendowner = waiter->task; 477 - waiter->task = NULL; 478 498 479 - rt_mutex_set_owner(lock, pendowner, RT_MUTEX_OWNER_PENDING); 499 + rt_mutex_set_owner(lock, NULL); 480 500 481 501 raw_spin_unlock_irqrestore(&current->pi_lock, flags); 482 502 483 - /* 484 - * Clear the pi_blocked_on variable and enqueue a possible 485 - * waiter into the pi_waiters list of the pending owner. This 486 - * prevents that in case the pending owner gets unboosted a 487 - * waiter with higher priority than pending-owner->normal_prio 488 - * is blocked on the unboosted (pending) owner. 489 - */ 490 - raw_spin_lock_irqsave(&pendowner->pi_lock, flags); 491 - 492 - WARN_ON(!pendowner->pi_blocked_on); 493 - WARN_ON(pendowner->pi_blocked_on != waiter); 494 - WARN_ON(pendowner->pi_blocked_on->lock != lock); 495 - 496 - pendowner->pi_blocked_on = NULL; 497 - 498 - if (rt_mutex_has_waiters(lock)) { 499 - struct rt_mutex_waiter *next; 500 - 501 - next = rt_mutex_top_waiter(lock); 502 - plist_add(&next->pi_list_entry, &pendowner->pi_waiters); 503 - } 504 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 505 - 506 - wake_up_process(pendowner); 503 + wake_up_process(waiter->task); 507 504 } 508 505 509 506 /* 510 - * Remove a waiter from a lock 507 + * Remove a waiter from a lock and give up 511 508 * 512 - * Must be called with lock->wait_lock held 509 + * Must be called with lock->wait_lock held and 510 + * have just failed to try_to_take_rt_mutex(). 513 511 */ 514 512 static void remove_waiter(struct rt_mutex *lock, 515 513 struct rt_mutex_waiter *waiter) ··· 497 543 498 544 raw_spin_lock_irqsave(&current->pi_lock, flags); 499 545 plist_del(&waiter->list_entry, &lock->wait_list); 500 - waiter->task = NULL; 501 546 current->pi_blocked_on = NULL; 502 547 raw_spin_unlock_irqrestore(&current->pi_lock, flags); 503 548 504 - if (first && owner != current) { 549 + if (!owner) 550 + return; 551 + 552 + if (first) { 505 553 506 554 raw_spin_lock_irqsave(&owner->pi_lock, flags); 507 555 ··· 570 614 * or TASK_UNINTERRUPTIBLE) 571 615 * @timeout: the pre-initialized and started timer, or NULL for none 572 616 * @waiter: the pre-initialized rt_mutex_waiter 573 - * @detect_deadlock: passed to task_blocks_on_rt_mutex 574 617 * 575 618 * lock->wait_lock must be held by the caller. 576 619 */ 577 620 static int __sched 578 621 __rt_mutex_slowlock(struct rt_mutex *lock, int state, 579 622 struct hrtimer_sleeper *timeout, 580 - struct rt_mutex_waiter *waiter, 581 - int detect_deadlock) 623 + struct rt_mutex_waiter *waiter) 582 624 { 583 625 int ret = 0; 584 626 585 627 for (;;) { 586 628 /* Try to acquire the lock: */ 587 - if (try_to_take_rt_mutex(lock)) 629 + if (try_to_take_rt_mutex(lock, current, waiter)) 588 630 break; 589 631 590 632 /* ··· 599 645 break; 600 646 } 601 647 602 - /* 603 - * waiter->task is NULL the first time we come here and 604 - * when we have been woken up by the previous owner 605 - * but the lock got stolen by a higher prio task. 606 - */ 607 - if (!waiter->task) { 608 - ret = task_blocks_on_rt_mutex(lock, waiter, current, 609 - detect_deadlock); 610 - /* 611 - * If we got woken up by the owner then start loop 612 - * all over without going into schedule to try 613 - * to get the lock now: 614 - */ 615 - if (unlikely(!waiter->task)) { 616 - /* 617 - * Reset the return value. We might 618 - * have returned with -EDEADLK and the 619 - * owner released the lock while we 620 - * were walking the pi chain. 621 - */ 622 - ret = 0; 623 - continue; 624 - } 625 - if (unlikely(ret)) 626 - break; 627 - } 628 - 629 648 raw_spin_unlock(&lock->wait_lock); 630 649 631 650 debug_rt_mutex_print_deadlock(waiter); 632 651 633 - if (waiter->task) 634 - schedule_rt_mutex(lock); 652 + schedule_rt_mutex(lock); 635 653 636 654 raw_spin_lock(&lock->wait_lock); 637 655 set_current_state(state); ··· 624 698 int ret = 0; 625 699 626 700 debug_rt_mutex_init_waiter(&waiter); 627 - waiter.task = NULL; 628 701 629 702 raw_spin_lock(&lock->wait_lock); 630 703 631 704 /* Try to acquire the lock again: */ 632 - if (try_to_take_rt_mutex(lock)) { 705 + if (try_to_take_rt_mutex(lock, current, NULL)) { 633 706 raw_spin_unlock(&lock->wait_lock); 634 707 return 0; 635 708 } ··· 642 717 timeout->task = NULL; 643 718 } 644 719 645 - ret = __rt_mutex_slowlock(lock, state, timeout, &waiter, 646 - detect_deadlock); 720 + ret = task_blocks_on_rt_mutex(lock, &waiter, current, detect_deadlock); 721 + 722 + if (likely(!ret)) 723 + ret = __rt_mutex_slowlock(lock, state, timeout, &waiter); 647 724 648 725 set_current_state(TASK_RUNNING); 649 726 650 - if (unlikely(waiter.task)) 727 + if (unlikely(ret)) 651 728 remove_waiter(lock, &waiter); 652 729 653 730 /* ··· 663 736 /* Remove pending timer: */ 664 737 if (unlikely(timeout)) 665 738 hrtimer_cancel(&timeout->timer); 666 - 667 - /* 668 - * Readjust priority, when we did not get the lock. We might 669 - * have been the pending owner and boosted. Since we did not 670 - * take the lock, the PI boost has to go. 671 - */ 672 - if (unlikely(ret)) 673 - rt_mutex_adjust_prio(current); 674 739 675 740 debug_rt_mutex_free_waiter(&waiter); 676 741 ··· 681 762 682 763 if (likely(rt_mutex_owner(lock) != current)) { 683 764 684 - ret = try_to_take_rt_mutex(lock); 765 + ret = try_to_take_rt_mutex(lock, current, NULL); 685 766 /* 686 767 * try_to_take_rt_mutex() sets the lock waiters 687 768 * bit unconditionally. Clean this up. ··· 911 992 { 912 993 __rt_mutex_init(lock, NULL); 913 994 debug_rt_mutex_proxy_lock(lock, proxy_owner); 914 - rt_mutex_set_owner(lock, proxy_owner, 0); 995 + rt_mutex_set_owner(lock, proxy_owner); 915 996 rt_mutex_deadlock_account_lock(lock, proxy_owner); 916 997 } 917 998 ··· 927 1008 struct task_struct *proxy_owner) 928 1009 { 929 1010 debug_rt_mutex_proxy_unlock(lock); 930 - rt_mutex_set_owner(lock, NULL, 0); 1011 + rt_mutex_set_owner(lock, NULL); 931 1012 rt_mutex_deadlock_account_unlock(proxy_owner); 932 1013 } 933 1014 ··· 953 1034 954 1035 raw_spin_lock(&lock->wait_lock); 955 1036 956 - mark_rt_mutex_waiters(lock); 957 - 958 - if (!rt_mutex_owner(lock) || try_to_steal_lock(lock, task)) { 959 - /* We got the lock for task. */ 960 - debug_rt_mutex_lock(lock); 961 - rt_mutex_set_owner(lock, task, 0); 1037 + if (try_to_take_rt_mutex(lock, task, NULL)) { 962 1038 raw_spin_unlock(&lock->wait_lock); 963 - rt_mutex_deadlock_account_lock(lock, task); 964 1039 return 1; 965 1040 } 966 1041 967 1042 ret = task_blocks_on_rt_mutex(lock, waiter, task, detect_deadlock); 968 1043 969 - if (ret && !waiter->task) { 1044 + if (ret && !rt_mutex_owner(lock)) { 970 1045 /* 971 1046 * Reset the return value. We might have 972 1047 * returned with -EDEADLK and the owner ··· 969 1056 */ 970 1057 ret = 0; 971 1058 } 1059 + 1060 + if (unlikely(ret)) 1061 + remove_waiter(lock, waiter); 1062 + 972 1063 raw_spin_unlock(&lock->wait_lock); 973 1064 974 1065 debug_rt_mutex_print_deadlock(waiter); ··· 1027 1110 1028 1111 set_current_state(TASK_INTERRUPTIBLE); 1029 1112 1030 - ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter, 1031 - detect_deadlock); 1113 + ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter); 1032 1114 1033 1115 set_current_state(TASK_RUNNING); 1034 1116 1035 - if (unlikely(waiter->task)) 1117 + if (unlikely(ret)) 1036 1118 remove_waiter(lock, waiter); 1037 1119 1038 1120 /* ··· 1041 1125 fixup_rt_mutex_waiters(lock); 1042 1126 1043 1127 raw_spin_unlock(&lock->wait_lock); 1044 - 1045 - /* 1046 - * Readjust priority, when we did not get the lock. We might have been 1047 - * the pending owner and boosted. Since we did not take the lock, the 1048 - * PI boost has to go. 1049 - */ 1050 - if (unlikely(ret)) 1051 - rt_mutex_adjust_prio(current); 1052 1128 1053 1129 return ret; 1054 1130 }
+2 -14
kernel/rtmutex_common.h
··· 91 91 /* 92 92 * lock->owner state tracking: 93 93 */ 94 - #define RT_MUTEX_OWNER_PENDING 1UL 95 - #define RT_MUTEX_HAS_WAITERS 2UL 96 - #define RT_MUTEX_OWNER_MASKALL 3UL 94 + #define RT_MUTEX_HAS_WAITERS 1UL 95 + #define RT_MUTEX_OWNER_MASKALL 1UL 97 96 98 97 static inline struct task_struct *rt_mutex_owner(struct rt_mutex *lock) 99 98 { 100 99 return (struct task_struct *) 101 100 ((unsigned long)lock->owner & ~RT_MUTEX_OWNER_MASKALL); 102 - } 103 - 104 - static inline struct task_struct *rt_mutex_real_owner(struct rt_mutex *lock) 105 - { 106 - return (struct task_struct *) 107 - ((unsigned long)lock->owner & ~RT_MUTEX_HAS_WAITERS); 108 - } 109 - 110 - static inline unsigned long rt_mutex_owner_pending(struct rt_mutex *lock) 111 - { 112 - return (unsigned long)lock->owner & RT_MUTEX_OWNER_PENDING; 113 101 } 114 102 115 103 /*
+23
kernel/timer.c
··· 970 970 * add_timer_on(). Upon exit the timer is not queued and the handler is 971 971 * not running on any CPU. 972 972 * 973 + * Note: You must not hold locks that are held in interrupt context 974 + * while calling this function. Even if the lock has nothing to do 975 + * with the timer in question. Here's why: 976 + * 977 + * CPU0 CPU1 978 + * ---- ---- 979 + * <SOFTIRQ> 980 + * call_timer_fn(); 981 + * base->running_timer = mytimer; 982 + * spin_lock_irq(somelock); 983 + * <IRQ> 984 + * spin_lock(somelock); 985 + * del_timer_sync(mytimer); 986 + * while (base->running_timer == mytimer); 987 + * 988 + * Now del_timer_sync() will never return and never release somelock. 989 + * The interrupt on the other CPU is waiting to grab somelock but 990 + * it has interrupted the softirq that CPU0 is waiting to finish. 991 + * 973 992 * The function returns whether it has deactivated a pending timer or not. 974 993 */ 975 994 int del_timer_sync(struct timer_list *timer) ··· 996 977 #ifdef CONFIG_LOCKDEP 997 978 unsigned long flags; 998 979 980 + /* 981 + * If lockdep gives a backtrace here, please reference 982 + * the synchronization rules above. 983 + */ 999 984 local_irq_save(flags); 1000 985 lock_map_acquire(&timer->lockdep_map); 1001 986 lock_map_release(&timer->lockdep_map);
+4 -6
lib/rwsem.c
··· 222 222 /* 223 223 * wait for the read lock to be granted 224 224 */ 225 - asmregparm struct rw_semaphore __sched * 226 - rwsem_down_read_failed(struct rw_semaphore *sem) 225 + struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem) 227 226 { 228 227 return rwsem_down_failed_common(sem, RWSEM_WAITING_FOR_READ, 229 228 -RWSEM_ACTIVE_READ_BIAS); ··· 231 232 /* 232 233 * wait for the write lock to be granted 233 234 */ 234 - asmregparm struct rw_semaphore __sched * 235 - rwsem_down_write_failed(struct rw_semaphore *sem) 235 + struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem) 236 236 { 237 237 return rwsem_down_failed_common(sem, RWSEM_WAITING_FOR_WRITE, 238 238 -RWSEM_ACTIVE_WRITE_BIAS); ··· 241 243 * handle waking up a waiter on the semaphore 242 244 * - up_read/up_write has decremented the active part of count if we come here 243 245 */ 244 - asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) 246 + struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) 245 247 { 246 248 unsigned long flags; 247 249 ··· 261 263 * - caller incremented waiting part of count and discovered it still negative 262 264 * - just wake up any readers at the front of the queue 263 265 */ 264 - asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) 266 + struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) 265 267 { 266 268 unsigned long flags; 267 269
-5
scripts/checkpatch.pl
··· 2654 2654 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); 2655 2655 } 2656 2656 2657 - # SPIN_LOCK_UNLOCKED & RW_LOCK_UNLOCKED are deprecated 2658 - if ($line =~ /\b(SPIN_LOCK_UNLOCKED|RW_LOCK_UNLOCKED)/) { 2659 - ERROR("Use of $1 is deprecated: see Documentation/spinlocks.txt\n" . $herecurr); 2660 - } 2661 - 2662 2657 # warn about #if 0 2663 2658 if ($line =~ /^.\s*\#\s*if\s+0\b/) { 2664 2659 CHK("if this code is redundant consider removing it\n" .
-2
scripts/rt-tester/rt-tester.py
··· 33 33 "lockintnowait" : "6", 34 34 "lockcont" : "7", 35 35 "unlock" : "8", 36 - "lockbkl" : "9", 37 - "unlockbkl" : "10", 38 36 "signal" : "11", 39 37 "resetevent" : "98", 40 38 "reset" : "99",
-5
scripts/rt-tester/t2-l1-2rt-sameprio.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal 0 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t2-l1-pi.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal 0 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t2-l1-signal.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal 0 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t2-l2-2rt-deadlock.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal 0 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t3-l1-pi-1rt.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t3-l1-pi-2rt.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t3-l1-pi-3rt.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t3-l1-pi-signal.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t3-l1-pi-steal.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t3-l2-pi.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t4-l2-pi-deboost.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t5-l4-pi-boost-deboost-setsched.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number
-5
scripts/rt-tester/t5-l4-pi-boost-deboost.tst
··· 19 19 # lockintnowait lock nr (0-7) 20 20 # lockcont lock nr (0-7) 21 21 # unlock lock nr (0-7) 22 - # lockbkl lock nr (0-7) 23 - # unlockbkl lock nr (0-7) 24 22 # signal thread to signal (0-7) 25 23 # reset 0 26 24 # resetevent 0 ··· 37 39 # blocked lock nr (0-7) 38 40 # blockedwake lock nr (0-7) 39 41 # unlocked lock nr (0-7) 40 - # lockedbkl dont care 41 - # blockedbkl dont care 42 - # unlockedbkl dont care 43 42 # opcodeeq command opcode or number 44 43 # opcodelt number 45 44 # opcodegt number