freebsd-dev/sys/kern
David Greenman 7c818168d5 Fixed a major bug that caused various pmap related panics, hangs, and reboots.
The i386 pmap module uses a special area of kernel virtual memory for mapping
of page tables pages when it needs to modify another process's virtual
address space. It's called the 'alternate page table map'. There is only one
of them and it's expected that only one process will be using it at once and
that the operation is atomic.
When the merged VM/buffer cache was implemented over a year ago, it became
necessary to rundown VM pages at I/O completion. The unfortunate and
unforeseen side effect of this is that pmap functions are now called at bio
interrupt time. If there happend to be a process using the alternate page
table map when this I/O completion occurred, it was possible for a different
process's address space to be switched into the alternate page table map -
leaving the current pmap process with the wrong address space mapped when
the interrupt completed. This resulted in BAD things happening like pages
being mapped or removed from the wrong address space, etc.. Since a very
common case of a process modifying another process's address space is during
fork when the kernel stack is inserted, one of the most common manifestations
of this bug was the kernel stack not being mapped properly, resulting in a
silent hang or reboot. This made it VERY difficult to troubleshoot this bug
(I've been trying to figure out the cause of this for >6 months). Fortunately,
the set of conditions that must be true before this problem occurs is
sufficiently rare enough that most people never saw the bug occur. As I/O
rates increase, however, so does the frequency of the crashes. This problem
used to kill wcarchive about every 10 days, but in more recent times when
the traffic exceeded >100GB/day, the machine could barely manage 6 hours of
uptime.
The fix is to make certain that no process has the pages mapped that are
involved in the I/O, before the I/O is started. The pages are made busy, so
no process will be able to map them, either, until the I/O has finished.
This side-steps the issue by still allowing the pmap functions to be called
at interrupt time, but also assuring that the alternate page table map won't
be switched.
Unfortunately, this appears to not be the only cause of this problem. :-(

Reviewed by:	dyson
1996-06-30 05:17:08 +00:00
..
imgact_aout.c First pass at cleaning up macros relating to pages, clusters and all that. 1996-05-02 10:43:17 +00:00
imgact_elf.c Clean-up the new VM map procfs code, and also add support for executable 1996-06-18 05:16:00 +00:00
imgact_gzip.c First pass at cleaning up macros relating to pages, clusters and all that. 1996-05-02 10:43:17 +00:00
imgact_shell.c Killed sections 3 and 4 of my copyright as I don't agree with it (I believe 1996-04-08 01:22:00 +00:00
inflate.c
init_main.c The Great PC98 Merge. 1996-06-14 11:02:28 +00:00
init_sysent.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
init_sysvec.c Clean-up the new VM map procfs code, and also add support for executable 1996-06-18 05:16:00 +00:00
kern_acct.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
kern_clock.c Unstaticize psratio and staticize profprocs. psratio needs to be exported 1996-06-23 17:40:47 +00:00
kern_conf.c
kern_descrip.c Add a couple of #ifdef DEVFS/#endif clauses to slence the following 1996-06-17 16:54:03 +00:00
kern_devconf.c Externalize the declaration of dc_list. This is required in order to 1996-06-12 15:10:30 +00:00
kern_exec.c Use kmem_alloc_wait/kmem_free_wakeup() to avoid allocation failures 1996-06-03 04:12:18 +00:00
kern_exit.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
kern_fork.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
kern_ktrace.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
kern_lkm.c Change the *evil* allocation of memory from kmem_map to the kernel_map. 1996-05-24 01:39:50 +00:00
kern_lockf.c
kern_malloc.c Minor performance improvement to kern_malloc.c that increases the 1996-05-18 22:33:13 +00:00
kern_mib.c Move the "mib" variables out to their own file. 1996-04-07 13:03:06 +00:00
kern_ntptime.c
kern_physio.c Fix a problem that caused system crashes after physio. This problem 1996-06-26 05:52:15 +00:00
kern_proc.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
kern_prot.c Fix a panic caused by (proc)->p_session being dereferenced for a process 1996-05-30 01:21:50 +00:00
kern_random.c Reduced nesting of #includes in random.h and adjusted isa/random_machdep.c 1996-06-17 16:47:43 +00:00
kern_resource.c Fixed accumulation of run time for processes that don't accumulate 1996-06-08 11:48:28 +00:00
kern_sig.c Removed unnecessary #includes from <sys/imgact.h> so that it is 1996-05-01 02:43:13 +00:00
kern_subr.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
kern_synch.c Don't generate code for the unused function sleep(). 1996-04-07 13:35:58 +00:00
kern_sysctl.c Implemented 'kern_sysctl', which differs from 'userland_sysctl' in that 1996-06-10 16:23:42 +00:00
kern_tc.c Unstaticize psratio and staticize profprocs. psratio needs to be exported 1996-06-23 17:40:47 +00:00
kern_time.c Updated some comments in settimeofday(). 1996-06-08 11:55:32 +00:00
kern_timeout.c Unstaticize psratio and staticize profprocs. psratio needs to be exported 1996-06-23 17:40:47 +00:00
kern_xxx.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
Make.tags.inc Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
Makefile Remove bogus architectures to allow make tags to work. 1996-03-31 18:53:43 +00:00
makesyscalls.sh Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
md5c.c
subr_autoconf.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
subr_clist.c Killed sections 3 and 4 of my copyright as I don't agree with it (I believe 1996-04-08 01:22:00 +00:00
subr_disklabel.c Clean up various compiler warnings. Most (if not all) were benign 1996-05-08 04:29:08 +00:00
subr_diskmbr.c Removed now-unused #includes of <machine/cpu.h>. They were for bootverbose 1996-04-07 17:32:42 +00:00
subr_diskslice.c Moved initialization of defaults for the label for the whole disk from 1996-06-17 14:43:54 +00:00
subr_dkbad.c Fix a bug that b_flags was getting unnecessarily modified by 1996-03-01 19:01:04 +00:00
subr_log.c Fixed name of /dev/fs/klog (it's not "log"). 1996-03-27 19:45:28 +00:00
subr_param.c Add an option "EXTRA_VNODES" to cause an extra number of vnode structures 1996-05-31 00:20:34 +00:00
subr_prf.c Correct a comment. There is no fn `kprintf' 1996-05-09 18:58:06 +00:00
subr_prof.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
subr_rlist.c In order to fix some concurrency problems with the swap pager early 1996-03-03 21:11:08 +00:00
subr_trap.c trap.c: 1996-06-25 20:02:16 +00:00
subr_xxx.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
sys_generic.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
sys_pipe.c Disable direct writes for non-blocking output. 1996-06-17 05:15:01 +00:00
sys_process.c Remove the now-unnecessary and incorrect wiring of the "other" processes 1996-06-02 06:24:27 +00:00
sys_socket.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
syscalls.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
syscalls.master Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
sysv_ipc.c kern_descrip.c: add fdshare()/fdcopy() 1996-02-23 18:49:25 +00:00
sysv_msg.c
sysv_sem.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
sysv_shm.c uninitialized auto variable shmseg is used in ... 1996-05-05 13:53:48 +00:00
tty_compat.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
tty_conf.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
tty_cons.c Removed unused #include. 1996-05-01 03:32:46 +00:00
tty_pty.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
tty_snoop.c Switched from using devfs_add_devsw() to devfs_add_devswf() 1996-03-28 14:31:42 +00:00
tty_subr.c Killed sections 3 and 4 of my copyright as I don't agree with it (I believe 1996-04-08 01:22:00 +00:00
tty_tb.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
tty_tty.c Switched from using devfs_add_devsw() to devfs_add_devswf() 1996-03-28 14:31:42 +00:00
tty.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
uipc_domain.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
uipc_mbuf.c Ups, I removed NMB_INIT too. 1996-05-12 07:48:47 +00:00
uipc_proto.c Clean up various compiler warnings. Most (if not all) were benign 1996-05-08 04:29:08 +00:00
uipc_sockbuf.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
uipc_socket2.c Clean up -Wunused warnings. 1996-06-12 05:11:41 +00:00
uipc_socket.c Make it possible to return more than one piece of control information 1996-05-09 20:15:26 +00:00
uipc_syscalls.c Make it possible to return more than one piece of control information 1996-05-09 20:15:26 +00:00
uipc_usrreq.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vfs_bio.c Fixed a major bug that caused various pmap related panics, hangs, and reboots. 1996-06-30 05:17:08 +00:00
vfs_cache.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vfs_cluster.c Fix an error when B_MALLOC buffers are returned from the cluster read 1996-06-03 04:40:35 +00:00
vfs_conf.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vfs_export.c Add an option "EXTRA_VNODES" to cause an extra number of vnode structures 1996-05-31 00:20:34 +00:00
vfs_extattr.c Dont allow directories to be link()ed or unlink()ed, even for root 1996-05-24 16:19:23 +00:00
vfs_init.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vfs_lookup.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vfs_mount.c
vfs_subr.c Add an option "EXTRA_VNODES" to cause an extra number of vnode structures 1996-05-31 00:20:34 +00:00
vfs_syscalls.c Dont allow directories to be link()ed or unlink()ed, even for root 1996-05-24 16:19:23 +00:00
vfs_vnops.c Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vnode_if.pl
vnode_if.sh Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00
vnode_if.src Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all 1996-03-11 20:02:06 +00:00