freebsd-skq/sys
rwatson 21164a78ac Merge next step in socket buffer locking:
- sowakeup() now asserts the socket buffer lock on entry.  Move
  the call to KNOTE higher in sowakeup() so that it is made with
  the socket buffer lock held for consistency with other calls.
  Release the socket buffer lock prior to calling into pgsigio(),
  so_upcall(), or aio_swake().  Locking for this event management
  will need revisiting in the future, but this model avoids lock
  order reversals when upcalls into other subsystems result in
  socket/socket buffer operations.  Assert that the socket buffer
  lock is not held at the end of the function.

- Wrapper macros for sowakeup(), sorwakeup() and sowwakeup(), now
  have _locked versions which assert the socket buffer lock on
  entry.  If a wakeup is required by sb_notify(), invoke
  sowakeup(); otherwise, unconditionally release the socket buffer
  lock.  This results in the socket buffer lock being released
  whether a wakeup is required or not.

- Break out socantsendmore() into socantsendmore_locked() that
  asserts the socket buffer lock.  socantsendmore()
  unconditionally locks the socket buffer before calling
  socantsendmore_locked().  Note that both functions return with
  the socket buffer unlocked as socantsendmore_locked() calls
  sowwakeup_locked() which has the same properties.  Assert that
  the socket buffer is unlocked on return.

- Break out socantrcvmore() into socantrcvmore_locked() that
  asserts the socket buffer lock.  socantrcvmore() unconditionally
  locks the socket buffer before calling socantrcvmore_locked().
  Note that both functions return with the socket buffer unlocked
  as socantrcvmore_locked() calls sorwakeup_locked() which has
  similar properties.  Assert that the socket buffer is unlocked
  on return.

- Break out sbrelease() into a sbrelease_locked() that asserts the
  socket buffer lock.  sbrelease() unconditionally locks the
  socket buffer before calling sbrelease_locked().
  sbrelease_locked() now invokes sbflush_locked() instead of
  sbflush().

- Assert the socket buffer lock in socket buffer sanity check
  functions sblastrecordchk(), sblastmbufchk().

- Assert the socket buffer lock in SBLINKRECORD().

- Break out various sbappend() functions into sbappend_locked()
  (and variations on that name) that assert the socket buffer
  lock.  The !_locked() variations unconditionally lock the socket
  buffer before calling their _locked counterparts.  Internally,
  make sure to call _locked() support routines, etc, if already
  holding the socket buffer lock.

- Break out sbinsertoob() into sbinsertoob_locked() that asserts
  the socket buffer lock.  sbinsertoob() unconditionally locks the
  socket buffer before calling sbinsertoob_locked().

- Break out sbflush() into sbflush_locked() that asserts the
  socket buffer lock.  sbflush() unconditionally locks the socket
  buffer before calling sbflush_locked().  Update panic strings
  for new function names.

- Break out sbdrop() into sbdrop_locked() that asserts the socket
  buffer lock.  sbdrop() unconditionally locks the socket buffer
  before calling sbdrop_locked().

- Break out sbdroprecord() into sbdroprecord_locked() that asserts
  the socket buffer lock.  sbdroprecord() unconditionally locks
  the socket buffer before calling sbdroprecord_locked().

- sofree() now calls socantsendmore_locked() and re-acquires the
  socket buffer lock on return.  It also now calls
  sbrelease_locked().

- sorflush() now calls socantrcvmore_locked() and re-acquires the
  socket buffer lock on return.  Clean up/mess up other behavior
  in sorflush() relating to the temporary stack copy of the socket
  buffer used with dom_dispose by more properly initializing the
  temporary copy, and selectively bzeroing/copying more carefully
  to prevent WITNESS from getting confused by improperly
  initialized mutexes.  Annotate why that's necessary, or at
  least, needed.

- soisconnected() now calls sbdrop_locked() before unlocking the
  socket buffer to avoid locking overhead.

Some parts of this change were:

Submitted by:	sam
Sponsored by:	FreeBSD Foundation
Obtained from:	BSD/OS
2004-06-21 00:20:43 +00:00
..
alpha Backed out previous commit. Blind substitution of dev_t by `struct cdev *' 2004-06-20 03:52:50 +00:00
amd64 - Simplify pmap_remove_pages(), eliminating unnecessary indirection. 2004-06-20 20:57:06 +00:00
arm Fix compilation for Xscale. 2004-06-19 20:50:50 +00:00
boot Document the possibility of setting default values for 2004-06-20 15:58:24 +00:00
cam Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
coda Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
compat Add stub for Linux SOUND_MIXER_READ_RECMASK, required by some Linux sound 2004-06-18 14:36:24 +00:00
conf Fix the following error: 2004-06-20 22:32:19 +00:00
contrib Add missing <sys/module.h> include. 2004-06-18 08:53:55 +00:00
crypto Use __FBSDID(). 2004-06-14 00:38:54 +00:00
ddb Fixed DDB_NOKLDSYM on amd64's: 2004-05-18 05:30:06 +00:00
dev Enable pcm to read kenv variables to set default values for 2004-06-20 15:38:11 +00:00
fs Reduce a fair bit of the atomics because we are now called with a 2004-06-18 08:08:47 +00:00
geom Duplicate the securelevel check from spec_vnops.c here. 2004-06-19 09:00:53 +00:00
gnu Fixed misformatting of code and breaking of a comment in previous commit. 2004-06-20 03:36:31 +00:00
i4b Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
i386 - Simplify pmap_remove_pages(), eliminating unnecessary indirection. 2004-06-20 20:57:06 +00:00
ia64 Backed out previous commit. Blind substitution of dev_t by `struct cdev *' 2004-06-20 03:52:50 +00:00
isa Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
isofs/cd9660 Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
kern Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
libkern Import libkern arm specific bits. 2004-05-14 12:28:31 +00:00
modules Give zlib the ability to be a module that can be depended on, 2004-06-20 17:42:35 +00:00
net Give zlib the ability to be a module that can be depended on, 2004-06-20 17:42:35 +00:00
net80211 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile 2004-06-13 17:29:10 +00:00
netatalk Socket MAC labels so_label and so_peerlabel are now protected by 2004-06-13 02:50:07 +00:00
netatm The socket field so_state is used to hold a variety of socket related 2004-06-14 18:16:22 +00:00
netgraph Remove one more unneeded reference to arpcom.ac_netgraph. 2004-06-20 21:08:58 +00:00
netinet If debug.mpsafenet is set, initialize TCP callouts as CALLOUT_MPSAFE. 2004-06-20 21:44:50 +00:00
netinet6 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile 2004-06-13 17:29:10 +00:00
netipsec use correct address for SADB_EXT_ADDRESS_DST in key_do_allocsa_policy 2004-05-03 05:15:53 +00:00
netipx It's now the responsibility of the consumer of soabort() to remove a 2004-06-20 21:47:12 +00:00
netkey Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
netnatm Extend coverage of SOCK_LOCK(so) to include so_count, the socket 2004-06-12 20:47:32 +00:00
netncp Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
netsmb Merge additional socket buffer locking from rwatson_netperf: 2004-06-17 22:48:11 +00:00
nfs Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
nfs4client Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
nfsclient Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
nfsserver Merge additional socket buffer locking from rwatson_netperf: 2004-06-17 22:48:11 +00:00
opencrypto Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pc98 MFi386: revision 1.1161 2004-06-16 14:21:52 +00:00
pccard Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pci Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
posix4
powerpc Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
rpc Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
security Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
sparc64 Backed out previous commit. Blind substitution of dev_t by `struct cdev *' 2004-06-20 03:52:50 +00:00
sys Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
tools devlist2h.awk is too generic a name for what it does. It really 2004-05-26 00:19:39 +00:00
ufs Backed out previous commit. The dev_t -> `struct cdev *' changes have 2004-06-20 03:11:19 +00:00
vm Remove spl() calls. Update comments to reflect the removal of spl() calls. 2004-06-19 04:19:47 +00:00
Makefile Try harder not to compile anything in sys/boot for arm. 2004-05-16 00:19:12 +00:00