Home
last modified time | relevance | path

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

123456

/linux-6.6.21/kernel/locking/
Drwsem.c68 # define DEBUG_RWSEMS_WARN_ON(c, sem) do { \ argument
71 #c, atomic_long_read(&(sem)->count), \
72 (unsigned long) sem->magic, \
73 atomic_long_read(&(sem)->owner), (long)current, \
74 list_empty(&(sem)->wait_list) ? "" : "not ")) \
78 # define DEBUG_RWSEMS_WARN_ON(c, sem) argument
140 static inline void rwsem_set_owner(struct rw_semaphore *sem) in rwsem_set_owner() argument
143 atomic_long_set(&sem->owner, (long)current); in rwsem_set_owner()
146 static inline void rwsem_clear_owner(struct rw_semaphore *sem) in rwsem_clear_owner() argument
149 atomic_long_set(&sem->owner, 0); in rwsem_clear_owner()
[all …]
Dpercpu-rwsem.c14 int __percpu_init_rwsem(struct percpu_rw_semaphore *sem, in __percpu_init_rwsem() argument
17 sem->read_count = alloc_percpu(int); in __percpu_init_rwsem()
18 if (unlikely(!sem->read_count)) in __percpu_init_rwsem()
21 rcu_sync_init(&sem->rss); in __percpu_init_rwsem()
22 rcuwait_init(&sem->writer); in __percpu_init_rwsem()
23 init_waitqueue_head(&sem->waiters); in __percpu_init_rwsem()
24 atomic_set(&sem->block, 0); in __percpu_init_rwsem()
26 debug_check_no_locks_freed((void *)sem, sizeof(*sem)); in __percpu_init_rwsem()
27 lockdep_init_map(&sem->dep_map, name, key, 0); in __percpu_init_rwsem()
33 void percpu_free_rwsem(struct percpu_rw_semaphore *sem) in percpu_free_rwsem() argument
[all …]
Dsemaphore.c37 static noinline void __down(struct semaphore *sem);
38 static noinline int __down_interruptible(struct semaphore *sem);
39 static noinline int __down_killable(struct semaphore *sem);
40 static noinline int __down_timeout(struct semaphore *sem, long timeout);
41 static noinline void __up(struct semaphore *sem);
54 void __sched down(struct semaphore *sem) in down() argument
59 raw_spin_lock_irqsave(&sem->lock, flags); in down()
60 if (likely(sem->count > 0)) in down()
61 sem->count--; in down()
63 __down(sem); in down()
[all …]
/linux-6.6.21/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-6.6.21/include/linux/
Drwsem.h70 static inline int rwsem_is_locked(struct rw_semaphore *sem) in rwsem_is_locked() argument
72 return atomic_long_read(&sem->count) != 0; in rwsem_is_locked()
104 extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
107 #define init_rwsem(sem) \ argument
111 __init_rwsem((sem), #sem, &__key); \
120 static inline int rwsem_is_contended(struct rw_semaphore *sem) in rwsem_is_contended() argument
122 return !list_empty(&sem->wait_list); in rwsem_is_contended()
148 #define init_rwsem(sem) \ argument
152 __init_rwsem((sem), #sem, &__key); \
155 static __always_inline int rwsem_is_locked(struct rw_semaphore *sem) in rwsem_is_locked() argument
[all …]
Dpercpu-rwsem.h47 static inline void percpu_down_read(struct percpu_rw_semaphore *sem) in percpu_down_read() argument
51 rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); in percpu_down_read()
62 if (likely(rcu_sync_is_idle(&sem->rss))) in percpu_down_read()
63 this_cpu_inc(*sem->read_count); in percpu_down_read()
65 __percpu_down_read(sem, false); /* Unconditional memory barrier */ in percpu_down_read()
73 static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem) in percpu_down_read_trylock() argument
81 if (likely(rcu_sync_is_idle(&sem->rss))) in percpu_down_read_trylock()
82 this_cpu_inc(*sem->read_count); in percpu_down_read_trylock()
84 ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */ in percpu_down_read_trylock()
92 rwsem_acquire_read(&sem->dep_map, 0, 1, _RET_IP_); in percpu_down_read_trylock()
[all …]
Dtty_ldisc.h28 void __init_ldsem(struct ld_semaphore *sem, const char *name,
31 #define init_ldsem(sem) \ argument
35 __init_ldsem((sem), #sem, &__key); \
39 int ldsem_down_read(struct ld_semaphore *sem, long timeout);
40 int ldsem_down_read_trylock(struct ld_semaphore *sem);
41 int ldsem_down_write(struct ld_semaphore *sem, long timeout);
42 int ldsem_down_write_trylock(struct ld_semaphore *sem);
43 void ldsem_up_read(struct ld_semaphore *sem);
44 void ldsem_up_write(struct ld_semaphore *sem);
47 int ldsem_down_read_nested(struct ld_semaphore *sem, int subclass,
[all …]
Dsemaphore.h37 static inline void sema_init(struct semaphore *sem, int val) in sema_init() argument
40 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val); in sema_init()
41 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0); in sema_init()
44 extern void down(struct semaphore *sem);
45 extern int __must_check down_interruptible(struct semaphore *sem);
46 extern int __must_check down_killable(struct semaphore *sem);
47 extern int __must_check down_trylock(struct semaphore *sem);
48 extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
49 extern void up(struct semaphore *sem);
/linux-6.6.21/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-6.6.21/tools/include/linux/
Drwsem.h11 static inline int init_rwsem(struct rw_semaphore *sem) in init_rwsem() argument
13 return pthread_rwlock_init(&sem->lock, NULL); in init_rwsem()
16 static inline int exit_rwsem(struct rw_semaphore *sem) in exit_rwsem() argument
18 return pthread_rwlock_destroy(&sem->lock); in exit_rwsem()
21 static inline int down_read(struct rw_semaphore *sem) in down_read() argument
23 return pthread_rwlock_rdlock(&sem->lock); in down_read()
26 static inline int up_read(struct rw_semaphore *sem) in up_read() argument
28 return pthread_rwlock_unlock(&sem->lock); in up_read()
31 static inline int down_write(struct rw_semaphore *sem) in down_write() argument
33 return pthread_rwlock_wrlock(&sem->lock); in down_write()
[all …]
/linux-6.6.21/arch/ia64/include/uapi/asm/
Dintrinsics.h36 #define IA64_FETCHADD(tmp,v,n,sz,sem) \ argument
40 tmp = ia64_fetchadd4_##sem((unsigned int *) v, n); \
44 tmp = ia64_fetchadd8_##sem((unsigned long *) v, n); \
52 #define ia64_fetchadd(i,v,sem) \ argument
58 IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v)), sem); \
60 IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v)), sem); \
62 IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v)), sem); \
64 IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v)), sem); \
66 IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v)), sem); \
68 IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v)), sem); \
[all …]
Dcmpxchg.h69 #define ia64_cmpxchg(sem, ptr, old, new, size) \ argument
91 _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \
95 _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \
99 _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \
103 _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \
/linux-6.6.21/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-6.6.21/drivers/net/ethernet/mellanox/mlx5/core/lib/
Ddevcom.c33 struct rw_semaphore sem; member
121 init_rwsem(&comp->sem); in mlx5_devcom_comp_alloc()
155 down_write(&comp->sem); in devcom_alloc_comp_dev()
157 up_write(&comp->sem); in devcom_alloc_comp_dev()
167 down_write(&comp->sem); in devcom_free_comp_dev()
169 up_write(&comp->sem); in devcom_free_comp_dev()
268 down_write(&comp->sem); in mlx5_devcom_send_event()
270 data = rcu_dereference_protected(pos->data, lockdep_is_held(&comp->sem)); in mlx5_devcom_send_event()
279 up_write(&comp->sem); in mlx5_devcom_send_event()
287 data = rcu_dereference_protected(pos->data, lockdep_is_held(&comp->sem)); in mlx5_devcom_send_event()
[all …]
/linux-6.6.21/fs/jffs2/
Ddir.c97 mutex_lock(&dir_f->sem); in jffs2_lookup()
110 mutex_unlock(&dir_f->sem); in jffs2_lookup()
135 mutex_lock(&f->sem); in jffs2_readdir()
156 mutex_unlock(&f->sem); in jffs2_readdir()
201 mutex_unlock(&f->sem); in jffs2_create()
271 mutex_lock(&f->sem); in jffs2_link()
273 mutex_unlock(&f->sem); in jffs2_link()
348 mutex_unlock(&f->sem); in jffs2_symlink()
358 mutex_unlock(&f->sem); in jffs2_symlink()
372 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_read_folio()
127 mutex_unlock(&f->sem); in jffs2_read_folio()
158 mutex_lock(&f->sem); in jffs2_write_begin()
185 mutex_unlock(&f->sem); in jffs2_write_begin()
200 mutex_unlock(&f->sem); in jffs2_write_begin()
205 mutex_unlock(&f->sem); in jffs2_write_begin()
227 mutex_lock(&f->sem); in jffs2_write_begin()
229 mutex_unlock(&f->sem); in jffs2_write_begin()
/linux-6.6.21/drivers/gpu/drm/gma500/
Dmmu.c88 down_write(&driver->sem);
90 up_write(&driver->sem);
100 down_write(&driver->sem); in psb_mmu_flush()
117 up_write(&driver->sem); in psb_mmu_flush()
127 down_write(&pd->driver->sem); in psb_mmu_set_pd_context()
132 up_write(&pd->driver->sem); in psb_mmu_set_pd_context()
237 down_write(&driver->sem); in psb_mmu_free_pagedir()
257 up_write(&driver->sem); in psb_mmu_free_pagedir()
402 down_read(&driver->sem); in psb_mmu_get_default_pd()
404 up_read(&driver->sem); in psb_mmu_get_default_pd()
[all …]
/linux-6.6.21/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-6.6.21/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-6.6.21/tools/testing/selftests/kvm/
Dhardware_disable_test.c28 sem_t *sem; variable
117 sem_post(sem); in run_test()
134 if (!sem_timedwait(sem, &wait_period)) in wait_for_child_setup()
160 sem = sem_open("vm_sem", O_CREAT | O_EXCL, 0644, 0); in main()
182 sem_destroy(sem); in main()
/linux-6.6.21/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-6.6.21/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-6.6.21/security/keys/
Dkeyring.c1056 down_write(&keyring->sem); in keyring_restrict()
1069 up_write(&keyring->sem); in keyring_restrict()
1238 __acquires(&keyring->sem) in __key_link_lock()
1244 down_write(&keyring->sem); in __key_link_lock()
1260 __acquires(&l_keyring->sem) in __key_move_lock()
1261 __acquires(&u_keyring->sem) in __key_move_lock()
1273 down_write(&l_keyring->sem); in __key_move_lock()
1274 down_write_nested(&u_keyring->sem, 1); in __key_move_lock()
1276 down_write(&u_keyring->sem); in __key_move_lock()
1277 down_write_nested(&l_keyring->sem, 1); in __key_move_lock()
[all …]

123456