MFC Alexander Motin's GEOM direct dispatch work:

r256603:
Introduce new function devstat_end_transaction_bio_bt(), adding new argument
to specify present time.  Use this function to move binuptime() out of lock,
substantially reducing lock congestion when slow timecounter is used.

r256606:
Move g_io_deliver() out of the lock, as required for direct dispatch.
Move g_destroy_bio() out too to reduce lock scope even more.

r256607:
Fix passing uninitialized bio_resid argument to g_trace().

r256610:
Add unmapped I/O support to GEOM RAID.

r256830:
Restore BIO_UNMAPPED and BIO_TRANSIENT_MAPPING in biodonne() when unmapping
temporary mapped buffer.  That fixes double unmap if biodone() called twice
for the same BIO (but with different done methods).

r256880:
Merge GEOM direct dispatch changes from the projects/camlock branch.

When safety requirements are met, it allows to avoid passing I/O requests
to GEOM g_up/g_down thread, executing them directly in the caller context.
That allows to avoid CPU bottlenecks in g_up/g_down threads, plus avoid
several context switches per I/O.

r259247:
Fix bug introduced at r256607.  We have to recalculate bp_resid here since
sizes of original and completed requests may differ due to end of media.

Testing of the stable/10 merge was done by Netflix, but all of the credit
goes to Alexander and iX Systems.

Submitted by:   mav
Sponsored by:   iX Systems


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260385 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC Alexander Motin's direct dispatch, multi-queue, and finer-grained
locking support for CAM

r256826:
Fix several target mode SIMs to not blindly clear ccb_h.flags field of
ATIO CCBs.  Not all CCB flags there belong to them.

r256836:
Remove hard limit on number of BIOs handled with one ATA TRIM request.

r256843:
Merge CAM locking changes from the projects/camlock branch to radically
reduce lock congestion and improve SMP scalability of the SCSI/ATA stack,
preparing the ground for the coming next GEOM direct dispatch support.

r256888:
Unconditionally acquire periph reference on CCB allocation failure.

r256895:
Fix memory and references leak due to unfreed path.

r256960:
Move CAM_UNQUEUED_INDEX setting to the last moment and under the periph lock.
This fixes race condition with cam_periph_ccbwait(), causing use-after-free.

r256975:
Minor (mostly cosmetical) addition to r256960.

r257054:
Some microoptimizations for da and ada drivers:
 - Replace ordered_tag_count counter with single flag;
 - From da remove outstanding_cmds counter, duplicating pending_ccbs list;
 - From da_softc remove unused links field.

r257482:
Fix lock recursion, triggered by `smartctl -a /dev/adaX`.

r257501:
Make getenv_*() functions and respectively TUNABLE_*_FETCH() macros not
allocate memory and so not require sleepable environment.  getenv() has
already used on-stack temporary storage, so just use it more rationally.
getenv_string() receives buffer as argument, so don't need another one.

r257914:
Some CAM locks polishing:
 - Fix LOR and possible lock recursion when handling high-power commands.
Introduce new lock to protect left power quota and list of frozen devices.
 - Correct locking around xpt periph creation.
 - Remove seems never used XPT_FLAG_OPEN xpt periph flag.

Again, Netflix assisted with testing the merge, but all of the credit goes
to Alexander and iX Systems.

Submitted by:	mav
Sponsored by:	iX Systems


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260387 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC	r259841

gcc:  Add ability to generate DWARF pubtypes section if
DEBUG_PUBTYPES_SECTION is defined.

Obtained from:	gcc 4.3 (rev. 118826; GPLv2)


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260395 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260232:
Don't check for fd limits in fdgrowtable_exp.

Callers do that already and additional check races with process
decreasing limits and can result in not growing the table at all, which
is currently not handled.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260400 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260290:

Bring back the old size of the kinfo_file structure to preserve ABI.
Keep only one uint64_t spare for further cap_rights_t expension.

Add a comment clarifying that if the size of this structure changes,
a new sysctl MIB has to be allocate for it and the old structure has
to be returned by the old sysctl MIB.

Requested by:   re


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260402 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260403 (MFV r260399):

Apply vendor commits:

197e0ea	Fix for TLS record tampering bug.  (CVE-2013-4353).
3462896	For DTLS we might need to retransmit messages from the
	previous session so keep a copy of write context in DTLS
	retransmission buffers instead of replacing it after
	sending CCS.  (CVE-2013-6450).
ca98926 When deciding whether to use TLS 1.2 PRF and record hash
	algorithms use the version number in the corresponding
	SSL_METHOD structure instead of the SSL structure.  The
	SSL structure version is sometimes inaccurate.
	Note: OpenSSL 1.0.2 and later effectively do this already.
	(CVE-2013-6449).

Security:	CVE-2013-4353
Security:	CVE-2013-6449
Security:	CVE-2013-6450


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260404 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260049:

Add mibs for hastd(1) queue stats.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260412 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merged r260415 from head.

Approved by:	davidch


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260416 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r258821 - fix tcp simultaneous close

PR:		kern/99188


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260417 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259943:

Address some warnings which showed up on the userland version.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260426 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260257:

Fix several bugs in sctp_bindx():
* Set errno to EAFNOSUPPORT if an address is provided which is neither
  AF_INET nor AF_INET6.
* Don't modify the arguments.
* Don't smash the stack when provided with a non-zero port.
* Handle the case correctly where the first address provided is
  an IPv6 address.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260428 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r258893, r258956:
  Add a new sysctl / loader tunable kern.panic_reboot_wait_time which
  defaults to PANIC_REBOOT_WAIT_TIME (a long-existing kernel config
  setting).  Use this now-variable value in place of the defined constant
  to control how long the system waits after a panic before rebooting.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260431 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revert MFC of r258821 - it was already handled by MFC of r239672.

Pointy hat to: peter


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260434 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259873:

gcc: small enhancements for the arm support.

fixes GCC-PR target/31152

Obtained from:	gcc 4.3 (rev. r118461, 125973: GPLv2)


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260455 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260204:
Assert that accounting for the pmap resident pages does not underflow.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260464 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260205:
Update the description for pmap_remove_pages() to match the modern
times.  Assert that the pmap passed to pmap_remove_pages() is only
active on current CPU.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260467 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259197:
Do not DELAY() for P-state transition unless we want to see the result.

Intel manual says: "If a transition is already in progress, transition to
a new value will subsequently take effect. Reads of IA32_PERF_CTL determine
the last targeted operating point."  So seems it should be fine to just
trigger wanted transition and go.  Linux does the same.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260473 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256547 (by smh):
Added 4K quirks for Corsair Neutron GTX SSD's


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260475 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256995:
Remove 128KB bzero() call done for every block I/O data buffer.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260476 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r257946:
Introduce seperate mutex lock to protect protect CTL I/O pools, slightly
reducing global CTL lock scope and congestion.

While there, simplify CTL I/O pools KPI, hiding implementation details.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/10@260477 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f