freebsd-dev/sys/kern
Robert Watson a34b704666 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
..
bus_if.m
clock_if.m Add a generic implementation of inittodr() and resettodr(), as well as 2002-04-04 23:39:10 +00:00
device_if.m
genassym.sh
imgact_aout.c Change the types of vn_rdwr_inchunks()'s len and aresid arguments to 2004-06-05 02:18:28 +00:00
imgact_elf32.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
imgact_elf64.c
imgact_elf.c Change the types of vn_rdwr_inchunks()'s len and aresid arguments to 2004-06-05 02:18:28 +00:00
imgact_gzip.c Locking for the per-process resource limits structure. 2004-02-04 21:52:57 +00:00
imgact_shell.c
inflate.c
init_main.c Nice, is a property of a process as a whole.. 2004-06-16 00:26:31 +00:00
init_sysent.c Regen. 2004-04-05 10:17:23 +00:00
kern_acct.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
kern_acl.c
kern_alq.c Allow MAC policies to block/revoke kern_alq write access to a file. 2003-10-25 16:10:41 +00:00
kern_clock.c Nice, is a property of a process as a whole.. 2004-06-16 00:26:31 +00:00
kern_condvar.c Associate a simple count of waiters with each condition variable. The 2004-04-06 19:17:46 +00:00
kern_conf.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
kern_context.c Change the clear_ret argument of get_mcontext() to be a flags argument. 2003-11-09 20:31:04 +00:00
kern_descrip.c Explicitly initialize f_data and f_vnode to NULL. 2004-06-19 11:40:08 +00:00
kern_environment.c If the buffer supplied to kenv(KENV_DUMP, ...) isn't big enough, 2004-04-28 01:27:33 +00:00
kern_event.c Add GIANT_REQUIRED to kqueue_close(), since kqueue currently requires 2004-06-01 18:05:41 +00:00
kern_exec.c Move TDF_SA from td_flags to td_pflags (and rename it accordingly) 2004-06-02 07:52:36 +00:00
kern_exit.c Add comment to reflect that we should retry after thread singling failed. 2004-06-18 11:13:49 +00:00
kern_fork.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
kern_idle.c
kern_intr.c Detect interrupt storms better. The storm detection didn't work at all 2004-06-05 18:27:28 +00:00
kern_jail.c Fix sysctl name: security.jail.getfsstate_getfsstatroot_only -> 2004-05-20 05:28:44 +00:00
kern_kse.c Shuffle some code around. 2004-06-11 17:48:20 +00:00
kern_kthread.c
kern_ktr.c
kern_ktrace.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
kern_linker.c Since we go to the trouble of compiling the kobj ops table for each class, 2004-05-17 21:24:39 +00:00
kern_lock.c Move TDF_DEADLKTREAT into td_pflags (and rename it accordingly) to avoid 2004-06-03 01:47:37 +00:00
kern_lockf.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
kern_mac.c Add /* !MAC */ to final #endif. 2004-05-03 22:54:46 +00:00
kern_malloc.c Bring in mbuma to replace mballoc. 2004-05-31 21:46:06 +00:00
kern_mbuf.c Fix a couple of bugs in the mbuf and packet ctors. In the latter case, 2004-06-01 16:17:10 +00:00
kern_mib.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
kern_module.c
kern_mtxpool.c
kern_mutex.c Add a new kernel option MUTEX_WAKE_ALL that changes the mutex unlock code 2004-04-06 19:12:24 +00:00
kern_ntptime.c
kern_physio.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
kern_poll.c Ensure that the poll_burst <= poll_burst_max constraint really holds. 2004-04-15 07:38:44 +00:00
kern_proc.c Fill in the values for the ki_tid and ki_numthreads which have been 2004-06-20 22:17:22 +00:00
kern_prot.c Socket MAC labels so_label and so_peerlabel are now protected by 2004-06-13 02:50:07 +00:00
kern_resource.c Nice, is a property of a process as a whole.. 2004-06-16 00:26:31 +00:00
kern_sema.c Change the return value of sema_timedwait() so it returns 0 on 2004-06-14 18:19:05 +00:00
kern_shutdown.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
kern_sig.c Deorbit COMPAT_SUNOS. 2004-06-11 11:16:26 +00:00
kern_subr.c Remove checks for curthread == NULL - it can't happen. 2004-06-03 10:22:47 +00:00
kern_switch.c
kern_sx.c
kern_synch.c Remove a stale and misleading comment. 2004-06-07 09:35:00 +00:00
kern_syscalls.c
kern_sysctl.c Make sysctl_wire_old_buffer() respect ENOMEM from vslock() by marking 2004-06-11 02:20:37 +00:00
kern_tc.c Just because the timecounter reads the same value on two samples 2004-03-04 14:14:23 +00:00
kern_thr.c If you're trying to find out if a thread is valid and in 2004-04-19 14:20:01 +00:00
kern_thread.c Define __lwpid_t as an int32_t in <sys/_types.h> and define lwpid_t 2004-06-19 17:58:32 +00:00
kern_time.c Implement CLOCK_VIRTUAL and CLOCK_PROF for clock_gettime(2) and 2004-06-17 23:12:12 +00:00
kern_timeout.c The paper "Hashed Timers and Hierarchical Wheels: Data Structures for the 2004-04-25 04:10:17 +00:00
kern_umtx.c
kern_uuid.c
kern_xxx.c Deorbit COMPAT_SUNOS. 2004-06-11 11:16:26 +00:00
ksched.c
link_elf_obj.c Change strategy based on a suggestion from Ian Dowse. Instead of trying 2004-06-15 23:57:02 +00:00
link_elf.c Include <sys/gmon.h> instead of <machine/profile.h> for the declaration 2004-05-19 14:36:38 +00:00
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh
md4c.c
md5c.c
p1003_1b.c Use __FBSDID(). 2003-06-11 06:34:30 +00:00
posix4_mib.c
sched_4bsd.c Nice, is a property of a process as a whole.. 2004-06-16 00:26:31 +00:00
sched_ule.c Nice, is a property of a process as a whole.. 2004-06-16 00:26:31 +00:00
subr_acl_posix1e.c
subr_autoconf.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
subr_blist.c Move the definitions of SWAPBLK_NONE and SWAPBLK_MASK from vm_page.h to 2004-06-04 04:03:26 +00:00
subr_bus.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
subr_clist.c Revert stuff which accidentally ended up in the previous commit. 2003-07-22 10:36:36 +00:00
subr_clock.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
subr_devstat.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
subr_disk.c Report bio_pblkbo instead of bio_blkno. 2003-10-18 17:27:10 +00:00
subr_eventhandler.c
subr_hints.c
subr_kobj.c
subr_log.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
subr_mbpool.c
subr_mchain.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
subr_module.c
subr_msgbuf.c
subr_param.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
subr_pcpu.c
subr_power.c Move the kernel power change printf under bootverbose since the 2004-01-02 18:24:13 +00:00
subr_prf.c Add a sysctl/tunable, "kern.always_console_output", that lets you set 2004-06-18 20:12:42 +00:00
subr_prof.c Enable MI bits for gcc -ftest-coverage -fprofile-arcs on amd64. 2004-05-29 01:18:14 +00:00
subr_rman.c Fix off by one error, twice. 2004-04-12 23:02:21 +00:00
subr_rtc.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
subr_sbuf.c
subr_scanf.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
subr_sleepqueue.c Fixed some common printf format errors. Don't assume that "struct foo *" 2004-05-14 20:51:42 +00:00
subr_smp.c Move the CPU newbus attachment to i386 legacy. The acpi_cpu device will 2004-05-06 15:54:02 +00:00
subr_taskqueue.c Tidy up the thread taskqueue implementation and close a lost wakeup race. 2004-02-19 22:03:52 +00:00
subr_trap.c
subr_turnstile.c Rename turnstile_wakeup() to turnstile_broadcast() to make the naming 2004-04-06 19:07:21 +00:00
subr_witness.c Introduce socket and UNIX domain socket locks into hard-coded lock 2004-06-13 00:23:03 +00:00
sys_generic.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
sys_pipe.c Revise the direct or optimized case to use uiomove_fromphys() by the reader 2004-03-27 19:50:23 +00:00
sys_process.c Finish fixing up Alpha to work with an MP safe ptrace(): 2004-04-01 20:56:44 +00:00
sys_socket.c Annotate two intentionally unlocked reads with comments. 2004-06-20 17:35:50 +00:00
syscalls.c Regen. 2004-04-05 10:17:23 +00:00
syscalls.master Add lgetfh(2) which is like getfh(2) but doesn't follow symlinks. 2004-04-05 10:15:53 +00:00
sysv_ipc.c
sysv_msg.c Add missing #include <sys/module.h> 2004-05-30 20:34:58 +00:00
sysv_sem.c Add missing #include <sys/module.h> 2004-05-30 20:34:58 +00:00
sysv_shm.c When no fixed address is given in a shmat() request, pass a hint address 2004-06-19 14:46:13 +00:00
tty_compat.c Deorbit COMPAT_SUNOS. 2004-06-11 11:16:26 +00:00
tty_conf.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
tty_cons.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
tty_pty.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
tty_subr.c
tty_tty.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
tty.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
uipc_accf.c Add a global mutex, accept_filter_mtx, to protect the global list of 2004-06-01 04:08:48 +00:00
uipc_cow.c In some cases, sf_buf_alloc() should sleep with pri PCATCH; in others, it 2004-04-03 09:16:27 +00:00
uipc_domain.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
uipc_jumbo.c
uipc_mbuf2.c Bring in mbuma to replace mballoc. 2004-05-31 21:46:06 +00:00
uipc_mbuf.c Gah! Plug a mbuf leak I introduced in the last commit. 2004-06-11 18:17:25 +00:00
uipc_proto.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
uipc_sem.c Add missing #include <sys/module.h> 2004-05-30 20:34:58 +00:00
uipc_sockbuf.c Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
uipc_socket2.c Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
uipc_socket.c Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
uipc_syscalls.c Assert socket buffer lock in sb_lock() to protect socket buffer sleep 2004-06-19 03:23:14 +00:00
uipc_usrreq.c Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
vfs_acl.c Update my personal copyrights and NETA copyrights in the kernel 2004-02-22 00:33:12 +00:00
vfs_aio.c Merge additional socket buffer locking from rwatson_netperf: 2004-06-17 22:48:11 +00:00
vfs_bio.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
vfs_cache.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
vfs_cluster.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
vfs_default.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
vfs_export.c Include <sys/mutex.h> and its prerequisite <sys/lock.h> instesd of depending 2004-04-21 12:10:30 +00:00
vfs_extattr.c Only initialize f_data and f_ops if nobody else did so already. 2004-06-19 11:41:45 +00:00
vfs_init.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
vfs_lookup.c Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00
vfs_mount.c Initialize ni_cnd.cn_cred before calling lookup() (this is normally done 2004-06-20 17:31:01 +00:00
vfs_subr.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
vfs_syscalls.c Only initialize f_data and f_ops if nobody else did so already. 2004-06-19 11:41:45 +00:00
vfs_vnops.c Change the types of vn_rdwr_inchunks()'s len and aresid arguments to 2004-06-05 02:18:28 +00:00
vnode_if.src Remove advertising clause from University of California Regent's license, 2004-04-05 21:03:37 +00:00