Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 303) sorted by relevance

12345678910>>...13

/arch/alpha/include/asm/
Dspinlock.h14 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
15 #define arch_spin_is_locked(x) ((x)->lock != 0)
17 do { cpu_relax(); } while ((x)->lock)
19 static inline void arch_spin_unlock(arch_spinlock_t * lock) in arch_spin_unlock() argument
22 lock->lock = 0; in arch_spin_unlock()
25 static inline void arch_spin_lock(arch_spinlock_t * lock) in arch_spin_lock() argument
41 : "=&r" (tmp), "=m" (lock->lock) in arch_spin_lock()
42 : "m"(lock->lock) : "memory"); in arch_spin_lock()
45 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
47 return !test_and_set_bit(0, &lock->lock); in arch_spin_trylock()
[all …]
/arch/hexagon/include/asm/
Dspinlock.h40 static inline void arch_read_lock(arch_rwlock_t *lock) in arch_read_lock() argument
49 : "r" (&lock->lock) in arch_read_lock()
55 static inline void arch_read_unlock(arch_rwlock_t *lock) in arch_read_unlock() argument
63 : "r" (&lock->lock) in arch_read_unlock()
70 static inline int arch_read_trylock(arch_rwlock_t *lock) in arch_read_trylock() argument
81 : "r" (&lock->lock) in arch_read_trylock()
89 return rwlock->lock == 0; in arch_read_can_lock()
94 return rwlock->lock == 0; in arch_write_can_lock()
98 static inline void arch_write_lock(arch_rwlock_t *lock) in arch_write_lock() argument
107 : "r" (&lock->lock) in arch_write_lock()
[all …]
/arch/mips/include/asm/
Dspinlock.h38 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
40 u32 counters = ACCESS_ONCE(lock->lock); in arch_spin_is_locked()
45 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
49 static inline int arch_spin_is_contended(arch_spinlock_t *lock) in arch_spin_is_contended() argument
51 u32 counters = ACCESS_ONCE(lock->lock); in arch_spin_is_contended()
57 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
92 : [ticket_ptr] "+" GCC_OFF_SMALL_ASM() (lock->lock), in arch_spin_lock()
93 [serving_now_ptr] "+m" (lock->h.serving_now), in arch_spin_lock()
125 : [ticket_ptr] "+" GCC_OFF_SMALL_ASM() (lock->lock), in arch_spin_lock()
126 [serving_now_ptr] "+m" (lock->h.serving_now), in arch_spin_lock()
[all …]
/arch/arm64/include/asm/
Dspinlock.h29 #define arch_spin_unlock_wait(lock) \ argument
30 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
32 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
34 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
60 : "=&r" (lockval), "=&r" (newval), "=&r" (tmp), "+Q" (*lock) in arch_spin_lock()
61 : "Q" (lock->owner), "I" (1 << TICKET_SHIFT) in arch_spin_lock()
65 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
79 : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock) in arch_spin_trylock()
86 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
90 : "=Q" (lock->owner) in arch_spin_unlock()
[all …]
/arch/ia64/include/asm/
Dspinlock.h19 #define arch_spin_lock_init(x) ((x)->lock = 0)
40 static __always_inline void __ticket_spin_lock(arch_spinlock_t *lock) in __ticket_spin_lock() argument
42 int *p = (int *)&lock->lock, ticket, serve; in __ticket_spin_lock()
60 static __always_inline int __ticket_spin_trylock(arch_spinlock_t *lock) in __ticket_spin_trylock() argument
62 int tmp = ACCESS_ONCE(lock->lock); in __ticket_spin_trylock()
65 return ia64_cmpxchg(acq, &lock->lock, tmp, tmp + 1, sizeof (tmp)) == tmp; in __ticket_spin_trylock()
69 static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock) in __ticket_spin_unlock() argument
71 unsigned short *p = (unsigned short *)&lock->lock + 1, tmp; in __ticket_spin_unlock()
77 static __always_inline void __ticket_spin_unlock_wait(arch_spinlock_t *lock) in __ticket_spin_unlock_wait() argument
79 int *p = (int *)&lock->lock, ticket; in __ticket_spin_unlock_wait()
[all …]
/arch/blackfin/include/asm/
Dspinlock.h27 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
29 return __raw_spin_is_locked_asm(&lock->lock); in arch_spin_is_locked()
32 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
34 __raw_spin_lock_asm(&lock->lock); in arch_spin_lock()
37 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
39 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
41 return __raw_spin_trylock_asm(&lock->lock); in arch_spin_trylock()
44 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
46 __raw_spin_unlock_asm(&lock->lock); in arch_spin_unlock()
49 static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) in arch_spin_unlock_wait() argument
[all …]
/arch/metag/include/asm/
Dspinlock_lock1.h7 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
12 ret = lock->lock; in arch_spin_is_locked()
17 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
24 if (lock->lock == 0) { in arch_spin_lock()
26 lock->lock = 1; in arch_spin_lock()
32 WARN_ON(lock->lock != 1); in arch_spin_lock()
36 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
42 ret = lock->lock; in arch_spin_trylock()
45 lock->lock = 1; in arch_spin_trylock()
51 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
[all …]
Dspinlock_lnkget.h10 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
19 : "da" (&lock->lock) in arch_spin_is_locked()
24 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
38 : "da" (&lock->lock) in arch_spin_lock()
45 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
60 : "da" (&lock->lock) in arch_spin_trylock()
68 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
74 : "da" (&lock->lock), "da" (0) in arch_spin_unlock()
100 : "da" (&rw->lock), "bd" (0x80000000) in arch_write_lock()
121 : "da" (&rw->lock), "bd" (0x80000000) in arch_write_trylock()
[all …]
Dspinlock.h10 #define arch_spin_unlock_wait(lock) \ argument
11 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
13 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
15 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) argument
16 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) argument
18 #define arch_spin_relax(lock) cpu_relax() argument
19 #define arch_read_relax(lock) cpu_relax() argument
20 #define arch_write_relax(lock) cpu_relax() argument
/arch/cris/include/arch-v32/arch/
Dspinlock.h17 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
20 : "=m" (lock->slock) \ in arch_spin_unlock()
25 static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) in arch_spin_unlock_wait() argument
27 while (arch_spin_is_locked(lock)) in arch_spin_unlock_wait()
31 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
33 return cris_spin_trylock((void *)&lock->slock); in arch_spin_trylock()
36 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
38 cris_spin_lock((void *)&lock->slock); in arch_spin_lock()
42 arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) in arch_spin_lock_flags() argument
44 arch_spin_lock(lock); in arch_spin_lock_flags()
[all …]
/arch/powerpc/include/asm/
Dspinlock.h57 static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock) in arch_spin_value_unlocked() argument
59 return lock.slock == 0; in arch_spin_value_unlocked()
62 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
65 return !arch_spin_value_unlocked(*lock); in arch_spin_is_locked()
72 static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock) in __arch_spin_trylock() argument
86 : "r" (token), "r" (&lock->slock) in __arch_spin_trylock()
92 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
95 return __arch_spin_trylock(lock) == 0; in arch_spin_trylock()
115 extern void __spin_yield(arch_spinlock_t *lock);
116 extern void __rw_yield(arch_rwlock_t *lock);
[all …]
/arch/arm/include/asm/
Dspinlock.h53 #define arch_spin_unlock_wait(lock) \ argument
54 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
56 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
58 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
64 prefetchw(&lock->slock); in arch_spin_lock()
72 : "r" (&lock->slock), "I" (1 << TICKET_SHIFT) in arch_spin_lock()
77 lockval.tickets.owner = ACCESS_ONCE(lock->tickets.owner); in arch_spin_lock()
83 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
88 prefetchw(&lock->slock); in arch_spin_trylock()
97 : "r" (&lock->slock), "I" (1 << TICKET_SHIFT) in arch_spin_trylock()
[all …]
/arch/sparc/include/asm/
Dspinlock_64.h24 #define arch_spin_is_locked(lp) ((lp)->lock != 0)
28 } while((lp)->lock)
30 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
45 : "r" (lock) in arch_spin_lock()
49 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
56 : "r" (lock) in arch_spin_trylock()
62 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
67 : "r" (lock) in arch_spin_unlock()
71 static inline void arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) in arch_spin_lock_flags() argument
89 : "r"(lock), "r"(flags) in arch_spin_lock_flags()
[all …]
Dspinlock_32.h14 #define arch_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) argument
16 #define arch_spin_unlock_wait(lock) \ argument
17 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
19 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
35 : "r" (lock) in arch_spin_lock()
39 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
44 : "r" (lock) in arch_spin_trylock()
49 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
51 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); in arch_spin_unlock()
93 #define arch_read_lock(lock) \ argument
[all …]
/arch/sh/include/asm/
Dspinlock.h26 #define arch_spin_is_locked(x) ((x)->lock <= 0)
27 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
37 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
52 : "r" (&lock->lock) in arch_spin_lock()
57 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
65 : "r" (&lock->lock) in arch_spin_unlock()
70 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
83 : "r" (&lock->lock) in arch_spin_trylock()
103 #define arch_read_can_lock(x) ((x)->lock > 0)
109 #define arch_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
[all …]
/arch/x86/include/asm/
Dspinlock.h47 static inline void __ticket_enter_slowpath(arch_spinlock_t *lock) in __ticket_enter_slowpath() argument
49 set_bit(0, (volatile unsigned long *)&lock->tickets.tail); in __ticket_enter_slowpath()
53 static __always_inline void __ticket_lock_spinning(arch_spinlock_t *lock, in __ticket_lock_spinning() argument
57 static inline void __ticket_unlock_kick(arch_spinlock_t *lock, in __ticket_unlock_kick() argument
64 static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock) in arch_spin_value_unlocked() argument
66 return lock.tickets.head == lock.tickets.tail; in arch_spin_value_unlocked()
82 static __always_inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
86 inc = xadd(&lock->tickets, inc); in arch_spin_lock()
95 if (ACCESS_ONCE(lock->tickets.head) == inc.tail) in arch_spin_lock()
99 __ticket_lock_spinning(lock, inc.tail); in arch_spin_lock()
[all …]
/arch/tile/include/asm/
Dspinlock_64.h45 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
47 u32 val = lock->lock; in arch_spin_is_locked()
52 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
55 __insn_fetchadd4(&lock->lock, 1U << __ARCH_SPIN_CURRENT_SHIFT); in arch_spin_unlock()
58 void arch_spin_unlock_wait(arch_spinlock_t *lock);
60 void arch_spin_lock_slow(arch_spinlock_t *lock, u32 val);
66 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
68 u32 val = __insn_fetchadd4(&lock->lock, 1); in arch_spin_lock()
71 arch_spin_lock_slow(lock, ticket); in arch_spin_lock()
75 int arch_spin_trylock(arch_spinlock_t *lock);
[all …]
Dspinlock_32.h36 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
45 return lock->next_ticket != lock->current_ticket; in arch_spin_is_locked()
48 void arch_spin_lock(arch_spinlock_t *lock);
51 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
53 int arch_spin_trylock(arch_spinlock_t *lock);
55 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
58 int old_ticket = lock->current_ticket; in arch_spin_unlock()
60 lock->current_ticket = old_ticket + TICKET_QUANTUM; in arch_spin_unlock()
63 void arch_spin_unlock_wait(arch_spinlock_t *lock);
85 return (rwlock->lock << _RD_COUNT_WIDTH) == 0; in arch_read_can_lock()
[all …]
/arch/xtensa/include/asm/
Dspinlock.h32 #define arch_spin_unlock_wait(lock) \ argument
33 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
35 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
37 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
48 : "a" (&lock->slock) in arch_spin_lock()
54 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
64 : "a" (&lock->slock) in arch_spin_trylock()
70 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
78 : "a" (&lock->slock) in arch_spin_unlock()
99 #define arch_write_can_lock(x) ((x)->lock == 0)
[all …]
/arch/m32r/include/asm/
Dspinlock.h29 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) argument
40 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
63 : "r" (&lock->slock) in arch_spin_trylock()
73 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
107 : "r" (&lock->slock) in arch_spin_lock()
115 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
118 lock->slock = 1; in arch_spin_unlock()
144 #define arch_read_can_lock(x) ((int)(x)->lock > 0)
150 #define arch_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
195 : "r" (&rw->lock) in arch_read_lock()
[all …]
/arch/s390/include/asm/
Dspinlock.h19 _raw_compare_and_swap(unsigned int *lock, unsigned int old, unsigned int new) in _raw_compare_and_swap() argument
25 : "=d" (old), "=Q" (*lock) in _raw_compare_and_swap()
26 : "0" (old), "d" (new), "Q" (*lock) in _raw_compare_and_swap()
46 static inline void arch_spin_relax(arch_spinlock_t *lock) in arch_spin_relax() argument
48 arch_lock_relax(lock->lock); in arch_spin_relax()
56 static inline int arch_spin_value_unlocked(arch_spinlock_t lock) in arch_spin_value_unlocked() argument
58 return lock.lock == 0; in arch_spin_value_unlocked()
63 return ACCESS_ONCE(lp->lock) != 0; in arch_spin_is_locked()
70 _raw_compare_and_swap(&lp->lock, 0, SPINLOCK_LOCKVAL)); in arch_spin_trylock_once()
95 typecheck(unsigned int, lp->lock); in arch_spin_unlock()
[all …]
/arch/mn10300/include/asm/
Dspinlock.h28 static inline void arch_spin_unlock(arch_spinlock_t *lock) in arch_spin_unlock() argument
33 : "a"(&lock->slock) in arch_spin_unlock()
37 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
48 : "a"(&lock->slock) in arch_spin_trylock()
54 static inline void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
60 : "a"(&lock->slock) in arch_spin_lock()
64 static inline void arch_spin_lock_flags(arch_spinlock_t *lock, in arch_spin_lock_flags() argument
83 : "d" (flags), "a"(&lock->slock), "i"(EPSW_IE | MN10300_CLI_LEVEL) in arch_spin_lock_flags()
104 #define arch_read_can_lock(x) ((int)(x)->lock > 0)
110 #define arch_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
[all …]
/arch/tile/lib/
Dspinlock_32.c22 void arch_spin_lock(arch_spinlock_t *lock) in arch_spin_lock() argument
28 while ((my_ticket = __insn_tns((void *)&lock->next_ticket)) & 1) in arch_spin_lock()
32 lock->next_ticket = my_ticket + TICKET_QUANTUM; in arch_spin_lock()
35 while ((delta = my_ticket - lock->current_ticket) != 0) in arch_spin_lock()
40 int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
47 int my_ticket = __insn_tns((void *)&lock->next_ticket); in arch_spin_trylock()
49 if (my_ticket == lock->current_ticket) { in arch_spin_trylock()
51 lock->next_ticket = my_ticket + TICKET_QUANTUM; in arch_spin_trylock()
58 lock->next_ticket = my_ticket; in arch_spin_trylock()
65 void arch_spin_unlock_wait(arch_spinlock_t *lock) in arch_spin_unlock_wait() argument
[all …]
Dspinlock_64.c26 static inline u32 arch_spin_read_noalloc(void *lock) in arch_spin_read_noalloc() argument
28 return atomic_cmpxchg((atomic_t *)lock, -1, -1); in arch_spin_read_noalloc()
35 void arch_spin_lock_slow(arch_spinlock_t *lock, u32 my_ticket) in arch_spin_lock_slow() argument
38 __insn_fetchand4(&lock->lock, ~__ARCH_SPIN_NEXT_OVERFLOW); in arch_spin_lock_slow()
43 u32 val = arch_spin_read_noalloc(lock); in arch_spin_lock_slow()
55 int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
57 u32 val = arch_spin_read_noalloc(lock); in arch_spin_trylock()
60 return cmpxchg(&lock->lock, val, (val + 1) & ~__ARCH_SPIN_NEXT_OVERFLOW) in arch_spin_trylock()
65 void arch_spin_unlock_wait(arch_spinlock_t *lock) in arch_spin_unlock_wait() argument
68 while (arch_spin_is_locked(lock)) in arch_spin_unlock_wait()
[all …]
/arch/parisc/include/asm/
Dspinlock.h15 #define arch_spin_lock(lock) arch_spin_lock_flags(lock, 0) argument
77 arch_spin_lock_flags(&rw->lock, flags); in arch_read_lock()
79 arch_spin_unlock(&rw->lock); in arch_read_lock()
89 arch_spin_lock_flags(&rw->lock, flags); in arch_read_unlock()
91 arch_spin_unlock(&rw->lock); in arch_read_unlock()
102 if (arch_spin_trylock(&rw->lock)) { in arch_read_trylock()
104 arch_spin_unlock(&rw->lock); in arch_read_trylock()
115 while (arch_spin_is_locked(&rw->lock) && rw->counter >= 0) in arch_read_trylock()
128 arch_spin_lock_flags(&rw->lock, flags); in arch_write_lock()
131 arch_spin_unlock(&rw->lock); in arch_write_lock()
[all …]

12345678910>>...13