freebsd.git
8 years agoMove f_isinteger() to the top
dteske [Sun, 31 Jan 2016 21:33:24 +0000 (21:33 +0000)]
Move f_isinteger() to the top

Grouping builtins-only algos together

8 years agoMove f_vsprintf() below f_sprintf()
dteske [Sun, 31 Jan 2016 21:31:24 +0000 (21:31 +0000)]
Move f_vsprintf() below f_sprintf()

Variable argument versions grouped with standard versions

8 years agoMove f_sprintf() above f_snprintf()
dteske [Sun, 31 Jan 2016 21:30:02 +0000 (21:30 +0000)]
Move f_sprintf() above f_snprintf()

Ordering functions by appearance of use

8 years agoOptimize f_substr() to use built-ins only
dteske [Sun, 31 Jan 2016 21:28:41 +0000 (21:28 +0000)]
Optimize f_substr() to use built-ins only

Change f_snprintf() to use optimzed f_substr()

8 years agoOptimize f_sprintf() for bash
dteske [Sun, 31 Jan 2016 21:22:10 +0000 (21:22 +0000)]
Optimize f_sprintf() for bash

bash lacks the ksh93 optimization that makes sub-shells fast if they do
not alter io. bash 3.1-alpha1 introduced printf -v var_to_set which is not
as fast but is still significantly faster than var_to_set=$( printf ) when
using any version of bash. If we find our interpreter to somehow be bash
by invocation or inclusion, use the feature that provides fastest results.

8 years agoReset OPTIND to 1 in f_device_find()
dteske [Sun, 31 Jan 2016 21:14:31 +0000 (21:14 +0000)]
Reset OPTIND to 1 in f_device_find()

8 years agoAdd make universe targets "kernels" and "worlds".
ian [Sun, 31 Jan 2016 17:32:58 +0000 (17:32 +0000)]
Add make universe targets "kernels" and "worlds".

"make kernels" is now shorthand for "make universe -DMAKE_JUST_KERNELS"
"make worlds"  is now shorthand for "make universe -DMAKE_JUST_WORLDS"

The kernels target includes modules (unless you add -DNO_MODULES).

And of course you can still add all the other universe options, such as
"make kernels TARGETS=arm" to build kernels for all arm arches, or
TARGET_ARCH=armv6 to build all armv6 kernels, etc.

Reviewed by: imp

8 years agoFix the logic in the ddb command 'show ktr /a'. Prior to r118269 it would
andrew [Sun, 31 Jan 2016 17:32:20 +0000 (17:32 +0000)]
Fix the logic in the ddb command 'show ktr /a'. Prior to r118269 it would
print until cncheckc returned a non -1, i.e. a character had been entered.
After this change it would print only if cncheckc returned a character.
As this was before each call to db_mach_vtrace the normal outcome was
nothing was printed.

With this change 'show ktr /a' will now keep printing until the user stops
the command with a key press, or there is no more entries to print.

8 years agoARM: Fix END() symbol for cpu_ident function. I forgot to rename it
mmel [Sun, 31 Jan 2016 16:55:52 +0000 (16:55 +0000)]
ARM: Fix END() symbol for cpu_ident function. I forgot to rename it
in r295096.

8 years agoARM: cpufunc_domains, cpufunc_faultstatus and cpufunc_faultaddress
mmel [Sun, 31 Jan 2016 16:34:06 +0000 (16:34 +0000)]
ARM: cpufunc_domains, cpufunc_faultstatus and cpufunc_faultaddress
functions are equal for all ARM variants. Remove them from cpu_functions
table.

8 years agoARM: Next round of cpufunc.* cleaning. Nobody uses flush_brnchtgt* functions,
mmel [Sun, 31 Jan 2016 15:36:13 +0000 (15:36 +0000)]
ARM: Next round of cpufunc.* cleaning. Nobody uses flush_brnchtgt* functions,
delete them.

8 years agoFix ixgbe flow control autoneg reporting
smh [Sun, 31 Jan 2016 15:18:03 +0000 (15:18 +0000)]
Fix ixgbe flow control autoneg reporting

Fix ixgbe reporting of flow control autoneg when running under DBG 1

Reviewed by: erj
MFC after: 2 days
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D5089

8 years agoConfigure ixgbe phy & gbic power
smh [Sun, 31 Jan 2016 15:14:23 +0000 (15:14 +0000)]
Configure ixgbe phy & gbic power

Setup phy and gbic power as per Linux 4.3.13 driver.

This fixes link not detected on X540-AT2 after booting to Linux which turns
the phy power off on detach.

Reviewed by: sbruno
MFC after: 2 days
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D5107

8 years agoARM: First round of cpufunc.* cleaning. All abort_fixup functions are
mmel [Sun, 31 Jan 2016 13:59:16 +0000 (13:59 +0000)]
ARM: First round of cpufunc.* cleaning. All abort_fixup functions are
not currently used or defined. Delete them.

8 years agoARM: Rename ARM specific VM_MEMATTR_WT memory attribute to standard one.
mmel [Sun, 31 Jan 2016 09:16:20 +0000 (09:16 +0000)]
ARM: Rename ARM specific VM_MEMATTR_WT memory attribute to standard one.

8 years agoARM: Convert spaces to tabs, fix formatting.
mmel [Sun, 31 Jan 2016 08:53:53 +0000 (08:53 +0000)]
ARM: Convert spaces to tabs, fix formatting.
Not a functional change.

8 years agoARM: Next round of cleanup in swtch-v*.S.
mmel [Sun, 31 Jan 2016 08:06:22 +0000 (08:06 +0000)]
ARM: Next round of cleanup in swtch-v*.S.
 - remove now useless #if __ARM_ARCH conditional
 - use macro for accessing CP15 registers
 - remove unused PCPU_SIZE

Pointed by: kib

8 years agoImplement power command to list all power modes, find out the power
imp [Sat, 30 Jan 2016 22:48:06 +0000 (22:48 +0000)]
Implement power command to list all power modes, find out the power
mode we're in and to set the power mode.

8 years agoMake pfctl(8) work on strict-alignment platforms, by copying a pair of
ian [Sat, 30 Jan 2016 22:03:14 +0000 (22:03 +0000)]
Make pfctl(8) work on strict-alignment platforms, by copying a pair of
embedded structures out of a packed, unaligned struct into local copies
on the stack which are aligned.

The original patch to do this was submitted by Guy Yur <guyyur@gmail.com>,
and this is conceptually the same change, but restructured with the
#ifndef __NO_STRICT_ALIGNMENT wrapper, similar to how the same issue is
handled in the kernel pf code.

PR: 185617
PR: 206658

8 years agosh: Don't allocate a redirtab if there are no redirections.
jilles [Sat, 30 Jan 2016 21:21:25 +0000 (21:21 +0000)]
sh: Don't allocate a redirtab if there are no redirections.

Builtins (including variable assignments without command word), function
calls and redirected compound commands need to restore file descriptors
to their original state after execution. This is handled by allocating a
redirtab structure. These mallocs and frees show up heavily in pmcstat.

Only allocate a redirtab if there are actually redirections and maintain a
count of how many levels of REDIR_PUSH there are without redirtabs.

A simple loop without external programs like

sh -c 'i=0; w=$(printf %0100d 7); while [ "$i" -lt 1000000 ]; do
    i=$((i+1)); done'

is over 25% faster on an amd64 bhyve VM.

8 years agosh(1): Document 'cd -'.
jilles [Sat, 30 Jan 2016 20:10:20 +0000 (20:10 +0000)]
sh(1): Document 'cd -'.

This reflects the changes in r294649 and can therefore not be MFCed by
itself.

8 years agotest: Optimize operator lookup.
jilles [Sat, 30 Jan 2016 19:59:58 +0000 (19:59 +0000)]
test: Optimize operator lookup.

The linear search using strcmp() shows up in pmcstat for several percent.

Split the operators into lengths and whether they start with '-' and compare
bytes using == instead of strcmp().

A simple test

sh -c 'i=0; w=$(printf %0100d 7); while [ "$i" -lt 1000000 ]; do
    v=$(printf %sx%s "$w" "$w"); i=$((i+1)); done'

is over 4% faster on an amd64 bhyve VM.

8 years agoUse the correct type for i when iterating over `buf` to avoid unlikely
ngie [Sat, 30 Jan 2016 18:33:23 +0000 (18:33 +0000)]
Use the correct type for i when iterating over `buf` to avoid unlikely
negative array indexing in iicrdwr(..)

Differential Revision: https://reviews.freebsd.org/D5132
Obtained from: HardenedBSD
PR: 206754
Reported by: CTurt <cturt@hardenedbsd.org>
Submitted by: Madhi Moktari <mokhi64@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoFix the type for hw.ncpu, so sysctlbyname doesn't consistently fail on
ngie [Sat, 30 Jan 2016 17:54:18 +0000 (17:54 +0000)]
Fix the type for hw.ncpu, so sysctlbyname doesn't consistently fail on
64-bit architectures where sizeof(int) != sizeof(size_t).

MFC after: 1 week
PR: 206758
Reported by: Christoph Schönweiler <public2016@hauptsignal.at>
Submitted by: kib
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd missing parentheses. This was reported by ccaughie via GitHub
tuexen [Sat, 30 Jan 2016 17:32:46 +0000 (17:32 +0000)]
Add missing parentheses. This was reported by ccaughie via GitHub
for the userland stack.

MFC after: 3 days

8 years agoRevert r295062 to unbreak buildworld
ngie [Sat, 30 Jan 2016 17:10:14 +0000 (17:10 +0000)]
Revert r295062 to unbreak buildworld

Some of the structures referenced in power.c (in particular
struct nvme_power_state) are missing from sbin/nvmecontrol/

Pointyhat to: imp
Reported by: Jenkins [*], O. Hartmann <ohartman@zedat.fu-berlin.de>, Outback Dingo <outbackdingo@gmail.com>

8 years agoUpdate the path mtu when turning on/off UDP encapsulation for SCTP.
tuexen [Sat, 30 Jan 2016 16:56:39 +0000 (16:56 +0000)]
Update the path mtu when turning on/off UDP encapsulation for SCTP.

MFC after: 3 days

8 years agoThe zfsboot automated part of bsdinstall now supports UEFI
allanjude [Sat, 30 Jan 2016 15:53:28 +0000 (15:53 +0000)]
The zfsboot automated part of bsdinstall now supports UEFI

MFC after: 3 days
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D4960

8 years agoARM: Remove TLB IPI.
mmel [Sat, 30 Jan 2016 13:11:13 +0000 (13:11 +0000)]
ARM: Remove TLB IPI.
We don't support SMP on ARMv6. All ARMv7 multicore cpus already uses
hardware broadcast for TLB and cache operations.

8 years agoDon't allow a remote encapsulation port change during the
tuexen [Sat, 30 Jan 2016 12:58:38 +0000 (12:58 +0000)]
Don't allow a remote encapsulation port change during the
SCTP restart procedure.

MFC after: 3 days

8 years agoARM: Cleanup mp_machdep.c. SMP is supported only on ARMv6 and later.
mmel [Sat, 30 Jan 2016 12:23:28 +0000 (12:23 +0000)]
ARM: Cleanup mp_machdep.c. SMP is supported only on ARMv6 and later.

8 years agoDon't change the remote UDP encapsulation port for SCTP packets
tuexen [Sat, 30 Jan 2016 11:10:22 +0000 (11:10 +0000)]
Don't change the remote UDP encapsulation port for SCTP packets
containing an INIT chunk.

MFC after: 3 days

8 years agoIgnore peer addresses in a consistent way also when checking for
tuexen [Sat, 30 Jan 2016 10:39:05 +0000 (10:39 +0000)]
Ignore peer addresses in a consistent way also when checking for
new addresses during restart. If this is not done, restart doesn't
work when the local socket is IPv4 only and the peer uses
IPv4 and IPv6 addresses.

MFC after: 3 days.

8 years agoARM: Don't misuse ARM_TP_ADDRESS as ARMv4 / ARMv6 selector.
mmel [Sat, 30 Jan 2016 10:10:29 +0000 (10:10 +0000)]
ARM: Don't misuse ARM_TP_ADDRESS as ARMv4 / ARMv6 selector.

8 years agoEHCI: Correct address of EHCI_USBMODE_LPM register is 0xC8, not 0xA8.
mmel [Sat, 30 Jan 2016 08:27:09 +0000 (08:27 +0000)]
EHCI: Correct address of EHCI_USBMODE_LPM register is 0xC8, not 0xA8.

8 years agoARM: Split swtch.S into common, ARMv4 and ARMv6 parts. Cleanup them.
mmel [Sat, 30 Jan 2016 08:02:12 +0000 (08:02 +0000)]
ARM: Split swtch.S into common, ARMv4 and ARMv6 parts. Cleanup them.

8 years agoPreliminary EFI support. Based, in part, on patches from Andy Turner.
imp [Sat, 30 Jan 2016 07:00:36 +0000 (07:00 +0000)]
Preliminary EFI support. Based, in part, on patches from Andy Turner.

Add support for being able to boot off both UEFI and BIOS firmware,
ala the memstick trick.

Add support for writing to GPT volumes.

Move away from using bsd labels at all for these embedded stuff.

Minor tweaks to README.

8 years agoTwo new variables: NANO_ROOT and NANO_ALTROOT. These used to be
imp [Sat, 30 Jan 2016 07:00:29 +0000 (07:00 +0000)]
Two new variables: NANO_ROOT and NANO_ALTROOT. These used to be
spelled ${NANO_SLICE_ROOT}a and ${NANO_SLICE_ALTROOT}a respectively,
and that's the default value. This will allow nanobsd on systems
without a bsd label. That's rarely needed these days, even in an MBR
world. The default will shift to this in the future, but remain an
option.

8 years agoTwo new config files. One that has UEFI booting, and the other that
imp [Sat, 30 Jan 2016 07:00:28 +0000 (07:00 +0000)]
Two new config files. One that has UEFI booting, and the other that
can do both UEFI and BIOS/GPT booting. Support for nanobsd coming
soon.

Based in part in a patch from: andrew@

8 years agoImplement power command to list all power modes, find out the power
imp [Sat, 30 Jan 2016 06:18:37 +0000 (06:18 +0000)]
Implement power command to list all power modes, find out the power
mode we're in and to set the power mode.

8 years agoThis seems like a very trivial bug that should have been squashed a long
sobomax [Sat, 30 Jan 2016 04:16:05 +0000 (04:16 +0000)]
This seems like a very trivial bug that should have been squashed a long
time ago, but for some reason it was not. Basically, without this change
dlopen(3)'ing an empty .so file would just cause application to dump core
with SIGSEGV.

Make sure the file has enough data for at least the ELF header before
mmap'ing it.

Add a test case to check that dlopen an empty file return an error.

There were a separate discussion as to whether it should be SIGBUS
instead when you try to access region mapped from an empty file,
but it's definitely SIGSEGV now, so if anyone want to check that please
be my guest.
Reviewed by: mjg, cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D5112

8 years agoAdd a SYSDECODE_ABI_ prefix to the ABI enums to avoid potential collisions.
jhb [Sat, 30 Jan 2016 01:00:54 +0000 (01:00 +0000)]
Add a SYSDECODE_ABI_ prefix to the ABI enums to avoid potential collisions.

Suggested by: jmallett
Reviewed by: bdrewery, jmallett
Differential Revision: https://reviews.freebsd.org/D5123

8 years agoFix phy interrupts setup for ixl
smh [Fri, 29 Jan 2016 21:06:59 +0000 (21:06 +0000)]
Fix phy interrupts setup for ixl

Fix the inverted set of interrupts being used as the mask for ixl.

Without this ixl devices fail to detect link state changes.

Reviewed by: erj, sbruno
MFC after: 2 days
Sponsored by: Multiplay

8 years agoFix sending IPI to all CPUs on ARM64
zbb [Fri, 29 Jan 2016 18:43:51 +0000 (18:43 +0000)]
Fix sending IPI to all CPUs on ARM64

There is no explanation why IPI ID is incremented here by "16".
This should have been removed in r285533 but somehow survived.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5120

8 years agoRetire pmap_pte_init_mmu_v6() which was used by old pmap-v6.
skra [Fri, 29 Jan 2016 17:43:03 +0000 (17:43 +0000)]
Retire pmap_pte_init_mmu_v6() which was used by old pmap-v6.

8 years agoMFV 295046: 6358 A faulted pool with only unavailable vdevs triggers
mav [Fri, 29 Jan 2016 17:20:59 +0000 (17:20 +0000)]
MFV 295046: 6358 A faulted pool with only unavailable vdevs triggers
assertion failure in libzfs

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Serban Maduta <serban.maduta@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Dan Vatca <dan.vatca@gmail.com>

illumos/illumos-gate@b289d045e084af53efcc025255af8242e41f28fa

8 years agoAdd a sysctl to allow ZFS pools backed by zvols
asomers [Fri, 29 Jan 2016 17:08:26 +0000 (17:08 +0000)]
Add a sysctl to allow ZFS pools backed by zvols

Change 294329 removed the ability to build ZFS pools that are backed by
zvols, because having that ability (even if it's not used) leads to
deadlocks. By popular demand, I'm adding an off-by-default sysctl to
reenable that ability.

Reviewed by: lidl, delphij
MFC after: Never
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D4998

8 years agoRemove NPTEPG definition which is not used anywhere now after
skra [Fri, 29 Jan 2016 16:42:03 +0000 (16:42 +0000)]
Remove NPTEPG definition which is not used anywhere now after
introduction of new pmap dump interface (r294722). And do not
expose pt_entry_t type.

8 years agoUse kernel_pmap directly instead of pmap_kernel(). The kernel_pmap is
skra [Fri, 29 Jan 2016 16:01:37 +0000 (16:01 +0000)]
Use kernel_pmap directly instead of pmap_kernel(). The kernel_pmap is
already used for __ARM_ARCH >= 6 and so even for __ARM_ARCH < 6 on some
common places.

8 years agoWelcome the RISC-V 64-bit kernel.
br [Fri, 29 Jan 2016 15:12:31 +0000 (15:12 +0000)]
Welcome the RISC-V 64-bit kernel.

This is the final step required allowing to compile and to run RISC-V
kernel and userland from HEAD.

RISC-V is a completely open ISA that is freely available to academia
and industry.

Thanks to all the people involved! Special thanks to Andrew Turner,
David Chisnall, Ed Maste, Konstantin Belousov, John Baldwin and
Arun Thomas for their help.
Thanks to Robert Watson for organizing this project.

This project sponsored by UK Higher Education Innovation Fund (HEIF5) and
DARPA CTSRD project at the University of Cambridge Computer Laboratory.

FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv

Reviewed by: andrew, emaste, kib
Relnotes: Yes
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D4982

8 years agoAdd implementations of sendmmsg(3) and recvmmsg(3) functions which
kib [Fri, 29 Jan 2016 14:12:12 +0000 (14:12 +0000)]
Add implementations of sendmmsg(3) and recvmmsg(3) functions which
wraps sendmsg(2) and recvmsg(2) into batch send and receive operation.
The goal of this implementation is only to provide API compatibility
with Linux.

The cancellation behaviour of the functions is not quite right, but
due to relative rare use of cancellation it is considered acceptable
comparing with the complexity of the correct implementation.  If
functions are reimplemented as syscalls, the fix would come almost
trivial.  The direct use of the syscall trampolines instead of libc
wrappers for sendmsg(2) and recvmsg(2) is to avoid data loss on
cancellation.

Submitted by: Boris Astardzhiev <boris.astardzhiev@gmail.com>
Discussed with: jilles (cancellation behaviour)
MFC after: 1 month

8 years agoFramework for ARM64 instruction disassembler
wma [Fri, 29 Jan 2016 13:06:30 +0000 (13:06 +0000)]
Framework for ARM64 instruction disassembler

    Provide an easy to use framework for ARM64 DDB disassembler.
    This commit does not contain full list of instruction opcodes.

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb, andrew, cognet
Differential revision: https://reviews.freebsd.org/D5114

8 years agoARM: After removal of old pmap-v6 code, rename pmap-v6-new.c to pmap-v6.c.
mmel [Fri, 29 Jan 2016 11:00:33 +0000 (11:00 +0000)]
ARM: After removal of old pmap-v6 code, rename pmap-v6-new.c to pmap-v6.c.

8 years agoARM: remove old pmap-v6 code. The new pmap-v6 is mature enough, and
mmel [Fri, 29 Jan 2016 10:31:54 +0000 (10:31 +0000)]
ARM: remove old pmap-v6 code. The new pmap-v6 is mature enough, and
dual implementation is showstopper for major cleanup.

This patch only removes old code from tree. Cleanups will follow asap.

8 years agoUse '^[>+][^+]' instead of '^[>+]' with grep(1) when filtering the
marius [Fri, 29 Jan 2016 01:54:32 +0000 (01:54 +0000)]
Use '^[>+][^+]' instead of '^[>+]' with grep(1) when filtering the
diff(1) output between two files in "new_only"-mode. Otherwise,
with the default of using unified format a remnant of the header
in the output is the result. This is especially irritating when
the two files differ but the second one is empty, amounting to the
vestige of the header being the only readout.
Reported by: Stefan Haemmerl

MFC after: 3 days

8 years agoUse intptr_t note ptrdiff_t when storing flags in the bottom bits of
brooks [Fri, 29 Jan 2016 01:22:12 +0000 (01:22 +0000)]
Use intptr_t note ptrdiff_t when storing flags in the bottom bits of
pointers.

Obtained from: CheriBSD (e3a69027cc5a384431156d61c90d4304387a9b9d)
Sponsored by: DARPA, AFRL

8 years agoNote the double fork behavior with filemon.
bdrewery [Fri, 29 Jan 2016 01:09:04 +0000 (01:09 +0000)]
Note the double fork behavior with filemon.

X-MFC-With: r295029
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoDocument the purpose and non-purpose of filemon(4).
bdrewery [Fri, 29 Jan 2016 01:00:12 +0000 (01:00 +0000)]
Document the purpose and non-purpose of filemon(4).

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

8 years agoDeclare bt_devenum() to match the definition.
brooks [Fri, 29 Jan 2016 00:59:48 +0000 (00:59 +0000)]
Declare bt_devenum() to match the definition.

Obtained from: CheriBSD (1c1dad87ef9983a4ca0c7d6eb0792d489436bcd1)
MFC after: 1 week
Sponsored by: DARPA, AFRL

8 years agofilemon: Track the process pointer rather than a pid.
bdrewery [Fri, 29 Jan 2016 00:44:32 +0000 (00:44 +0000)]
filemon: Track the process pointer rather than a pid.

The process is not held since the process_exit hook is called after the
exithold.  There is no need to hold the process since the hook will
always see it exiting via the process_exit event.

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

8 years agofilemon_open: Don't record a process to trace here.
bdrewery [Fri, 29 Jan 2016 00:44:28 +0000 (00:44 +0000)]
filemon_open: Don't record a process to trace here.

Only ioctl(FILEMON_SET_PID) should be setting the process-to-be-traced.

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

8 years agonvd: add hw.nvd.delete_max tunable
jimharris [Thu, 28 Jan 2016 23:15:14 +0000 (23:15 +0000)]
nvd: add hw.nvd.delete_max tunable

The NVMe specification does not define a maximum or optimal delete
size, so technically max delete size is min(full size of namespace,
2^32 - 1 LBAs).  A single delete operation for a multi-TB NVMe
namespace though may take much longer to complete than the nvme(4)
I/O timeout period.  So choose a sensible default here that is still
suitably large to minimize the number of overall delete operations.

This also fixes possible uint32_t overflow on initial TRIM operation
for zpool create operations for NVMe namespaces with >4G LBAs.

MFC after: 3 days
Sponsored by: Intel

8 years agoRemove debug output which was committed by accident.
tuexen [Thu, 28 Jan 2016 23:12:12 +0000 (23:12 +0000)]
Remove debug output which was committed by accident.
Thanks to Oliver Pinter for reporting.

MFC after: 3 days
X-MFC with: r294995

8 years agofilemon: Use process_exec EVENTHANDLER to capture sys_execve.
bdrewery [Thu, 28 Jan 2016 21:45:25 +0000 (21:45 +0000)]
filemon: Use process_exec EVENTHANDLER to capture sys_execve.

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

8 years agokqueue EVFILT_PROC: avoid collision between NOTE_CHILD and NOTE_EXIT
vangyzen [Thu, 28 Jan 2016 20:24:15 +0000 (20:24 +0000)]
kqueue EVFILT_PROC: avoid collision between NOTE_CHILD and NOTE_EXIT

NOTE_CHILD and NOTE_EXIT return something in kevent.data: the parent
pid (ppid) for NOTE_CHILD and the exit status for NOTE_EXIT.
Do not let the two events be combined, since one would overwrite
the other's data.

PR: 180385
Submitted by: David A. Bright <david_a_bright@dell.com>
Reviewed by: jhb
MFC after: 1 month
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D4900

8 years agoMerge OpenSSL 1.0.2f.
jkim [Thu, 28 Jan 2016 20:15:22 +0000 (20:15 +0000)]
Merge OpenSSL 1.0.2f.

Relnotes: yes

8 years agoFix -include .depend hack from r294370 for headers not in .PATH.
bdrewery [Thu, 28 Jan 2016 18:57:47 +0000 (18:57 +0000)]
Fix -include .depend hack from r294370 for headers not in .PATH.

This hack will be removed in a few weeks.  It is here to fix incremental
builds of SSH between r291941 and r294370.

Reported by: jmallett
MFC after: 1 day
Sponsored by: EMC / Isilon Storage Division

8 years agoImport OpenSSL 1.0.2f.
jkim [Thu, 28 Jan 2016 18:41:59 +0000 (18:41 +0000)]
Import OpenSSL 1.0.2f.

8 years agoFix VNIC enumeration after r294993 and r294990
zbb [Thu, 28 Jan 2016 16:58:49 +0000 (16:58 +0000)]
Fix VNIC enumeration after r294993 and r294990

ofw_bus_get_node() must be tested against negative values since
missing parent bus method will result in calling the default method
which simply returns (-1): sys/dev/ofw/ofw_bus_if.m
This was lost in the review process.

Obtained from: Semihalf
Sponsored by:  Cavium

8 years agoUse m_getjcl() instead of manually selecting zone.
glebius [Thu, 28 Jan 2016 16:51:56 +0000 (16:51 +0000)]
Use m_getjcl() instead of manually selecting zone.

Reviewed by: arybchik

8 years agoAlways look in the TCP pool.
tuexen [Thu, 28 Jan 2016 16:05:46 +0000 (16:05 +0000)]
Always look in the TCP pool.
This fixes issues with a restarting peer when the listening
1-to-1 style socket is closed.

MFC after: 3 days

8 years agoSupport new MDIO hierarchy in ThunderX DTB
zbb [Thu, 28 Jan 2016 15:44:14 +0000 (15:44 +0000)]
Support new MDIO hierarchy in ThunderX DTB

Some firmware revisions provide different DTB tree that include
odd MDIO placement in the tree.
This commit adds support for 2 new buses:
- MRML bridge (PCIB subordinate)
- MDIO nexus (MRML subordinate)
This allows for the correct MDIO attachment with both - new and old
firmware.

Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5070

8 years agoAdd FDT bus capabilities to ThunderX PCI driver
zbb [Thu, 28 Jan 2016 15:40:56 +0000 (15:40 +0000)]
Add FDT bus capabilities to ThunderX PCI driver

New ThunderX firmware incorporates modified DTB that presents
different device hierarchy. In the new device tree, MDIO
devices are below two additional buses that oddly hang on
PCI bridge.

Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5069

8 years agoCorrect alloc_ and release_resource methods in thunder_pcie driver
zbb [Thu, 28 Jan 2016 15:38:02 +0000 (15:38 +0000)]
Correct alloc_ and release_resource methods in thunder_pcie driver

- Avoid using BUS_ macros as bus_generic_ functions should be used instead.
- Fix mistaken device_t pointers in thunder_pcie_alloc_resource.
  Should use dev->parent method and allocate resource for child device

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5068

8 years agoDivide ThunderX PCIe driver to general and FDT part
zbb [Thu, 28 Jan 2016 15:34:13 +0000 (15:34 +0000)]
Divide ThunderX PCIe driver to general and FDT part

- Separate FDT and general PCIe driver parts
- Drop some irrelevant printfs that cannot be displayed in
  FDT attach
- Move ranges parsing to FDT portion of PCIe code

Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5067

8 years agoFix finding appropriate BGX node in DTB and move it to a separate function
zbb [Thu, 28 Jan 2016 15:30:58 +0000 (15:30 +0000)]
Fix finding appropriate BGX node in DTB and move it to a separate function

Search for BGX node in DTS in two ways:
1. Try to find it uder root node first
2. If not found under root, find the top level PCI bridge node
   and search all nodes below it until appropriate BGX node is found.
Move search code to another function to make the code more clear.
Remove unused variable by the way.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5066

8 years agoEHCI: Make core reset and port speed reading more generic.
mmel [Thu, 28 Jan 2016 14:11:59 +0000 (14:11 +0000)]
EHCI: Make core reset and port speed reading more generic.

Use driver settable callbacks for handling of:
- core post reset
- reading actual port speed

Typically, OTG enabled EHCI cores wants setting of USBMODE register,
but this register is not defined in EHCI specification and different
cores can have it on different offset.

Also, for cores with TT extension, actual port speed must be determinable.
But again, EHCI specification not covers this so this patch provides
function for two most common variant of speed bits layout.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D5088

8 years agoSMP support for ARMv6/v7 HW watchpoints
zbb [Thu, 28 Jan 2016 12:43:58 +0000 (12:43 +0000)]
SMP support for ARMv6/v7 HW watchpoints

Use per-CPU structure to store HW watchpoints registers state
for each CPU present in the system. Those registers will be restored
upon wake up from the STOP state if requested by the debug_monitor
code. The method is similar to the one introduced to AMD64.

We store all possible 16 registers for HW watchpoints
(maximum allowed by the architecture).
HW breakpoints are not maintained since they are used for single
stepping only.

Pointed out by: kib
Reviewed by:    wma
No strong objections from: kib
Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4338

8 years agoRemove ffs_mountroot() prototype; seems to be long gone.
trasz [Thu, 28 Jan 2016 12:21:23 +0000 (12:21 +0000)]
Remove ffs_mountroot() prototype; seems to be long gone.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoFix mutex releasing in ARM64 cpu_switch
wma [Thu, 28 Jan 2016 12:00:17 +0000 (12:00 +0000)]
Fix mutex releasing in ARM64 cpu_switch

    The code should be comparing pointers, not any data
    gathered from a blocked_lock.

Spotted by:            cognet
Approved by:           zbb, cognet (mentor)
Differential revision: https://reviews.freebsd.org/D5100

8 years agoAdd pidfile support to ggated(8)
ngie [Thu, 28 Jan 2016 03:24:06 +0000 (03:24 +0000)]
Add pidfile support to ggated(8)

The tests will manipulate the system daemon today, which can cause undesired
service interruption when the tests are run.

This change allows the geom_gate tests to be run with an arbitrary ggated(8)
daemon / geom_gate(4) device pairing.

Other changes:
- Sort #includes
- Use a more common idiom for parsing options with getopt(3)

Differential Revision: https://reviews.freebsd.org/D4836
MFC after: 2 weeks
Reviewed by: bjk (manpages), pjd (maintainer timeout)
Sponsored by: EMC / Isilon Storage Division

8 years agoFollow-up r294967: Mark flags unused.
bdrewery [Thu, 28 Jan 2016 01:19:19 +0000 (01:19 +0000)]
Follow-up r294967: Mark flags unused.

X-MFC-With: r294967
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agofilemon: Trace fork via process_fork event.
bdrewery [Thu, 28 Jan 2016 01:17:55 +0000 (01:17 +0000)]
filemon: Trace fork via process_fork event.

This avoids needing ugly hooks and needing both a vfork and fork
handler.

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

8 years agofilemon: Use process_exit EVENTHANDLER to capture process exit.
bdrewery [Thu, 28 Jan 2016 00:51:17 +0000 (00:51 +0000)]
filemon: Use process_exit EVENTHANDLER to capture process exit.

This fixes some cases where a process could exit without being untracked
by filemon.

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

8 years agofilemon_dtr: Lock the associated filemon handle before writing to it.
bdrewery [Wed, 27 Jan 2016 21:37:43 +0000 (21:37 +0000)]
filemon_dtr: Lock the associated filemon handle before writing to it.

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

8 years agoThis fixes a bug in UFS2 exported NFS volumes. An NFS client can
mckusick [Wed, 27 Jan 2016 21:27:05 +0000 (21:27 +0000)]
This fixes a bug in UFS2 exported NFS volumes. An NFS client can
crash a server that has exported UFS2 by presenting a filehandle
with an inode number that references an uninitialized inode in a
cylinder group. The problem is that UFS2 only initializes blocks
of inodes as they are first allocated and ffs_fhtovp() does not
validate that the inode is in a range of inodes that have been
initialized. Attempting to read an uninitialized inode gets random
data from the disk. When the kernel tries to interpret it as an
inode, panics often arise.

Reported by: Christos Zoulas (from NetBSD)
Reviewed by: kib

8 years agoThe bread() function was inconsistent about whether it would return
mckusick [Wed, 27 Jan 2016 21:23:01 +0000 (21:23 +0000)]
The bread() function was inconsistent about whether it would return
a buffer pointer in the event of an error (for some errors it would
return a buffer pointer and for other errors it would not return a
buffer pointer). The cluster_read() function was similarly inconsistent.

Clients of these functions were inconsistent in handling errors.
Some would assume that no buffer was returned after an error and
would thus lose buffers under certain error conditions. Others would
assume that brelse() should always be called after an error and
would thus panic the system under certain error conditions.

To correct both of these problems with minimal code churn, bread()
and cluster_write() now always free the buffer when returning an
error thus ensuring that buffers will never be lost. The brelse()
routine checks for being passed a NULL buffer pointer and silently
returns to avoid panics. Thus both approaches to handling error
returns from bread() and cluster_read() will work correctly.

Future code should be written assuming that bread() and cluster_read()
will never return a buffer with an error, so should not attempt to
brelse() the buffer when an error is returned.

Reviewed by: kib

8 years agofilemon_comment has nothing to do with wrappers so move it out of filemon_wrapper.c.
bdrewery [Wed, 27 Jan 2016 21:17:43 +0000 (21:17 +0000)]
filemon_comment has nothing to do with wrappers so move it out of filemon_wrapper.c.

It only prints the header from filemon_ioctl.  Keep the name though to stay
closer to other implementations.

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

8 years agofilemon_ioctl: Lock the associated filemon handle before writing to it.
bdrewery [Wed, 27 Jan 2016 21:14:09 +0000 (21:14 +0000)]
filemon_ioctl: Lock the associated filemon handle before writing to it.

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

8 years agofilemon_ioctl: Handle error from devfs_get_cdevpriv(9).
bdrewery [Wed, 27 Jan 2016 21:12:18 +0000 (21:12 +0000)]
filemon_ioctl: Handle error from devfs_get_cdevpriv(9).

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

8 years agoReplace prebuilt uuencoded gallant.fnt with editable hex version
emaste [Wed, 27 Jan 2016 20:23:42 +0000 (20:23 +0000)]
Replace prebuilt uuencoded gallant.fnt with editable hex version

8 years agoDo not unlock rtld_phdr_lock over callback invocations.
kan [Wed, 27 Jan 2016 20:20:37 +0000 (20:20 +0000)]
Do not unlock rtld_phdr_lock over callback invocations.

The dl_iterate_phdr consumer code in libgcc does not expect multiple
callbacks running concurrently. This was fixed once already in r178807,
but accidentally got reverted in r294373.

8 years agoMake .debug file for libgcc_s.so.1 more useful.
kan [Wed, 27 Jan 2016 20:20:35 +0000 (20:20 +0000)]
Make .debug file for libgcc_s.so.1 more useful.

The files compiled into libgcc_s.so.1 did not have -g on
compiler command line, making generated .debug quite
pointless.

8 years agoktrace: tidy up ktrstruct
mjg [Wed, 27 Jan 2016 19:55:02 +0000 (19:55 +0000)]
ktrace: tidy up ktrstruct

- minor style fixes
- avoid doing strlen twice [1]

PR: 206648
Submitted by: C Turt <ecturt gmail.com> (original version) [1]

8 years agoDrop any previous fd when setting a new one.
bdrewery [Wed, 27 Jan 2016 19:11:11 +0000 (19:11 +0000)]
Drop any previous fd when setting a new one.

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

8 years agoImprove reporting of connection problems in iscsid(8).
trasz [Wed, 27 Jan 2016 18:12:42 +0000 (18:12 +0000)]
Improve reporting of connection problems in iscsid(8).

Obtained from: Mellanox Technologies
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoRename netinet/tcp_cc.h to netinet/cc/cc.h.
glebius [Wed, 27 Jan 2016 17:59:39 +0000 (17:59 +0000)]
Rename netinet/tcp_cc.h to netinet/cc/cc.h.

Discussed with: lstewart

8 years agoConvert ss_sp in stack_t and sigstack to void *.
jhb [Wed, 27 Jan 2016 17:55:01 +0000 (17:55 +0000)]
Convert ss_sp in stack_t and sigstack to void *.

POSIX requires these members to be of type void * rather than the
char * inherited from 4BSD.  NetBSD and OpenBSD both changed their
fields to void * back in 1998.  No new build failures were reported
via an exp-run.

PR: 206503 (exp-run)
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D5092

8 years agoFix the value we print when the size is too large. While here fix the types
andrew [Wed, 27 Jan 2016 17:47:07 +0000 (17:47 +0000)]
Fix the value we print when the size is too large. While here fix the types
we cast to to be unsigned as the data is unsigned.

Reviewed by: ian

8 years agoWhen finding the physical address of a device allow intermediate addresses
andrew [Wed, 27 Jan 2016 17:33:31 +0000 (17:33 +0000)]
When finding the physical address of a device allow intermediate addresses
to be 64-bit on 32-bit architectures. It is not uncommon for device trees
to use the upper 32-bits to store what effectively is an index into the
parent ranges property. In this case, when running with a 32-bit bus_addr_t
and bus_size_t, we would previously truncate the address, this may then
incorrectly match the wrong range, and return the wrong address.

Tested by: bz (earlier version)