FreeBSD kernel kern code
|
#include "opt_ddb.h"
#include "opt_hwpmc_hooks.h"
#include "opt_kdtrace.h"
#include "opt_no_adaptive_sx.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kdb.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sleepqueue.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
Go to the source code of this file.
Macros | |
#define | SQ_EXCLUSIVE_QUEUE 0 |
#define | SQ_SHARED_QUEUE 1 |
#define | GIANT_DECLARE |
#define | GIANT_SAVE() |
#define | GIANT_RESTORE() |
#define | sx_recurse lock_object.lo_data |
#define | sx_recursed(sx) ((sx)->sx_recurse != 0) |
#define | _sx_assert(sx, what, file, line) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
CTASSERT ((SX_NOADAPTIVE &LO_CLASSFLAGS)==SX_NOADAPTIVE) | |
static void | assert_sx (struct lock_object *lock, int what) |
static void | lock_sx (struct lock_object *lock, int how) |
static int | unlock_sx (struct lock_object *lock) |
void | sx_sysinit (void *arg) |
void | sx_init_flags (struct sx *sx, const char *description, int opts) |
void | sx_destroy (struct sx *sx) |
int | _sx_slock (struct sx *sx, int opts, const char *file, int line) |
int | _sx_try_slock (struct sx *sx, const char *file, int line) |
int | _sx_xlock (struct sx *sx, int opts, const char *file, int line) |
int | _sx_try_xlock (struct sx *sx, const char *file, int line) |
void | _sx_sunlock (struct sx *sx, const char *file, int line) |
void | _sx_xunlock (struct sx *sx, const char *file, int line) |
int | _sx_try_upgrade (struct sx *sx, const char *file, int line) |
void | _sx_downgrade (struct sx *sx, const char *file, int line) |
int | _sx_xlock_hard (struct sx *sx, uintptr_t tid, int opts, const char *file, int line) |
void | _sx_xunlock_hard (struct sx *sx, uintptr_t tid, const char *file, int line) |
int | _sx_slock_hard (struct sx *sx, int opts, const char *file, int line) |
void | _sx_sunlock_hard (struct sx *sx, const char *file, int line) |
Variables | |
struct lock_class | lock_class_sx |
#define _sx_assert | ( | sx, | |
what, | |||
file, | |||
line | |||
) |
Definition at line 145 of file kern_sx.c.
Referenced by _sx_downgrade(), _sx_sunlock(), _sx_try_upgrade(), and _sx_xunlock().
#define GIANT_DECLARE |
Definition at line 90 of file kern_sx.c.
Referenced by _sx_slock_hard(), and _sx_xlock_hard().
#define GIANT_RESTORE | ( | ) |
Definition at line 104 of file kern_sx.c.
Referenced by _sx_slock_hard(), and _sx_xlock_hard().
#define GIANT_SAVE | ( | ) |
Definition at line 94 of file kern_sx.c.
Referenced by _sx_slock_hard(), and _sx_xlock_hard().
#define SQ_EXCLUSIVE_QUEUE 0 |
Definition at line 78 of file kern_sx.c.
Referenced by _sx_sunlock_hard(), _sx_xlock_hard(), and _sx_xunlock_hard().
#define SQ_SHARED_QUEUE 1 |
Definition at line 79 of file kern_sx.c.
Referenced by _sx_downgrade(), _sx_slock_hard(), and _sx_xunlock_hard().
#define sx_recursed | ( | sx | ) | ((sx)->sx_recurse != 0) |
Definition at line 118 of file kern_sx.c.
Referenced by _sx_downgrade(), _sx_try_xlock(), _sx_xunlock(), and _sx_xunlock_hard().
__FBSDID | ( | "$BSDSUniX$" | ) |
void _sx_downgrade | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 431 of file kern_sx.c.
References _sx_assert, panic(), sleepq_broadcast(), sleepq_lock(), sleepq_release(), SQ_SHARED_QUEUE, and sx_recursed.
int _sx_slock | ( | struct sx * | sx, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 244 of file kern_sx.c.
References kdb_active.
int _sx_slock_hard | ( | struct sx * | sx, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 794 of file kern_sx.c.
References GIANT_DECLARE, GIANT_RESTORE, GIANT_SAVE, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_wait(), sleepq_wait_sig(), SQ_SHARED_QUEUE, and waittime.
void _sx_sunlock | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 359 of file kern_sx.c.
References _sx_assert.
void _sx_sunlock_hard | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 991 of file kern_sx.c.
References sleepq_broadcast(), sleepq_lock(), sleepq_release(), and SQ_EXCLUSIVE_QUEUE.
int _sx_try_slock | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 267 of file kern_sx.c.
References kdb_active.
int _sx_try_upgrade | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 398 of file kern_sx.c.
References _sx_assert.
int _sx_try_xlock | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 324 of file kern_sx.c.
References kdb_active, and sx_recursed.
int _sx_xlock | ( | struct sx * | sx, |
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 299 of file kern_sx.c.
References kdb_active.
int _sx_xlock_hard | ( | struct sx * | sx, |
uintptr_t | tid, | ||
int | opts, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 501 of file kern_sx.c.
References GIANT_DECLARE, GIANT_RESTORE, GIANT_SAVE, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_wait(), sleepq_wait_sig(), SQ_EXCLUSIVE_QUEUE, and waittime.
void _sx_xunlock | ( | struct sx * | sx, |
const char * | file, | ||
int | line | ||
) |
Definition at line 375 of file kern_sx.c.
References _sx_assert, and sx_recursed.
void _sx_xunlock_hard | ( | struct sx * | sx, |
uintptr_t | tid, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 732 of file kern_sx.c.
References sleepq_broadcast(), sleepq_lock(), sleepq_release(), sleepq_sleepcnt(), SQ_EXCLUSIVE_QUEUE, SQ_SHARED_QUEUE, and sx_recursed.
|
static |
CTASSERT | ( | (SX_NOADAPTIVE &LO_CLASSFLAGS) | = =SX_NOADAPTIVE | ) |
|
static |
void sx_destroy | ( | struct sx * | sx | ) |
Definition at line 234 of file kern_sx.c.
References lock_destroy().
Referenced by ksem_module_destroy(), lf_advlockasync(), lf_purgelocks(), mqfs_uninit(), rm_destroy(), and sodealloc().
void sx_init_flags | ( | struct sx * | sx, |
const char * | description, | ||
int | opts | ||
) |
Definition at line 205 of file kern_sx.c.
References lock_init().
Referenced by pmc_init_sx(), rm_init_flags(), and sx_sysinit().
void sx_sysinit | ( | void * | arg | ) |
Definition at line 197 of file kern_sx.c.
References sx_init_flags().