Commit Graph

2164 Commits

Author SHA1 Message Date
antoine
9f2d677686 Hook vm_page_busy.9 to the build 2013-08-26 16:38:40 +00:00
joel
5a0170ddd5 Remove EOL whitespace. 2013-08-25 06:59:30 +00:00
joel
2b2005aeb3 mdoc fixes. 2013-08-25 06:58:51 +00:00
andre
dc23a4a559 Fix BUGS section after botched modify in r254772.
Reported by:	bjk
2013-08-24 21:30:35 +00:00
markj
3541d8b143 Rename the kld_unload event handler to kld_unload_try, and add a new
kld_unload event handler which gets invoked after a linker file has been
successfully unloaded. The kld_unload and kld_load event handlers are now
invoked with the shared linker lock held, while kld_unload_try is invoked
with the lock exclusively held.

Convert hwpmc(4) to use these event handlers instead of having
kern_kldload() and kern_kldunload() invoke hwpmc(4) hooks whenever files are
loaded or unloaded. This has no functional effect, but simplifes the linker
code somewhat.

Reviewed by:	jhb
2013-08-24 21:13:38 +00:00
andre
25d6b936a0 Adjust for the pfil_func_t typedef added in r254769. 2013-08-24 11:57:02 +00:00
andre
0a27403dbe pfil_hook_get() has been internalized in r254771 and is no longer
part of the API.  It wasn't safe for external use in any case.
2013-08-24 10:38:02 +00:00
davide
9e74434e92 - Bump date.
- Small mdoc fix.

Submitted by:	pluknet
2013-08-23 14:33:56 +00:00
davide
7cf3eec1d4 Introduce callout_init_rm() so that callouts can be used in conjunction
with rmlocks. This works only with non-sleepable rm because handlers run
in SWI context. While here, document the new KPI in the timeout(9)
manpage.

Requested by:	adrian, scottl
Reviewed by:	mav, remko(manpage)
2013-08-23 14:12:39 +00:00
kib
7b6ce3ea58 Update the manual page for vm_page_grab(9).
Reviewed and edited by:	alc
Sponsored by:	The FreeBSD Foundation
2013-08-22 22:01:56 +00:00
joel
df7871af7a Minor mdoc nit. 2013-08-22 16:00:09 +00:00
jkim
f354dbfd86 Implement atomic_swap() and atomic_testandset().
Reviewed by:	arch, bde, jilles, kib
2013-08-21 22:03:06 +00:00
markj
58170e2ce5 Update the SDT(9) man page with the macros added in 254468. Also change the
existing examples to not pass an mbuf as a probe argument. There's no
obvious reason to have it there, and it doesn't really jibe with the example
added in this revision.

MFC after:	1 week
2013-08-17 22:06:30 +00:00
mjacob
68a04d4c0b Correct sentence syntax too. 2013-08-17 01:17:51 +00:00
obrien
e5edc7c263 Correct spelling. 2013-08-17 01:02:04 +00:00
markj
8c7687b41c Fix a typo.
MFC after:	3 days
2013-08-15 04:10:15 +00:00
markj
cee1e037da Use kld_{load,unload} instead of mod_{load,unload} for the linker file load
and unload event handlers added in r254266.

Reported by:	jhb
X-MFC with:	r254266
2013-08-14 00:42:21 +00:00
markj
80dd3f5e73 Add event handlers for module load and unload events. The load handlers are
called after the module has been loaded, and the unload handlers are called
before the module is unloaded. Moreover, the module unload handlers may
return an error to prevent the unload from proceeding.

Reviewed by:	avg
MFC after:	2 weeks
2013-08-13 03:07:49 +00:00
joel
d921a36411 Minor mdoc nits. 2013-08-10 06:39:42 +00:00
joel
d44a790903 mdoc: document title should be all caps. 2013-08-10 06:37:53 +00:00
attilio
3f74b0e634 Give mutex(9) the ability to recurse on a per-instance basis.
Now the MTX_RECURSE flag can be passed to the mtx_*_flag() calls.
This helps in cases we want to narrow down to specific calls the
possibility to recurse for some locks.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	jeff, alc
Tested by:	pho
2013-08-09 11:24:29 +00:00
attilio
16c7563cf4 The soft and hard busy mechanism rely on the vm object lock to work.
Unify the 2 concept into a real, minimal, sxlock where the shared
acquisition represent the soft busy and the exclusive acquisition
represent the hard busy.
The old VPO_WANTED mechanism becames the hard-path for this new lock
and it becomes per-page rather than per-object.
The vm_object lock becames an interlock for this functionality:
it can be held in both read or write mode.
However, if the vm_object lock is held in read mode while acquiring
or releasing the busy state, the thread owner cannot make any
assumption on the busy state unless it is also busying it.

Also:
- Add a new flag to directly shared busy pages while vm_page_alloc
  and vm_page_grab are being executed.  This will be very helpful
  once these functions happen under a read object lock.
- Move the swapping sleep into its own per-object flag

The KPI is heavilly changed this is why the version is bumped.
It is very likely that some VM ports users will need to change
their own code.

Sponsored by:	EMC / Isilon storage division
Discussed with:	alc
Reviewed by:	jeff, kib
Tested by:	gavin, bapt (older version)
Tested by:	pho, scottl
2013-08-09 11:11:11 +00:00
brooks
0f2f795739 Document the sbinuptime() and getsbinuptime() functions introduced in
r247452.

Sponsored by:	DARPA, AFRL
2013-07-25 20:53:15 +00:00
jimharris
67afca3d12 Add bus_dmamap_load_bio and bus_dmamap_load_ccb to bus_dma(9).
Sponsored by:	Intel
Reviewed by:	kib
MFC after:	3 days
2013-07-17 19:41:16 +00:00
pluknet
de0b6f6b4c - mdoc: remove superfluous paragraph macros.
- fix typo in xref manual section number.
2013-07-12 15:08:37 +00:00
glebius
1d903c60f9 Remove non existent in FreeBSD reference. 2013-07-12 14:46:40 +00:00
glebius
cc08c941d9 Add manual page for vmem(9). Obtained from NetBSD, modified to match
our implementation.

Obtained from:	NetBSD
2013-07-12 14:25:58 +00:00
joel
b5e7d8f60c mdoc: remove superfluous paragraph macros. 2013-07-08 05:58:09 +00:00
markj
ef002987cb Add a man page for the SDT_* macros, which can be used to define new static
DTrace probes and providers in kernel code.

MFC after:	1 week
2013-07-06 20:31:22 +00:00
bjk
2009e3adc3 Grammar tweaks for locking.9
Reviewed by:	jhb
Approved by:	hrs (mentor)
2013-06-30 19:33:07 +00:00
joel
fb34da0b96 mdoc: remove EOL whitespace. 2013-06-29 16:05:44 +00:00
jhb
069178c4c3 Make a pass over this page to correct and clarify a few things as well as
some general word-smithing.
- Don't claim that adaptive mutexes have a timeout (they don't).
- Don't treat pool mutexes as a separate primitive in a few places.
- Describe sleepable read-mostly locks as a separate lock type and add
  them to the various tables.
- Don't claim that sx locks are less efficient.  That hasn't been true in
  a few years now.
- Describe lockmanager locks next to sx locks since they are very similar
  in terms of rules, etc., and so that all the lock primitives are
  grouped together before the non-lock primitives.
- Similarly, move the section on Giant after the description of all the
  non-lock primitives to preserve grouping.
- Condition variables work on several types of locks, not just mutexes.
- Add a bit of language to compare/contrast condition variables with
  sleep/wakeup.
- Add a note about why pause(9) is unique.
- Add some language to define bounded vs unbounded sleeps and explain
  why they are treated separately (bounded sleeps only need CPU time
  to make forward progress).
- Don't state that using mtx_sleep() is a bad idea.  It is in fact rather
  necessary.
- Rework the interaction table a bit.  First, it did not include really
  include sleepable rmlocks and it left out lockmgr entirely.  To get
  things to fit, combine similar lock types into the same column / row,
  and explicitly state what "sleep" means.  The notes about recursion
  and lock order were also a bit banal (lock order is always important,
  not just in the few places annotated here), so remove them.  In
  particular, the lock order note would need to be on just about every
  cell.  If we want to document recursion I think a better approach
  would be a separate table summarizing the recursion rules for each
  lock as having too many notes clutters the table.
- Tweak the tables to use less indentation so everything still fits with
  the added columns.
- Correct a few cells in the context mode table.
- Use mdoc markup instead of explicit markup in a few places.

Requested by:	julian
MFC after:	2 weeks
2013-06-28 16:33:45 +00:00
jhb
0807c44cdd Several improvements to rmlock(9). Many of these are based on patches
provided by Isilon.
- Add an rm_assert() supporting various lock assertions similar to other
  locking primitives.  Because rmlocks track readers the assertions are
  always fully accurate unlike rw_assert() and sx_assert().
- Flesh out the lock class methods for rmlocks to support sleeping via
  condvars and rm_sleep() (but only while holding write locks), rmlock
  details in 'show lock' in DDB, and the lc_owner method used by
  dtrace.
- Add an internal destroyed cookie so that API functions can assert
  that an rmlock is not destroyed.
- Make use of rm_assert() to add various assertions to the API (e.g.
  to assert locks are held when an unlock routine is called).
- Give RM_SLEEPABLE locks their own lock class and always use the
  rmlock's own lock_object with WITNESS.
- Use THREAD_NO_SLEEPING() / THREAD_SLEEPING_OK() to disallow sleeping
  while holding a read lock on an rmlock.

Submitted by:	andre
Obtained from:	EMC/Isilon
2013-06-25 18:44:15 +00:00
lstewart
0b70fa91a8 Non-virtualised hhook points are supported as of r251732.
MFC after:	1 week
X-MFC with:	251732
2013-06-21 03:37:35 +00:00
jhb
a73b44b2ba Document RA_RECURSED and RA_NOTRECURSED.
MFC after:	3 days
2013-06-20 17:26:25 +00:00
delphij
a5442c0a6f Remove vfs_mount(9), it have been died since 2004.
Noticed by:	git via alfred
MFC after:	2 weeks
2013-06-17 03:32:27 +00:00
markj
248fad7220 The functions are called pci_{msi,msix}_count(), not pci_count_{msi,msix}().
MFC after:	3 days
2013-06-14 01:12:59 +00:00
pluknet
75cf89493f Update locking scheme, mostly transition from sched_lock. 2013-06-08 18:16:41 +00:00
emaste
22c906e7e4 Remove reference to removed !MPSAFE filesystem support 2013-05-22 16:33:28 +00:00
glebius
92fe819b2b Document constantness of dst argument to if_output.
Submitted by:	pluknet
2013-04-26 13:18:07 +00:00
glebius
b2817f16f2 On those machines that use critical(9) for counter(9) we need to
include systm.h.
2013-04-26 13:02:11 +00:00
trasz
f497b9bd3e Make DELAY(9) reference pause(9). 2013-04-20 12:36:53 +00:00
trasz
086d73aef6 Fix usage for soreceive(9) - uio must always be non-NULL.
MFC after:	1 week
2013-04-12 16:36:18 +00:00
trociny
61d99a1d27 Document sbuf_start_section() and sbuf_end_section() functions.
MFC after:	1 month
2013-04-11 19:51:53 +00:00
joel
d5b5017793 Remove contractions. 2013-04-11 18:46:41 +00:00
glebius
9cf64d6c35 Merge from projects/counters: counter(9).
Introduce counter(9) API, that implements fast and raceless counters,
provided (but not limited to) for gathering of statistical data.

See http://lists.freebsd.org/pipermail/freebsd-arch/2013-April/014204.html
for more details.

In collaboration with:	kib
Reviewed by:		luigi
Tested by:		ae, ray
Sponsored by:		Nginx, Inc.
2013-04-08 19:40:53 +00:00
glebius
7f9db020a2 Merge from projects/counters: UMA_ZONE_PCPU zones.
These zones have slab size == sizeof(struct pcpu), but request from VM
enough pages to fit (uk_slabsize * mp_ncpus). An item allocated from such
zone would have a separate twin for each CPU in the system, and these twins
are at a distance of sizeof(struct pcpu) from each other. This magic value
of distance would allow us to make some optimizations later.

  To address private item from a CPU simple arithmetics should be used:

  item = (type *)((char *)base + sizeof(struct pcpu) * curcpu)

  These arithmetics are available as zpcpu_get() macro in pcpu.h.

  To introduce non-page size slabs a new field had been added to uma_keg
uk_slabsize. This shifted some frequently used fields of uma_keg to the
fourth cache line on amd64. To mitigate this pessimization, uma_keg fields
were a bit rearranged and least frequently used uk_name and uk_link moved
down to the fourth cache line. All other fields, that are dereferenced
frequently fit into first three cache lines.

Sponsored by:	Nginx, Inc.
2013-04-08 19:10:45 +00:00
trociny
c54b01f636 Fix synopsis for sbuf_len.
MFC after:	3 days
2013-04-07 17:54:38 +00:00
will
5d3a27c743 Extend taskqueue(9) to enable per-taskqueue callbacks.
The scope of these callbacks is primarily to support actions that affect the
taskqueue's thread environments.  They are entirely optional, and
consequently are introduced as a new API: taskqueue_set_callback().

This interface allows the caller to specify that a taskqueue requires a
callback and optional context pointer for a given callback type.

The callback types included in this commit can be used to register a
constructor and destructor for thread-local storage using osd(9).  This
allows a particular taskqueue to define that its threads require a specific
type of TLS, without the need for a specially-orchestrated task-based
mechanism for startup and shutdown in order to accomplish it.

Two callback types are supported at this point:

- TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, prior
  to processing any tasks.
- TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it exits,
  after it has processed its last task but before the taskqueue is
  reclaimed.

While I'm here:

- Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use them
  in appropriate locations.
- Fix taskqueue.9 to mention taskqueue_start_threads(), which is a required
  interface for all consumers of taskqueue(9).

Reviewed by:	kib (all), eadler (taskqueue.9), brd (taskqueue.9)
Approved by:	ken (mentor)
Sponsored by:	Spectra Logic
MFC after:	1 month
2013-03-23 15:11:53 +00:00
glebius
22bd645df5 Document some flags to the uma_zcreate(). Not all flags are documented,
only those that at least are used in the kernel, or that definitely
work.
2013-03-21 16:19:46 +00:00