Commit Graph

57 Commits

Author SHA1 Message Date
pjd
a3e664d830 Constify arguments for locking KPIs where possible.
This enables locking consumers to pass their own structures around as const and
be able to assert locks embedded into those structures.

Reviewed by:	ed, kib, jhb
2011-11-16 21:51:17 +00:00
jhb
b80745da98 Retire the INTR_FAST flag as it was obsoleted by the introduction of the
filter argument to bus_setup_intr().
2011-01-06 21:14:34 +00:00
julian
3f8481620d Add some cross references to locking.9 from related pages. 2007-03-30 18:07:26 +00:00
jhb
f5e3969340 Allow threads to atomically release rw and sx locks while waiting for an
event.  Locking primitives that support this (mtx, rw, and sx) now each
include their own foo_sleep() routine.
- Rename msleep() to _sleep() and change it's 'struct mtx' object to a
  'struct lock_object' pointer.  _sleep() uses the recently added
  lc_unlock() and lc_lock() function pointers for the lock class of the
  specified lock to release the lock while the thread is suspended.
- Add wrappers around _sleep() for mutexes (mtx_sleep()), rw locks
  (rw_sleep()), and sx locks (sx_sleep()).  msleep() still exists and
  is now identical to mtx_sleep(), but it is deprecated.
- Rename SLEEPQ_MSLEEP to SLEEPQ_SLEEP.
- Rewrite much of sleep.9 to not be msleep(9) centric.
- Flesh out the 'RETURN VALUES' section in sleep.9 and add an 'ERRORS'
  section.
- Add __nonnull(1) to _sleep() and msleep_spin() so that the compiler will
  warn if you try to pass a NULL wait channel.  The functions already have
  a KASSERT to that effect.
2007-03-09 22:41:01 +00:00
jhb
bf4e259df6 Place mtx_destroy() and rw_destroy() right after mtx_init() and rw_init()
to match sx(9) and condvar(9).
2007-03-09 16:54:03 +00:00
pjd
bb91ae1dcc Document MTX_NOPROFILE flag. 2006-12-21 22:42:18 +00:00
ru
b3e1c0a791 Replace a reference to no longer existing MUTEX_PROFILING(9) with
a LOCK_PROFILING(9).
2006-11-11 08:41:39 +00:00
maxim
830aad07d2 o Fix MTX_SYSINIT prototype.
PR:		kern/99956
Submitted by:	Arne Woerner
MFC after:	1 week
2006-07-09 09:46:43 +00:00
glebius
bd3f3fcc08 Xref rwlock(9).
Reviewed by:	ru
2006-02-01 20:30:55 +00:00
jhb
9e10bf9a66 Various and sundry improvements:
- Replace 'process' with 'thread' everywhere.
- Update several places to note that that the fact that default mutexes
  may adaptively spin isn't necessarily MD, but is just part of the
  implementation as a whole.
- Clarify the text about MTX_SPIN mutexes only being appropriate for
  INTR_FAST interrupts or other low level scheduler code to make the
  jargon more FreeBSD-ish rather than BSD/OS-ish.
- Also, note that it is possible that interrupts aren't blocked but just
  deferred when a spin lock is held (the whole blocked vs. deferred bit is
  an MD implementation detail).
- Remove statements saying that spin locks must be released in the exact
  opposite order that they were acquired.  This stopped being true several
  years ago when we first added critical sections that stored their state
  in the current thread rather than in struct mtx.
- Note that a mutex must be initialized before it is passed to any other
  mutex function, not just mtx_lock.
- Clarify that mtx_trylock() only operates on MTX_DEF mutexes.
- Simplify the text about possible preemption during a mtx_unlock().
- Use complete English sentences in place of phrases in a few places.
- Clarify that it isn't ever safe to sleep with a mutex held.  The kernel
  tends to panic when you do that.

Requested by:	scottl (7)
MFC after:	3 days
2005-09-13 15:16:50 +00:00
ru
c3757b437a Don't say that mtx_lock() will "sleep" if another kernel thread is
holding the mutex, say it will "block".  Later in this manual page
we say that sleeping while holding a mutex isn't allowed, and this
can be confusing.

Submitted by:	jhb
2005-02-15 23:52:35 +00:00
ru
1541af42f1 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
ru
114ea39c76 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
keramida
e1b5b19788 "non-spin" is better with a dash, than without. 2005-01-06 16:16:17 +00:00
ru
d384729d50 Fix the NAME section making whatis(1) happy in particular. 2004-07-05 17:12:53 +00:00
ru
1cf1598667 Mechanically kill hard sentence breaks and double whitespaces. 2004-07-03 18:29:24 +00:00
ru
aa52a5a900 Assorted markup, spelling, and grammar fixes. 2004-06-16 08:33:57 +00:00
des
f4ceb3a98d Add a cross-reference to MUTEX_PROFILING(9). 2004-01-25 12:24:23 +00:00
jkoshy
eb1c647689 Add "options INVARIANTS" and "options INVARIANT_SUPPORT" to the
synopsis, with supporting text in the body of the manual page.

Add a cross-reference to panic(9) for completeness.

Reviewed by:	ru (synopsis changes)
2004-01-01 05:16:35 +00:00
jkoshy
5c61422855 Use of the MTX_SYSINIT macro requires the inclusion of <sys/kernel.h>. 2003-12-28 01:39:18 +00:00
jkoshy
0b146f01b2 Typo fix. 2003-12-11 13:30:26 +00:00
ru
aaa0f05b80 Assorted mdoc(7), grammar, spelling, and punctuation fixes.
Approved by:	re (blanket)
2003-05-21 15:49:01 +00:00
chris
082ad05a9b Back out revision 1.34 until we can come up with a more accurate patch. 2003-02-17 22:31:27 +00:00
chris
3a720af460 Add a section on Giant lock manipulation macros.
Submitted by:	Hiten M. Pandya <hiten@angelica.unixdaemons.com>
Reviewed by:	bmilekic
2003-02-17 22:21:41 +00:00
gallatin
1f58532c90 Add some documentation of FreeBSD's special synchronization quirks
which may surprise developers coming from Solaris, or other platforms
which have a similar interface, but slightly different rules.

Reviewed by: jhb, ru
2002-10-21 12:54:13 +00:00
jhb
a8f31edbf6 Remove all mention of MTX_NOSWITCH. It was obsoleted a long time ago. 2002-09-24 20:45:58 +00:00
davidc
7b59b3310d Document MTX_DUPOK
Requested by: jeff (long ago)
2002-06-06 19:08:11 +00:00
ru
9495c02d27 mdoc(7) police: lint. 2002-05-29 17:50:04 +00:00
davidc
ad1eafb6f0 Remove a duplicate description of the type parameter for mtx_init.
Noticed by: scottl
2002-04-12 16:32:38 +00:00
davidc
861f848704 Add text describing the new type parameter, and rename description
to name as that is what it is called in mutex.h.
2002-04-12 05:55:17 +00:00
scottl
75c2263931 Document the lock type argument of mtx_init(). 2002-04-12 05:05:19 +00:00
davidc
8acd6ce788 Update the .Fn line for MTX_SYSINIT to include the parameter types. 2002-04-12 03:54:44 +00:00
arr
85f5ae7a3b - Add notes about SX_SYSINIT and MTX_SYSINIT in order to document the
recent additions of these macros.
- Add in a MLINK to create SX_SYSINIT.9 and MTX_SYSINIT.9.
2002-04-02 17:21:00 +00:00
dd
8edb7b74a0 Add mtx_pool(9) to the SEE ALSO section.
Submitted by:	Garrett Rooney <rooneg@electricjellyfish.net>
2002-03-28 12:51:06 +00:00
mpp
52a504f88d ispell sweep of share/man/man9/*. 2002-01-09 11:43:48 +00:00
ru
623da62a5a mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
silby
203a1b36d1 Common Mike adds see alsos from all of the synchronization
man pages to their brethren.
2001-09-17 07:24:48 +00:00
ru
ec61b4a7e5 mdoc(7) police: Please don't commit when you are drunk!
(Committer rules candidate.)
2001-09-04 10:18:45 +00:00
logo
775a952f41 From Mike Silbersack's message on cvs-commits:
> > Doh!  There is a sx man page, the mutex man page just doesn't have a SEE
> > ALSO pointing to sx(9).  Could some mdoc madman go add one?
2001-09-02 00:45:41 +00:00
ru
c6c3284428 mdoc(7) police: s;BSD/OS;.Bsx; where appropriate. 2001-08-13 17:07:40 +00:00
sheldonh
7950d85ec2 can not -> cannot 2001-08-08 18:32:06 +00:00
schweikh
511e378b14 Removed whitespace at end-of-line; no content changes. I simply did
cd src/share; find man[1-9] -type f|xargs perl -pi -e 's/[ \t]+$//'

BTW, what editors are the culprits? I'm using vim and it shows
me whitespace at EOL in troff files with a thick blue block...

Reviewed by:	Silence from cvs diff -b
MFC after:	7 days
2001-07-14 19:41:16 +00:00
dd
be7e13cb78 s/mtx_try_enter/mtx_trylock/ 2001-05-06 22:04:17 +00:00
jhb
8df5fee25b - Document mtx_initialized().
- Document that MTX_QUIET can be passed to mtx_init() and the new flag
  MTX_NOWITNESS.
2001-03-30 22:59:02 +00:00
bde
4c29931b6c Fixed wrong include in synopsis. <sys/param.h> is a prerequisite for
<sys/mutex.h> due to #include spam in <sys/mutex.h>.  (More precisely,
<sys/time.h> is the prerequisite, but that is provided by standard
#include spam in <sys/param.h>.)

Fixed bitrot in prototype for mtx_init().
2001-03-29 10:06:50 +00:00
jhb
11a6b9c53f - Both <sys/sx.h> and <sys/mutex.h> depend on <sys/types.h> and
<sys/lock.h>.
- <sys/sx.h> depends on <sys/mutex.h>.
2001-03-28 12:45:41 +00:00
ru
de1cfc6d8f mdoc(7) cleanup. 2001-02-12 10:56:50 +00:00
bmilekic
0f9122defa Catch up to mutex API changes. 2001-02-12 03:14:57 +00:00
jhb
facc7916be mtx_try_enter() returns an int, not void. 2001-02-02 00:49:17 +00:00
jasone
24d53563ed Remove MUTEX_DECLARE() and MTX_COLD. Instead, postpone full mutex
initialization until after malloc() is safe to call, then iterate through
all mutexes and complete their initialization.

This change is necessary in order to avoid some circular bootstrapping
dependencies.
2001-01-21 07:52:20 +00:00