Home
last modified time | relevance | path

Searched refs:sem (Results 1 – 25 of 121) sorted by relevance

12345

/Linux-v5.4/kernel/locking/
Drwsem.c106 # define DEBUG_RWSEMS_WARN_ON(c, sem) do { \ argument
109 #c, atomic_long_read(&(sem)->count), \
110 (unsigned long) sem->magic, \
111 atomic_long_read(&(sem)->owner), (long)current, \
112 list_empty(&(sem)->wait_list) ? "" : "not ")) \
116 # define DEBUG_RWSEMS_WARN_ON(c, sem) argument
175 static inline void rwsem_set_owner(struct rw_semaphore *sem) in rwsem_set_owner() argument
177 atomic_long_set(&sem->owner, (long)current); in rwsem_set_owner()
180 static inline void rwsem_clear_owner(struct rw_semaphore *sem) in rwsem_clear_owner() argument
182 atomic_long_set(&sem->owner, 0); in rwsem_clear_owner()
[all …]
Dsemaphore.c36 static noinline void __down(struct semaphore *sem);
37 static noinline int __down_interruptible(struct semaphore *sem);
38 static noinline int __down_killable(struct semaphore *sem);
39 static noinline int __down_timeout(struct semaphore *sem, long timeout);
40 static noinline void __up(struct semaphore *sem);
53 void down(struct semaphore *sem) in down() argument
57 raw_spin_lock_irqsave(&sem->lock, flags); in down()
58 if (likely(sem->count > 0)) in down()
59 sem->count--; in down()
61 __down(sem); in down()
[all …]
Dpercpu-rwsem.c13 int __percpu_init_rwsem(struct percpu_rw_semaphore *sem, in __percpu_init_rwsem() argument
16 sem->read_count = alloc_percpu(int); in __percpu_init_rwsem()
17 if (unlikely(!sem->read_count)) in __percpu_init_rwsem()
21 rcu_sync_init(&sem->rss); in __percpu_init_rwsem()
22 __init_rwsem(&sem->rw_sem, name, rwsem_key); in __percpu_init_rwsem()
23 rcuwait_init(&sem->writer); in __percpu_init_rwsem()
24 sem->readers_block = 0; in __percpu_init_rwsem()
29 void percpu_free_rwsem(struct percpu_rw_semaphore *sem) in percpu_free_rwsem() argument
35 if (!sem->read_count) in percpu_free_rwsem()
38 rcu_sync_dtor(&sem->rss); in percpu_free_rwsem()
[all …]
/Linux-v5.4/drivers/tty/
Dtty_ldsem.c57 void __init_ldsem(struct ld_semaphore *sem, const char *name, in __init_ldsem() argument
64 debug_check_no_locks_freed((void *)sem, sizeof(*sem)); in __init_ldsem()
65 lockdep_init_map(&sem->dep_map, name, key, 0); in __init_ldsem()
67 atomic_long_set(&sem->count, LDSEM_UNLOCKED); in __init_ldsem()
68 sem->wait_readers = 0; in __init_ldsem()
69 raw_spin_lock_init(&sem->wait_lock); in __init_ldsem()
70 INIT_LIST_HEAD(&sem->read_wait); in __init_ldsem()
71 INIT_LIST_HEAD(&sem->write_wait); in __init_ldsem()
74 static void __ldsem_wake_readers(struct ld_semaphore *sem) in __ldsem_wake_readers() argument
85 adjust = sem->wait_readers * (LDSEM_ACTIVE_BIAS - LDSEM_WAIT_BIAS); in __ldsem_wake_readers()
[all …]
/Linux-v5.4/include/linux/
Drwsem.h63 static inline int rwsem_is_locked(struct rw_semaphore *sem) in rwsem_is_locked() argument
65 return atomic_long_read(&sem->count) != 0; in rwsem_is_locked()
103 extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
106 #define init_rwsem(sem) \ argument
110 __init_rwsem((sem), #sem, &__key); \
119 static inline int rwsem_is_contended(struct rw_semaphore *sem) in rwsem_is_contended() argument
121 return !list_empty(&sem->wait_list); in rwsem_is_contended()
127 extern void down_read(struct rw_semaphore *sem);
128 extern int __must_check down_read_killable(struct rw_semaphore *sem);
133 extern int down_read_trylock(struct rw_semaphore *sem);
[all …]
Dpercpu-rwsem.h36 static inline void percpu_down_read(struct percpu_rw_semaphore *sem) in percpu_down_read() argument
40 rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 0, _RET_IP_); in percpu_down_read()
51 __this_cpu_inc(*sem->read_count); in percpu_down_read()
52 if (unlikely(!rcu_sync_is_idle(&sem->rss))) in percpu_down_read()
53 __percpu_down_read(sem, false); /* Unconditional memory barrier */ in percpu_down_read()
61 static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem) in percpu_down_read_trylock() argument
69 __this_cpu_inc(*sem->read_count); in percpu_down_read_trylock()
70 if (unlikely(!rcu_sync_is_idle(&sem->rss))) in percpu_down_read_trylock()
71 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */ in percpu_down_read_trylock()
79 rwsem_acquire_read(&sem->rw_sem.dep_map, 0, 1, _RET_IP_); in percpu_down_read_trylock()
[all …]
Dtty_ldisc.h144 extern void __init_ldsem(struct ld_semaphore *sem, const char *name,
147 #define init_ldsem(sem) \ argument
151 __init_ldsem((sem), #sem, &__key); \
155 extern int ldsem_down_read(struct ld_semaphore *sem, long timeout);
156 extern int ldsem_down_read_trylock(struct ld_semaphore *sem);
157 extern int ldsem_down_write(struct ld_semaphore *sem, long timeout);
158 extern int ldsem_down_write_trylock(struct ld_semaphore *sem);
159 extern void ldsem_up_read(struct ld_semaphore *sem);
160 extern void ldsem_up_write(struct ld_semaphore *sem);
163 extern int ldsem_down_read_nested(struct ld_semaphore *sem, int subclass,
[all …]
Dsemaphore.h31 static inline void sema_init(struct semaphore *sem, int val) in sema_init() argument
34 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val); in sema_init()
35 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0); in sema_init()
38 extern void down(struct semaphore *sem);
39 extern int __must_check down_interruptible(struct semaphore *sem);
40 extern int __must_check down_killable(struct semaphore *sem);
41 extern int __must_check down_trylock(struct semaphore *sem);
42 extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
43 extern void up(struct semaphore *sem);
/Linux-v5.4/tools/perf/util/
Drwsem.c5 int init_rwsem(struct rw_semaphore *sem) in init_rwsem() argument
7 return pthread_rwlock_init(&sem->lock, NULL); in init_rwsem()
10 int exit_rwsem(struct rw_semaphore *sem) in exit_rwsem() argument
12 return pthread_rwlock_destroy(&sem->lock); in exit_rwsem()
15 int down_read(struct rw_semaphore *sem) in down_read() argument
17 return perf_singlethreaded ? 0 : pthread_rwlock_rdlock(&sem->lock); in down_read()
20 int up_read(struct rw_semaphore *sem) in up_read() argument
22 return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock); in up_read()
25 int down_write(struct rw_semaphore *sem) in down_write() argument
27 return perf_singlethreaded ? 0 : pthread_rwlock_wrlock(&sem->lock); in down_write()
[all …]
Drwsem.h10 int init_rwsem(struct rw_semaphore *sem);
11 int exit_rwsem(struct rw_semaphore *sem);
13 int down_read(struct rw_semaphore *sem);
14 int up_read(struct rw_semaphore *sem);
16 int down_write(struct rw_semaphore *sem);
17 int up_write(struct rw_semaphore *sem);
/Linux-v5.4/arch/ia64/include/uapi/asm/
Dintrinsics.h42 #define IA64_FETCHADD(tmp,v,n,sz,sem) \ argument
46 tmp = ia64_fetchadd4_##sem((unsigned int *) v, n); \
50 tmp = ia64_fetchadd8_##sem((unsigned long *) v, n); \
58 #define ia64_fetchadd(i,v,sem) \ argument
64 IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v)), sem); \
66 IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v)), sem); \
68 IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v)), sem); \
70 IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v)), sem); \
72 IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v)), sem); \
74 IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v)), sem); \
[all …]
Dcmpxchg.h71 #define ia64_cmpxchg(sem, ptr, old, new, size) \ argument
93 _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
97 _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
101 _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
105 _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
/Linux-v5.4/tools/power/acpi/os_specific/service_layers/
Dosunixxf.c630 sem_t *sem; in acpi_os_create_semaphore() local
643 sem = in acpi_os_create_semaphore()
646 if (!sem) { in acpi_os_create_semaphore()
653 sem = acpi_os_allocate(sizeof(sem_t)); in acpi_os_create_semaphore()
654 if (!sem) { in acpi_os_create_semaphore()
658 if (sem_init(sem, 0, initial_units) == -1) { in acpi_os_create_semaphore()
659 acpi_os_free(sem); in acpi_os_create_semaphore()
664 *out_handle = (acpi_handle)sem; in acpi_os_create_semaphore()
682 sem_t *sem = (sem_t *) handle; in acpi_os_delete_semaphore() local
684 if (!sem) { in acpi_os_delete_semaphore()
[all …]
/Linux-v5.4/drivers/net/ethernet/mellanox/mlx5/core/lib/
Ddevcom.c20 struct rw_semaphore sem; member
47 init_rwsem(&comp->sem); in mlx5_devcom_list_alloc()
161 down_write(&comp->sem); in mlx5_devcom_register_component()
164 up_write(&comp->sem); in mlx5_devcom_register_component()
176 down_write(&comp->sem); in mlx5_devcom_unregister_component()
178 up_write(&comp->sem); in mlx5_devcom_unregister_component()
193 down_write(&comp->sem); in mlx5_devcom_send_event()
201 up_write(&comp->sem); in mlx5_devcom_send_event()
212 WARN_ON(!rwsem_is_locked(&comp->sem)); in mlx5_devcom_set_paired()
236 down_read(&comp->sem); in mlx5_devcom_get_peer_data()
[all …]
/Linux-v5.4/arch/mips/include/asm/
Dpmon.h27 int (*semlock) (int sem);
28 void (*semunlock) (int sem);
43 #define pmon_semlock(sem) debug_vectors->semlock(sem) argument
44 #define pmon_semunlock(sem) debug_vectors->semunlock(sem) argument
/Linux-v5.4/fs/jffs2/
Ddir.c94 mutex_lock(&dir_f->sem); in jffs2_lookup()
107 mutex_unlock(&dir_f->sem); in jffs2_lookup()
132 mutex_lock(&f->sem); in jffs2_readdir()
153 mutex_unlock(&f->sem); in jffs2_readdir()
198 mutex_unlock(&f->sem); in jffs2_create()
267 mutex_lock(&f->sem); in jffs2_link()
269 mutex_unlock(&f->sem); in jffs2_link()
343 mutex_unlock(&f->sem); in jffs2_symlink()
353 mutex_unlock(&f->sem); in jffs2_symlink()
367 mutex_unlock(&f->sem); in jffs2_symlink()
[all …]
Dwrite.c145 mutex_unlock(&f->sem); in jffs2_write_dnode()
150 mutex_lock(&f->sem); in jffs2_write_dnode()
297 mutex_unlock(&f->sem); in jffs2_write_dirent()
302 mutex_lock(&f->sem); in jffs2_write_dirent()
368 mutex_lock(&f->sem); in jffs2_write_inode_range()
397 mutex_unlock(&f->sem); in jffs2_write_inode_range()
420 mutex_unlock(&f->sem); in jffs2_write_inode_range()
424 mutex_unlock(&f->sem); in jffs2_write_inode_range()
460 mutex_lock(&f->sem); in jffs2_do_create()
473 mutex_unlock(&f->sem); in jffs2_do_create()
[all …]
Dfile.c125 mutex_lock(&f->sem); in jffs2_readpage()
127 mutex_unlock(&f->sem); in jffs2_readpage()
164 mutex_lock(&f->sem); in jffs2_write_begin()
191 mutex_unlock(&f->sem); in jffs2_write_begin()
206 mutex_unlock(&f->sem); in jffs2_write_begin()
211 mutex_unlock(&f->sem); in jffs2_write_begin()
220 mutex_lock(&f->sem); in jffs2_write_begin()
222 mutex_unlock(&f->sem); in jffs2_write_begin()
/Linux-v5.4/drivers/gpu/drm/gma500/
Dmmu.c96 down_write(&driver->sem);
98 up_write(&driver->sem);
108 down_write(&driver->sem); in psb_mmu_flush()
125 up_write(&driver->sem); in psb_mmu_flush()
135 down_write(&pd->driver->sem); in psb_mmu_set_pd_context()
140 up_write(&pd->driver->sem); in psb_mmu_set_pd_context()
245 down_write(&driver->sem); in psb_mmu_free_pagedir()
265 up_write(&driver->sem); in psb_mmu_free_pagedir()
412 down_read(&driver->sem); in psb_mmu_get_default_pd()
414 up_read(&driver->sem); in psb_mmu_get_default_pd()
[all …]
/Linux-v5.4/drivers/gpu/drm/radeon/
Dradeon_trace.h170 TP_PROTO(int ring, struct radeon_semaphore *sem),
172 TP_ARGS(ring, sem),
182 __entry->waiters = sem->waiters;
183 __entry->gpu_addr = sem->gpu_addr;
192 TP_PROTO(int ring, struct radeon_semaphore *sem),
194 TP_ARGS(ring, sem)
199 TP_PROTO(int ring, struct radeon_semaphore *sem),
201 TP_ARGS(ring, sem)
/Linux-v5.4/drivers/infiniband/core/
Dnetlink.c50 struct rw_semaphore sem; member
99 up_read(&rdma_nl_types[type].sem); in get_cb_table()
103 down_read(&rdma_nl_types[type].sem); in get_cb_table()
125 down_write(&rdma_nl_types[index].sem); in rdma_nl_unregister()
127 up_write(&rdma_nl_types[index].sem); in rdma_nl_unregister()
164 down_read(&rdma_nl_types[index].sem); in rdma_nl_rcv_msg()
197 up_read(&rdma_nl_types[index].sem); in rdma_nl_rcv_msg()
296 init_rwsem(&rdma_nl_types[idx].sem); in rdma_nl_init()
/Linux-v5.4/drivers/net/ethernet/mellanox/mlx4/
Dreset.c51 u32 sem; in mlx4_reset() local
104 sem = readl(reset + MLX4_SEM_OFFSET); in mlx4_reset()
105 if (!sem) in mlx4_reset()
111 if (sem) { in mlx4_reset()
/Linux-v5.4/arch/x86/platform/intel/
Diosf_mbi.c247 static int iosf_mbi_get_sem(u32 *sem) in iosf_mbi_get_sem() argument
252 iosf_mbi_sem_address, sem); in iosf_mbi_get_sem()
258 *sem &= PUNIT_SEMAPHORE_BIT; in iosf_mbi_get_sem()
316 u32 sem; in iosf_mbi_block_punit_i2c_access() local
355 ret = iosf_mbi_get_sem(&sem); in iosf_mbi_block_punit_i2c_access()
356 if (!ret && sem) { in iosf_mbi_block_punit_i2c_access()
370 if (!iosf_mbi_get_sem(&sem)) in iosf_mbi_block_punit_i2c_access()
371 dev_err(&mbi_pdev->dev, "P-Unit semaphore: %d\n", sem); in iosf_mbi_block_punit_i2c_access()
/Linux-v5.4/security/keys/
Dkeyring.c1060 down_write(&keyring->sem); in keyring_restrict()
1071 up_write(&keyring->sem); in keyring_restrict()
1240 __acquires(&keyring->sem) in __key_link_lock()
1246 down_write(&keyring->sem); in __key_link_lock()
1262 __acquires(&l_keyring->sem) in __key_move_lock()
1263 __acquires(&u_keyring->sem) in __key_move_lock()
1275 down_write(&l_keyring->sem); in __key_move_lock()
1276 down_write_nested(&u_keyring->sem, 1); in __key_move_lock()
1278 down_write(&u_keyring->sem); in __key_move_lock()
1279 down_write_nested(&l_keyring->sem, 1); in __key_move_lock()
[all …]
/Linux-v5.4/ipc/
Dsem.c95 struct sem { struct
126 struct sem sems[]; argument
271 struct sem *curr; in unmerge_queues()
292 struct sem *sem = &sma->sems[i]; in merge_queues() local
294 list_splice_init(&sem->pending_alter, &sma->pending_alter); in merge_queues()
314 struct sem *sem; in complexmode_enter() local
328 sem = &sma->sems[i]; in complexmode_enter()
329 spin_lock(&sem->lock); in complexmode_enter()
330 spin_unlock(&sem->lock); in complexmode_enter()
370 struct sem *sem; in sem_lock() local
[all …]

12345