MFH: r260483, r260484, r260594, r260595, r260596, r260597

Improve error message shown to the user when trying to load a module that is
already loaded or compiled withing the kernel
Point the user to dmesg(1) to get informations about why loading a module did fail
instead of printing the cryptic "Exec format error"
Update the BUGS section of kld(4) according the recent changes in kldload(8)


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260909 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC	r260014, r260099:

gcc: Add support for label attributes and "unavailable" attribute.

Apple GCC has extensions to support for both label attributes and
an "unavailable" attribute. These are critical for objc but are
also useful in regular C/C++.

Obtained from:	Apple GCC 4.2 - 5531


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

Bring back r226403, the fix for bin/161526, which was (accidentally?)
reverted in r238896.

PR:		bin/161526
Reported by:	Karli.Sjoberg slu.se


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC	r260332;
gcc: backport some fixes from llvm-gcc

llvm-gcc backported some patches from gcc trunk:

http://gcc.gnu.org/ml/gcc-cvs/2007-05/msg00662.html
http://gcc.gnu.org/ml/gcc-cvs/2007-07/msg00019.html
http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00240.html
http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00493.html

The first two were always GPL2. The last two were
added after the GPL3 transition, but were written
by aaw@google.com and Rafael Espíndola got permission
to relicense them under the GPL2 for inclusion in
llvm-gcc.

This fixes GCC-PR c++/31749

Obtained from:	llvm-gcc (rev. 75463; GPLv2)


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

-h and -H options backwards in manual page.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260948 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r254970 (by ken):
If a drive returns ASC/ASCQ 0x04,0x11 "Logical unit not ready,
notify (enable spinup) required", instead of doing the normal
retries, poll for a change in status.

We will poll every half second for a minute for the status to
change.

Hitachi drives (and likely other SAS drives) return that ASC/ASCQ
when they are waiting to spin up.  What it means is that they are
waiting for the SAS expander to send them the SAS
NOTIFY (ENABLE SPINUP) primitive.

That primitive is the mechanism expanders/enclosures use to
sequence drive spinup to avoid overloading power supplies.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260960 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r255307 (by bryanv):
Add camcontrol support for the SCSI sanitize command


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260961 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256836:
Remove hard limit on number of BIOs handled with one ATA TRIM request.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260962 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256895:
Fix memory and references leak due to unfreed path.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260963 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/9@260964 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 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.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r260407:
Allow delete_method sysctl to be set to "DISABLE".


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@260966 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259925-259926:

  Add GPT UUID for VMware vSAN meta-data partition.

Approved by:	ae


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

  Fix circular math macro.

PR:	146082


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@261010 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r258132:
Some minor tuning to rpc/svc.c:
 - close cosmetic race in svc_exit();
 - do not set wait timeout for idle threads if we have no use for wakeups;
 - create new requested thread sooner, not only after some another thread
wakeup, that may happen later under constant load.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@261056 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r258578, r258580, r258581 (by hrs):
Replace Sun RPC license in TI-RPC library with a 3-clause BSD license
with the explicit permissions.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@261057 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r244008 (by rmacklem):
Add support for backchannels to the kernel RPC. Backchannels
are used by NFSv4.1 for callbacks. A backchannel is a connection
established by the client, but used for RPCs done by the server
on the client (callbacks). As a result, this patch mixes some
client side calls in the server side and vice versa. Some
definitions in the .c files were extracted out into a file called
krpc.h, so that they could be included in multiple .c files.
This code has been in projects/nfsv4.1-client for some time.
Although no one has given it a formal review, I believe kib@
has taken a look at it.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@261058 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259632:
Rework flow control for connection-oriented (TCP) RPC server.

  When processing receive buffer, write the amount of data, expected
in present request record, into socket's so_rcv.sb_lowat to make stack
aware about our needs.  When processing following upcalls, ignore them
until socket collect enough data to be read and processed in one turn.
  This change reduces number of context switches and other operations
in RPC stack during large NFS writes (especially via non-Jumbo networks)
by order of magnitude.

  After precessing current packet, take another look into the pending
buffer to find out whether the next packet had been already received.
If not, deactivate this port right there without making RPC code to
push this port to another thread just to find that there is nothing.
If the next packet is received partially, also deactivate the port, but
also update socket's so_rcv.sb_lowat to not be woken up prematurely.
  This change additionally reduces number of context switches per NFS
request about in half.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@261059 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259659, r259662:
Remove several linear list traversals per request from RPC server code.

  Do not insert active ports into pool->sp_active list if they are success-
fully assigned to some thread.  This makes that list include only ports that
really require attention, and so traversal can be reduced to simple taking
the first one.

  Remove idle thread from pool->sp_idlethreads list when assigning some
work (port of requests) to it.  That again makes possible to replace list
traversals with simple taking the first element.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@261060 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259765:
Fix RPC server threads file handle affinity to work better with ZFS.

  Instead of taking 8 specific bytes of file handle to identify file during
RPC thread affitinity handling, use trivial hash of the full file handle.
ZFS's struct zfid_short does not have padding field after the length field,
as result, originally picked 8 bytes are loosing lower 16 bits of object ID,
causing many false matches and unneeded requests affinity to same thread.
  This fix substantially improves NFS server latency and scalability in SPEC
NFS benchmark by more flexible use of multiple NFS threads.


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