FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_adaptive_mutexes.h"
#include "opt_ddb.h"
#include "opt_global.h"
#include "opt_hwpmc_hooks.h"
#include "opt_kdtrace.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/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 | mtx_unowned(m) ((m)->mtx_lock == MTX_UNOWNED) |
#define | mtx_destroyed(m) ((m)->mtx_lock == MTX_DESTROYED) |
#define | mtx_owner(m) ((struct thread *)((m)->mtx_lock & ~MTX_FLAGMASK)) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static void | assert_mtx (struct lock_object *lock, int what) |
static void | lock_mtx (struct lock_object *lock, int how) |
static void | lock_spin (struct lock_object *lock, int how) |
static int | unlock_mtx (struct lock_object *lock) |
static int | unlock_spin (struct lock_object *lock) |
void | _mtx_lock_flags (struct mtx *m, int opts, const char *file, int line) |
void | _mtx_unlock_flags (struct mtx *m, int opts, const char *file, int line) |
void | _mtx_lock_spin_flags (struct mtx *m, int opts, const char *file, int line) |
void | _mtx_unlock_spin_flags (struct mtx *m, int opts, const char *file, int line) |
int | _mtx_trylock (struct mtx *m, int opts, const char *file, int line) |
void | _mtx_lock_sleep (struct mtx *m, uintptr_t tid, int opts, const char *file, int line) |
static void | _mtx_lock_spin_failed (struct mtx *m) |
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_set (struct thread *td, struct mtx *new) |
void | _mtx_unlock_sleep (struct mtx *m, int opts, const char *file, int line) |
void | mtx_sysinit (void *arg) |
void | mtx_init (struct mtx *m, const char *name, const char *type, int opts) |
void | mtx_destroy (struct mtx *m) |
void | mutex_init (void) |
Variables | |
struct lock_class | lock_class_mtx_sleep |
struct lock_class | lock_class_mtx_spin |
struct mtx | blocked_lock |
struct mtx | Giant |
#define mtx_destroyed | ( | m | ) | ((m)->mtx_lock == MTX_DESTROYED) |
Definition at line 90 of file kern_mutex.c.
#define mtx_owner | ( | m | ) | ((struct thread *)((m)->mtx_lock & ~MTX_FLAGMASK)) |
Definition at line 92 of file kern_mutex.c.
Referenced by _mtx_lock_sleep(), and _mtx_lock_spin_failed().
#define mtx_unowned | ( | m | ) | ((m)->mtx_lock == MTX_UNOWNED) |
Definition at line 88 of file kern_mutex.c.
Referenced by mtx_destroy().
__FBSDID | ( | "$BSDSUniX$" | ) |
void _mtx_lock_flags | ( | struct mtx * | m, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 197 of file kern_mutex.c.
References kdb_active, and lock_class_mtx_sleep.
void _mtx_lock_sleep | ( | struct mtx * | m, |
uintptr_t | tid, | ||
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 338 of file kern_mutex.c.
References mtx_owner, ts, turnstile_cancel(), turnstile_trywait(), turnstile_wait(), and waittime.
|
static |
Definition at line 507 of file kern_mutex.c.
References mtx_owner, panic(), printf(), and witness_display_spinlock().
Referenced by _thread_lock_flags().
void _mtx_lock_spin_flags | ( | struct mtx * | m, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 243 of file kern_mutex.c.
References lock_class_mtx_spin.
int _mtx_trylock | ( | struct mtx * | m, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 290 of file kern_mutex.c.
References kdb_active, lock_class_mtx_sleep, and waittime.
void _mtx_unlock_flags | ( | struct mtx * | m, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 221 of file kern_mutex.c.
References lock_class_mtx_sleep.
void _mtx_unlock_sleep | ( | struct mtx * | m, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 711 of file kern_mutex.c.
References ts, turnstile_broadcast(), turnstile_chain_lock(), turnstile_chain_unlock(), turnstile_lookup(), and turnstile_unpend().
void _mtx_unlock_spin_flags | ( | struct mtx * | m, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 266 of file kern_mutex.c.
References lock_class_mtx_spin.
void _thread_lock_flags | ( | struct thread * | td, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 592 of file kern_mutex.c.
References _mtx_lock_spin_failed(), kdb_active, lock_class_mtx_spin, and panicstr.
|
static |
Definition at line 143 of file kern_mutex.c.
|
static |
Definition at line 150 of file kern_mutex.c.
|
static |
Definition at line 157 of file kern_mutex.c.
References panic().
void mtx_destroy | ( | struct mtx * | m | ) |
Definition at line 884 of file kern_mutex.c.
References lock_class_mtx_spin, lock_destroy(), and mtx_unowned.
Referenced by aio_init_aioinfo(), aio_proc_rundown(), aio_unload(), alq_destroy(), alq_load_handler(), destroy_vpollinfo_free(), intr_event_destroy(), itimer_fini(), kern_sendfile(), kqueue_close(), ksem_module_destroy(), mbp_destroy(), mount_fini(), mqueue_free(), msgunload(), mtx_pool_destroy(), pgdelete(), pipe_zone_fini(), prison_deref(), proc_fini(), rm_destroy(), rman_fini(), sema_destroy(), semunload(), sess_release(), sigacts_free(), taskqueue_free(), tty_dealloc(), turnstile_fini(), uifree(), and vdropl().
void mtx_init | ( | struct mtx * | m, |
const char * | name, | ||
const char * | type, | ||
int | opts | ||
) |
Definition at line 837 of file kern_mutex.c.
References lock_class_mtx_sleep, lock_class_mtx_spin, and lock_init().
Referenced by _taskqueue_create(), aio_init_aioinfo(), aio_onceonly(), ald_startup(), alq_open_flags(), bufinit(), callout_cpu_init(), cn_drvinit(), cpu_initclocks_bsp(), cpuset_thread0(), devinit(), enterpgrp(), eventhandler_init(), eventhandler_register_internal(), filelistinit(), getnewvnode(), init_device_poll(), init_dynamic_kenv(), init_sleepqueues(), init_turnstiles(), initclocks(), intr_event_create(), itimer_init(), kern_jail_set(), kern_sendfile(), kmeminit(), kobj_init_mutex(), ksem_module_init(), lc_init(), LIST_HEAD(), mbp_create(), mount_init(), mqueue_alloc(), msgbuf_init(), msgbuf_reinit(), msginit(), mtx_pool_initialize(), mtx_sysinit(), mutex_init(), osd_init(), pipe_zone_init(), proc0_init(), proc_init(), procinit(), rm_init_flags(), rman_init(), schedinit(), seltdinit(), sema_init(), seminit(), shm_init(), sigacts_alloc(), sys_kqueue(), tdq_setup(), terminal_init(), threadinit(), tty_alloc_mutex(), turnstile_init(), uifind(), umtxq_sysinit(), v_addpollinfo(), vntblinit(), and witness_initialize().
void mtx_sysinit | ( | void * | arg | ) |
Definition at line 823 of file kern_mutex.c.
References mtx_init().
void mutex_init | ( | void | ) |
Definition at line 914 of file kern_mutex.c.
References blocked_lock, devmtx, Giant, init_turnstiles(), mtx_init(), and proc0.
struct mtx* thread_lock_block | ( | struct thread * | td | ) |
Definition at line 672 of file kern_mutex.c.
References blocked_lock.
Referenced by sched_switch(), and sched_switch_migrate().
void thread_lock_set | ( | struct thread * | td, |
struct mtx * | new | ||
) |
Definition at line 693 of file kern_mutex.c.
Referenced by sched_add(), sleepq_switch(), and turnstile_wait().
void thread_lock_unblock | ( | struct thread * | td, |
struct mtx * | new | ||
) |
Definition at line 685 of file kern_mutex.c.
References blocked_lock.
|
static |
Definition at line 164 of file kern_mutex.c.
|
static |
Definition at line 175 of file kern_mutex.c.
References panic().
struct mtx blocked_lock |
Definition at line 139 of file kern_mutex.c.
Referenced by mutex_init(), thread_lock_block(), and thread_lock_unblock().
struct mtx Giant |
Definition at line 140 of file kern_mutex.c.
Referenced by _callout_stop_safe(), _cv_timedwait(), _cv_timedwait_sig(), _cv_wait(), _cv_wait_sig(), _cv_wait_unlock(), _sleep(), ast(), buf_do_flush(), callout_init(), dounmount(), exit1(), fork_exit(), fork_return(), 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_adjtime(), kern_shmat(), kern_shmctl(), 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(), namei(), periodic_resettodr(), sched_idletd(), sched_sync(), settime(), shmexit_myhook(), shmfork_myhook(), shutdown_resettodr(), softclock_call_cc(), start_init(), sys_mount(), sys_ntp_adjtime(), sys_ntp_gettime(), sys_reboot(), sys_shmdt(), sys_shmget(), sys_unmount(), sysctl_root(), thread_exit(), thread_single(), thread_suspend_check(), thread_wait(), unp_connect(), vfs_domount(), vfs_domount_first(), vfs_domount_update(), witness_checkorder(), witness_initialize(), and witness_warn().
struct lock_class lock_class_mtx_sleep |
Definition at line 109 of file kern_mutex.c.
Referenced by _mtx_lock_flags(), _mtx_trylock(), _mtx_unlock_flags(), and mtx_init().
struct lock_class lock_class_mtx_spin |
Definition at line 122 of file kern_mutex.c.
Referenced by _mtx_lock_spin_flags(), _mtx_unlock_spin_flags(), _thread_lock_flags(), mtx_destroy(), and mtx_init().