Commit Graph

55 Commits

Author SHA1 Message Date
Hans Petter Selasky
c55f4c9445 Revert r287780 until more developers have their say.
Differential Revision:	https://reviews.freebsd.org/D3521
Requested by:		gnn
2015-09-22 06:51:55 +00:00
Sergey Kandaurov
0eea5207a0 Bump .Dd. 2015-09-15 13:24:52 +00:00
Hans Petter Selasky
9acc0eafd7 Implement callout_drain_async(), inspired by the projects/hps_head
branch.

This function is used to drain a callout via a callback instead of
blocking the caller until the drain is complete. Refer to the
callout_drain_async() manual page for a detailed description.

Limitation: If a lock is used with the callout, the callout can only
be drained asynchronously one time unless the callout_init_mtx()
function is called again. This limitation is not present in
projects/hps_head and will require more invasive changes to the
timeout code, which was not in the scope of this patch.

Differential Revision:	https://reviews.freebsd.org/D3521
Reviewed by:		wblock
MFC after:		1 month
2015-09-14 10:52:26 +00:00
Hans Petter Selasky
a115fb62ed Revert for r277213:
FreeBSD developers need more time to review patches in the surrounding
areas like the TCP stack which are using MPSAFE callouts to restore
distribution of callouts on multiple CPUs.

Bump the __FreeBSD_version instead of reverting it.

Suggested by:		kmacy, adrian, glebius and kib
Differential Revision:	https://reviews.freebsd.org/D1438
2015-01-22 11:12:42 +00:00
Hans Petter Selasky
1a26c3c047 Major callout subsystem cleanup and rewrite:
- Close a migration race where callout_reset() failed to set the
  CALLOUT_ACTIVE flag.
- Callout callback functions are now allowed to be protected by
  spinlocks.
- Switching the callout CPU number cannot always be done on a
  per-callout basis. See the updated timeout(9) manual page for more
  information.
- The timeout(9) manual page has been updated to reflect how all the
  functions inside the callout API are working. The manual page has
  been made function oriented to make it easier to deduce how each of
  the functions making up the callout API are working without having
  to first read the whole manual page. Group all functions into a
  handful of sections which should give a quick top-level overview
  when the different functions should be used.
- The CALLOUT_SHAREDLOCK flag and its functionality has been removed
  to reduce the complexity in the callout code and to avoid problems
  about atomically stopping callouts via callout_stop(). If someone
  needs it, it can be re-added. From my quick grep there are no
  CALLOUT_SHAREDLOCK clients in the kernel.
- A new callout API function named "callout_drain_async()" has been
  added. See the updated timeout(9) manual page for a complete
  description.
- Update the callout clients in the "kern/" folder to use the callout
  API properly, like cv_timedwait(). Previously there was some custom
  sleepqueue code in the callout subsystem, which has been removed,
  because we now allow callouts to be protected by spinlocks. This
  allows us to tear down the callout like done with regular mutexes,
  and a "td_slpmutex" has been added to "struct thread" to atomically
  teardown the "td_slpcallout". Further the "TDF_TIMOFAIL" and
  "SWT_SLEEPQTIMO" states can now be completely removed. Currently
  they are marked as available and will be cleaned up in a follow up
  commit.
- Bump the __FreeBSD_version to indicate kernel modules need
  recompilation.
- There has been several reports that this patch "seems to squash a
  serious bug leading to a callout timeout and panic".

Kernel build testing:	all architectures were built
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D1438
Sponsored by:		Mellanox Technologies
Reviewed by:		jhb, adrian, sbruno and emaste
2015-01-15 15:32:30 +00:00
Andriy Gapon
088b124ba7 callout(9): add sbt flavors of callout_schedule
Differential Revision:	https://reviews.freebsd.org/D1161 (partial)
Reviewed by:	jhb, markj
MFC after:	1 week
2014-11-25 15:21:21 +00:00
John Baldwin
3ec056ef7d Forgot to bump Dd.
Pointy hat to:	jhb
2014-10-08 21:56:00 +00:00
John Baldwin
958e30b890 Rewrite timeout(9) to be callout(9)-centric instead. Move the description
of timeout(9) to the end and mark it prominently as deprecated.  Document
somewhat how times are specified for the 'sbt' variants.  Better explain
how using callout_init_*() to associate a lock with a callout resolves
common races.

Differential Revision:	https://reviews.freebsd.org/D847
Reviewed by:	wblock, bjk
MFC after:	1 week
2014-10-08 21:53:24 +00:00
Gavin Atkinson
8382d842d5 Fix return type of callout_init_rm() and add return type to
callout_deactivate().

PR:		192520
Submitted by:	yaneurabeya gmail com
MFC after:	3 days
2014-08-20 23:29:34 +00:00
Xin LI
1afc6e14b2 Fix markup regression introduced in r268369. 2014-07-17 23:14:47 +00:00
Warner Losh
4d3e74492b Document C_HARDCLOCK flag. 2014-07-07 16:55:07 +00:00
Ian Lepore
53bf5ef829 Fix a typo, C_ALSOLUTE -> C_ABSOLUTE. 2014-02-15 02:30:34 +00:00
Joel Dahl
ec76d29f81 Remove EOL whitespace. 2013-08-25 06:59:30 +00:00
Davide Italiano
ad0947c3a4 - Bump date.
- Small mdoc fix.

Submitted by:	pluknet
2013-08-23 14:33:56 +00:00
Davide Italiano
246fb6b232 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
Davide Italiano
bf1fc2c2e1 MFcalloutng:
Dcoument the new functions added to condvar(9), sleep(9), sleepqueue(9)
KPIs. Also document recent changes in timeout(9) and eventtimers(4).
2013-03-04 19:10:39 +00:00
Alfred Perlstein
a99b51055f add semicolon to end of CALLOUT_HANDLE_INITIALIZER example. 2013-02-08 20:13:28 +00:00
Jim Harris
d9fad1defa Add descriptions for callout_reset_on and callout_schedule_on and
their curcpu variants.

Discussed with:	mav, davide
MFC after:	1 week
2012-11-01 21:00:13 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Joel Dahl
9ba4735280 Spelling fixes. 2010-07-31 10:01:15 +00:00
Joel Dahl
c0de7d2f15 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-02 21:50:36 +00:00
Sam Leffler
6e0186d5ee add callout_schedule; besides being useful it also improves
compatibility with other systems

Reviewed by:	ed, battlez
2008-08-02 17:42:38 +00:00
Gabor Kovesdan
53b41930df - Document newly added callout_init_rw function
Requested by:	attilio
Reviewed by:	attilio
2007-11-20 12:21:36 +00:00
John Baldwin
267b051a81 - Use .fn to markup untimeout in two places it was missing.
- Reword a confusing sentence.

PR:		docs/89810
Submitted by:	Marius Nuennerich marius dot nuennerich at gmx dot net
MFC after:	3 days
2005-12-01 19:16:35 +00:00
Ruslan Ermilov
78ad54210f -mdoc sweep. 2005-11-18 10:56:28 +00:00
Gleb Smirnoff
d04304d155 Make callout_reset() return a non-zero value if a pending callout
was rescheduled. If there was no pending callout, then return 0.

Reviewed by:	iedowse, cperciva
2005-09-08 14:20:39 +00:00
Ruslan Ermilov
4f06896130 Assorted markup fixes and minor wordsmithing.
Approved by:	re
2005-06-15 13:31:23 +00:00
Ian Dowse
98c926b20f Add a mechanism for associating a mutex with a callout when the
callout is first initialised, using a new function callout_init_mtx().
The callout system will acquire this mutex before calling the callout
function and release it on return.

In addition, the callout system uses the mutex to avoid most of the
complications and race conditions inherent in asynchronous timer
facilities, so mutex-protected callouts have much simpler semantics.
As long as the mutex is held when invoking callout_stop() or
callout_reset(), then these functions will guarantee that the callout
will be stopped, even if softclock() had already begun to process
the callout.

Existing Giant-locked callouts will automatically pick up the new
race-free semantics. This should close a number of race conditions
in the USB code and probably other areas of the kernel too.

There should be no change in behaviour for "MP-safe" callouts; these
still need to use the techniques mentioned in timeout(9) to avoid
race conditions.
2005-02-07 02:47:33 +00:00
Ruslan Ermilov
cae0500fd4 Fixed whitespace at EOL and double word.
Uncompact enumaration to make it look better.
2005-01-28 21:18:14 +00:00
Ian Dowse
641a1aa10d Attempt to describe the race conditions that must be considered
when using the callout subsystem. Show how the callout_pending(),
callout_active() and callout_deactivate() macros can be used to
achieve simpler race-free callout semantics in many situations.
2005-01-23 17:42:48 +00:00
Gleb Smirnoff
e5f8af4e5c Document callout_pending() macro.
MFC after:	1 week
2004-12-29 08:01:24 +00:00
Ruslan Ermilov
bf7f20c2b6 Assorted markup, spelling, and grammar fixes. 2004-06-16 08:33:57 +00:00
Hiten Pandya
d5a8819cb7 mdoc(7) police:
* correctly place parenthisized sentences
	* remove hard sentence breaks
	* use .Vt instead of .Fn
2004-05-05 10:47:19 +00:00
Colin Percival
2c1bb20746 Introduce a callout_drain() function. This acts in the same manner as
callout_stop(), except that if the callout being stopped is currently
in progress, it blocks attempts to reset the callout and waits until the
callout is completed before it returns.

This makes it possible to clean up callout-using code safely, e.g.,
without potentially freeing memory which is still being used by a callout.

Reviewed by:	mux, gallatin, rwatson, jhb
2004-04-06 23:08:49 +00:00
Warner Losh
6e8666a5a8 Looks like I misread the callout code. We do not seem to hold the
callout lock while the callout is happening.  So the serialization
that I thought was happening isn't.  Therefore, remove the part of the
bugs that says this.  Leave in the other bug as it is very hard to
work around (impossible?).

Fix various typos.

Also note that timeout/untimeout are considered to be the old interface and
the callout interface should be used insetad.

Submitted by: bde (first two) and wollman (third)
2003-10-01 21:32:42 +00:00
Warner Losh
de78273e9c Document the implications of the callout_stop() returning 0 if the
callout has finished or is in progress.  Also document that the
locking of the callout code for FreeBSD 5 has eliminated the 'or is in
progress' clause as a possibility and that such elimination is an
accident of the implementation and shouldn't be relied upon.
2003-10-01 05:48:48 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
John Baldwin
6f2d81026c - callout_stop() now returns an integer value instead of void so
describe it.
- Add a return values section.
2001-08-23 23:52:59 +00:00
Ruslan Ermilov
753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Jens Schweikhardt
c1f3e4bf21 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
Ruslan Ermilov
3d45e180f4 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:31:11 +00:00
Ben Smithurst
d13241e146 Document the mpsafe argument to callout_init().
PR:		24529
Submitted by:	harti brandt <brandt@fokus.gmd.de>
Reviewed by:	jlemon
2001-01-31 12:17:45 +00:00
Ruslan Ermilov
3136363f3e Prepare for mdoc(7)NG. 2000-12-29 09:18:45 +00:00
Ruslan Ermilov
b5c508fba3 Use Fx macro wherever possible. 2000-11-14 11:20:58 +00:00
Mark Murray
58ea82758e Mention more functions in the headers so whatis(1) can find them, and
create links to functions so added found.
2000-08-16 19:53:38 +00:00
Bruce Evans
20c4d417bc Fixed some bugs (one serious one: timeouts were claimed to be executed at
spl0) and some bitrot (the not-so-new callout_init/stop/reset functions
were not mentioned; the callout_activate/deactivate/pending macros are
still not mentioned).

Submitted by:	mostly by jlemon
1999-12-27 16:22:20 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Bruce Evans
06dcc5a953 Fixed synopsis again. Too much was blown away by splatting a NetBSD-
based version over the top of the FreeBSD version in rev.1.6.
1998-01-16 18:45:52 +00:00
Justin T. Gibbs
c242996390 Updated timeout.9 man page describing the new callout interface. This
man page was based on the NetBSD version.
1997-09-21 22:12:19 +00:00