MFC r233711:
Major update to driver to support for Drake Skinny and ThunderBolt cards.

MFC r233768:
Change typedef atomic_t to struct mfi_atomic to avoid name space
collision and some couple more style changes.

MFC r233805:
Move struct megasas_sge from mfi_ioctl.h to mfivar.h so we can
remove including machine/bus.h.  Add some more mfi_ prefixes to
avoid name space pollution.

MFC r233877:
- Do not include machine/atomic.h.  It is no longer necessary since r233768.
- Remove bogus "atomic" macros and a read-only variable from softc.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234429 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r233713
Remove the magic mfi_array is 288 bytes and just use the
sizeof the array since it is not 288 bytes.

Change reporting of a "SYSTEM" disk to "JBOD" to match
LSI MegaCli and firmware reporting.

This means that mfiutil command to "create jbod" is now a
little confusing since a RAID per drive is not really what
LSI defines JBOD to be.  This should be fixed in the future
and support added to really create LSI JBOD and enable that
feature on cards that support it.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234433 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r230778
When detaching an AIO or LIO requests grab the lock and tell knlist_remove
that we have the lock now.  This cleans up a locking panic ASSERT when
knlist_empty is called without a lock when INVARIANTS etc. are turned.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234438 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r234058:
  In kdump's mkioctls script, use '${CPP}' instead of hardcodedly using
  'gcc -E'.  This fixes building when WITH_CLANG_IS_CC is in effect.

  Report by:	Niclas Zeising <zeising@daemonic.se>

MFC r234060:
  Since truss also uses kdump's mkioctls script, pass the value of ${CPP}
  there too, similar to r234058.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234444 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r234336:
Fix typo miror -> mirror

Reported by:	Glen Barber <gjb@FreeBSD.org>


git-svn-id: svn://svn.freebsd.org/base/stable/9@234452 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r234170:
Propagate the current state of rtld_bind_lock to dlopen_object() calls
through the filter loading call chain. This fixes attempts to
write-lock the already locked rtld_bind_lock when filter loading is
initiated by relocation of dlopening dso.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234454 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r234172:
Add thread-private flag to indicate that error value is already placed
in td_errno. Flag is supposed to be used by syscalls returning
EJUSTRETURN because errno was already placed into the usermode frame
by a call to set_syscall_retval(9). Both ktrace and dtrace get errno
value from td_errno if the flag is set.

Use the flag to fix sigsuspend(2) error return ktrace records.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234455 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of 233627, 234024, 234025, and 234026

Restore per mount-point counts of synchronous and asynchronous
reads and writes associated with UFS and MSDOS filesystems.

MFS 233627:
Keep track of the mount point associated with a special device
to enable the collection of counts of synchronous and asynchronous
reads and writes for its associated filesystem. The counts are
displayed using `mount -v'.

Ensure that buffers used for paging indicate the vnode from
which they are operating so that counts of paging I/O operations
from the filesystem are collected.

This checkin only adds the setting of the mount point for the
UFS/FFS filesystem, but it would be trivial to add the setting
and clearing of the mount point at filesystem mount/unmount
time for other filesystems too.

Reviewed by: kib

MFC 234024:
Drop an unnecessary setting of si_mountpt when updating a UFS mount point.
Clearly it must have been set when the mount was done.

Reviewed by: kib

MFC 234025:
Add I/O accounting to msdos filesystem.

Suggested and reviewed by: kib

MFC 234026:
Expand locking around identification of filesystem mount point when
accounting for I/O counts at completion of I/O operation. Also switch
from using global devmtx to vnode mutex to reduce contention.

Suggested and reviewed by: kib


git-svn-id: svn://svn.freebsd.org/base/stable/9@234466 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC:	r234350

- When interrupt is not requested for VM86 call, make a fake exit point and
push the address onto stack as we do for INTn emulation.  This avoids stack
underflow when we encounter RETF instruction in VM86 mode.  Lack of this
exit point actually caused page fault in VM86 mode with VESA module when we
resume from suspend state.
- Remove unnecessary CLI and STI instructions from BIOS interrupt emulation.
INTn and IRET must be able to emulate the flag correctly.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234467 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFV r234164/MFC r234165:

The BIND 9.8.2 tarball was re-rolled to remove 9.8.1 release notes.
This change was noticed by ISC at:

https://lists.isc.org/pipermail/bind-users/2012-April/087345.html

and verified by me both by comparing the contents of the old and new
distfiles and by verifying the PGP signature on the new distfile.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234468 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of 233817:

A file cannot be deallocated until its last name has been removed
and it is no longer referenced by a user process. The inode for a
file whose name has been removed, but is still referenced at the
time of a crash will still be allocated in the filesystem, but will
have no references (e.g., they will have no names referencing them
from any directory).

With traditional soft updates these unreferenced inodes will be
found and reclaimed when the background fsck is run. When using
journaled soft updates, the kernel must keep track of these inodes
so that it can find and reclaim them during the cleanup process.
Their existence cannot be stored in the journal as the journal only
handles short-term events, and they may persist for days. So, they
are tracked by keeping them in a linked list whose head pointer is
stored in the superblock. The journal tracks them only until their
linked list pointers have been commited to disk. Part of the cleanup
process involves traversing the list of unreferenced inodes and
reclaiming them.

This bug was triggered when confusion arose in the commit steps
of keeping the unreferenced-inode linked list coherent on disk.
Notably, a race between the link() system call adding a link-count
to a file and the unlink() system call removing a link-count to
the file. Here if the unlink() ran after link() had looked up
the file but before link() had incremented the link-count of the
file, the file's link-count would drop to zero before the link()
incremented it back up to one. If the file was referenced by a
user process, the first transition through zero made it appear
that it should be added to the unreferenced-inode list when in
fact it should not have been added. If the new name created by
link() was deleted within a few seconds (with the file still
referenced by a user process) it would legitimately be a candidate
for addition to the unreferenced-inode list. The result was that
there were two attempts to add the same inode to the unreferenced-inode
list which scrambled the unreferenced-inode list's pointers leading
to a panic. The fix is to detect and avoid the false attempt at
adding it to the unreferenced-inode list by having the link()
system call check to see if the link count is zero before it
increments it. If it is, the link() fails with ENOENT (showing that
it has failed the link()/unlink() race).

While tracking down this bug, we have added additional assertions
to detect the problem sooner and also simplified some of the code.

Reported by:      Kirk Russell
Fix submitted by: Jeff Roberson
Tested by:        Peter Holm
PR:               kern/159971


git-svn-id: svn://svn.freebsd.org/base/stable/9@234470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of 234157:

Whitespace cleanup.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of 234158:

Export vinactive() from kern/vfs_subr.c (e.g., make it no longer
static and declare its prototype in sys/vnode.h) so that it can be
called from process_deferred_inactive() (in ufs/ffs/ffs_snapshot.c)
instead of the body of vinactive() being cut and pasted into
process_deferred_inactive().

Reviewed by: kib
MFC after:   2 weeks


git-svn-id: svn://svn.freebsd.org/base/stable/9@234473 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r233949,233957,233964,234149,234155:
More PMAP concurrency and performance improvements by only flushing icaches
when needed and executing ptesync only when architecturally required.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234476 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge remote-tracking branch 'upstream/svn_stable_9' into svn_stable_9