FreeBSD kernel kern code
kern_umtx.c File Reference
#include <sys/cdefs.h>
#include "opt_umtx_profiling.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/sbuf.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/syscallsubr.h>
#include <sys/taskqueue.h>
#include <sys/time.h>
#include <sys/eventhandler.h>
#include <sys/umtx.h>
#include <sys/umtxvar.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_object.h>
#include <machine/atomic.h>
#include <machine/cpu.h>
#include <compat/freebsd32/freebsd32.h>
Include dependency graph for kern_umtx.c:

Go to the source code of this file.

Data Structures

struct  umtx_copyops
 
struct  umtx_shm_reg
 
struct  timespeci386
 
struct  umtx_timei386
 

Macros

#define _UMUTEX_TRY   1
 
#define _UMUTEX_WAIT   2
 
#define UMTXQ_LOCKED_ASSERT(uc)   mtx_assert(&(uc)->uc_lock, MA_OWNED)
 
#define UMTXQ_ASSERT_LOCKED_BUSY(key)   do {} while (0)
 
#define UPRI(td)
 
#define GOLDEN_RATIO_PRIME   2654404609U
 
#define UMTX_CHAINS   512
 
#define UMTX_SHIFTS   (__WORD_BIT - 9)
 
#define GET_SHARE(flags)    (((flags) & USYNC_PROCESS_SHARED) == 0 ? THREAD_SHARE : PROCESS_SHARE)
 
#define BUSY_SPINS   200
 
#define umtxq_signal(key, nwake)   umtxq_signal_queue((key), (nwake), UMTX_SHARED_QUEUE)
 
#define BATCH_SIZE   128
 
#define USHM_OBJ_UMTX(o)    ((struct umtx_shm_obj_list *)(&(o)->umtx_data))
 
#define USHMF_REG_LINKED   0x0001
 
#define USHMF_OBJ_LINKED   0x0002
 
#define UMTX_OP__FLAGS   (UMTX_OP__32BIT | UMTX_OP__I386)
 

Typedefs

typedef int(* _umtx_op_func) (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *umtx_ops)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 _Static_assert (sizeof(struct umutex)==sizeof(struct umutex32), "umutex32")
 
 _Static_assert (__offsetof(struct umutex, m_spare[0])==__offsetof(struct umutex32, m_spare[0]), "m_spare32")
 
 SYSCTL_INT (_kern_ipc, OID_AUTO, umtx_vnode_persistent, CTLFLAG_RWTUN, &umtx_shm_vnobj_persistent, 0, "False forces destruction of umtx attached to file, on last close")
 
 SYSCTL_INT (_kern_ipc, OID_AUTO, umtx_max_robust, CTLFLAG_RWTUN, &umtx_max_rb, 0, "Maximum number of robust mutexes allowed for each thread")
 
static MALLOC_DEFINE (M_UMTX, "umtx", "UMTX queue memory")
 
static SYSCTL_NODE (_debug, OID_AUTO, umtx, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "umtx debug")
 
 SYSCTL_INT (_debug_umtx, OID_AUTO, umtx_pi_allocated, CTLFLAG_RD, &umtx_pi_allocated, 0, "Allocated umtx_pi")
 
 SYSCTL_INT (_debug_umtx, OID_AUTO, robust_faults_verbose, CTLFLAG_RWTUN, &umtx_verbose_rb, 0, "")
 
static void umtx_abs_timeout_init2 (struct umtx_abs_timeout *timo, const struct _umtx_time *umtxtime)
 
static void umtx_shm_init (void)
 
static void umtxq_sysinit (void *)
 
static void umtxq_hash (struct umtx_key *key)
 
static int do_unlock_pp (struct thread *td, struct umutex *m, uint32_t flags, bool rb)
 
static void umtx_thread_cleanup (struct thread *td)
 
 SYSINIT (umtx, SI_SUB_EVENTHANDLER+1, SI_ORDER_MIDDLE, umtxq_sysinit, NULL)
 
static void umtxq_sysinit (void *arg __unused)
 
struct umtx_q * umtxq_alloc (void)
 
void umtxq_free (struct umtx_q *uq)
 
struct umtxq_chain * umtxq_getchain (struct umtx_key *key)
 
void umtxq_busy (struct umtx_key *key)
 
void umtxq_unbusy (struct umtx_key *key)
 
void umtxq_unbusy_unlocked (struct umtx_key *key)
 
static struct umtxq_queue * umtxq_queue_lookup (struct umtx_key *key, int q)
 
void umtxq_insert_queue (struct umtx_q *uq, int q)
 
void umtxq_remove_queue (struct umtx_q *uq, int q)
 
int umtxq_count (struct umtx_key *key)
 
static int umtxq_count_pi (struct umtx_key *key, struct umtx_q **first)
 
int umtxq_signal_mask (struct umtx_key *key, int n_wake, u_int bitset)
 
static int umtxq_signal_queue (struct umtx_key *key, int n_wake, int q)
 
static void umtxq_signal_thread (struct umtx_q *uq)
 
int umtxq_requeue (struct umtx_key *key, int n_wake, struct umtx_key *key2, int n_requeue)
 
static int tstohz (const struct timespec *tsp)
 
void umtx_abs_timeout_init (struct umtx_abs_timeout *timo, int clockid, int absolute, const struct timespec *timeout)
 
static int umtx_abs_timeout_getsbt (struct umtx_abs_timeout *timo, sbintime_t *sbt, int *flags)
 
static uint32_t umtx_unlock_val (uint32_t flags, bool rb)
 
int umtxq_sleep (struct umtx_q *uq, const char *wmesg, struct umtx_abs_timeout *timo)
 
int umtx_key_get (const void *addr, int type, int share, struct umtx_key *key)
 
void umtx_key_release (struct umtx_key *key)
 
static int do_wait (struct thread *td, void *addr, u_long id, struct _umtx_time *timeout, int compat32, int is_private)
 
int kern_umtx_wake (struct thread *td, void *uaddr, int n_wake, int is_private)
 
static int do_lock_normal (struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int mode)
 
static int do_unlock_normal (struct thread *td, struct umutex *m, uint32_t flags, bool rb)
 
static int do_wake_umutex (struct thread *td, struct umutex *m)
 
static int do_wake2_umutex (struct thread *td, struct umutex *m, uint32_t flags)
 
struct umtx_pi * umtx_pi_alloc (int flags)
 
void umtx_pi_free (struct umtx_pi *pi)
 
static int umtx_pi_adjust_thread (struct umtx_pi *pi, struct thread *td)
 
static struct umtx_pi * umtx_pi_next (struct umtx_pi *pi)
 
static bool umtx_pi_check_loop (struct umtx_pi *pi)
 
static void umtx_propagate_priority (struct thread *td)
 
static void umtx_repropagate_priority (struct umtx_pi *pi)
 
static void umtx_pi_setowner (struct umtx_pi *pi, struct thread *owner)
 
static void umtx_pi_disown (struct umtx_pi *pi)
 
int umtx_pi_claim (struct umtx_pi *pi, struct thread *owner)
 
void umtx_pi_adjust (struct thread *td, u_char oldpri)
 
int umtxq_sleep_pi (struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner, const char *wmesg, struct umtx_abs_timeout *timo, bool shared)
 
void umtx_pi_ref (struct umtx_pi *pi)
 
void umtx_pi_unref (struct umtx_pi *pi)
 
struct umtx_pi * umtx_pi_lookup (struct umtx_key *key)
 
void umtx_pi_insert (struct umtx_pi *pi)
 
int umtx_pi_drop (struct thread *td, struct umtx_key *key, bool rb, int *count)
 
static int do_lock_pi (struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int try)
 
static int do_unlock_pi (struct thread *td, struct umutex *m, uint32_t flags, bool rb)
 
static int do_lock_pp (struct thread *td, struct umutex *m, uint32_t flags, struct _umtx_time *timeout, int try)
 
static int do_set_ceiling (struct thread *td, struct umutex *m, uint32_t ceiling, uint32_t *old_ceiling)
 
static int do_lock_umutex (struct thread *td, struct umutex *m, struct _umtx_time *timeout, int mode)
 
static int do_unlock_umutex (struct thread *td, struct umutex *m, bool rb)
 
static int do_cv_wait (struct thread *td, struct ucond *cv, struct umutex *m, struct timespec *timeout, u_long wflags)
 
static int do_cv_signal (struct thread *td, struct ucond *cv)
 
static int do_cv_broadcast (struct thread *td, struct ucond *cv)
 
static int do_rw_rdlock (struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx_time *timeout)
 
static int do_rw_wrlock (struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeout)
 
static int do_rw_unlock (struct thread *td, struct urwlock *rwlock)
 
static int do_sem2_wait (struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout)
 
static int do_sem2_wake (struct thread *td, struct _usem2 *sem)
 
int umtx_copyin_timeout (const void *uaddr, struct timespec *tsp)
 
static int umtx_copyin_umtx_time (const void *uaddr, size_t size, struct _umtx_time *tp)
 
static int umtx_copyin_robust_lists (const void *uaddr, size_t size, struct umtx_robust_lists_params *rb)
 
static int umtx_copyout_timeout (void *uaddr, size_t sz, struct timespec *tsp)
 
static int __umtx_op_unimpl (struct thread *td __unused, struct _umtx_op_args *uap __unused, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_wait (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_wait_uint (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_wait_uint_private (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_wake (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_nwake_private_native (struct thread *td, struct _umtx_op_args *uap)
 
static int __umtx_op_nwake_private_compat32 (struct thread *td, struct _umtx_op_args *uap)
 
static int __umtx_op_nwake_private (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_wake_private (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_lock_umutex (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_trylock_umutex (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_wait_umutex (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_wake_umutex (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_unlock_umutex (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_set_ceiling (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_cv_wait (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_cv_signal (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_cv_broadcast (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_rw_rdlock (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_rw_wrlock (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_rw_unlock (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_wake2_umutex (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_sem2_wait (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int __umtx_op_sem2_wake (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
 LIST_HEAD (umtx_shm_obj_list, umtx_shm_reg)
 
 TAILQ_HEAD (umtx_shm_reg_head, umtx_shm_reg)
 
static void umtx_shm_free_reg (struct umtx_shm_reg *reg)
 
static void umtx_shm_reg_delfree_tq (void *context __unused, int pending __unused)
 
static struct umtx_shm_regumtx_shm_find_reg_locked (const struct umtx_key *key)
 
static struct umtx_shm_regumtx_shm_find_reg (const struct umtx_key *key)
 
static bool umtx_shm_unref_reg_locked (struct umtx_shm_reg *reg, bool force)
 
static void umtx_shm_unref_reg (struct umtx_shm_reg *reg, bool force)
 
void umtx_shm_object_init (vm_object_t object)
 
void umtx_shm_object_terminated (vm_object_t object)
 
static int umtx_shm_create_reg (struct thread *td, const struct umtx_key *key, struct umtx_shm_reg **res)
 
static int umtx_shm_alive (struct thread *td, void *addr)
 
static int umtx_shm (struct thread *td, void *addr, u_int flags)
 
static int __umtx_op_shm (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops __unused)
 
static int __umtx_op_robust_lists (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *ops)
 
static int umtx_copyin_robust_lists32 (const void *uaddr, size_t size, struct umtx_robust_lists_params *rbp)
 
static int umtx_copyin_timeouti386 (const void *uaddr, struct timespec *tsp)
 
static int umtx_copyin_umtx_timei386 (const void *uaddr, size_t size, struct _umtx_time *tp)
 
static int umtx_copyout_timeouti386 (void *uaddr, size_t sz, struct timespec *tsp)
 
static int kern__umtx_op (struct thread *td, void *obj, int op, unsigned long val, void *uaddr1, void *uaddr2, const struct umtx_copyops *ops)
 
int sys__umtx_op (struct thread *td, struct _umtx_op_args *uap)
 
void umtx_thread_init (struct thread *td)
 
void umtx_thread_fini (struct thread *td)
 
void umtx_thread_alloc (struct thread *td)
 
void umtx_exec (struct proc *p)
 
void umtx_thread_exit (struct thread *td)
 
static int umtx_read_uptr (struct thread *td, uintptr_t ptr, uintptr_t *res, bool compat32)
 
static void umtx_read_rb_list (struct thread *td, struct umutex *m, uintptr_t *rb_list, bool compat32)
 
static int umtx_handle_rb (struct thread *td, uintptr_t rbp, uintptr_t *rb_list, bool inact, bool compat32)
 
static void umtx_cleanup_rb_list (struct thread *td, uintptr_t rb_list, uintptr_t *rb_inact, const char *name, bool compat32)
 

Variables

int umtx_shm_vnobj_persistent = 0
 
static int umtx_max_rb = 1000
 
static uma_zone_t umtx_pi_zone
 
static struct umtxq_chain umtxq_chains [2][UMTX_CHAINS]
 
static int umtx_pi_allocated
 
static int umtx_verbose_rb = 1
 
static struct mtx umtx_lock
 
static uma_zone_t umtx_shm_reg_zone
 
static struct umtx_shm_reg_head umtx_shm_registry [UMTX_CHAINS]
 
static struct mtx umtx_shm_lock
 
static struct umtx_shm_reg_head umtx_shm_reg_delfree
 
static struct task umtx_shm_reg_delfree_task
 
static const _umtx_op_func op_table []
 
static const struct umtx_copyops umtx_native_ops
 
static const struct umtx_copyops umtx_native_opsi386
 

Macro Definition Documentation

◆ _UMUTEX_TRY

#define _UMUTEX_TRY   1

Definition at line 84 of file kern_umtx.c.

◆ _UMUTEX_WAIT

#define _UMUTEX_WAIT   2

Definition at line 85 of file kern_umtx.c.

◆ BATCH_SIZE

#define BATCH_SIZE   128

Definition at line 3935 of file kern_umtx.c.

◆ BUSY_SPINS

#define BUSY_SPINS   200

Definition at line 127 of file kern_umtx.c.

◆ GET_SHARE

#define GET_SHARE (   flags)     (((flags) & USYNC_PROCESS_SHARED) == 0 ? THREAD_SHARE : PROCESS_SHARE)

Definition at line 124 of file kern_umtx.c.

◆ GOLDEN_RATIO_PRIME

#define GOLDEN_RATIO_PRIME   2654404609U

Definition at line 118 of file kern_umtx.c.

◆ UMTX_CHAINS

#define UMTX_CHAINS   512

Definition at line 120 of file kern_umtx.c.

◆ UMTX_OP__FLAGS

#define UMTX_OP__FLAGS   (UMTX_OP__32BIT | UMTX_OP__I386)

Definition at line 4845 of file kern_umtx.c.

◆ UMTX_SHIFTS

#define UMTX_SHIFTS   (__WORD_BIT - 9)

Definition at line 122 of file kern_umtx.c.

◆ UMTXQ_ASSERT_LOCKED_BUSY

#define UMTXQ_ASSERT_LOCKED_BUSY (   key)    do {} while (0)

Definition at line 102 of file kern_umtx.c.

◆ UMTXQ_LOCKED_ASSERT

#define UMTXQ_LOCKED_ASSERT (   uc)    mtx_assert(&(uc)->uc_lock, MA_OWNED)

Definition at line 92 of file kern_umtx.c.

◆ umtxq_signal

#define umtxq_signal (   key,
  nwake 
)    umtxq_signal_queue((key), (nwake), UMTX_SHARED_QUEUE)

Definition at line 187 of file kern_umtx.c.

◆ UPRI

#define UPRI (   td)
Value:
(((td)->td_user_pri >= PRI_MIN_TIMESHARE &&\
(td)->td_user_pri <= PRI_MAX_TIMESHARE) ?\
PRI_MAX_TIMESHARE : (td)->td_user_pri)

Definition at line 114 of file kern_umtx.c.

◆ USHM_OBJ_UMTX

#define USHM_OBJ_UMTX (   o)     ((struct umtx_shm_obj_list *)(&(o)->umtx_data))

Definition at line 4235 of file kern_umtx.c.

◆ USHMF_OBJ_LINKED

#define USHMF_OBJ_LINKED   0x0002

Definition at line 4239 of file kern_umtx.c.

◆ USHMF_REG_LINKED

#define USHMF_REG_LINKED   0x0001

Definition at line 4238 of file kern_umtx.c.

Typedef Documentation

◆ _umtx_op_func

typedef int(* _umtx_op_func) (struct thread *td, struct _umtx_op_args *uap, const struct umtx_copyops *umtx_ops)

Definition at line 4760 of file kern_umtx.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ __umtx_op_cv_broadcast()

static int __umtx_op_cv_broadcast ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4099 of file kern_umtx.c.

References do_cv_broadcast().

Here is the call graph for this function:

◆ __umtx_op_cv_signal()

static int __umtx_op_cv_signal ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4091 of file kern_umtx.c.

References do_cv_signal().

Here is the call graph for this function:

◆ __umtx_op_cv_wait()

static int __umtx_op_cv_wait ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4072 of file kern_umtx.c.

References umtx_copyops::copyin_timeout, do_cv_wait(), and ts.

Here is the call graph for this function:

◆ __umtx_op_lock_umutex()

static int __umtx_op_lock_umutex ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4000 of file kern_umtx.c.

References umtx_copyops::copyin_umtx_time, and do_lock_umutex().

Here is the call graph for this function:

◆ __umtx_op_nwake_private()

static int __umtx_op_nwake_private ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 3982 of file kern_umtx.c.

References __umtx_op_nwake_private_compat32(), __umtx_op_nwake_private_native(), and umtx_copyops::compat32.

Here is the call graph for this function:

◆ __umtx_op_nwake_private_compat32()

static int __umtx_op_nwake_private_compat32 ( struct thread *  td,
struct _umtx_op_args *  uap 
)
static

Definition at line 3959 of file kern_umtx.c.

References BATCH_SIZE, count, kern_umtx_wake(), and maybe_yield().

Referenced by __umtx_op_nwake_private().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ __umtx_op_nwake_private_native()

static int __umtx_op_nwake_private_native ( struct thread *  td,
struct _umtx_op_args *  uap 
)
static

Definition at line 3937 of file kern_umtx.c.

References BATCH_SIZE, count, kern_umtx_wake(), and maybe_yield().

Referenced by __umtx_op_nwake_private().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ __umtx_op_robust_lists()

static int __umtx_op_robust_lists ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4544 of file kern_umtx.c.

References umtx_copyops::compat32, and umtx_copyops::copyin_robust_lists.

◆ __umtx_op_rw_rdlock()

static int __umtx_op_rw_rdlock ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4107 of file kern_umtx.c.

References umtx_copyops::copyin_umtx_time, and do_rw_rdlock().

Here is the call graph for this function:

◆ __umtx_op_rw_unlock()

static int __umtx_op_rw_unlock ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4148 of file kern_umtx.c.

References do_rw_unlock().

Here is the call graph for this function:

◆ __umtx_op_rw_wrlock()

static int __umtx_op_rw_wrlock ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4127 of file kern_umtx.c.

References umtx_copyops::copyin_umtx_time, and do_rw_wrlock().

Here is the call graph for this function:

◆ __umtx_op_sem2_wait()

static int __umtx_op_sem2_wait ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4194 of file kern_umtx.c.

References umtx_copyops::copyin_umtx_time, umtx_copyops::copyout_timeout, do_sem2_wait(), umtx_copyops::timespec_sz, and umtx_copyops::umtx_time_sz.

Here is the call graph for this function:

◆ __umtx_op_sem2_wake()

static int __umtx_op_sem2_wake ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4228 of file kern_umtx.c.

References do_sem2_wake().

Here is the call graph for this function:

◆ __umtx_op_set_ceiling()

static int __umtx_op_set_ceiling ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4064 of file kern_umtx.c.

References do_set_ceiling().

Here is the call graph for this function:

◆ __umtx_op_shm()

static int __umtx_op_shm ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4536 of file kern_umtx.c.

References umtx_shm().

Here is the call graph for this function:

◆ __umtx_op_trylock_umutex()

static int __umtx_op_trylock_umutex ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4020 of file kern_umtx.c.

References _UMUTEX_TRY, and do_lock_umutex().

Here is the call graph for this function:

◆ __umtx_op_unimpl()

static int __umtx_op_unimpl ( struct thread *td  __unused,
struct _umtx_op_args *uap  __unused,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 3863 of file kern_umtx.c.

◆ __umtx_op_unlock_umutex()

static int __umtx_op_unlock_umutex ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4056 of file kern_umtx.c.

References do_unlock_umutex().

Here is the call graph for this function:

◆ __umtx_op_wait()

static int __umtx_op_wait ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 3871 of file kern_umtx.c.

References umtx_copyops::compat32, umtx_copyops::copyin_umtx_time, and do_wait().

Here is the call graph for this function:

◆ __umtx_op_wait_uint()

static int __umtx_op_wait_uint ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 3890 of file kern_umtx.c.

References umtx_copyops::copyin_umtx_time, and do_wait().

Here is the call graph for this function:

◆ __umtx_op_wait_uint_private()

static int __umtx_op_wait_uint_private ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 3909 of file kern_umtx.c.

References umtx_copyops::copyin_umtx_time, and do_wait().

Here is the call graph for this function:

◆ __umtx_op_wait_umutex()

static int __umtx_op_wait_umutex ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops ops 
)
static

Definition at line 4028 of file kern_umtx.c.

References _UMUTEX_WAIT, umtx_copyops::copyin_umtx_time, and do_lock_umutex().

Here is the call graph for this function:

◆ __umtx_op_wake()

static int __umtx_op_wake ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 3928 of file kern_umtx.c.

References kern_umtx_wake().

Here is the call graph for this function:

◆ __umtx_op_wake2_umutex()

static int __umtx_op_wake2_umutex ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4186 of file kern_umtx.c.

References do_wake2_umutex().

Here is the call graph for this function:

◆ __umtx_op_wake_private()

static int __umtx_op_wake_private ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 3992 of file kern_umtx.c.

References kern_umtx_wake().

Here is the call graph for this function:

◆ __umtx_op_wake_umutex()

static int __umtx_op_wake_umutex ( struct thread *  td,
struct _umtx_op_args *  uap,
const struct umtx_copyops *ops  __unused 
)
static

Definition at line 4048 of file kern_umtx.c.

References do_wake_umutex().

Here is the call graph for this function:

◆ _Static_assert() [1/2]

_Static_assert ( __offsetof(struct umutex, m_spare[0])  = =__offsetof(struct umutex32, m_spare[0]),
"m_spare32"   
)

◆ _Static_assert() [2/2]

_Static_assert ( sizeof(struct umutex)  = =sizeof(struct umutex32),
"umutex32"   
)

◆ do_cv_broadcast()

static int do_cv_broadcast ( struct thread *  td,
struct ucond *  cv 
)
static

Definition at line 3005 of file kern_umtx.c.

References flags, GET_SHARE, umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_signal, and umtxq_unbusy_unlocked().

Referenced by __umtx_op_cv_broadcast().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_cv_signal()

static int do_cv_signal ( struct thread *  td,
struct ucond *  cv 
)
static

Definition at line 2976 of file kern_umtx.c.

References flags, GET_SHARE, umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_count(), umtxq_signal, and umtxq_unbusy().

Referenced by __umtx_op_cv_signal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_cv_wait()

static int do_cv_wait ( struct thread *  td,
struct ucond *  cv,
struct umutex *  m,
struct timespec *  timeout,
u_long  wflags 
)
static

Definition at line 2885 of file kern_umtx.c.

References do_unlock_umutex(), flags, GET_SHARE, umtx_abs_timeout_init(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_sleep(), umtxq_unbusy(), and umtxq_unbusy_unlocked().

Referenced by __umtx_op_cv_wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lock_normal()

static int do_lock_normal ( struct thread *  td,
struct umutex *  m,
uint32_t  flags,
struct _umtx_time *  timeout,
int  mode 
)
static

Definition at line 1321 of file kern_umtx.c.

References _UMUTEX_TRY, _UMUTEX_WAIT, flags, GET_SHARE, mode, thread_check_susp(), umtx_abs_timeout_init2(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_sleep(), and umtxq_unbusy().

Referenced by do_lock_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lock_pi()

static int do_lock_pi ( struct thread *  td,
struct umutex *  m,
uint32_t  flags,
struct _umtx_time *  timeout,
int  try 
)
static

◆ do_lock_pp()

static int do_lock_pp ( struct thread *  td,
struct umutex *  m,
uint32_t  flags,
struct _umtx_time *  timeout,
int  try 
)
static

Definition at line 2480 of file kern_umtx.c.

References flags, GET_SHARE, priv_check(), sched_lend_user_prio(), thread_check_susp(), umtx_abs_timeout_init2(), umtx_key_get(), umtx_key_release(), umtx_lock, umtxq_busy(), umtxq_sleep(), umtxq_unbusy(), umtxq_unbusy_unlocked(), and UPRI.

Referenced by do_lock_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lock_umutex()

static int do_lock_umutex ( struct thread *  td,
struct umutex *  m,
struct _umtx_time *  timeout,
int  mode 
)
static

Definition at line 2825 of file kern_umtx.c.

References _UMUTEX_WAIT, do_lock_normal(), do_lock_pi(), do_lock_pp(), flags, and mode.

Referenced by __umtx_op_lock_umutex(), __umtx_op_trylock_umutex(), and __umtx_op_wait_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_rw_rdlock()

static int do_rw_rdlock ( struct thread *  td,
struct urwlock *  rwlock,
long  fflag,
struct _umtx_time *  timeout 
)
static

Definition at line 3033 of file kern_umtx.c.

References flags, GET_SHARE, thread_check_susp(), umtx_abs_timeout_init2(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_sleep(), umtxq_unbusy(), and umtxq_unbusy_unlocked().

Referenced by __umtx_op_rw_rdlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_rw_unlock()

static int do_rw_unlock ( struct thread *  td,
struct urwlock *  rwlock 
)
static

Definition at line 3415 of file kern_umtx.c.

References count, flags, GET_SHARE, thread_check_susp(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_signal_queue(), and umtxq_unbusy().

Referenced by __umtx_op_rw_unlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_rw_wrlock()

static int do_rw_wrlock ( struct thread *  td,
struct urwlock *  rwlock,
struct _umtx_time *  timeout 
)
static

Definition at line 3219 of file kern_umtx.c.

References flags, GET_SHARE, thread_check_susp(), umtx_abs_timeout_init2(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_insert_queue(), umtxq_remove_queue(), umtxq_signal_queue(), umtxq_sleep(), umtxq_unbusy(), and umtxq_unbusy_unlocked().

Referenced by __umtx_op_rw_wrlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_sem2_wait()

static int do_sem2_wait ( struct thread *  td,
struct _usem2 *  sem,
struct _umtx_time *  timeout 
)
static

Definition at line 3619 of file kern_umtx.c.

References count, flags, fuword32(), GET_SHARE, kern_clock_gettime(), sem, thread_check_susp(), umtx_abs_timeout_init2(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_sleep(), and umtxq_unbusy().

Referenced by __umtx_op_sem2_wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_sem2_wake()

static int do_sem2_wake ( struct thread *  td,
struct _usem2 *  sem 
)
static

Definition at line 3704 of file kern_umtx.c.

References count, flags, GET_SHARE, sem, thread_check_susp(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_count(), umtxq_signal, and umtxq_unbusy().

Referenced by __umtx_op_sem2_wake().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_set_ceiling()

static int do_set_ceiling ( struct thread *  td,
struct umutex *  m,
uint32_t  ceiling,
uint32_t *  old_ceiling 
)
static

Definition at line 2729 of file kern_umtx.c.

References flags, GET_SHARE, umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_signal, umtxq_sleep(), and umtxq_unbusy().

Referenced by __umtx_op_set_ceiling().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_unlock_normal()

static int do_unlock_normal ( struct thread *  td,
struct umutex *  m,
uint32_t  flags,
bool  rb 
)
static

Definition at line 1496 of file kern_umtx.c.

References count, flags, GET_SHARE, thread_check_susp(), umtx_key_get(), umtx_key_release(), umtx_unlock_val(), umtxq_busy(), umtxq_count(), umtxq_signal, and umtxq_unbusy().

Referenced by do_unlock_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_unlock_pi()

static int do_unlock_pi ( struct thread *  td,
struct umutex *  m,
uint32_t  flags,
bool  rb 
)
static

Definition at line 2397 of file kern_umtx.c.

References count, flags, GET_SHARE, thread_check_susp(), umtx_key_get(), umtx_key_release(), umtx_pi_drop(), umtx_unlock_val(), umtxq_busy(), umtxq_unbusy(), and umtxq_unbusy_unlocked().

Referenced by do_unlock_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_unlock_pp()

static int do_unlock_pp ( struct thread *  td,
struct umutex *  m,
uint32_t  flags,
bool  rb 
)
static

Definition at line 2646 of file kern_umtx.c.

References flags, GET_SHARE, priv_check(), sched_lend_user_prio(), umtx_key_get(), umtx_key_release(), umtx_lock, umtx_unlock_val(), umtxq_busy(), umtxq_signal, umtxq_unbusy(), and UPRI.

Referenced by do_unlock_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_unlock_umutex()

static int do_unlock_umutex ( struct thread *  td,
struct umutex *  m,
bool  rb 
)
static

Definition at line 2863 of file kern_umtx.c.

References do_unlock_normal(), do_unlock_pi(), do_unlock_pp(), and flags.

Referenced by __umtx_op_unlock_umutex(), do_cv_wait(), and umtx_handle_rb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_wait()

static int do_wait ( struct thread *  td,
void *  addr,
u_long  id,
struct _umtx_time *  timeout,
int  compat32,
int  is_private 
)
static

Definition at line 1248 of file kern_umtx.c.

References addr, umtx_abs_timeout_init2(), umtx_key_get(), umtx_key_release(), and umtxq_sleep().

Referenced by __umtx_op_wait(), __umtx_op_wait_uint(), and __umtx_op_wait_uint_private().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_wake2_umutex()

static int do_wake2_umutex ( struct thread *  td,
struct umutex *  m,
uint32_t  flags 
)
static

Definition at line 1637 of file kern_umtx.c.

References count, flags, GET_SHARE, thread_check_susp(), type, umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_count(), umtxq_signal, and umtxq_unbusy().

Referenced by __umtx_op_wake2_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_wake_umutex()

static int do_wake_umutex ( struct thread *  td,
struct umutex *  m 
)
static

Definition at line 1571 of file kern_umtx.c.

References count, flags, GET_SHARE, thread_check_susp(), umtx_key_get(), umtx_key_release(), umtxq_busy(), umtxq_count(), umtxq_signal, and umtxq_unbusy().

Referenced by __umtx_op_wake_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern__umtx_op()

static int kern__umtx_op ( struct thread *  td,
void *  obj,
int  op,
unsigned long  val,
void *  uaddr1,
void *  uaddr2,
const struct umtx_copyops ops 
)
static

Definition at line 4848 of file kern_umtx.c.

References op_table.

Referenced by sys__umtx_op().

Here is the caller graph for this function:

◆ kern_umtx_wake()

int kern_umtx_wake ( struct thread *  td,
void *  uaddr,
int  n_wake,
int  is_private 
)

Definition at line 1302 of file kern_umtx.c.

References umtx_key_get(), umtx_key_release(), and umtxq_signal.

Referenced by __umtx_op_nwake_private_compat32(), __umtx_op_nwake_private_native(), __umtx_op_wake(), __umtx_op_wake_private(), and sys_thr_exit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LIST_HEAD()

LIST_HEAD ( umtx_shm_obj_list  ,
umtx_shm_reg   
)

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_UMTX  ,
"umtx"  ,
"UMTX queue memory"   
)
static

◆ sys__umtx_op()

int sys__umtx_op ( struct thread *  td,
struct _umtx_op_args *  uap 
)

Definition at line 4865 of file kern_umtx.c.

References kern__umtx_op(), umtx_native_ops, and umtx_native_opsi386.

Here is the call graph for this function:

◆ SYSCTL_INT() [1/4]

SYSCTL_INT ( _debug_umtx  ,
OID_AUTO  ,
robust_faults_verbose  ,
CTLFLAG_RWTUN  ,
umtx_verbose_rb,
,
""   
)

◆ SYSCTL_INT() [2/4]

SYSCTL_INT ( _debug_umtx  ,
OID_AUTO  ,
umtx_pi_allocated  ,
CTLFLAG_RD  ,
umtx_pi_allocated,
,
"Allocated umtx_pi"   
)

◆ SYSCTL_INT() [3/4]

SYSCTL_INT ( _kern_ipc  ,
OID_AUTO  ,
umtx_max_robust  ,
CTLFLAG_RWTUN  ,
umtx_max_rb,
,
"Maximum number of robust mutexes allowed for each thread"   
)

◆ SYSCTL_INT() [4/4]

SYSCTL_INT ( _kern_ipc  ,
OID_AUTO  ,
umtx_vnode_persistent  ,
CTLFLAG_RWTUN  ,
umtx_shm_vnobj_persistent,
,
"False forces destruction of umtx attached to  file,
on last close"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _debug  ,
OID_AUTO  ,
umtx  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"umtx debug"   
)
static

◆ SYSINIT()

SYSINIT ( umtx  ,
SI_SUB_EVENTHANDLER+  1,
SI_ORDER_MIDDLE  ,
umtxq_sysinit  ,
NULL   
)

◆ TAILQ_HEAD()

TAILQ_HEAD ( umtx_shm_reg_head  ,
umtx_shm_reg   
)

◆ tstohz()

static int tstohz ( const struct timespec *  tsp)
inlinestatic

Definition at line 668 of file kern_umtx.c.

References tvtohz().

Referenced by umtx_abs_timeout_getsbt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_abs_timeout_getsbt()

static int umtx_abs_timeout_getsbt ( struct umtx_abs_timeout *  timo,
sbintime_t *  sbt,
int *  flags 
)
static

Definition at line 705 of file kern_umtx.c.

References bintime(), bt, flags, getboottimebin(), kern_clock_gettime(), tc_tick_sbt, tick_sbt, and tstohz().

Referenced by umtxq_sleep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_abs_timeout_init()

void umtx_abs_timeout_init ( struct umtx_abs_timeout *  timo,
int  clockid,
int  absolute,
const struct timespec *  timeout 
)

Definition at line 677 of file kern_umtx.c.

References kern_clock_gettime().

Referenced by do_cv_wait(), and umtx_abs_timeout_init2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_abs_timeout_init2()

static void umtx_abs_timeout_init2 ( struct umtx_abs_timeout *  timo,
const struct _umtx_time *  umtxtime 
)
inlinestatic

Definition at line 696 of file kern_umtx.c.

References umtx_abs_timeout_init().

Referenced by do_lock_normal(), do_lock_pi(), do_lock_pp(), do_rw_rdlock(), do_rw_wrlock(), do_sem2_wait(), and do_wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_cleanup_rb_list()

static void umtx_cleanup_rb_list ( struct thread *  td,
uintptr_t  rb_list,
uintptr_t *  rb_inact,
const char *  name,
bool  compat32 
)
static

Definition at line 5044 of file kern_umtx.c.

References name, umtx_handle_rb(), umtx_max_rb, umtx_read_uptr(), umtx_verbose_rb, and uprintf().

Referenced by umtx_thread_cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_copyin_robust_lists()

static int umtx_copyin_robust_lists ( const void *  uaddr,
size_t  size,
struct umtx_robust_lists_params *  rb 
)
static

Definition at line 3801 of file kern_umtx.c.

◆ umtx_copyin_robust_lists32()

static int umtx_copyin_robust_lists32 ( const void *  uaddr,
size_t  size,
struct umtx_robust_lists_params *  rbp 
)
static

Definition at line 4614 of file kern_umtx.c.

◆ umtx_copyin_timeout()

int umtx_copyin_timeout ( const void *  uaddr,
struct timespec *  tsp 
)
inline

Definition at line 3767 of file kern_umtx.c.

Referenced by sys_thr_suspend().

Here is the caller graph for this function:

◆ umtx_copyin_timeouti386()

static int umtx_copyin_timeouti386 ( const void *  uaddr,
struct timespec *  tsp 
)
inlinestatic

Definition at line 4634 of file kern_umtx.c.

References timespeci386::tv_nsec, and timespeci386::tv_sec.

◆ umtx_copyin_umtx_time()

static int umtx_copyin_umtx_time ( const void *  uaddr,
size_t  size,
struct _umtx_time *  tp 
)
inlinestatic

Definition at line 3782 of file kern_umtx.c.

◆ umtx_copyin_umtx_timei386()

static int umtx_copyin_umtx_timei386 ( const void *  uaddr,
size_t  size,
struct _umtx_time *  tp 
)
inlinestatic

◆ umtx_copyout_timeout()

static int umtx_copyout_timeout ( void *  uaddr,
size_t  sz,
struct timespec *  tsp 
)
static

Definition at line 3811 of file kern_umtx.c.

◆ umtx_copyout_timeouti386()

static int umtx_copyout_timeouti386 ( void *  uaddr,
size_t  sz,
struct timespec *  tsp 
)
static

Definition at line 4677 of file kern_umtx.c.

References timespeci386::tv_sec.

◆ umtx_exec()

void umtx_exec ( struct proc *  p)

Definition at line 4956 of file kern_umtx.c.

References umtx_thread_cleanup().

Referenced by exec_onexec_old().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_handle_rb()

static int umtx_handle_rb ( struct thread *  td,
uintptr_t  rbp,
uintptr_t *  rb_list,
bool  inact,
bool  compat32 
)
static

Definition at line 5023 of file kern_umtx.c.

References do_unlock_umutex(), and umtx_read_rb_list().

Referenced by umtx_cleanup_rb_list(), and umtx_thread_cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_key_get()

int umtx_key_get ( const void *  addr,
int  type,
int  share,
struct umtx_key *  key 
)

◆ umtx_key_release()

◆ umtx_pi_adjust()

void umtx_pi_adjust ( struct thread *  td,
u_char  oldpri 
)

Definition at line 1969 of file kern_umtx.c.

References umtx_lock, umtx_pi_adjust_thread(), and umtx_repropagate_priority().

Referenced by rtp_to_pri().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_adjust_thread()

static int umtx_pi_adjust_thread ( struct umtx_pi *  pi,
struct thread *  td 
)
static

Definition at line 1735 of file kern_umtx.c.

References umtx_lock, and UPRI.

Referenced by umtx_pi_adjust(), umtx_propagate_priority(), and umtx_repropagate_priority().

Here is the caller graph for this function:

◆ umtx_pi_alloc()

struct umtx_pi * umtx_pi_alloc ( int  flags)

Definition at line 1713 of file kern_umtx.c.

References flags, umtx_pi_allocated, and umtx_pi_zone.

Referenced by do_lock_pi().

Here is the caller graph for this function:

◆ umtx_pi_check_loop()

static bool umtx_pi_check_loop ( struct umtx_pi *  pi)
static

Definition at line 1792 of file kern_umtx.c.

References umtx_lock, and umtx_pi_next().

Referenced by umtx_propagate_priority(), and umtx_repropagate_priority().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_claim()

int umtx_pi_claim ( struct umtx_pi *  pi,
struct thread *  owner 
)

Definition at line 1933 of file kern_umtx.c.

References sched_lend_user_prio(), umtx_lock, umtx_pi_setowner(), and UPRI.

Referenced by do_lock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_disown()

static void umtx_pi_disown ( struct umtx_pi *  pi)
static

Definition at line 1921 of file kern_umtx.c.

References umtx_lock.

Referenced by umtx_pi_drop(), and umtx_pi_unref().

Here is the caller graph for this function:

◆ umtx_pi_drop()

int umtx_pi_drop ( struct thread *  td,
struct umtx_key *  key,
bool  rb,
int *  count 
)

Definition at line 2127 of file kern_umtx.c.

References count, sched_lend_user_prio(), umtx_lock, umtx_pi_disown(), umtx_pi_lookup(), UMTXQ_ASSERT_LOCKED_BUSY, umtxq_count_pi(), umtxq_signal_thread(), and UPRI.

Referenced by do_unlock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_free()

void umtx_pi_free ( struct umtx_pi *  pi)

Definition at line 1724 of file kern_umtx.c.

References umtx_pi_allocated, and umtx_pi_zone.

Referenced by do_lock_pi(), and umtx_pi_unref().

Here is the caller graph for this function:

◆ umtx_pi_insert()

void umtx_pi_insert ( struct umtx_pi *  pi)

Definition at line 2114 of file kern_umtx.c.

References umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by do_lock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_lookup()

struct umtx_pi * umtx_pi_lookup ( struct umtx_key *  key)

Definition at line 2094 of file kern_umtx.c.

References umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by do_lock_pi(), and umtx_pi_drop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_next()

static struct umtx_pi * umtx_pi_next ( struct umtx_pi *  pi)
static

Definition at line 1776 of file kern_umtx.c.

Referenced by umtx_pi_check_loop().

Here is the caller graph for this function:

◆ umtx_pi_ref()

void umtx_pi_ref ( struct umtx_pi *  pi)

Definition at line 2059 of file kern_umtx.c.

References umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by do_lock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_pi_setowner()

static void umtx_pi_setowner ( struct umtx_pi *  pi,
struct thread *  owner 
)
static

Definition at line 1906 of file kern_umtx.c.

References umtx_lock.

Referenced by umtx_pi_claim(), and umtxq_sleep_pi().

Here is the caller graph for this function:

◆ umtx_pi_unref()

void umtx_pi_unref ( struct umtx_pi *  pi)

Definition at line 2071 of file kern_umtx.c.

References umtx_lock, umtx_pi_disown(), umtx_pi_free(), umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by do_lock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_propagate_priority()

static void umtx_propagate_priority ( struct thread *  td)
static

Definition at line 1821 of file kern_umtx.c.

References sched_lend_user_prio(), umtx_lock, umtx_pi_adjust_thread(), umtx_pi_check_loop(), and UPRI.

Referenced by umtxq_sleep_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_read_rb_list()

static void umtx_read_rb_list ( struct thread *  td,
struct umutex *  m,
uintptr_t *  rb_list,
bool  compat32 
)
static

Definition at line 5009 of file kern_umtx.c.

Referenced by umtx_handle_rb().

Here is the caller graph for this function:

◆ umtx_read_uptr()

static int umtx_read_uptr ( struct thread *  td,
uintptr_t  ptr,
uintptr_t *  res,
bool  compat32 
)
static

Definition at line 4988 of file kern_umtx.c.

References res.

Referenced by umtx_cleanup_rb_list(), and umtx_thread_cleanup().

Here is the caller graph for this function:

◆ umtx_repropagate_priority()

static void umtx_repropagate_priority ( struct umtx_pi *  pi)
static

Definition at line 1870 of file kern_umtx.c.

References sched_lend_user_prio(), umtx_lock, umtx_pi_adjust_thread(), umtx_pi_check_loop(), and UPRI.

Referenced by umtx_pi_adjust(), and umtxq_sleep_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_shm()

static int umtx_shm ( struct thread *  td,
void *  addr,
u_int  flags 
)
static

Definition at line 4482 of file kern_umtx.c.

References addr, falloc_caps(), fd, finit(), flags, shm_access(), shm_hold(), umtx_key_get(), umtx_key_release(), umtx_shm_alive(), umtx_shm_create_reg(), umtx_shm_find_reg(), and umtx_shm_unref_reg().

Referenced by __umtx_op_shm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_shm_alive()

static int umtx_shm_alive ( struct thread *  td,
void *  addr 
)
static

Definition at line 4446 of file kern_umtx.c.

References addr, and res.

Referenced by umtx_shm().

Here is the caller graph for this function:

◆ umtx_shm_create_reg()

static int umtx_shm_create_reg ( struct thread *  td,
const struct umtx_key *  key,
struct umtx_shm_reg **  res 
)
static

Definition at line 4402 of file kern_umtx.c.

References chgumtxcnt(), crhold(), lim_cur(), res, shm_alloc(), shm_dotruncate(), umtx_shm_find_reg(), umtx_shm_find_reg_locked(), umtx_shm_free_reg(), umtx_shm_lock, umtx_shm_reg_zone, umtx_shm_registry, USHM_OBJ_UMTX, USHMF_OBJ_LINKED, and USHMF_REG_LINKED.

Referenced by umtx_shm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_shm_find_reg()

static struct umtx_shm_reg * umtx_shm_find_reg ( const struct umtx_key *  key)
static

Definition at line 4309 of file kern_umtx.c.

References umtx_shm_find_reg_locked(), and umtx_shm_lock.

Referenced by umtx_shm(), and umtx_shm_create_reg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_shm_find_reg_locked()

static struct umtx_shm_reg * umtx_shm_find_reg_locked ( const struct umtx_key *  key)
static

Definition at line 4281 of file kern_umtx.c.

References umtx_shm_lock, umtx_shm_registry, and USHMF_REG_LINKED.

Referenced by umtx_shm_create_reg(), and umtx_shm_find_reg().

Here is the caller graph for this function:

◆ umtx_shm_free_reg()

static void umtx_shm_free_reg ( struct umtx_shm_reg reg)
static

Definition at line 4320 of file kern_umtx.c.

References chgumtxcnt(), crfree(), shm_drop(), and umtx_shm_reg_zone.

Referenced by umtx_shm_create_reg(), umtx_shm_reg_delfree_tq(), and umtx_shm_unref_reg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_shm_init()

static void umtx_shm_init ( void  )
static

Definition at line 4470 of file kern_umtx.c.

References umtx_shm_lock, umtx_shm_reg_zone, and umtx_shm_registry.

Referenced by umtxq_sysinit().

Here is the caller graph for this function:

◆ umtx_shm_object_init()

void umtx_shm_object_init ( vm_object_t  object)

Definition at line 4372 of file kern_umtx.c.

References USHM_OBJ_UMTX.

◆ umtx_shm_object_terminated()

void umtx_shm_object_terminated ( vm_object_t  object)

Definition at line 4379 of file kern_umtx.c.

References taskqueue_enqueue(), umtx_shm_lock, umtx_shm_reg_delfree, umtx_shm_reg_delfree_task, umtx_shm_unref_reg_locked(), and USHM_OBJ_UMTX.

Here is the call graph for this function:

◆ umtx_shm_reg_delfree_tq()

static void umtx_shm_reg_delfree_tq ( void *context  __unused,
int pending  __unused 
)
static

Definition at line 4262 of file kern_umtx.c.

References umtx_shm_free_reg(), umtx_shm_lock, and umtx_shm_reg_delfree.

Here is the call graph for this function:

◆ umtx_shm_unref_reg()

static void umtx_shm_unref_reg ( struct umtx_shm_reg reg,
bool  force 
)
static

Definition at line 4353 of file kern_umtx.c.

References umtx_shm_free_reg(), umtx_shm_lock, and umtx_shm_unref_reg_locked().

Referenced by umtx_shm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_shm_unref_reg_locked()

static bool umtx_shm_unref_reg_locked ( struct umtx_shm_reg reg,
bool  force 
)
static

Definition at line 4330 of file kern_umtx.c.

References res, umtx_shm_lock, umtx_shm_registry, USHMF_OBJ_LINKED, and USHMF_REG_LINKED.

Referenced by umtx_shm_object_terminated(), and umtx_shm_unref_reg().

Here is the caller graph for this function:

◆ umtx_thread_alloc()

void umtx_thread_alloc ( struct thread *  td)

Definition at line 4935 of file kern_umtx.c.

Referenced by thread_ctor().

Here is the caller graph for this function:

◆ umtx_thread_cleanup()

static void umtx_thread_cleanup ( struct thread *  td)
static

Definition at line 5076 of file kern_umtx.c.

References sched_lend_user_prio_cond(), umtx_cleanup_rb_list(), umtx_handle_rb(), umtx_lock, and umtx_read_uptr().

Referenced by umtx_exec(), and umtx_thread_exit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_thread_exit()

void umtx_thread_exit ( struct thread *  td)

Definition at line 4981 of file kern_umtx.c.

References umtx_thread_cleanup().

Referenced by exit_onexit(), kthread_exit(), sys_thr_exit(), and thread_suspend_check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_thread_fini()

void umtx_thread_fini ( struct thread *  td)

Definition at line 4925 of file kern_umtx.c.

References umtxq_free().

Referenced by thread_fini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_thread_init()

void umtx_thread_init ( struct thread *  td)

Definition at line 4917 of file kern_umtx.c.

References umtxq_alloc().

Referenced by thread_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtx_unlock_val()

static uint32_t umtx_unlock_val ( uint32_t  flags,
bool  rb 
)
static

Definition at line 772 of file kern_umtx.c.

References flags.

Referenced by do_unlock_normal(), do_unlock_pi(), and do_unlock_pp().

Here is the caller graph for this function:

◆ umtxq_alloc()

struct umtx_q * umtxq_alloc ( void  )

Definition at line 357 of file kern_umtx.c.

References malloc().

Referenced by umtx_thread_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_busy()

void umtxq_busy ( struct umtx_key *  key)

◆ umtxq_count()

int umtxq_count ( struct umtx_key *  key)

Definition at line 538 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, and umtxq_queue_lookup().

Referenced by do_cv_signal(), do_sem2_wake(), do_unlock_normal(), do_wake2_umutex(), and do_wake_umutex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_count_pi()

static int umtxq_count_pi ( struct umtx_key *  key,
struct umtx_q **  first 
)
static

Definition at line 554 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, and umtxq_queue_lookup().

Referenced by umtx_pi_drop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_free()

void umtxq_free ( struct umtx_q *  uq)

Definition at line 371 of file kern_umtx.c.

References free().

Referenced by umtx_thread_fini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_getchain()

◆ umtxq_hash()

static void umtxq_hash ( struct umtx_key *  key)
inlinestatic

Definition at line 380 of file kern_umtx.c.

References GOLDEN_RATIO_PRIME, UMTX_CHAINS, and UMTX_SHIFTS.

Referenced by umtx_key_get().

Here is the caller graph for this function:

◆ umtxq_insert_queue()

void umtxq_insert_queue ( struct umtx_q *  uq,
int  q 
)

Definition at line 471 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, and umtxq_queue_lookup().

Referenced by do_rw_wrlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_queue_lookup()

static struct umtxq_queue * umtxq_queue_lookup ( struct umtx_key *  key,
int  q 
)
static

Definition at line 455 of file kern_umtx.c.

References umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by umtxq_count(), umtxq_count_pi(), umtxq_insert_queue(), umtxq_requeue(), umtxq_signal_mask(), and umtxq_signal_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_remove_queue()

void umtxq_remove_queue ( struct umtx_q *  uq,
int  q 
)

Definition at line 505 of file kern_umtx.c.

References umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by do_rw_wrlock(), umtxq_signal_mask(), and umtxq_signal_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_requeue()

int umtxq_requeue ( struct umtx_key *  key,
int  n_wake,
struct umtx_key *  key2,
int  n_requeue 
)

Definition at line 639 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, umtxq_queue_lookup(), and wakeup_one().

Here is the call graph for this function:

◆ umtxq_signal_mask()

int umtxq_signal_mask ( struct umtx_key *  key,
int  n_wake,
u_int  bitset 
)

Definition at line 572 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, umtxq_queue_lookup(), umtxq_remove_queue(), and wakeup_one().

Here is the call graph for this function:

◆ umtxq_signal_queue()

static int umtxq_signal_queue ( struct umtx_key *  key,
int  n_wake,
int  q 
)
static

Definition at line 599 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, umtxq_queue_lookup(), umtxq_remove_queue(), and wakeup().

Referenced by do_rw_unlock(), and do_rw_wrlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_signal_thread()

static void umtxq_signal_thread ( struct umtx_q *  uq)
inlinestatic

Definition at line 623 of file kern_umtx.c.

References umtxq_getchain(), UMTXQ_LOCKED_ASSERT, and wakeup().

Referenced by umtx_pi_drop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_sleep()

int umtxq_sleep ( struct umtx_q *  uq,
const char *  wmesg,
struct umtx_abs_timeout *  timo 
)

Definition at line 789 of file kern_umtx.c.

References flags, rtc_generation, umtx_abs_timeout_getsbt(), umtxq_getchain(), and UMTXQ_LOCKED_ASSERT.

Referenced by do_cv_wait(), do_lock_normal(), do_lock_pp(), do_rw_rdlock(), do_rw_wrlock(), do_sem2_wait(), do_set_ceiling(), do_wait(), and umtxq_sleep_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_sleep_pi()

int umtxq_sleep_pi ( struct umtx_q *  uq,
struct umtx_pi *  pi,
uint32_t  owner,
const char *  wmesg,
struct umtx_abs_timeout *  timo,
bool  shared 
)

Definition at line 1991 of file kern_umtx.c.

References tdfind(), umtx_lock, umtx_pi_setowner(), umtx_propagate_priority(), umtx_repropagate_priority(), umtxq_getchain(), UMTXQ_LOCKED_ASSERT, umtxq_sleep(), umtxq_unbusy(), and UPRI.

Referenced by do_lock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ umtxq_sysinit() [1/2]

static void umtxq_sysinit ( void *  )
static

◆ umtxq_sysinit() [2/2]

static void umtxq_sysinit ( void *arg  __unused)
static

Definition at line 327 of file kern_umtx.c.

References UMTX_CHAINS, umtx_lock, umtx_pi_zone, umtx_shm_init(), and umtxq_chains.

Here is the call graph for this function:

◆ umtxq_unbusy()

void umtxq_unbusy ( struct umtx_key *  key)

◆ umtxq_unbusy_unlocked()

void umtxq_unbusy_unlocked ( struct umtx_key *  key)

Definition at line 446 of file kern_umtx.c.

References umtxq_unbusy().

Referenced by do_cv_broadcast(), do_cv_wait(), do_lock_pi(), do_lock_pp(), do_rw_rdlock(), do_rw_wrlock(), and do_unlock_pi().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ op_table

const _umtx_op_func op_table[]
static

Definition at line 4763 of file kern_umtx.c.

Referenced by kern__umtx_op().

◆ umtx_lock

◆ umtx_max_rb

int umtx_max_rb = 1000
static

Definition at line 150 of file kern_umtx.c.

Referenced by umtx_cleanup_rb_list().

◆ umtx_native_ops

const struct umtx_copyops umtx_native_ops
static
Initial value:
= {
.copyin_timeout = umtx_copyin_timeout,
.copyin_umtx_time = umtx_copyin_umtx_time,
.copyin_robust_lists = umtx_copyin_robust_lists,
.copyout_timeout = umtx_copyout_timeout,
.timespec_sz = sizeof(struct timespec),
.umtx_time_sz = sizeof(struct _umtx_time),
}
static int umtx_copyin_robust_lists(const void *uaddr, size_t size, struct umtx_robust_lists_params *rb)
Definition: kern_umtx.c:3801
static int umtx_copyout_timeout(void *uaddr, size_t sz, struct timespec *tsp)
Definition: kern_umtx.c:3811
int umtx_copyin_timeout(const void *uaddr, struct timespec *tsp)
Definition: kern_umtx.c:3767
static int umtx_copyin_umtx_time(const void *uaddr, size_t size, struct _umtx_time *tp)
Definition: kern_umtx.c:3782

Definition at line 4803 of file kern_umtx.c.

Referenced by sys__umtx_op().

◆ umtx_native_opsi386

const struct umtx_copyops umtx_native_opsi386
static
Initial value:
= {
.copyin_timeout = umtx_copyin_timeouti386,
.copyin_umtx_time = umtx_copyin_umtx_timei386,
.copyin_robust_lists = umtx_copyin_robust_lists32,
.copyout_timeout = umtx_copyout_timeouti386,
.timespec_sz = sizeof(struct timespeci386),
.umtx_time_sz = sizeof(struct umtx_timei386),
.compat32 = true,
}
static int umtx_copyout_timeouti386(void *uaddr, size_t sz, struct timespec *tsp)
Definition: kern_umtx.c:4677
static int umtx_copyin_robust_lists32(const void *uaddr, size_t size, struct umtx_robust_lists_params *rbp)
Definition: kern_umtx.c:4614
static int umtx_copyin_umtx_timei386(const void *uaddr, size_t size, struct _umtx_time *tp)
Definition: kern_umtx.c:4654
static int umtx_copyin_timeouti386(const void *uaddr, struct timespec *tsp)
Definition: kern_umtx.c:4634

Definition at line 4813 of file kern_umtx.c.

Referenced by sys__umtx_op().

◆ umtx_pi_allocated

int umtx_pi_allocated
static

Definition at line 158 of file kern_umtx.c.

Referenced by umtx_pi_alloc(), and umtx_pi_free().

◆ umtx_pi_zone

uma_zone_t umtx_pi_zone
static

Definition at line 155 of file kern_umtx.c.

Referenced by umtx_pi_alloc(), umtx_pi_free(), and umtxq_sysinit().

◆ umtx_shm_lock

◆ umtx_shm_reg_delfree

struct umtx_shm_reg_head umtx_shm_reg_delfree
static
Initial value:
=
TAILQ_HEAD_INITIALIZER(umtx_shm_reg_delfree)
static struct umtx_shm_reg_head umtx_shm_reg_delfree
Definition: kern_umtx.c:4256

Definition at line 4256 of file kern_umtx.c.

Referenced by umtx_shm_object_terminated(), and umtx_shm_reg_delfree_tq().

◆ umtx_shm_reg_delfree_task

struct task umtx_shm_reg_delfree_task
static
Initial value:
=
TASK_INITIALIZER(0, umtx_shm_reg_delfree_tq, NULL)
static void umtx_shm_reg_delfree_tq(void *context __unused, int pending __unused)
Definition: kern_umtx.c:4262

Definition at line 4277 of file kern_umtx.c.

Referenced by umtx_shm_object_terminated().

◆ umtx_shm_reg_zone

uma_zone_t umtx_shm_reg_zone
static

Definition at line 4253 of file kern_umtx.c.

Referenced by umtx_shm_create_reg(), umtx_shm_free_reg(), and umtx_shm_init().

◆ umtx_shm_registry

struct umtx_shm_reg_head umtx_shm_registry[UMTX_CHAINS]
static

◆ umtx_shm_vnobj_persistent

int umtx_shm_vnobj_persistent = 0

Definition at line 146 of file kern_umtx.c.

◆ umtx_verbose_rb

int umtx_verbose_rb = 1
static

Definition at line 164 of file kern_umtx.c.

Referenced by umtx_cleanup_rb_list().

◆ umtxq_chains

struct umtxq_chain umtxq_chains[2][UMTX_CHAINS]
static

Definition at line 156 of file kern_umtx.c.

Referenced by umtxq_getchain(), and umtxq_sysinit().