]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFV r342532: 5882 Temporary pool names
avg [Wed, 26 Dec 2018 11:03:14 +0000 (11:03 +0000)]
MFV r342532: 5882 Temporary pool names

Note that this commit brings only formatting changes that were done
during the final review of the illumos change, because FreeBSD got the
main changes before illumos.

illumos/illumos-gate@04e56356520b98d5a93c496b10f02530bb6647e0
https://github.com/illumos/illumos-gate/commit/04e56356520b98d5a93c496b10f02530bb6647e0

https://www.illumos.org/issues/5882
  This is an import of the temporary pool names functionality from ZoL:
  https://github.com/zfsonlinux/zfs/commit/e2282ef57edc79cdce2a4b9b7e3333c56494a807
  https://github.com/zfsonlinux/zfs/commit/26b42f3f9d03f85cc7966dc2fe4dfe9216601b0e
  https://github.com/zfsonlinux/zfs/commit/2f3ec9006146844af6763d1fa4e823fd9047fd54
  https://github.com/zfsonlinux/zfs/commit/00d2a8c92f614f49d23dea5d73f7ea7eb489ccf1
  https://github.com/zfsonlinux/zfs/commit/83e9986f6eefdf0afc387f06407087bba3ead4e9
  https://github.com/zfsonlinux/zfs/commit/023bbe6f017380f4a04c5060feb24dd8cdda9fce
  It is intended to assist the creation and management of virtual machines
  that have their rootfs on ZFS on hosts that also have their rootfs on
  ZFS. These situations cause SPA namespace collisions when the standard
  name rpool is used in both cases. The solution is either to give each
  guest pool a name unique to the host, which is not always desireable, or
  boot a VM environment containing an ISO image to install it, which is
  cumbersome.

MFC after: 1 week
Sponsored by: Panzura

5 years agoDriver version upgrade.
kadesai [Wed, 26 Dec 2018 10:48:39 +0000 (10:48 +0000)]
Driver version upgrade.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoProblem statement:
kadesai [Wed, 26 Dec 2018 10:47:52 +0000 (10:47 +0000)]
Problem statement:
Due to hardware errata in Aero controllers, reads to certain
fusion registers could intermittently return all zeroes.
This behavior is transient in nature and subsequent reads will return
valid value.

Fix:
For Aero controllers, any read will retry the read operations
from certain registers for maximum three times, if read returns zero.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for 32 bit atomic request descriptor for Aero adapters.
kadesai [Wed, 26 Dec 2018 10:47:08 +0000 (10:47 +0000)]
This patch will add support for 32 bit atomic request descriptor for Aero adapters.

For Aero adapters-
1. Driver will use 32 bit atomic descriptor to fire IOs and DCMDs.
2. Driver will use 64 bit request descriptor to fire IOC INIT.
3. If Aero firmware supports 32 bit atomic descriptor, then only driver will use it
otherwise driver will use 64 bit request descriptor.

For rest of adapters(Ventura, Invader and Thunderbolt), driver will use 64 bit request
descriptors only.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for latest generation MegaRAID adapters- Aero(39xx).
kadesai [Wed, 26 Dec 2018 10:46:23 +0000 (10:46 +0000)]
This patch will add support for latest generation MegaRAID adapters- Aero(39xx).
Driver will throw a warning message when a Configurable secure type controller is
encountered.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoUpdate mpr driver version to v23.00.00.00-fbsd
kadesai [Wed, 26 Dec 2018 10:44:30 +0000 (10:44 +0000)]
Update mpr driver version to v23.00.00.00-fbsd

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoUpdate copyright information
kadesai [Wed, 26 Dec 2018 10:43:31 +0000 (10:43 +0000)]
Update copyright information

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoOn Aero/Sea A0 cards retry MPT Fusion registers reads for max three times
kadesai [Wed, 26 Dec 2018 10:42:45 +0000 (10:42 +0000)]
On Aero/Sea A0 cards retry MPT Fusion registers reads for max three times

Due to HW Errta on Aero/Sea A0 chipset on secure boot mode & on heavy IO load,
sometimes read operation on MPT Fusion registers will give zero value,
So, as a workaround driver will retry the MPT Fusion register
read operation for max three times upon reading zero value form these
registers.

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoEnable atomic type descriptor support only for Sea & Aero cards
kadesai [Wed, 26 Dec 2018 10:41:53 +0000 (10:41 +0000)]
Enable atomic type descriptor support only for Sea & Aero cards

Enable atomic type descriptor support only for Sea & Aero cards,
due to HW errata this atomic descriptor support has to be disabled
on Ventura cards.

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoAdd Sea,Aero adapter support
kadesai [Wed, 26 Dec 2018 10:41:14 +0000 (10:41 +0000)]
Add Sea,Aero adapter support

Added deviceID's for Sea,Aero to mpr Driver
Aero:
        0x00E0 Invalid
        0x00E1 Configurable Secure
        0x00E2 Hard Secure
        0x00E3 Tampered
Sea:
        0x00E4 Invalid
        0x00E5 Configurable Secure
        0x00E6 Hard Secure
        0x00E7 Tampered

For Tampered & Invalid type cards, driver will claim the device & quit the probe function with below error message,
"HBA is in Non Secure mode"

for Configurable Secure type cards, driver will display below message in .probe() callback function,
"HBA is in Configurable Secure mode"

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoAdded support for NVMe Task Management
kadesai [Wed, 26 Dec 2018 10:40:27 +0000 (10:40 +0000)]
Added support for NVMe Task Management

Following list of changes done in the driver as a part of TM handling on the NVMe drives.
Below changes are only applicable on NVMe drives and only when custom NVMe TM handling bit is set to zero by IOC.

1. Issue LUN reset & Target reset TMs with Target reset method field set to Protocol Level reset (0x3),
2. For LUN & target reset TMs use the timeout value as ControllerResetTO value provided by firmware using PCie Device Page 0,
3. If LUN reset fails to terminates the IO then directly escalate to host reset instead of going for target reset TM,
4. For Abort TM use the timeout value as NVMeAbortTO value given by the IOC using Manufacturing Page 11,
5. Log message "PCie Host Reset failed" message up on receiving P

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoCopy back the Sense data at proper location expected by the application
kadesai [Wed, 26 Dec 2018 10:39:22 +0000 (10:39 +0000)]
Copy back the Sense data at proper location expected by the application

typedef struct mps_pass_thru
{
               uint64_t               PtrRequest;
               uint64_t               PtrReply;
               uint64_t               PtrData;
               uint32_t               RequestSize;
               uint32_t               ReplySize;
               uint32_t               DataSize;
               uint32_t               DataDirection;
               uint64_t               PtrDataOut;
               uint32_t               DataOutSize;
               uint32_t               Timeout;
} mps_pass_thru_t, * ptrmpssas_pass_thru_t;

In the above mps_pass_thru structure; Application expects PrtReply buffer
should contain both MPI reply followed by sense data. So, updated driver
to copy sense data at PtrReply + sizeof(MPI2 reply) location where
application wants the driver to copy back the sense data info.

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoUpdate MPI header files version to 2.00.52 from 2.00.48
kadesai [Wed, 26 Dec 2018 10:38:12 +0000 (10:38 +0000)]
Update MPI header files version to 2.00.52 from 2.00.48

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoMFV r342469: 9630 add lzc_rename and lzc_destroy to libzfs_core
avg [Wed, 26 Dec 2018 10:37:41 +0000 (10:37 +0000)]
MFV r342469: 9630 add lzc_rename and lzc_destroy to libzfs_core

illumos/illumos-gate@049ba636fa37a2892809192fc671bff9158a01cd
https://github.com/illumos/illumos-gate/commit/049ba636fa37a2892809192fc671bff9158a01cd

https://www.illumos.org/issues/9630
  Rename and destroy are very useful operations that deserve to be in
  libzfs_core.  And they are not hard to implement too.

MFC after: 2 weeks
Relnotes: maybe

5 years agobectl: use jail id as the default jail name for a boot environment
kevans [Tue, 25 Dec 2018 15:18:41 +0000 (15:18 +0000)]
bectl: use jail id as the default jail name for a boot environment

By default, bectl is setting the jail 'name' parameter to the boot
environment name, which causes an error when the boot environment name is
not a valid jail name. With the attached fix, when no name is supplied, the
default jail name will be the jail id - this is is the same behavior as the
jail command.

Additionally, this commit addresses two other bugs that prevented unjailing
in scenarios where the jail name does not match the boot environment name:

1. In 'bectl_locate_jail', 'mountpoint' is used to resolve the boot
  environment path, but really 'mounted' should be used. 'mountpoint' is the
  path where the zfs dataset will be mounted. 'mounted' is the path where
  the dataset is actually mounted.

2. in 'bectl_search_jail_paths', 'jail_getv' would fail after the first
  call. Which is fine, if the boot environment you're unjailing is the next
  one up. According to 'man jail_getv', it's expecting name and value
  strings. 'jail_getv' is being passed an integer for the lastjid, so amend
  that to use a string instead.

Test cases have been amended to reflect the bugs found.

PR: 233637
Submitted by: Rob <rob.fx907_gmail.com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18607

5 years agoFix reading of USB sample rate descriptor for SPL Crimson Rev 1.
hselasky [Tue, 25 Dec 2018 10:15:48 +0000 (10:15 +0000)]
Fix reading of USB sample rate descriptor for SPL Crimson Rev 1.

Read first one entry, then try to read the full rate descriptor table.

PR: 234380
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoIncrease MTX_POOL_SLEEP_SIZE from 128 to 1024.
mav [Mon, 24 Dec 2018 23:52:35 +0000 (23:52 +0000)]
Increase MTX_POOL_SLEEP_SIZE from 128 to 1024.

This value remained unchanged for 15 years, and now this bump reduces
lock spinning in GEOM and BIO layers while doing ~1.6M IOPS to 4 NVMe
on 72-core system from ~25% to ~5% by the cost of additional 28KB RAM.

While there, align struct mtx_pool fields to cache lines.

MFC after: 1 month

5 years agoRemove CAM SIM lock from NVMe SIM.
mav [Mon, 24 Dec 2018 23:28:11 +0000 (23:28 +0000)]
Remove CAM SIM lock from NVMe SIM.

CAM does not require SIM lock since FreeBSD 10.4, and NVMe code never
required it at all, using per-queue locks instead.  This formally allows
parallel request submission in CAM mode as much as single per-device and
per-queue locks of CAM allow.

MFC after: 1 month

5 years agoEnable sys/random.h #include from C++
cem [Mon, 24 Dec 2018 19:37:10 +0000 (19:37 +0000)]
Enable sys/random.h #include from C++

And bump __FreeBSD_version, just in case.

PR: 234180
Submitted by: Ralf van der Enden <tremere AT cainites.net>
MFC after: 5 days

5 years agoDragonFly 5.4.0, 5.4.1 and FreeBSD 12.0 releases added.
maxim [Mon, 24 Dec 2018 16:36:39 +0000 (16:36 +0000)]
DragonFly 5.4.0, 5.4.1 and FreeBSD 12.0 releases added.

5 years agoActivate support for efibootmgr(8) -b --bootnum parameter
bcran [Mon, 24 Dec 2018 15:38:36 +0000 (15:38 +0000)]
Activate support for efibootmgr(8) -b --bootnum parameter

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18647

5 years agoClarify kld_list format
crees [Mon, 24 Dec 2018 10:47:48 +0000 (10:47 +0000)]
Clarify kld_list format

PR: docs/234248
Submitted by: David Fiander
Submitted by: Miroslav Lachman

5 years agoFurther refactoring for task management commands. Also fix a related
scottl [Mon, 24 Dec 2018 06:14:32 +0000 (06:14 +0000)]
Further refactoring for task management commands.  Also fix a related
typo from the previous commit.

5 years agoCommands for user-initated device resets should come from the high-priority
scottl [Mon, 24 Dec 2018 05:54:36 +0000 (05:54 +0000)]
Commands for user-initated device resets should come from the high-priority
allocator.  Prior to this change, they would leak from the normal allocator.

5 years agoFirst step in refactoring and fixing the error recovery and task management
scottl [Mon, 24 Dec 2018 05:05:38 +0000 (05:05 +0000)]
First step in refactoring and fixing the error recovery and task management
code in the mpr and mps drivers.  Eliminate duplicated code and fix some
comments.

5 years agoRemove an empty #if block.
cy [Mon, 24 Dec 2018 01:12:43 +0000 (01:12 +0000)]
Remove an empty #if block.

The interesting thing is that looking through Darren's commit logs,
the line containing an extern ppsratecheck() definition was removed
from the v5-1-RELEASE branch but not from HEAD (I have taken his
CVS tree and converted it to GIT). There is a commit adding an
additional #if defined to the empty block. I can only assume that
this was intentional for something later. Looking through HEAD the
extern ppsratecheck() is there. However if we put it back it would
conflict with a static ppsratecheck() definition in fil.c when
building ipftest.

Therefore we remove this empty block.

ppsratecheck() is a function in the FreeBSD kernel. However ipftest
cannot call the ppsratecheck() in the kernel. Therefore one exists in
fil.c for use when building the userland ipftest utility which
approximates the packet filter in userland for testing of ipfilter
rules against packets captured with tcpdump.

MFC after: 1 week

5 years agoRegister a pre-commit review for ipfilter.
cy [Mon, 24 Dec 2018 01:12:22 +0000 (01:12 +0000)]
Register a pre-commit review for ipfilter.

5 years agoFix mismatch from r342379.
pfg [Sun, 23 Dec 2018 20:51:13 +0000 (20:51 +0000)]
Fix mismatch from r342379.

5 years agonvdimm SPA geom: Update bio fields needed for devstat_end_transaction_bio().
kib [Sun, 23 Dec 2018 19:14:31 +0000 (19:14 +0000)]
nvdimm SPA geom: Update bio fields needed for devstat_end_transaction_bio().

Reported by: bde
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoAllocate v_object for the new snapshot vnode.
kib [Sun, 23 Dec 2018 18:54:09 +0000 (18:54 +0000)]
Allocate v_object for the new snapshot vnode.

The vnode is not opened, so it ends up with the malloced buffers otherwise.

Reported and tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoProperly test for vmio buffer in bnoreuselist().
kib [Sun, 23 Dec 2018 18:52:02 +0000 (18:52 +0000)]
Properly test for vmio buffer in bnoreuselist().

The presence of allocated v_object does not imply that the buffer is
necessary VMIO kind.  Buffer might has been allocated before the
object created, then the buffer is malloced.  Although we try to avoid
such situation, it seems to be still legitimate.

Reported and tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agogai_strerror() - Update string error messages according to RFC 3493.
pfg [Sun, 23 Dec 2018 18:15:48 +0000 (18:15 +0000)]
gai_strerror() - Update string error messages according to RFC 3493.

Error messages in gai_strerror(3) vary largely among OSs.

For new software we largely replaced the obsoleted EAI_NONAME and
with EAI_NODATA but we never updated the corresponding message to better
match the intended use. We also have references to ai_flags and ai_family
which are not very descriptive for non-developer end users.

Bring new new error messages based on informational RFC 3493, which has
obsoleted RFC 2553, and make them consistent among the header adn
manpage.

MFC after: 1 month
Differentical Revision: D18630

5 years agoRemove NETBSD_PF. NETBSD_PF is a flag that defines whether the pfil(9)
cy [Sun, 23 Dec 2018 05:10:36 +0000 (05:10 +0000)]
Remove NETBSD_PF. NETBSD_PF is a flag that defines whether the pfil(9)
framework is available. pfil(9) has been in FreeBSD since FreeBSD 5
and according to svn log was first committed to HEAD in 2000, therefore
it is safe to say the check is no longer needed in FreeBSD.

pfil(9) first appeared in NetBSD 1.3 (hence the name NETBSD_PF).
Therefore it is safe to say that it is supported by every NetBSD system
today. The framework also exists in illumos.

As ipfilter code is shared and exchanged between FreeBSD and NetBSD, and
at some point in the future illumos too, and as all three platforms have
pfil(9), the redundant NETBSD_PF #defines and #ifdefs are removed.

MFC after: 1 week

5 years agoMerge bmake-20181221
sjg [Sun, 23 Dec 2018 01:05:52 +0000 (01:05 +0000)]
Merge bmake-20181221

5 years agoFix devstat on md devices, second attempt. r341765 depends on
bde [Sat, 22 Dec 2018 22:59:11 +0000 (22:59 +0000)]
Fix devstat on md devices, second attempt.  r341765 depends on
g_io_deliver() finishing initialization of the bio, but g_io_deliver()
actually destroys the bio.  INVARIANTS makes the bug obvious by
overwriting the bio with garbage.

Restore the old order for calling devstat (except don't restore not calling
it for the error case), and translate to the devstat KPI so that this order
works.

Reviewed by: kib

5 years agoRemove the last vestiges of HP/UX from a FreeBSD-only ipfilter
cy [Sat, 22 Dec 2018 21:49:25 +0000 (21:49 +0000)]
Remove the last vestiges of HP/UX from a FreeBSD-only ipfilter
source file.

MFC after: 1 week

5 years agonetmap: fix txsync check in netmap poll
vmaffione [Sat, 22 Dec 2018 16:23:42 +0000 (16:23 +0000)]
netmap: fix txsync check in netmap poll

To check if txsync can be skipped, it is necessary to look for
unseen TX space. However, this means comparing ring->cur
against ring->tail, rather than ring->head against ring->tail
(like nm_ring_empty() does).
This change also adds some more comments to explain the optimization
performed at the beginning of netmap_poll().

MFC after: 3 days
Sponsored by: Sunny Valley Networks

5 years agonetmap: fix bug in netmap_poll() optimization
vmaffione [Sat, 22 Dec 2018 15:15:45 +0000 (15:15 +0000)]
netmap: fix bug in netmap_poll() optimization

The bug was introduced by r339639, although it is present in the upstream
netmap code since 2015. It is due to resetting the want_rx variable to
POLLIN, rather than resetting it to POLLIN|POLLRDNORM.
It only affects select(), which uses POLLRDNORM. poll() is not affected,
because it uses POLLIN.
Also, it only affects FreeBSD, because Linux skips the optimization
implemented by the piece of code where the bug occurs.

MFC after: 3 days
Sponsored by: Sunny Valley Networks

5 years agoifconfig.4, lagg.4: fix documentation bug: -use_flowid needs to be used
eugen [Sat, 22 Dec 2018 11:38:54 +0000 (11:38 +0000)]
ifconfig.4, lagg.4: fix documentation bug: -use_flowid needs to be used
to force local hash computation and disable usage of RSS hash
provided by driver.

PR: 234242
MFC after: 1 week

5 years agoOops, rounddown() for the start was misspelled roundup() in r342295,
bde [Sat, 22 Dec 2018 09:31:55 +0000 (09:31 +0000)]
Oops, rounddown() for the start was misspelled roundup() in r342295,
so only aligned starts worked.  This broke releasing caches in most
cases where the i/o size is smaller than the fs block size.

5 years agoconfig(8): Remove all instances of an option when opting out
kevans [Sat, 22 Dec 2018 06:08:06 +0000 (06:08 +0000)]
config(8): Remove all instances of an option when opting out

Quick follow-up to r342362: options can appear multiple times now, so
clean up all of them as needed. For non-OPTIONS options, this has no effect
since they're already de-duplicated.

MFC after: 1 week
X-MFC-With: r342362

5 years agoconfig(8): Allow duplicate options to be specified
kevans [Sat, 22 Dec 2018 06:02:34 +0000 (06:02 +0000)]
config(8): Allow duplicate options to be specified

config(8)'s option handling has been written to allow duplicate options; if
the value changes, then the latest value is used and an informative message
is printed to stderr like so:

/usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1

Currently, this is only a possibility for cpu types, MAXUSERS, and
MACHINE_ARCH. Anything else duplicated in a config file will use the first
value set and error about duplicated options on subsequent appearances,
which is arguably unfriendly since one could specify:

include GENERIC
nooptions VERBOSE_SYSINIT
options VERBOSE_SYSINIT

to redefine the value later anyways.

Reported by: mmacy
MFC after: 1 week

5 years agoTry the first 256 units with nvmecontrol devlist.
imp [Fri, 21 Dec 2018 23:22:37 +0000 (23:22 +0000)]
Try the first 256 units with nvmecontrol devlist.

The nvmecontrol code that did the devlist assumed that we had a
tightly-packed allocation of units. Since pci writing exists, this
isn't the case. Loop over the first 256 units, which is a reasonable
number of possible units.

Sponsored by: Netflix

5 years agoFix clobbering of the fatchain cache for clustered i/o's when full
bde [Fri, 21 Dec 2018 21:17:45 +0000 (21:17 +0000)]
Fix clobbering of the fatchain cache for clustered i/o's when full
clustering is not done.  The bug caused extreme slowness for large
files in some cases.

There is no way to tell VOP_BMAP() how many blocks are wanted, so for
all file systems it has to waste time in some cases by searching for
more contiguous blocks than will be accessed.  For msdosfs, it also
clobbered the fatchain cache in these cases by advancing the cache to
point to the chain entry for block that won't be read.  This makes
the cache useless for the next sequential i/o (or VOP_BMAP()), so the
fat chain is searched from the beginning.  The cache only has 1 relevant
entry, so it is similarly useless for random i/o.

Fix this by only advancing the cache to point to the chain entry for
the first block that will be read.  Clustering uses results from
VOP_BMAP(), so when more than 1 block is read by clustering, the cache
is not advanced as optimally as before, but it is at most 1 cluster
size behind and searching the chain through the blocks for this cluster
doesn't take too long.

5 years agoRemove unused macros from t4_tom.h.
np [Fri, 21 Dec 2018 20:46:45 +0000 (20:46 +0000)]
Remove unused macros from t4_tom.h.

5 years agomps(4), mpr(4): remove SATA ID command cancellation hack
cem [Fri, 21 Dec 2018 20:30:52 +0000 (20:30 +0000)]
mps(4), mpr(4): remove SATA ID command cancellation hack

Add a generic mechanism to override mp?_wait_command's timeout behavior,
which continues to invoke reinit by default.  Invokers who set
cm_timeout_handler may avoid automatic reinit and do their own handling.

Adapt mp?sas_get_sata_identify to this mechanism and remove its callout
hack.

Reviewed by: scottl
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18614

5 years agomps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify
cem [Fri, 21 Dec 2018 20:29:16 +0000 (20:29 +0000)]
mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify

In the event that the ID command timed out, mps(4)/mpr(4) did not free the
command until it could be cancelled.  However, it freed the associated
buffer (cm_data).  Fix the lifetime issue by freeing the associated buffer
only after Abort Task or controller reset.

Reviewed by: scottl
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18612

5 years agoQuick fix for initialization of mnt_iosize_max. (This limit controls
bde [Fri, 21 Dec 2018 20:12:43 +0000 (20:12 +0000)]
Quick fix for initialization of mnt_iosize_max.  (This limit controls
mainly clustering and read-ahead.)  Copy the initialization from ffs,
and also copy a couple of lines of ffs's nearby style for initialization
order and whitespace.

A correct fix would de-duplicate the initialization and fix bitrot in it
instead of adding another instance of the duplication.  Complications to
use the size preferred by the device have been reduced to hard-coding
slightly pessimal and/or inconsistent defaults, using large code that was
almost needed to support the complications.

For msdosfs, the result was that mnt_iosize_max was DFTLPHYS (64K) but is
now MAXPHYS (128K).

5 years agoFix passing wrong variables to nvlist_destroy() after r333446.
mav [Fri, 21 Dec 2018 17:22:15 +0000 (17:22 +0000)]
Fix passing wrong variables to nvlist_destroy() after r333446.

Reported by: Alexander Fedorov (IT-Grad.ru)
MFC after: 5 days

5 years agonetmap: update nmreplay(8)
vmaffione [Fri, 21 Dec 2018 14:45:10 +0000 (14:45 +0000)]
netmap: update nmreplay(8)

Small modifications to the nmreplay man page.
Used igor and mandoc tools to fix warnings and errors.

Reviewed by: bcr
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18629

5 years agonetmap: nmreplay: import various fixes from upstream (2704a51839906)
vmaffione [Fri, 21 Dec 2018 13:56:57 +0000 (13:56 +0000)]
netmap: nmreplay: import various fixes from upstream (2704a51839906)

Changelist:
    - General reformatting
    - Fix packet duplication in cons(). Whenever cons() reached the
      burst limit it would send all pending packets without advancing
      head. This caused the last injected packet to be sent again in
      the next round.
    - Fix full-speed transmissions after first loop.

MFC after: 3 days

5 years agonetmap: move buf_size validation code to its own function
vmaffione [Fri, 21 Dec 2018 11:50:14 +0000 (11:50 +0000)]
netmap: move buf_size validation code to its own function

This code validates the netmap buf_size against the interface MTU
and maximum descriptor size, to make sure the values are consistent.
Moving this functionality to its own function is needed because this
function is also called by Linux-specific code.

MFC after: 3 days

5 years agonetmap: pipes: make sure both ends use the same number of slots
vmaffione [Fri, 21 Dec 2018 11:32:55 +0000 (11:32 +0000)]
netmap: pipes: make sure both ends use the same number of slots

5 years agoAllow use underscores and dots in service names without escaping.
ae [Fri, 21 Dec 2018 10:41:45 +0000 (10:41 +0000)]
Allow use underscores and dots in service names without escaping.

PR: 234237
MFC after: 1 week

5 years agoUse VOP_ADVISE() with POSIX_FADV_DONTNEED instead of IO_DIRECT to
bde [Fri, 21 Dec 2018 08:15:31 +0000 (08:15 +0000)]
Use VOP_ADVISE() with POSIX_FADV_DONTNEED instead of IO_DIRECT to
implement not double-caching for reads from vnode-backed md devices.
Use VOP_ADVISE() similarly instead of !IO_DIRECT unsimilarly for writes.
Add a "cache" option to mdconfig to allow changing the default of not
caching.

This depends on a recent commit to fix VOP_ADVISE().  A previous version
had optimizations for sequential i/o's (merge the i/o's and only uncache
for discontiguous i/o's and for full blocks), but optimizations and
knowledge of block boundaries belong in VOP_ADVISE().  Read-ahead should
also be handled better, by supporting it in md and discarding it in
VOP_ADVISE().

POSIX_FADV_DONTNEED is ignored by zfs, but so is IO_DIRECT.

POSIX_FADV_DONTNEED works better than IO_DIRECT if it is not ignored,
since it only discards from the buffer cache immediately, while
IO_DIRECT also discards from the page cache immediately.

IO_DIRECT was not used for writes since it was claimed to be too slow,
but most of the slowness for writes is from doing them synchronously by
default.  Non-synchronous writes still deadlock in many cases.

IO_DIRECT only has a special implementation for ffs reads with DIRECTIO
configured.  Otherwise, if it is not ignored than it uses the buffer and
page caches normally except for discarding everything after each i/o,
and then it has much the same overheads as POSIX_FADV_DONTNEED.  The
overheads for reading with ffs and DIRECTIO were similar in tests of md.

Reviewed by: kib

5 years agoFix missing (sub)options in usage message to prepare for adding a new one.
bde [Fri, 21 Dec 2018 06:38:13 +0000 (06:38 +0000)]
Fix missing (sub)options in usage message to prepare for adding a new one.

Reviewed by: kib

5 years agoFix rounding in vop_stdadvise() for POSIX_FADV_NOREUSE (really
bde [Fri, 21 Dec 2018 04:57:59 +0000 (04:57 +0000)]
Fix rounding in vop_stdadvise() for POSIX_FADV_NOREUSE (really
POSIX_FADV_DONTNEED).  The most broken case was for applications that
advise for the whole file and then do block-aligned i/o's 1 block at
a time.  Then advice is sent to VOP_ADVISE() 1 block at a time, but
in vop_stdadvise() the 1-block advice was turned into 0-block advice
for the buffer cache part.

The bugs were caused partly by callers representing the region as
(a_start, a_end), where a_end is actually the maximum, and everything
else representing the region as (start, end) where 'end' is actually
the end (1 after the maximum).  The maximum a_end must be rounded up,
but was rounded down.  Also, rounding to page boundaries was inconsistent.

The bugs and fixes have no effect for zfs and other file systems that
don't use the buffer cache or the page cache.  Most or all file systems
currently use the default VOP_FADVISE(), but it finds a null buffer cache
and a null page cache for file systems that don't use normal methods.

Reviewed by: kib

5 years agoSome filesystems (like cd9660 and ext3) require that VFS_STATFS()
mckusick [Fri, 21 Dec 2018 01:09:25 +0000 (01:09 +0000)]
Some filesystems (like cd9660 and ext3) require that VFS_STATFS()
be called before VFS_ROOT() is called. Move the call for VFS_STATFS()
so that it is done after VFS_MOUNT(), but before VFS_ROOT().
This change actually improves the robustness of the mount system
call because it returns an error rather than failing silently
when VFS_STATFS() returns failure.

Reported by:  Rebecca Cran <rebecca@bluestop.org>
Sponsored by: Netflix

5 years agocxgbe/iw_cxgbe: Remove redundant CTRs from c4iw_alloc/c4iw_rdev_open.
np [Thu, 20 Dec 2018 22:39:58 +0000 (22:39 +0000)]
cxgbe/iw_cxgbe: Remove redundant CTRs from c4iw_alloc/c4iw_rdev_open.
This information is readily available elsewhere.

Sponsored by: Chelsio Communications

5 years agocxgbe/iw_cxgbe: Do not terminate CTRx messages with \n.
np [Thu, 20 Dec 2018 22:31:07 +0000 (22:31 +0000)]
cxgbe/iw_cxgbe: Do not terminate CTRx messages with \n.

5 years agoAdd an UPDATING message for r342286.
rmacklem [Thu, 20 Dec 2018 22:26:54 +0000 (22:26 +0000)]
Add an UPDATING message for r342286.

5 years agoFix the NFSv4 server to obey vfs.nfsd.nfs_privport.
rmacklem [Thu, 20 Dec 2018 22:21:41 +0000 (22:21 +0000)]
Fix the NFSv4 server to obey vfs.nfsd.nfs_privport.

When the NFSv4 server was coded, I believed that the specification authors
did not want NFSv4 servers to require a client to use a reserved port#.
However, recently it has been noted that the Linux NFSv4 server does support
a check for a reserved port#.
Since both the FreeBSD and Linux NFSv4 clients use a reserved port# by
default, enabling vfs.nfsd.nfs_privport to require a reserved port# for
NFSv4 the same as it does for NFSv2, 3 seems reasonable.
The only case where this could cause a POLA violation is a FreeBSD NFSv4
server with vfs.nfsd.nfs_privport set, but with NFSv4 clients doing mounts
without using a reserved port# (< 1024).

Tested by: chaz.newton58@gmail.com
PR: 234106
MFC after: 1 week

5 years agotpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)
cem [Thu, 20 Dec 2018 20:55:33 +0000 (20:55 +0000)]
tpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)

Move static variable definition (cdevsw) to a more conventional location
(the C file it is used in), rather than a header.

This fixes the GCC warning, -Wunused-variable ("defined but not used") when
the tpm20.h header is included in files other than tpm20.c (e.g.,
tpm_tis.c).

X-MFC-with: r342084
Sponsored by: Dell EMC Isilon

5 years agocxgbe(4): Make sure the rx queues start off with the correct timestamp
np [Thu, 20 Dec 2018 20:34:21 +0000 (20:34 +0000)]
cxgbe(4): Make sure the rx queues start off with the correct timestamp
settings on initialization.

Sponsored by: Chelsio Communications

5 years agoRework UEFI ESP generation
bcran [Thu, 20 Dec 2018 19:39:37 +0000 (19:39 +0000)]
Rework UEFI ESP generation

Currently, the installer uses pre-created 800KB FAT12 filesystems that
it dd's onto the ESP partition.
This changeset improves that by having the installer generate a FAT32
filesystem directly onto the ESP using newfs_msdos and then copying
loader.efi into /EFI/freebsd.
For live installs it then runs efibootmgr to add a FreeBSD boot entry
in the BIOS.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D17947

5 years agoWait a maximum of 300 seconds for network send/recv in libsa
bcran [Thu, 20 Dec 2018 19:27:46 +0000 (19:27 +0000)]
Wait a maximum of 300 seconds for network send/recv in libsa

The reason for this change is that currently, a send/recv
takes many hours to time out.
This is suboptimal in the bootloader because it means for example
that NFS will take hours to fail before allowing subsequent access
methods such as gzip to be tried.

Setting MAXWAIT to 300 seconds (5 minutes) still allows slow
connections of 1Mb to be used to download a 30MB kernel file.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18544

5 years agoFix a regression in the TCP handling of received segments.
tuexen [Thu, 20 Dec 2018 16:05:30 +0000 (16:05 +0000)]
Fix a regression in the TCP handling of received segments.
When receiving TCP segments the stack protects itself by limiting
the resources allocated for a TCP connections. This patch adds
an exception to these limitations for the TCP segement which is the next
expected in-sequence segment. Without this patch, TCP connections
may stall and finally fail in some cases of packet loss.

Reported by: jhb@
Reviewed by: jtl@, rrs@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18580

5 years agoRemove setting of long-unused MK_NCP option
emaste [Thu, 20 Dec 2018 15:53:27 +0000 (15:53 +0000)]
Remove setting of long-unused MK_NCP option

NCP was removed from the tree in 2013 (r248097) and disconnected some
time before.

Reported by: bz
Sponsored by: The FreeBSD Foundation

5 years agoFix panic message when we can't create thread for one wire temperature
imp [Thu, 20 Dec 2018 05:46:56 +0000 (05:46 +0000)]
Fix panic message when we can't create thread for one wire temperature
reading.

5 years agocxgbe/iw_cxgbe: Use -ve errno when interfacing with linuxkpi/OFED.
np [Thu, 20 Dec 2018 01:35:45 +0000 (01:35 +0000)]
cxgbe/iw_cxgbe: Use -ve errno when interfacing with linuxkpi/OFED.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

5 years agoFix obtaining RSP address in TPM CRB for non-amd64 platforms
mw [Thu, 20 Dec 2018 01:05:09 +0000 (01:05 +0000)]
Fix obtaining RSP address in TPM CRB for non-amd64 platforms

On amd64 the RSP address can be read in single 8-byte transaction,
which is obviously not possible on 32-bit platforms. Fix that
by performing 2 4-byte read on them.

Obtained from: Semihalf
Sponsored by: Stormshield

5 years agocxgbe/iw_cxgbe: Add a knob for testing that lets iWARP connections cycle
np [Thu, 20 Dec 2018 01:00:21 +0000 (01:00 +0000)]
cxgbe/iw_cxgbe: Add a knob for testing that lets iWARP connections cycle
through 4-tuples quickly.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

5 years agocxgbe/iw_cxgbe: Use DSGLs to write to card's memory when appropriate.
np [Wed, 19 Dec 2018 23:29:01 +0000 (23:29 +0000)]
cxgbe/iw_cxgbe: Use DSGLs to write to card's memory when appropriate.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

5 years agoregcomp: revert part of r341838 which turned out to be unrelated
yuripv [Wed, 19 Dec 2018 23:28:56 +0000 (23:28 +0000)]
regcomp: revert part of r341838 which turned out to be unrelated
and caused issues with search in less.

PR: 234066
Reviewed by: pfg
Differential revision: https://reviews.freebsd.org/D18611

5 years agoCheck for probes enabled in priv_check_cred before evaluting the error.
mjg [Wed, 19 Dec 2018 23:28:29 +0000 (23:28 +0000)]
Check for probes enabled in priv_check_cred before evaluting the error.

Sponsored by: The FreeBSD Foundation

5 years agoAdd note to 32-bit mips smp config files documenting the status
imp [Wed, 19 Dec 2018 23:22:14 +0000 (23:22 +0000)]
Add note to 32-bit mips smp config files documenting the status

5 years agoProvide SDT_PROBES_ENABLED for kernels without KDTRACE.
mjg [Wed, 19 Dec 2018 23:19:05 +0000 (23:19 +0000)]
Provide SDT_PROBES_ENABLED for kernels without KDTRACE.

Sponsored by: The FreeBSD Foundation

5 years ago32-bit mips SMP is unsupported
imp [Wed, 19 Dec 2018 23:15:49 +0000 (23:15 +0000)]
32-bit mips SMP is unsupported

Per discussions on mips@, 32-bit mips SMP is now unsupported. The
files in the tree will compile for a while longer, but when the
atomic_swap_64 or similar atomic enters into the MI part of the tree,
as currently foreseen sometime next year, these ports will start to no
longer link. The JZ4780 is the only such system we have.

The UP version of this chip is unaffected by this, and will remain
supported.

Discussed on: mips@
Relnotes: yes

5 years agoAllow multi-byte thousands separators in strfmon(3)
cem [Wed, 19 Dec 2018 22:57:47 +0000 (22:57 +0000)]
Allow multi-byte thousands separators in strfmon(3)

PR: 234010
Reported by: Jon Tejnung <jon AT herrskogen.se>
Reviewed by: yuripv
Differential Revision: https://reviews.freebsd.org/D18605

5 years agoFix the date
imp [Wed, 19 Dec 2018 22:56:31 +0000 (22:56 +0000)]
Fix the date

The first part of the mips pruning has been commited. This part
is uncontested. Fix the date in the UPDATING file to reflect when
I made the commit. The contested parts will be committed (or not)
once those discussions complete.

5 years agoRemove old config file for SENTRY5
imp [Wed, 19 Dec 2018 22:54:34 +0000 (22:54 +0000)]
Remove old config file for SENTRY5

This is an older broadcom part that implements the mips32 ISA. 32-bit
FreeBSD/mips now requires mips32r2, so retire this config. Most of the
broadcom port is shared with newer ports, so what little code may be
unique to this part has not been GC'd at this time.

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543

5 years agoRemove support for running 32-bit kernels on 64-bit hardware.
imp [Wed, 19 Dec 2018 22:54:29 +0000 (22:54 +0000)]
Remove support for running 32-bit kernels on 64-bit hardware.

This was useful in bring up. However, it causes more issues than the
support is worth (64-bit atomics being chief among them).

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543

5 years agoRemove the GXEMUL support.
imp [Wed, 19 Dec 2018 22:54:23 +0000 (22:54 +0000)]
Remove the GXEMUL support.

gxemul was a nice stop-gap while qemu support for mips was firmed
up. Now MALTA* + qemu is the platform of choice retire gxemul support.
It's unknown when this was last confirmed working.

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543

5 years agoRemove support for the now very old SiByte MIPS platform. It's not
imp [Wed, 19 Dec 2018 22:54:03 +0000 (22:54 +0000)]
Remove support for the now very old SiByte MIPS platform. It's not
relevant and is unused. It's also getting in the way of progress in
some admittedly minor ways. Better to retire it to reduce the burden
on the project.

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543

5 years agoFix alignment issue in uefisign
mw [Wed, 19 Dec 2018 22:47:37 +0000 (22:47 +0000)]
Fix alignment issue in uefisign

The pe_certificate structure has to be aligned to 8 bytes. [1]
Since this is now checked in edk2, any binaries signed with
older version of this tool will fail verification.

References:
[1] https://docs.microsoft.com/en-us/windows/desktop/Debug/pe-format#the-attribute-certificate-table-image-only

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: trasz
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D18554

5 years agoInclude the new TPM 2.0 driver in the TPM module.
mw [Wed, 19 Dec 2018 22:43:10 +0000 (22:43 +0000)]
Include the new TPM 2.0 driver in the TPM module.

Update the appropriate Makefile to build the new driver
together with the old one.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reported by: kib
Obtained from: Semihalf
Sponsored by: Stormshield

5 years agomac: reduce pessimization of sdt probe handling
mjg [Wed, 19 Dec 2018 22:30:26 +0000 (22:30 +0000)]
mac: reduce pessimization of sdt probe handling

Prior to the change the code would branch on return value and then check
if probes are enabled. Since vast majority of the time they are not, this
is clearly wasteful. Check probes first.

Sponsored by: The FreeBSD Foundation

5 years agoRemove iBCS2: plug a wart missed in r342242
mjg [Wed, 19 Dec 2018 22:08:51 +0000 (22:08 +0000)]
Remove iBCS2: plug a wart missed in r342242

Sponsored by: The FreeBSD Foundation

5 years agoRemove iBCS2, part3: the implementation
mjg [Wed, 19 Dec 2018 22:02:49 +0000 (22:02 +0000)]
Remove iBCS2, part3: the implementation

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation

5 years agoRemove iBCS2, part2: general kernel
mjg [Wed, 19 Dec 2018 21:57:58 +0000 (21:57 +0000)]
Remove iBCS2, part2: general kernel

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation

5 years agoRemove iBCS2, part1: userspace
mjg [Wed, 19 Dec 2018 21:56:54 +0000 (21:56 +0000)]
Remove iBCS2, part1: userspace

iBCS2 was disconnected from the build in 2015 (see r291419)

bsdconfig parts submitted by dteske.

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation

5 years agoMicrooptimize corner case of ID bitmap handling.
mjg [Wed, 19 Dec 2018 20:29:52 +0000 (20:29 +0000)]
Microoptimize corner case of ID bitmap handling.

Prior to the change we would avoidably test more possibly used IDs.

While here update the comment: there is no pidchecked variable anymore.

5 years agoDeinline vfork handling out of the syscall return path.
mjg [Wed, 19 Dec 2018 20:27:26 +0000 (20:27 +0000)]
Deinline vfork handling out of the syscall return path.

vfork is rarely called (comparatively to other syscalls) and it avoidably
pollutes the fast path.

Sponsored by: The FreeBSD Foundation

5 years agoUpdate priv(9) after r341827
mjg [Wed, 19 Dec 2018 20:25:58 +0000 (20:25 +0000)]
Update priv(9) after r341827

Reported by: trasz
Sponsored by: The FreeBSD Foundation

5 years agocxgbe(4): Do not issue mbox commands after t4_fw_bye.
np [Wed, 19 Dec 2018 19:21:29 +0000 (19:21 +0000)]
cxgbe(4): Do not issue mbox commands after t4_fw_bye.

Sponsored by: Chelsio Communications

5 years agobootpd: validate hardware type
emaste [Wed, 19 Dec 2018 18:16:29 +0000 (18:16 +0000)]
bootpd: validate hardware type

Due to insufficient validation of network-provided data it may have been
possible for a malicious actor to craft a bootp packet which could cause
a stack buffer overflow.

admbugs: 850
Reported by: Reno Robert
Reviewed by: markj
Approved by: so
Security: FreeBSD-SA-18:15.bootpd
Sponsored by: The FreeBSD Foundation

5 years agoReplace uses of sbadaddr with stval.
markj [Wed, 19 Dec 2018 17:52:09 +0000 (17:52 +0000)]
Replace uses of sbadaddr with stval.

The sbadaddr register was renamed in version 1.10 of the privileged
architecture specification.  No functional change intended.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18594

5 years agoImplement cpu_halt() for RISC-V.
markj [Wed, 19 Dec 2018 17:45:16 +0000 (17:45 +0000)]
Implement cpu_halt() for RISC-V.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18595

5 years agoasmc: Add support for MacPro1,1
dab [Wed, 19 Dec 2018 16:45:37 +0000 (16:45 +0000)]
asmc: Add support for MacPro1,1

PR: 203431
Submitted by: jjr@alisa.org & holindho@saunalahti.fi
Reported by: jjr@alisa.org
MFC after: 1 week

5 years agoRemove a use of a negative array index from fxp(4).
markj [Wed, 19 Dec 2018 04:54:32 +0000 (04:54 +0000)]
Remove a use of a negative array index from fxp(4).

This fixes a warning seen when compiling amd64 GENERIC with clang 7.
Also remove the workaround added in r337324.  clang 7 and gcc 4.2
generate the same code with or without the code change.

Reviewed by: imp (previous version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18603