5 hours agoIn if_attachdomain1() there does not seem to be any reason master github/master
bz [Sat, 28 May 2016 08:32:15 +0000 (08:32 +0000)]
In if_attachdomain1() there does not seem to be any reason
to use TRYLOCK rather than just acquire the lock, so just do that.

Reviewed by: markj
Obtained from: projects/vnet
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision:

11 hours ago[ath] add WB335 btcoex for initial testing.
adrian [Sat, 28 May 2016 02:14:24 +0000 (02:14 +0000)]
[ath] add WB335 btcoex for initial testing.

This is like the WB222 coexistence (ie, "MCI", a message bus inside the
chip), and it's currently a cut/paste so I can start using it to flesh
out the differences with WB222.

It doesn't completely /do/ bluetooth coexistence, because it turns out
I need to add some contigmalloc'ed buffers to the btcoex path for this
type of hardware.  I'm putting this work in the "people would like
to see functioning-ish btcoex before FreeBSD-11" bucket because I see
this as "broken".


* QCA9535 (WB335) NIC, BT + 2GHz STA

13 hours agocxgbe/t4_tom: Exempt RDMA connections from a TCP sanity test for now, to
np [Sat, 28 May 2016 00:38:17 +0000 (00:38 +0000)]
cxgbe/t4_tom: Exempt RDMA connections from a TCP sanity test for now, to
avoid panicking debug kernels.

t4_tom does not keep track of a connection once it switches to ULP mode
iWARP.  If the connection falls out of ULP mode the driver/hardware seq#
etc. are out of sync.  A better fix would be to figure out what the
current seq# are, update the driver's state, and perform all sanity
checks as usual.

13 hours agoAdd gpiokeys to the list of GPIO modules built only if FDT is enabled
gonzo [Sat, 28 May 2016 00:22:39 +0000 (00:22 +0000)]
Add gpiokeys to the list of GPIO modules built only if FDT is enabled

13 hours agoDon't truncate existing error when writing the log.
bdrewery [Fri, 27 May 2016 23:58:00 +0000 (23:58 +0000)]
Don't truncate existing error when writing the log.

Suggested by: markj
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

13 hours agoRename function to be less generic.
bdrewery [Fri, 27 May 2016 23:57:57 +0000 (23:57 +0000)]
Rename function to be less generic.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

13 hours agoWrite to the log using the tracer's credentials.
bdrewery [Fri, 27 May 2016 23:57:53 +0000 (23:57 +0000)]
Write to the log using the tracer's credentials.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

13 hours agoexec: Cease tracing if credentials will change with the new image.
bdrewery [Fri, 27 May 2016 23:57:43 +0000 (23:57 +0000)]
exec: Cease tracing if credentials will change with the new image.

This also prevents tracing to a P_INEXEC process since it could race
with other processes attaching to it in filemon_event_process_exec() due
to the filemon_get_proc() race of incrementing ref and then locking the
filemon.  With the no-P_INEXEC invariant in place the p_filemon may only
be the same or NULL when trying to drop it in

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision:

13 hours agoFix taskqueue groups to work with EARLY_AP_STARTUP.
jhb [Fri, 27 May 2016 23:49:16 +0000 (23:49 +0000)]
Fix taskqueue groups to work with EARLY_AP_STARTUP.

In the EARLY_AP_STARTUP case the APs are already running when a taskqgroup
is created, so adjust the group at the same time it is created.

Sponsored by: Netflix

14 hours agoiw_cxgbe: Plug a lock leak in process_mpa_request().
np [Fri, 27 May 2016 23:44:33 +0000 (23:44 +0000)]
iw_cxgbe: Plug a lock leak in process_mpa_request().

If the parent is DEAD or connect_request_upcall() fails, the parent
mutex is left locked.  This leads to a hang when process_mpa_request()
is called again for another child of the listening endpoint.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Obtained from: upstream iw_cxgb4
Sponsored by: Chelsio Communications

14 hours agoMove external GCC compiler hacks to
bdrewery [Fri, 27 May 2016 23:03:44 +0000 (23:03 +0000)]
Move external GCC compiler hacks to

This allows respecting -nostdinc, -nostdinc++ and -nostdlib before
making the decision to add in -isystem, etc.  The -isystem flags
are problematic for building lib/libc++ and lib/libcxxrt which wants
to only use its own headers.

More information the need of these flags can be found at

This also reverts r300873.

Sponsored by: EMC / Isilon Storage Division

14 hours agoLibcompat: Only pass -isystem =/usr/include for external GCC.
bdrewery [Fri, 27 May 2016 23:03:28 +0000 (23:03 +0000)]
Libcompat: Only pass -isystem =/usr/include for external GCC.

This is the same as the main build logic.  GCC with a cross-compiler
requires using -isystem to =/usr/include to get the search order

Reported by: dim, asomers
Sponsored by: EMC / Isilon Storage Division

14 hours agoFix up r300870
ngie [Fri, 27 May 2016 22:56:00 +0000 (22:56 +0000)]
Fix up r300870

The sys/types.h fix I proposed was only tested with zfs(4), not with
libzpool, which is where the build failure actually existed

Remove vm/vm_pageout.h from arc.c and zfs_vnops.c because they're both

MFC after: 1 week
X-MFC with: r300865, r300870
In collaboration with: kib
Submitted by: alc
Sponsored by: EMC / Isilon Storage Division

15 hours agoFix typo from r300880
asomers [Fri, 27 May 2016 22:44:33 +0000 (22:44 +0000)]
Fix typo from r300880

Reported by: rpokala
MFC after: Never
Sponsored by: Spectra Logic Corp

15 hours agoAlways create loopback routes on every fib
asomers [Fri, 27 May 2016 22:40:40 +0000 (22:40 +0000)]
Always create loopback routes on every fib

Always create loopback routes on every fib, for both IPv4 and IPv6

Create loopback IPv4 and IPv6 routes on every fib at boot. Revert
278302; now that all FIBs have IPv6 loopback routes, the
"route add -reject" commands won't fail.

Greatly simplify static_ipv6_loopback_route_for_each_fib. It was
written under the assumption that loopback routes would be added to
a given fib by the kernel as soon as an interface is configured on
that fib. However, the logic can be much simpler now that we simply
add loopback routes to all fibs at boot. This also removes the need
to run the test as root, removes the restriction that
net.add_addr_allfibs=0, and removes the need to configure fibs in

Also, add a test case for IPv4 loopback routes

Sponsored by: Spectra Logic Corp
Differential Revision:

15 hours agoAvoid issuing spa config updates for physical path when not necessary
asomers [Fri, 27 May 2016 22:32:44 +0000 (22:32 +0000)]
Avoid issuing spa config updates for physical path when not necessary

ZFS's configuration needs to be updated whenever the physical path for a
device changes, but not when a new device is introduced. This is because new
devices necessarily cause config updates, but only if they are actually
accepted into the pool.

Split vdev_geom_set_physpath out of vdev_geom_attrchanged.  When
setting the vdev's physical path, only request a config update if
the physical path has changed.  Don't request it when opening a
device for the first time, because the config sync will happen
anyway upstack.

Split g_dev_set_physpath and g_dev_set_media out of

Submitted by: will, asomers
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision:

15 hours agoStrip leading spaces off of a SCSI disk's serial number
asomers [Fri, 27 May 2016 22:26:43 +0000 (22:26 +0000)]
Strip leading spaces off of a SCSI disk's serial number

Strip leading spaces off of a SCSI disk's reported serial number
when populating the CAM serial number. This affects the output of
"diskinfo -v" and the names of /dev/diskid/DISK-* device nodes,
among other things.

SPC5r05 says that the Product Serial Number field from the Unit
Serial Number VPD page is right-aligned. So any leading spaces are
not part of the actual serial number. Most devices don't left-pad
their serial numbers, but some do. In particular, the SN VPD page
that an LSI HBA emulates for a SATA drive contains enough
left-padding to fill a 20-byte field.

Add a note to UPDATING, because some users may have to update
/etc/fstab or geom labels.

Reviewed by: ken, mav
MFC after: Never
Sponsored by: Spectra Logic Corp
Differential Revision:

15 hours agoMerge ACPICA 20160527.
jkim [Fri, 27 May 2016 22:16:46 +0000 (22:16 +0000)]
Merge ACPICA 20160527.

Relnotes: yes

15 hours agoFix erronious mixed use of tx/rx variables/constants in the same expression.
ian [Fri, 27 May 2016 22:14:39 +0000 (22:14 +0000)]
Fix erronious mixed use of tx/rx variables/constants in the same expression.

Pointed out by jmcneill; other instances found by grep -iE 'rx.*tx|tx.*rx'

16 hours agoiw_cxgbe: Use vmem(9) to manage PBL and RQT allocations.
np [Fri, 27 May 2016 21:26:26 +0000 (21:26 +0000)]
iw_cxgbe: Use vmem(9) to manage PBL and RQT allocations.

Submitted by: Krishnamraju Eraparaju at Chelsio
Reviewed by: Steve Wise
Sponsored by: Chelsio Communications

16 hours agoUpdate usage(..)
ngie [Fri, 27 May 2016 21:12:25 +0000 (21:12 +0000)]
Update usage(..)

- Document missing options
- Sync options with ioatcontrol(8).
- Make it clear that the first 2 parameters are always required.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

16 hours agoAfter r300770, for libc++ and libcxxrt, use -isystem instead of -I.
dim [Fri, 27 May 2016 20:45:32 +0000 (20:45 +0000)]
After r300770, for libc++ and libcxxrt, use -isystem instead of -I.
This should fix builds with external gcc toolchains from ports, which
also use -isystem to work around problems with gcc's --sysroot
implementation.  Thanks to Bryan Drewery for this workaround.

17 hours agoGo back to unconditionally compiling modules/gpio now that the parts of it
ian [Fri, 27 May 2016 20:43:46 +0000 (20:43 +0000)]
Go back to unconditionally compiling modules/gpio now that the parts of it
dependent on FDT support are conditionally compiled only on FDT platforms.

17 hours agoDon't wrap the declaration of gpio_alloc_intr_resource() in #ifdef INTRNG,
ian [Fri, 27 May 2016 20:41:25 +0000 (20:41 +0000)]
Don't wrap the declaration of gpio_alloc_intr_resource() in #ifdef INTRNG,
wrap the implementation so that it returns an error if INTRNG support is
not available.  It should be possible to write a non-INTRNG implementation
of this function some day.  In the meantime, there is code that contains
calls to this function (so the decl is needed), but have runtime checks to
avoid calling it in the non-INTRNG case.

17 hours agoUnbreak the zfs(4) build
ngie [Fri, 27 May 2016 20:33:38 +0000 (20:33 +0000)]
Unbreak the zfs(4) build

vm/vm_pageout.h grew a dependency on the bool typedef in r300865

arc.c didn't include sys/types.h, which included the definition for the typedef

Other items (ofed, drm2) might need to be chased for this commit.

X-MFC with: r300865
MFC after: 1 week
Pointyhat to: alc
Sponsored by: EMC / Isilon Storage Division

17 hours agoMake PKG_VERSION aware of '-ALPHA*'.
gjb [Fri, 27 May 2016 20:33:14 +0000 (20:33 +0000)]
Make PKG_VERSION aware of '-ALPHA*'.

Submitted by: Ben Woods
Sponsored by: The FreeBSD Foundation

17 hours agoRemove note about bogus chain-len maximum
ngie [Fri, 27 May 2016 20:12:32 +0000 (20:12 +0000)]
Remove note about bogus chain-len maximum

There's no current limit on chain-len with Broadwell DE chips; it isn't
enforced in software, and there doesn't appear to be a hardware limitation
either on the Intel Xeon D-1527 (Broadwell-DE) chip.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

18 hours agoOnly expose `hint_uaddr` in the ND_DEBUG case
ngie [Fri, 27 May 2016 19:30:13 +0000 (19:30 +0000)]
Only expose `hint_uaddr` in the ND_DEBUG case

This fixes a -Wunused-but-set-variable warning with gcc

MFC after: 1 week
Reported by: gcc 5
Sponsored by: EMC / Isilon Storage Division

18 hours agoIf the I/O offset and length is multiple of the media size then
ambrisko [Fri, 27 May 2016 19:23:15 +0000 (19:23 +0000)]
If the I/O offset and length is multiple of the media size then
directly pass the request otherwise use a buffer that is a
multiple of the media size.  This speeds up I/O quite a bit
when using large transfer sizes on 4Kn disks etc.

MFC after: 1 week

18 hours agoThe flag "vm_pages_needed" has long served two distinct purposes: (1) to
alc [Fri, 27 May 2016 19:15:45 +0000 (19:15 +0000)]
The flag "vm_pages_needed" has long served two distinct purposes: (1) to
indicate that threads are waiting for free pages to become available and
(2) to indicate whether a wakeup call has been sent to the page daemon.
The trouble is that a single flag cannot really serve both purposes, because
we have two distinct targets for when to wakeup threads waiting for free
pages versus when the page daemon has completed its work.  In particular,
the flag will be cleared by vm_page_free() before the page daemon has met
its target, and this can lead to the OOM killer being invoked prematurely.
To address this problem, a new flag "vm_pageout_wanted" is introduced.

Discussed with: jeff
Reviewed by: kib, markj
Tested by: markj
Sponsored by: EMC / Isilon Storage Division

18 hours agoRemove duplicate sentence from pfsync.8.
dru [Fri, 27 May 2016 18:52:58 +0000 (18:52 +0000)]
Remove duplicate sentence from pfsync.8.

PR: 209539
Submitted by: olivier@
Reviewed by:
Sponsored by: iXsystems

19 hours agoIn pmap_advise(), avoid leaking DI start for EPT pmaps which needs A/D
kib [Fri, 27 May 2016 18:45:11 +0000 (18:45 +0000)]
In pmap_advise(), avoid leaking DI start for EPT pmaps which needs A/D
emulation.  Assert that syscalls do not leak DI.

Reported by: gjb
Sponsored by: The FreeBSD Foundation

19 hours agoInstall ioatcontrol to /usr/bin by default instead of /
ngie [Fri, 27 May 2016 18:40:38 +0000 (18:40 +0000)]
Install ioatcontrol to /usr/bin by default instead of /

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

19 hours ago- Sort make variables
ngie [Fri, 27 May 2016 18:39:47 +0000 (18:39 +0000)]
- Sort make variables
- Use SRCTOP instead of ad hoc definition for it

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

19 hours agoReplace linux-f10 packages with updated linux-c6.
gjb [Fri, 27 May 2016 18:20:07 +0000 (18:20 +0000)]
Replace linux-f10 packages with updated linux-c6.

PR:  208280
Submitted by:  Johannes Meixner
Sponsored by: The FreeBSD Foundation

19 hours agoCorrect the implementation of dtrace_interrupt_disable/enable.
br [Fri, 27 May 2016 17:58:10 +0000 (17:58 +0000)]
Correct the implementation of dtrace_interrupt_disable/enable.

Pointed out by: andrew
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

19 hours agoFix description for -V in the -r case
ngie [Fri, 27 May 2016 17:57:30 +0000 (17:57 +0000)]
Fix description for -V in the -r case

t.verify_test = true is always set when -V is specified, regardless of whether
or not the tool is being run in raw mode

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

20 hours agoDocument the default behavior for -c (0)
ngie [Fri, 27 May 2016 17:44:30 +0000 (17:44 +0000)]
Document the default behavior for -c (0)

Bump .Dd for the change

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

20 hours agoInitialize `t` with memset(.., 0, ..)
ngie [Fri, 27 May 2016 17:42:59 +0000 (17:42 +0000)]
Initialize `t` with memset(.., 0, ..)

This will help ensure that we're not using random garbage on the stack by
accident with respect to the variable

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

20 hours agoWhen building modules, define make variable OPT_FDT if the kernel config
ian [Fri, 27 May 2016 17:40:29 +0000 (17:40 +0000)]
When building modules, define make variable OPT_FDT if the kernel config
includes the FDT option.  Use OPT_FDT to conditionally compile modules
that require FDT support.

In the past we've gotten away with using the arch name as a proxy for FDT
support in makefile conditional logic, but now mips has some platforms with
fdt support and some without and we need a more direct test.

20 hours agoPlug route reference underleak that happens with FLOWTABLE after r297225.
glebius [Fri, 27 May 2016 17:31:02 +0000 (17:31 +0000)]
Plug route reference underleak that happens with FLOWTABLE after r297225.

Submitted by: Mike Karels <mike>

20 hours agoDisconnect PIE from the build until it is free of floating point math.
truckman [Fri, 27 May 2016 17:07:07 +0000 (17:07 +0000)]
Disconnect PIE from the build until it is free of floating point math.

Reported by: lidl, adrian

20 hours agofd: provide a common exit point for unlock in kern_dup
mjg [Fri, 27 May 2016 17:00:15 +0000 (17:00 +0000)]
fd: provide a common exit point for unlock in kern_dup

While here assert dropped filedesc lock on return from closefp.

22 hours agoexec: get rid of one vnode lock/unlock pair in do_execve
mjg [Fri, 27 May 2016 15:03:38 +0000 (15:03 +0000)]
exec: get rid of one vnode lock/unlock pair in do_execve

The lock was temporarily dropped for vrele calls, but they can be
postponed to a point where the lock is not held in the first place.

While here shuffle other code not needing the lock.

25 hours agoFix dtrace_interrupt_disable and dtrace_interrupt_enable by having the
andrew [Fri, 27 May 2016 12:02:12 +0000 (12:02 +0000)]
Fix dtrace_interrupt_disable and dtrace_interrupt_enable by having the
former return the current status for the latter to use. Without this we
could enable interrupts when they shouldn't be.

It's still not quite right as it should only update the bits we care about,
bit should be good enough until the correct fix can be tested.

PR: 204270
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

25 hours agosfxge(4): fix typo in monitor types strings in common code
arybchik [Fri, 27 May 2016 11:50:26 +0000 (11:50 +0000)]
sfxge(4): fix typo in monitor types strings in common code

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agosfxge(4): avoid necessity to add one more constant condition note
arybchik [Fri, 27 May 2016 11:49:46 +0000 (11:49 +0000)]
sfxge(4): avoid necessity to add one more constant condition note

Use for forever loop instead of while.

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agosfxge(4): cope with always true unsigned comparison with 0 to make lint happier
arybchik [Fri, 27 May 2016 11:49:05 +0000 (11:49 +0000)]
sfxge(4): cope with always true unsigned comparison with 0 to make lint happier

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agosfxge(4): unsigned 1 should be shifted to produce bitmask
arybchik [Fri, 27 May 2016 11:48:25 +0000 (11:48 +0000)]
sfxge(4): unsigned 1 should be shifted to produce bitmask

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agosfxge(4): cope with lint for EFX_SET_OWORD_BIT() with const bit arg
arybchik [Fri, 27 May 2016 11:47:56 +0000 (11:47 +0000)]
sfxge(4): cope with lint for EFX_SET_OWORD_BIT() with const bit arg

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agosfxge(4): remove set but not used variable
arybchik [Fri, 27 May 2016 11:47:11 +0000 (11:47 +0000)]
sfxge(4): remove set but not used variable

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agoImprove error message when failing to open a backing file
bapt [Fri, 27 May 2016 11:46:54 +0000 (11:46 +0000)]
Improve error message when failing to open a backing file

When bhyve cannot open a backing file, it now says explicitly which file
could not be opened

Note that the change has only be maed in block_if.c and not in
pci_virtio_block.c as the error will always be catched by the first

PR: 202321 (different patch)
Reviewed by: grehan
MFC after: 3 day
Sponsored by:
Differential Revision:

25 hours agosfxge(4): remove unreachable break after goto
arybchik [Fri, 27 May 2016 11:46:35 +0000 (11:46 +0000)]
sfxge(4): remove unreachable break after goto

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

25 hours agosfxge(4): add constant condition note to make lint happier
arybchik [Fri, 27 May 2016 11:45:42 +0000 (11:45 +0000)]
sfxge(4): add constant condition note to make lint happier

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

26 hours agosfxge(4): note unused variables to make lint happier
arybchik [Fri, 27 May 2016 11:44:40 +0000 (11:44 +0000)]
sfxge(4): note unused variables to make lint happier

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

26 hours agoAttach iser(4) to the build.
trasz [Fri, 27 May 2016 11:39:08 +0000 (11:39 +0000)]
Attach iser(4) to the build.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

26 hours agoBuild iscsi(4) with ICL_KERNEL_PROXY when building with WITH_OFED.
trasz [Fri, 27 May 2016 11:37:56 +0000 (11:37 +0000)]
Build iscsi(4) with ICL_KERNEL_PROXY when building with WITH_OFED.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

26 hours agoFix build on i386.
trasz [Fri, 27 May 2016 11:37:02 +0000 (11:37 +0000)]
Fix build on i386.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

28 hours agoQuell false positives in svc_vc_create and svc_vc_create_conn with cd and xprt
ngie [Fri, 27 May 2016 08:48:33 +0000 (08:48 +0000)]
Quell false positives in svc_vc_create and svc_vc_create_conn with cd and xprt

Both cd and xprt will be non-NULL after their respective malloc(9) wrappers are
called (mem_alloc and svc_xprt_alloc, which calls mem_alloc) as mem_alloc
always gets called with M_WAITOK|M_ZERO today. Thus, testing for them being
non-NULL is incorrect -- it misleads Coverity and it misleads the reader.

Remove some unnecessary NULL initializations as a follow up to help solidify
the fact that these pointers will be initialized properly in sys/rpc/.. with
the interfaces the way they are currently.

Differential Revision:
MFC after: 2 weeks
Reported by: Coverity
CID: 1007338, 1007339, 1007340
Reviewed by: markj, truckman
Sponsored by: EMC / Isilon Storage Division

30 hours agoThe SCHEDULER_STOPPED() macro already contains a predict false statement.
hselasky [Fri, 27 May 2016 07:33:49 +0000 (07:33 +0000)]
The SCHEDULER_STOPPED() macro already contains a predict false statement.
Remove superfluous unlikely() wrapper.

Suggested by: glebius
MFC after: 1 week
Sponsored by: Mellanox Technologies

30 hours agohyperv: Test features before enabling optional functionalities
sephe [Fri, 27 May 2016 07:29:31 +0000 (07:29 +0000)]
hyperv: Test features before enabling optional functionalities

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision:

30 hours ago[iwm] remove dead code.
adrian [Fri, 27 May 2016 07:10:11 +0000 (07:10 +0000)]
[iwm] remove dead code.

if_iwm - GC some dead code, left by a partially applied OpenBSD change.

Taken-From: OpenBSD (if_iwm.c r1.69)

Submitted by: Imre Vadasz <>
Obtained from: DragonflyBSD git 07dfed32ea39b980b0b80d27ff938e7c3ca4c0b5

30 hours agohyperv: Clean up Hyper-V timecounter a bit.
sephe [Fri, 27 May 2016 07:05:30 +0000 (07:05 +0000)]
hyperv: Clean up Hyper-V timecounter a bit.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision:

30 hours agohyperv: GC unneeded bits
sephe [Fri, 27 May 2016 06:55:05 +0000 (06:55 +0000)]
hyperv: GC unneeded bits

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision:

30 hours agohyperv/vmbus: Move MSR EOM to hyperv_reg.h
sephe [Fri, 27 May 2016 06:47:04 +0000 (06:47 +0000)]
hyperv/vmbus: Move MSR EOM to hyperv_reg.h

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision:

31 hours agohyperv: Move timer related MSRs into hyperv_reg.h
sephe [Fri, 27 May 2016 06:12:43 +0000 (06:12 +0000)]
hyperv: Move timer related MSRs into hyperv_reg.h

And avoid bit fields for event timer.

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision:

31 hours agoUse vm_page_replace_checked() instead of vm_page_rename() for implementing
alc [Fri, 27 May 2016 06:05:12 +0000 (06:05 +0000)]
Use vm_page_replace_checked() instead of vm_page_rename() for implementing
optimized copy-on-write faults.  This has two advantages: (1) one less radix
tree operation is performed and (2) vm_page_replace_checked() cannot fail,
making the code simpler.

Submitted by: Ryan Libby
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision:

31 hours agohyperv: Move CPUID related bits to hyperv_reg.h and give them clean name
sephe [Fri, 27 May 2016 05:58:53 +0000 (05:58 +0000)]
hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name

MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision:

32 hours agolibmd: Work around C++'s inability to understand C
cem [Fri, 27 May 2016 05:31:14 +0000 (05:31 +0000)]
libmd: Work around C++'s inability to understand C

Reported by: antoine@ (x265)

33 hours agoFix parallel builds by specifying *all* required headers in SRCS.
ian [Fri, 27 May 2016 04:34:42 +0000 (04:34 +0000)]
Fix parallel builds by specifying *all* required headers in SRCS.

Submitted by: manu
Pointy hat: ian

34 hours agogcc42: Fix minor C99 parse bug
cem [Fri, 27 May 2016 03:40:52 +0000 (03:40 +0000)]
gcc42: Fix minor C99 parse bug

DR #289[0] came down and gcc4.2.1 was on the wrong side of history.
Partially revert GCC r42574 (just remove the error) to rectify the parse
bug to match Clang and other compliant C99 compilers.

An example declaration gcc tripped on before this fix:

  void foobar(int [static 1]);

An example declaration gcc did not trip on before this fix:

  void foobar(int name[static 1]);

Bump __FreeBSD_cc_version.


Reported by: allanjude
Sponsored by: EMC / Isilon Storage Division

34 hours agoAdd rtwn(4) and rtwnfw(4).
kevlo [Fri, 27 May 2016 03:30:42 +0000 (03:30 +0000)]
Add rtwn(4) and rtwnfw(4).

36 hours ago[gpio] add gpiospi to the gpio module.
adrian [Fri, 27 May 2016 01:42:55 +0000 (01:42 +0000)]
[gpio] add gpiospi to the gpio module.

36 hours ago[spigen] add the userland ioctl API for spigen.
adrian [Fri, 27 May 2016 01:40:33 +0000 (01:40 +0000)]
[spigen] add the userland ioctl API for spigen.

36 hours ago[gpiospi] add debug option.
adrian [Fri, 27 May 2016 01:36:29 +0000 (01:36 +0000)]
[gpiospi] add debug option.

This was missing from the previous commit that introduced gpiospi.
It's required for it to build.

Pointy-hat-to: me

36 hours agoOnly build gpio modules on armv6, until it's known that they can be built
ian [Fri, 27 May 2016 01:14:35 +0000 (01:14 +0000)]
Only build gpio modules on armv6, until it's known that they can be built
succesfully on other arches.

36 hours agoMake Makefile.mirrors -ALPHA${N}-aware.
gjb [Fri, 27 May 2016 01:07:48 +0000 (01:07 +0000)]
Make Makefile.mirrors -ALPHA${N}-aware.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

37 hours agoUpdate head from 11.0-CURRENT to 11.0-ALPHA1, marking the official
gjb [Fri, 27 May 2016 00:01:48 +0000 (00:01 +0000)]
Update head from 11.0-CURRENT to 11.0-ALPHA1, marking the official
start of the code slush.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

37 hours agoRevert changes for local testing, inadvertantly commited in r300811.
ian [Thu, 26 May 2016 23:59:42 +0000 (23:59 +0000)]
Revert changes for local testing, inadvertantly commited in r300811.

37 hours agoAdd a PPS driver that takes the timing pulse from a gpio pin. Currently
ian [Thu, 26 May 2016 23:56:12 +0000 (23:56 +0000)]
Add a PPS driver that takes the timing pulse from a gpio pin.  Currently
supports only ofw/fdt systems.  Some day, hinted attachment for non-fdt
systems should be possible too.

38 hours agoFix unit number of EFI net interfaces and ignore psuedo network interfaces.
jhb [Thu, 26 May 2016 23:32:28 +0000 (23:32 +0000)]
Fix unit number of EFI net interfaces and ignore psuedo network interfaces.

In r277943, the efinet_match() routine was changed to use an off by one
when matching network interfaces.  The effect was that using "net1"
actually used the device attached to "net0".

Digging into the hardware that needed this workaround more, I found that
UEFI was creating two simple network protocol devices for each physical
NIC.  The first device was a "raw" Ethernet device and the second device
was a "IP" device that used the IP protocol on top of the underlying
"raw" device.  The PXE code in the firmware used the "IP" device to pull
across the loader.efi, so currdev was set to "net1" when booting from the
physical interface "net0".  (The loaded image's device handle referenced
the "IP" device that "net1" claimed.)

However, the IP device isn't suitable for doing raw packet I/O (and the
current code to open devices exclusively actually turns the "IP" devices
off on these systems).

To fix, change the efinet driver to only attach to "raw" devices.  This
is determined by fetching the DEVICE_PATH for each handle which supports
the simple network protocol and examining the last node in the path.  If
the last node in the path is a MAC address, the device is assumed to be
a "raw" device and is added as a 'netX' device.  If the last node is not
a MAC address, the device is ignored.

However, this causes a new problem as the device handle associated with
the loaded image no longer matches any of the handles enumerated by
efinet for systems that load the image via the "IP" device.  To handle
this case, expand the logic that resolves currdev from the loaded image
in main().  First, the existing logic of looking for a handle that
matches the loaded image's handle is tried.  If that fails, the device
path of the handle that loaded the loaded image is fetched via
efi_lookup_image_devpath().  This device path is then walked from the
end up to the beginning using efi_handle_lookup() to fetch the handle
associated with a path.  If the handle is found and is a known handle,
then that is used as currdev.  The effect for machines that load the
image via the "IP" device is that the first lookup fails (the handle
for the "IP" device isn't claimed by efinet), but walking up the
image's device path finds the handle of the raw MAC device which is used
as currdev.

With these fixes in place, the hack to subtract 1 from the unit can now
be removed, so that setting currdev to 'net0' actually uses 'net0'.

PR: 202097
Tested by: ambrisko
Sponsored by: Cisco Systems

38 hours agofilemon exec: Use imgp->execpath rather than vn_fullpath(9).
bdrewery [Thu, 26 May 2016 23:27:08 +0000 (23:27 +0000)]
filemon exec: Use imgp->execpath rather than vn_fullpath(9).

This will be more accurate as the actual name is provided if ran
from an absolute path in do_execve().

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

38 hours agoDIRDEPS_BUILD: Add a Makefile.depend
bdrewery [Thu, 26 May 2016 23:20:44 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Add a Makefile.depend

Sponsored by: EMC / Isilon Storage Division

38 hours agoDIRDEPS_BUILD: Fix and hookup rescue/rescue to the build.
bdrewery [Thu, 26 May 2016 23:20:40 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Fix and hookup rescue/rescue to the build.

Sponsored by: EMC / Isilon Storage Division

38 hours agoWITH_AUTO_OBJ: Fix crunchgen builds.
bdrewery [Thu, 26 May 2016 23:20:36 +0000 (23:20 +0000)]
WITH_AUTO_OBJ: Fix crunchgen builds.

Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse
WITH_AUTO_OBJ and cause it to create a recursed object directory that
then broke the actual prog build.  This is normally not a problem since
we do not call 'make -f obj' before building anything in it.

Crunchgen(1) also assumes that if -o is not passed then if an object
directory does not already exist then it should build in the source
directories.  The normal buildworld process will have already ran 'make
obj' in each of the component directories so this is not a problem.
With WITH_AUTO_OBJ though this is not the case.  So we must tell
crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not
require it be present before generating its Makefile.

Sponsored by: EMC / Isilon Storage Division

38 hours agoDon't strip paths away from META_XTRAS.
bdrewery [Thu, 26 May 2016 23:20:33 +0000 (23:20 +0000)]
Don't strip paths away from META_XTRAS.

This would otherwise disallow using meta files from a foreign build that
spread them around in directories outside our own .OBJDIR.

Sponsored by: EMC / Isilon Storage Division

38 hours agoAvoid redundant 'make objs' tree-walk when building the main prog.
bdrewery [Thu, 26 May 2016 23:20:30 +0000 (23:20 +0000)]
Avoid redundant 'make objs' tree-walk when building the main prog.

The main prog has a dependency on the submake targets to ensure they are
built.  From though we already have our own dependency
on 'make objs' so there is no need for another one.  Crunchgen(1) is
doing the right thing here so it is not modified.

This also prevents the CC fix tainting the submake environment with
META_MODE and causing rebuilds.  The CC passed is is only intended for
the main prog itself.

Sponsored by: EMC / Isilon Storage Division

38 hours agoPass CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS to the main crunch exec build.
bdrewery [Thu, 26 May 2016 23:20:27 +0000 (23:20 +0000)]
Pass CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS to the main crunch exec build.

This fixes --sysroot and other CFLAGS/LDFLAGS not being respected
in the crunchgen build since it is not including and
other files.  For example, this fixes building rescue itself without
--sysroot and other CFLAGS.

Sponsored by: EMC / Isilon Storage Division

38 hours agoWITH_META_MODE: Only expect a .meta file for the main target.
bdrewery [Thu, 26 May 2016 23:20:24 +0000 (23:20 +0000)]
WITH_META_MODE: Only expect a .meta file for the main target.

Since multiple files are generated from one build command, only
the first to run will actually generate a .meta file.  This fix
prevents 'required but missing' rebuilds on each target.

Sponsored by: EMC / Isilon Storage Division

38 hours agoDIRDEPS_BUILD: Don't show finished stats, which confuses crunchgen(1).
bdrewery [Thu, 26 May 2016 23:20:20 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Don't show finished stats, which confuses crunchgen(1).

It would show 'make error:' lines for each auto object directory created.

Sponsored by: EMC / Isilon Storage Division

38 hours agoUse netinet/in.h to avoid include/arpa dependency for DIRDEPS_BUILD.
bdrewery [Thu, 26 May 2016 23:20:17 +0000 (23:20 +0000)]
Use netinet/in.h to avoid include/arpa dependency for DIRDEPS_BUILD.

Sponsored by: EMC / Isilon Storage Division

38 hours agoAdd some missing .PHONY.
bdrewery [Thu, 26 May 2016 23:20:14 +0000 (23:20 +0000)]
Add some missing .PHONY.

These are relevant for WITH_META_MODE to ensure they are
always reran and don't generate a .meta file.

Sponsored by: EMC / Isilon Storage Division

38 hours agoDIRDEPS_BUILD: Build the kernel in the same place as buildkernel would.
bdrewery [Thu, 26 May 2016 23:20:10 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Build the kernel in the same place as buildkernel would.

Sponsored by: EMC / Isilon Storage Division

38 hours agoDIRDEPS_BUILD: Update dependencies.
bdrewery [Thu, 26 May 2016 23:20:07 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Update dependencies.

Sponsored by: EMC / Isilon Storage Division

38 hours agoFix MAKESYSPATH not being sent to sub-makes after r266566.
bdrewery [Thu, 26 May 2016 23:20:04 +0000 (23:20 +0000)]
Fix MAKESYSPATH not being sent to sub-makes after r266566.

Because bmake defaults to .../share/mk now, this code was not doing anything
to help objdir builds (such as the rescue build).  Export the same default.

Sponsored by: EMC / Isilon Storage Division

38 hours agoWITH_META_MODE: Move the kernel support to
bdrewery [Thu, 26 May 2016 23:20:01 +0000 (23:20 +0000)]
WITH_META_MODE: Move the kernel support to

This allows using META_MODE directly from the kernel build directory.
This also allows removing a hack from the DIRDEPS_BUILD kernel target.

Sponsored by: EMC / Isilon Storage Division

38 hours agoRemove leftover _crunchide from r283108
bdrewery [Thu, 26 May 2016 23:19:57 +0000 (23:19 +0000)]
Remove leftover _crunchide from r283108

38 hours agoexec: Provide execpath in imgp for the process_exec hook.
bdrewery [Thu, 26 May 2016 23:19:39 +0000 (23:19 +0000)]
exec: Provide execpath in imgp for the process_exec hook.

This was previously set after the hook and only if auxargs were present.
Now always provide it if possible.

MFC after: 2 weeks
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision:

38 hours agoexec: Add credential change information into imgp for process_exec hook.
bdrewery [Thu, 26 May 2016 23:18:54 +0000 (23:18 +0000)]
exec: Add credential change information into imgp for process_exec hook.

This allows an EVENTHANDLER(process_exec) hook to see if the new image
will cause credentials to change whether due to setgid/setuid or because
of POSIX saved-id semantics.

This adds 3 new fields into image_params:
  struct ucred *newcred Non-null if the credentials will change.
  bool credential_setid True if the new image is setuid or setgid.

This will pre-determine the new credentials before invoking the image
activators, where the process_exec hook is called.  The new credentials
will be installed into the process in the same place as before, after
image activators are done handling the image.

MFC after: 2 weeks
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision:

38 hours agoUse a unique error message if we fail to find the simple network protocol.
jhb [Thu, 26 May 2016 23:08:57 +0000 (23:08 +0000)]
Use a unique error message if we fail to find the simple network protocol.

While here, fix the various net driver callbacks to return early instead
of crashing if this fails.  (The 'init' callback from the netif interface
doesn't return an error if the protocol lookup fails.)

Sponsored by: Cisco Systems