FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_adaptive_mutexes.h"
#include "opt_ddb.h"
#include "opt_hwpmc_hooks.h"
#include "opt_sched.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/sbuf.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/turnstile.h>
#include <sys/vmmeter.h>
#include <sys/lock_profile.h>
#include <machine/atomic.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <ddb/ddb.h>
#include <fs/devfs/devfs_int.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
Go to the source code of this file.
Macros | |
#define | mtxlock2mtx(c) (__containerof(c, struct mtx, mtx_lock)) |
#define | mtx_unowned(m) ((m)->mtx_lock == MTX_UNOWNED) |
#define | mtx_destroyed(m) ((m)->mtx_lock == MTX_DESTROYED) |
#define | mtx_spin_delay locks_delay |
#define | thread_lock_validate(m, opts, file, line) do { } while (0) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | assert_mtx (const struct lock_object *lock, int what) |
static void | lock_mtx (struct lock_object *lock, uintptr_t how) |
static void | lock_spin (struct lock_object *lock, uintptr_t how) |
static uintptr_t | unlock_mtx (struct lock_object *lock) |
static uintptr_t | unlock_spin (struct lock_object *lock) |
static void | _mtx_lock_indefinite_check (struct mtx *, struct lock_delay_arg *) |
void | __mtx_lock_flags (volatile uintptr_t *c, int opts, const char *file, int line) |
void | __mtx_unlock_flags (volatile uintptr_t *c, int opts, const char *file, int line) |
void | __mtx_lock_spin_flags (volatile uintptr_t *c, int opts, const char *file, int line) |
int | __mtx_trylock_spin_flags (volatile uintptr_t *c, int opts, const char *file, int line) |
void | __mtx_unlock_spin_flags (volatile uintptr_t *c, int opts, const char *file, int line) |
int | _mtx_trylock_flags_int (struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF) |
int | _mtx_trylock_flags_ (volatile uintptr_t *c, int opts, const char *file, int line) |
void | __mtx_lock_sleep (volatile uintptr_t *c, uintptr_t v) |
void | _thread_lock (struct thread *td) |
void | thread_lock_flags_ (struct thread *td, int opts, const char *file, int line) |
struct mtx * | thread_lock_block (struct thread *td) |
void | thread_lock_unblock (struct thread *td, struct mtx *new) |
void | thread_lock_block_wait (struct thread *td) |
void | thread_lock_set (struct thread *td, struct mtx *new) |
void | __mtx_unlock_sleep (volatile uintptr_t *c, uintptr_t v) |
void | mtx_sysinit (void *arg) |
void | _mtx_init (volatile uintptr_t *c, const char *name, const char *type, int opts) |
void | _mtx_destroy (volatile uintptr_t *c) |
void | mutex_init (void) |
void | mtx_spin_wait_unlocked (struct mtx *m) |
void | mtx_wait_unlocked (struct mtx *m) |
Variables | |
struct lock_class | lock_class_mtx_sleep |
struct lock_class | lock_class_mtx_spin |
struct mtx | blocked_lock |
struct mtx __exclusive_cache_line | Giant |
#define mtx_destroyed | ( | m | ) | ((m)->mtx_lock == MTX_DESTROYED) |
Definition at line 97 of file kern_mutex.c.
#define mtx_spin_delay locks_delay |
Definition at line 174 of file kern_mutex.c.
#define mtx_unowned | ( | m | ) | ((m)->mtx_lock == MTX_UNOWNED) |
Definition at line 95 of file kern_mutex.c.
#define mtxlock2mtx | ( | c | ) | (__containerof(c, struct mtx, mtx_lock)) |
Definition at line 90 of file kern_mutex.c.
#define thread_lock_validate | ( | m, | |
opts, | |||
file, | |||
line | |||
) | do { } while (0) |
Definition at line 821 of file kern_mutex.c.
__FBSDID | ( | "$FreeBSD$" | ) |
void __mtx_lock_flags | ( | volatile uintptr_t * | c, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 262 of file kern_mutex.c.
References kdb_active, lock_class_mtx_sleep, mtx, and mtxlock2mtx.
void __mtx_lock_sleep | ( | volatile uintptr_t * | c, |
uintptr_t | v | ||
) |
Definition at line 497 of file kern_mutex.c.
References lock_delay(), lockstat_nsecs(), mtx, mtxlock2mtx, sched_tdname(), ts, turnstile_cancel(), turnstile_trywait(), and turnstile_wait().
void __mtx_lock_spin_flags | ( | volatile uintptr_t * | c, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 321 of file kern_mutex.c.
References lock_class_mtx_spin, mtx, and mtxlock2mtx.
int __mtx_trylock_spin_flags | ( | volatile uintptr_t * | c, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 362 of file kern_mutex.c.
References lock_class_mtx_spin, mtx, and mtxlock2mtx.
void __mtx_unlock_flags | ( | volatile uintptr_t * | c, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 296 of file kern_mutex.c.
References __mtx_unlock_sleep(), lock_class_mtx_sleep, mtx, and mtxlock2mtx.
void __mtx_unlock_sleep | ( | volatile uintptr_t * | c, |
uintptr_t | v | ||
) |
Definition at line 1020 of file kern_mutex.c.
References mtx, mtxlock2mtx, ts, turnstile_broadcast(), turnstile_chain_lock(), turnstile_chain_unlock(), turnstile_lookup(), and turnstile_unpend().
Referenced by __mtx_unlock_flags().
void __mtx_unlock_spin_flags | ( | volatile uintptr_t * | c, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 390 of file kern_mutex.c.
References lock_class_mtx_spin, mtx, and mtxlock2mtx.
void _mtx_destroy | ( | volatile uintptr_t * | c | ) |
Definition at line 1180 of file kern_mutex.c.
References lock_class_mtx_spin, lock_destroy(), mtx, mtx_unowned, and mtxlock2mtx.
void _mtx_init | ( | volatile uintptr_t * | c, |
const char * | name, | ||
const char * | type, | ||
int | opts | ||
) |
Definition at line 1133 of file kern_mutex.c.
References flags, lock_class_mtx_sleep, lock_class_mtx_spin, lock_init(), mtx, mtxlock2mtx, name, and type.
|
static |
Definition at line 1237 of file kern_mutex.c.
References kdb_active, panic(), printf(), and witness_display_spinlock().
Referenced by mtx_spin_wait_unlocked(), and thread_lock_flags_().
int _mtx_trylock_flags_ | ( | volatile uintptr_t * | c, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 477 of file kern_mutex.c.
References _mtx_trylock_flags_int(), mtx, and mtxlock2mtx.
int _mtx_trylock_flags_int | ( | struct mtx * | m, |
int opts | LOCK_FILE_LINE_ARG_DEF | ||
) |
Definition at line 416 of file kern_mutex.c.
References kdb_active, and lock_class_mtx_sleep.
Referenced by _mtx_trylock_flags_().
void _thread_lock | ( | struct thread * | td | ) |
Definition at line 830 of file kern_mutex.c.
References blocked_lock, mtx, thread_lock_flags_(), and thread_lock_validate.
|
static |
Definition at line 186 of file kern_mutex.c.
References mtx.
|
static |
Definition at line 208 of file kern_mutex.c.
References mtx.
|
static |
Definition at line 215 of file kern_mutex.c.
References mtx.
void mtx_spin_wait_unlocked | ( | struct mtx * | m | ) |
Definition at line 1262 of file kern_mutex.c.
References _mtx_lock_indefinite_check(), and lock_class_mtx_spin.
Referenced by proc_reap().
void mtx_sysinit | ( | void * | arg | ) |
Definition at line 1118 of file kern_mutex.c.
References mtx.
void mtx_wait_unlocked | ( | struct mtx * | m | ) |
Definition at line 1287 of file kern_mutex.c.
References lock_class_mtx_sleep.
Referenced by cache_purge_vgone().
void mutex_init | ( | void | ) |
Definition at line 1215 of file kern_mutex.c.
References blocked_lock, devmtx, Giant, init_turnstiles(), and proc0.
struct mtx * thread_lock_block | ( | struct thread * | td | ) |
Definition at line 963 of file kern_mutex.c.
References blocked_lock, and mtx.
Referenced by sched_switch(), and sched_throw().
void thread_lock_block_wait | ( | struct thread * | td | ) |
Definition at line 986 of file kern_mutex.c.
References blocked_lock.
Referenced by callout_process(), propagate_priority(), sleepq_resume_thread(), and turnstile_unpend().
void thread_lock_flags_ | ( | struct thread * | td, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 864 of file kern_mutex.c.
References _mtx_lock_indefinite_check(), lock_delay(), lockstat_enabled, lockstat_nsecs(), mtx, mtx_spin_delay, and thread_lock_validate.
Referenced by _thread_lock().
void thread_lock_set | ( | struct thread * | td, |
struct mtx * | new | ||
) |
Definition at line 997 of file kern_mutex.c.
References mtx.
Referenced by sched_add(), sleepq_switch(), softclock_thread(), start_softclock(), and turnstile_wait().
void thread_lock_unblock | ( | struct thread * | td, |
struct mtx * | new | ||
) |
Definition at line 975 of file kern_mutex.c.
References blocked_lock.
|
static |
Definition at line 222 of file kern_mutex.c.
References mtx.
|
static |
Definition at line 233 of file kern_mutex.c.
References mtx.
struct mtx blocked_lock |
Definition at line 180 of file kern_mutex.c.
Referenced by _thread_lock(), mutex_init(), thread_lock_block(), thread_lock_block_wait(), and thread_lock_unblock().
struct mtx __exclusive_cache_line Giant |
Definition at line 181 of file kern_mutex.c.
Referenced by _blockcount_sleep(), _callout_stop_safe(), _cv_timedwait_sbt(), _cv_timedwait_sig_sbt(), _cv_wait(), _cv_wait_sig(), _cv_wait_unlock(), _sleep(), ast(), bus_topo_mtx(), callout_init(), exit1(), fork_exit(), giant_close(), giant_fdopen(), giant_ioctl(), giant_kqfilter(), giant_mmap(), giant_mmap_single(), giant_open(), giant_poll(), giant_read(), giant_strategy(), giant_write(), intr_event_execute_handlers(), ithread_loop(), kern_reboot(), link_elf_load_file(), linker_file_sysinit(), linker_file_sysuninit(), mi_startup(), mi_switch(), module_quiesce(), module_register_init(), module_shutdown(), module_unload(), mutex_init(), sched_idletd(), softclock_call_cc(), sysctl_root_handler_locked(), thread_exit(), thread_single(), thread_suspend_check(), thread_wait(), vfs_mountroot(), witness_checkorder(), witness_startup(), and witness_warn().
struct lock_class lock_class_mtx_sleep |
Definition at line 115 of file kern_mutex.c.
Referenced by __mtx_lock_flags(), __mtx_unlock_flags(), _mtx_init(), _mtx_trylock_flags_int(), and mtx_wait_unlocked().
struct lock_class lock_class_mtx_spin |
Definition at line 128 of file kern_mutex.c.
Referenced by __mtx_lock_spin_flags(), __mtx_trylock_spin_flags(), __mtx_unlock_spin_flags(), _mtx_destroy(), _mtx_init(), and mtx_spin_wait_unlocked().