6 hours agoAdd the start of a GENERIC armv6 kernel config. This supports the Allwinner master github/master
andrew [Sun, 25 Sep 2016 07:48:08 +0000 (07:48 +0000)]
Add the start of a GENERIC armv6 kernel config. This supports the Allwinner
SMP SoCs and qemu virt. Further SoCs can be supported if they support the

Tested by: manu
Sponsored by: ABT Systems Ltd

15 hours agoGive the user a clue as to which process hit maxfiles.
julian [Sat, 24 Sep 2016 22:56:13 +0000 (22:56 +0000)]
Give the user a clue as to which process hit maxfiles.

MFC after: 1 week
Sponsored by: Panzura

16 hours agoConvert checks in nd6_dad_start() and nd6_dad_timer() to assertions.
markj [Sat, 24 Sep 2016 21:40:24 +0000 (21:40 +0000)]
Convert checks in nd6_dad_start() and nd6_dad_timer() to assertions.

In particular, these functions can assume they are operating on tentative

MFC after: 2 weeks

16 hours agoMove implementations of uread() and uwrite() to the illumos compat layer.
markj [Sat, 24 Sep 2016 21:40:14 +0000 (21:40 +0000)]
Move implementations of uread() and uwrite() to the illumos compat layer.

MFC after: 1 week

18 hours agocxgbe(4): Use the port's top speed to figure out whether it is "high
np [Sat, 24 Sep 2016 19:03:05 +0000 (19:03 +0000)]
cxgbe(4): Use the port's top speed to figure out whether it is "high
speed" or not (for the purpose of calculating the number of queues etc.)
This does the right thing for 25Gbps and 100Gbps ports.

20 hours agoWhen MAKEOBJDIRPREFIX points to a case-insensitive file system, the
marcel [Sat, 24 Sep 2016 17:50:11 +0000 (17:50 +0000)]
When MAKEOBJDIRPREFIX points to a case-insensitive file system, the
build can break when different source files create the same target
files (case-insensitivity speaking).  This is the case for object
files compiled with -fpic and shared libraries. The former uses
an extension of ".So", and the latter an extension ".so".  Rename
shared object files from *.So to *.pico to match what NetBSD does.

Missed in r306297

MFC after: 1 month
Sponsored by: Bracket Computing
Differential Revision:

20 hours agoUpdate local variable 'block' after calling capacity_resize(),
marcel [Sat, 24 Sep 2016 17:29:27 +0000 (17:29 +0000)]
Update local variable 'block' after calling capacity_resize(),
otherwise format_resize(), which is called right after, isn't
getting the current/actual image size. Rather than rounding up,
format_resize() could end up truncating the size and we don't
allow that by design.

MFC after: 1 week

22 hours agoWhen MAKEOBJDIRPREFIX points to a case-insensitive file system, the
marcel [Sat, 24 Sep 2016 15:11:27 +0000 (15:11 +0000)]
When MAKEOBJDIRPREFIX points to a case-insensitive file system, the
build can break when different source files create the same target
files (case-insensitivity speaking).  This is the case for object
files compiled with -fpic and shared libraries. The former uses
an extension of ".So", and the latter an extension ".so".  Rename
shared object files from *.So to *.pico to match what NetBSD does.

See also r305855

MFC after: 1 month
Sponsored by: Bracket Computing
Differential Revision:

24 hours agocxgbe(4): Support SIOGIFXMEDIA so that ifconfig displays correct media
np [Sat, 24 Sep 2016 13:23:47 +0000 (13:23 +0000)]
cxgbe(4): Support SIOGIFXMEDIA so that ifconfig displays correct media
for 25Gbps and 100Gbps ports.   This should have been part of r305713,
which is when the driver first started reporting extended media types.

29 hours agofix vnode lock assertion for extended attributes directory
avg [Sat, 24 Sep 2016 08:13:15 +0000 (08:13 +0000)]
fix vnode lock assertion for extended attributes directory

Background.  In ZFS a file with extended attributes has a special
directory associated with it where each extended attribute is a file.
The attribute's name is a file name and its value is a file content.
When the ownership of a file with extended attributes is changed, ZFS
also changes ownership of the special directory.  This is where the bug
was hit.

The bug was introduced in r209158.

Nota bene.  ZFS vnode locks are typically acquired before
z_teardown_lock (i.e., before ZFS_ENTER).  But this is not the case for
the vnodes that represent the extended attribute directory and files.
Those are always locked after ZFS_ENTER.  This is confusing and fragile.

PR: 212702
Reported by: Christian Fuss to FreeNAS
Tested by: mav
MFC after: 1 week

30 hours agothe rest of changes intended to be committed in r306290
avg [Sat, 24 Sep 2016 07:59:54 +0000 (07:59 +0000)]
the rest of changes intended to be committed in r306290

MFC after: 5 days
X-MFC with: r306218

30 hours agoclarify description of the 0x790b1022 / "KERNCZ"/ "CZ" device
avg [Sat, 24 Sep 2016 07:55:49 +0000 (07:55 +0000)]
clarify description of the 0x790b1022 / "KERNCZ"/ "CZ" device

MFC after: 5 days
X-MFC with: r306218

30 hours agobridge: Fix fragment handling and memory leak
kp [Sat, 24 Sep 2016 07:09:43 +0000 (07:09 +0000)]
bridge: Fix fragment handling and memory leak

Fragmented UDP and ICMP packets were corrupted if a firewall with reassembling
feature (like pf'scrub) is enabled on the bridge.  This patch fixes corrupted
packet problem and the panic (triggered easly with low RAM) as explain in PR

bridge_pfil and bridge_fragment relationship:

bridge_pfil() receive (IN direction) packets and sent it to the firewall The
firewall can be configured for reassembling fragmented packet (like pf'scrubing)
in one mbuf chain when bridge_pfil() need to send this reassembled packet to the
outgoing interface, it needs to re-fragment it by using bridge_fragment()
bridge_fragment() had to split this mbuf (using ip_fragment) first then
had to M_PREPEND each packet in the mbuf chain for adding Ethernet

But M_PREPEND can sometime create a new mbuf on the begining of the mbuf chain,
then the "main" pointer of this mbuf chain should be updated and this case is
tottaly forgotten. The original bridge_fragment code (Revision 158140,
2006 April 29) came from OpenBSD, and the call to bridge_enqueue was
embedded.  But on FreeBSD, bridge_enqueue() is done after bridge_fragment(),
then the original OpenBSD code can't work as-it of FreeBSD.

PR: 185633
Submitted by: Olivier Cochard-LabbĂ©
Differential Revision:

32 hours agoFix ds1307 probing
jhibbits [Sat, 24 Sep 2016 05:27:12 +0000 (05:27 +0000)]
Fix ds1307 probing

'compat' can never be NULL, because the compatible check loop ends when
compat->ocd_str is NULL.  This causes ds1307 to attach to any unclaimed i2c

33 hours agobhnd(4): Implement common API for IOST/IOCTL register access and core reset
landonf [Sat, 24 Sep 2016 04:08:16 +0000 (04:08 +0000)]
bhnd(4): Implement common API for IOST/IOCTL register access and core reset

- Added bhnd(4) bus APIs for per-core ioctl/iost register access.
- Updated reset/suspend bhnd(4) APIs for compatibility with ioctl/iost
- Implemented core reset/suspend support for both bcma(4) and siba(4).
- Implemented explicit release of all outstanding PMU requests at the bus
  level when putting a core into reset.

Approved by:    adrian (mentor, implicit)
Differential Revision:

36 hours ago[iwm] fix default antenna selection a bit; fix 5GHz rate control handling.
adrian [Sat, 24 Sep 2016 01:21:42 +0000 (01:21 +0000)]
[iwm] fix default antenna selection a bit; fix 5GHz rate control handling.

* Don't do the antenna switching when setting up the rate table - we don't
  take into account whether it's an active antenna or not (eg shared with BT.)
  I'll look into this a bit more later.

* The default antenna is still 1, I'll look into that a bit more later.
  (So no, this doesn't fix it for Larry who needs ANT_B to be active, not

* My changes to the rate control setup used the wrong method for finding
  a suitable rate, which led to 1M CCK frames being queued for 11a operation.
  This is .. sub-optimal.  Change the rate control lookup path to use
  the global table instead of the per-node table, which won't be setup
  until the node rate table is setup (which happens way too late in this


* Intel 7260, 2G and 5G operation.

36 hours agoRename ndpr_refcnt to ndpr_addrcnt.
markj [Sat, 24 Sep 2016 01:14:25 +0000 (01:14 +0000)]
Rename ndpr_refcnt to ndpr_addrcnt.

This field counts derived addresses and is not a true refcount for prefix
objects, so the previous name was misleading.

MFC after: 1 week

38 hours agoFixes for issues under high workloads
davidcs [Fri, 23 Sep 2016 23:18:54 +0000 (23:18 +0000)]
Fixes for issues under high workloads

MFC after:5 days

38 hours agocloudabi: use fget_cap instead of hand-rolling capability read
mjg [Fri, 23 Sep 2016 23:08:23 +0000 (23:08 +0000)]
cloudabi: use fget_cap instead of hand-rolling capability read

This has a side effect of unbreaking the build after r306272.

Discussed with: ed

39 hours agoDIRDEPS_BUILD: Connect new directories.
bdrewery [Fri, 23 Sep 2016 22:46:19 +0000 (22:46 +0000)]
DIRDEPS_BUILD: Connect new directories.

Sponsored by: Dell EMC Isilon

40 hours agoUse g_wither_provider() where applicable.
mav [Fri, 23 Sep 2016 21:29:40 +0000 (21:29 +0000)]
Use g_wither_provider() where applicable.

It is just a helper function combining G_PF_WITHER setting with

41 hours agocxgbe(4): Make the location/length of all descriptor rings available in
np [Fri, 23 Sep 2016 20:03:28 +0000 (20:03 +0000)]
cxgbe(4): Make the location/length of all descriptor rings available in
the sysctl MIB.

42 hours agoMount msdosfs with longnames support by default.
asomers [Fri, 23 Sep 2016 19:05:07 +0000 (19:05 +0000)]
Mount msdosfs with longnames support by default.

The old behavior depended on the FAT version and on what files were in the
root directory. "mount_msdosfs -o shortnames" is still supported.

Reviewed by: wblock, cem
Discussed with: trasz, adrian, imp
MFC after: 4 weeks
X-MFC-Notes: Don't MFC the removal of findwin95
Differential Revision:

43 hours agoDo not perform extra check for NULL, evdev_free can handle NULL value
gonzo [Fri, 23 Sep 2016 18:55:32 +0000 (18:55 +0000)]
Do not perform extra check for NULL, evdev_free can handle NULL value

Submitted by: Vladimir Kondratiev <>

43 hours agoHandle NULL argument in evdev_free
gonzo [Fri, 23 Sep 2016 18:54:08 +0000 (18:54 +0000)]
Handle NULL argument in evdev_free

Add check for evdev argument of evdev_free being NULL. This is valid
value and should not cause crash. In this case evdev_free does nothing

Submitted by: Vladimir Kondratiev <>

44 hours agocxgbe(4): Fix netmap with T6, which doesn't encapsulate SGE_EGR_UPDATE
np [Fri, 23 Sep 2016 17:24:06 +0000 (17:24 +0000)]
cxgbe(4): Fix netmap with T6, which doesn't encapsulate SGE_EGR_UPDATE
message inside a FW_MSG.  The base NIC already deals with updates in
either form.

Sponsored by: Chelsio Communications

45 hours agofd: hide fd_modified under CAPABILITIES
mjg [Fri, 23 Sep 2016 16:47:12 +0000 (16:47 +0000)]
fd: hide fd_modified under CAPABILITIES

It has no use without it and is now less error prone.

46 hours agoAlso implement platform_cpu_reset on bcm2836
andrew [Fri, 23 Sep 2016 15:28:15 +0000 (15:28 +0000)]
Also implement platform_cpu_reset on bcm2836

47 hours agoRestrict where we need to define fdt_fixup_table to just PowerPC and
andrew [Fri, 23 Sep 2016 14:11:23 +0000 (14:11 +0000)]
Restrict where we need to define fdt_fixup_table to just PowerPC and

Sponsored by: ABT Systems Ltd

2 days agolibcompiler_rt: use ${SRCTOP} for the top of the FreeBSD tree
emaste [Fri, 23 Sep 2016 13:23:52 +0000 (13:23 +0000)]
libcompiler_rt: use ${SRCTOP} for the top of the FreeBSD tree

2 days agoForce LLVM_LIBUNWIND off if we don't have a C++11 compiler
emaste [Fri, 23 Sep 2016 13:21:29 +0000 (13:21 +0000)]
Force LLVM_LIBUNWIND off if we don't have a C++11 compiler

Tested by: bde
Differential Revision:

2 days agoUse 32-bit value for .text padding, for linker portability
emaste [Fri, 23 Sep 2016 13:18:59 +0000 (13:18 +0000)]
Use 32-bit value for .text padding, for linker portability

GNU ld interprets the padding value as a variable-length byte string,
while GNU gold and LLVM lld interpret it as a 32-bit value.

2 days agoMove cpu_reset to be a platform method to allow multiple implementations.
andrew [Fri, 23 Sep 2016 13:08:15 +0000 (13:08 +0000)]
Move cpu_reset to be a platform method to allow multiple implementations.

Reviewed by: mmel
Sponsored by: ABT Systems Ltd
Differential Revision:

2 days agoRemove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
andrew [Fri, 23 Sep 2016 12:38:05 +0000 (12:38 +0000)]
Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
this on a few earlier arm SoCs.

Reviewed by: manu (earlier version)
Sponsored by: ABT Systems Ltd

2 days agoProvide proccontrol(1), an utility to control processes behaviour, related
kib [Fri, 23 Sep 2016 12:34:54 +0000 (12:34 +0000)]
Provide proccontrol(1), an utility to control processes behaviour, related
to procctl(2).

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days agoAdd the foundation copyrights to procctl kernel sources.
kib [Fri, 23 Sep 2016 12:32:20 +0000 (12:32 +0000)]
Add the foundation copyrights to procctl kernel sources.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days agoDocument r306081, i.e. procctl(PROC_TRAPCAP) and sysctl kern.trap_enocap.
kib [Fri, 23 Sep 2016 09:26:40 +0000 (09:26 +0000)]
Document r306081, i.e. procctl(PROC_TRAPCAP) and sysctl kern.trap_enocap.

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision:

2 days agofd: fix up fget_cap
oshogbo [Fri, 23 Sep 2016 08:13:46 +0000 (08:13 +0000)]
fd: fix up fget_cap

If the kernel is not compiled with the CAPABILITIES kernel options
fget_unlocked doesn't return the sequence number so fd_modify will
always report modification, in that case we got infinity loop.

Reported by: br
Reviewed by: mjg
Tested by: br, def

2 days agoCheck if IPv6 supported before running the test, skip otherwise.
br [Fri, 23 Sep 2016 07:51:01 +0000 (07:51 +0000)]
Check if IPv6 supported before running the test, skip otherwise.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

2 days agoPrevent cuse4bsd.ko and cuse.ko from loading at the same time by
hselasky [Fri, 23 Sep 2016 07:41:23 +0000 (07:41 +0000)]
Prevent cuse4bsd.ko and cuse.ko from loading at the same time by
declaring support for the cuse4bsd interface in cuse.ko.

Found by: Sergey V. Dyatko <>
MFC after: 1 week

2 days agofd: fix up fgetvp_rights after r306184
mjg [Fri, 23 Sep 2016 06:51:46 +0000 (06:51 +0000)]
fd: fix up fgetvp_rights after r306184

fget_cap_locked returns a referenced file, but the fgetvp_rights does
not need it. Instead, due to the filedesc lock being held, it can
ref the vnode after the file was looked up.

Fix up fget_cap_locked to be consistent with other _locked helpers and not
ref the file.

This plugs a leak introduced in r306184.

Pointy hat to: mjg, oshogbo

2 days agocache: get rid of the global lock
mjg [Fri, 23 Sep 2016 04:45:11 +0000 (04:45 +0000)]
cache: get rid of the global lock

Add a table of vnode locks and use them along with bucketlocks to provide
concurrent modification support. The approach taken is to preserve the
current behaviour of the namecache and just lock all relevant parts before
any changes are made.

Lookups still require the relevant bucket to be locked.

Discussed with: kib
Tested by: pho

2 days agoRe-check the systrace probe ID before calling dtrace_probe().
markj [Thu, 22 Sep 2016 23:22:53 +0000 (23:22 +0000)]
Re-check the systrace probe ID before calling dtrace_probe().

Otherwise there exists a narrow window during which a syscall probe can be
disabled and cause a concurrently-running thread to call dtrace_probe()
with an invalid probe ID.

Reported by: ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 days agoUpdate oce to version
jpaetzel [Thu, 22 Sep 2016 22:51:11 +0000 (22:51 +0000)]
Update oce to version

Submitted by: Venkat Duvvuru <>

2 days agoamdsbwd, intpm: unify bits specific to AMD chipsets (FCHs, southbridges)
avg [Thu, 22 Sep 2016 21:34:35 +0000 (21:34 +0000)]
amdsbwd, intpm: unify bits specific to AMD chipsets (FCHs, southbridges)

AMD chipsets have proprietary mechanisms for dicovering resources.
Those resources are not discoverable via plug-and-play mechanisms
like PCI configuration registers or ACPI.
For this reason a chipset-specific knowledge of proprietary registers
is required.

At present there are two FreeBSD drivers that require the proprietary
resource discovery.  One is amdsbwd which is a driver for the watchdog
timer in the AMD chipsets.  The other is intpm SMBus driver when it
attaches to the newer AMD chipsets where the resources of the SMBus HBA
are not described in the regular PCI way.

In both cases the resources are discovered by accessing AMD PMIO space.
Thus, many definitions are shared between the two drivers.
This change puts those defintions into a common header file.

As an added benefit, intpm driver now supports newest FCHs built into
AMD processors of Family 15h, models 70h-7Fh and Family 16h, models

Reviewed by: kib
MFC after: 1 week
Differential Revision:

2 days agocxgbe(4): Fix the output of the "tids" sysctl on T6.
np [Thu, 22 Sep 2016 21:19:25 +0000 (21:19 +0000)]
cxgbe(4): Fix the output of the "tids" sysctl on T6.

2 days agoFix regression from r297400, which truncates headers in case of low socket
glebius [Thu, 22 Sep 2016 20:34:44 +0000 (20:34 +0000)]
Fix regression from r297400, which truncates headers in case of low socket
buffer and put a small optimization for low socket buffer case:

- Do not hack uio_resid, and let m_uiotombuf() properly take care of it. This
  fixes truncation of headers at low buffer.
- If headers ate all the space, jump right to the end of the cycle, to
  avoid doing single page I/O and allocating zero length mbuf.
- Clear hdr_uio only if space is positive, which indicates that all uio
  was copied in.

Reviewed by: pluknet, jtl, emax, rrs, lstewart, emax, gallatin, scottl

2 days agoChange the efi_get_table interface to a void ** so we can return the
imp [Thu, 22 Sep 2016 19:04:51 +0000 (19:04 +0000)]
Change the efi_get_table interface to a void ** so we can return the
pointer by dereferencing the pointer.

Reviewed by: kib@
MFC After: 2 weeks
Sponsored by: Netflix, Inc

2 days agocxgbe(4): Catch up with the different layout of WHOAMI in T6.
np [Thu, 22 Sep 2016 18:47:07 +0000 (18:47 +0000)]
cxgbe(4): Catch up with the different layout of WHOAMI in T6.

Note that the code moved below t4_prep_adapter() as part of this change
because now it needs a working chip_id().

2 days agoAdd the ID for the Huawei ME909S LTE modem.
loos [Thu, 22 Sep 2016 18:45:25 +0000 (18:45 +0000)]
Add the ID for the Huawei ME909S LTE modem.

Submitted by: svenauhagen at github
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

2 days agoRevert svn:mergeinfo added inadvertantly in last commit r306197
imp [Thu, 22 Sep 2016 16:05:19 +0000 (16:05 +0000)]
Revert svn:mergeinfo added inadvertantly in last commit r306197

2 days agoRevert and redo r306083.
imp [Thu, 22 Sep 2016 15:17:36 +0000 (15:17 +0000)]
Revert and redo r306083.

Update the device tree source files to a Linux 4.7-RC.

The dts tree currently can't be merged w/o specific revisions.

Note: due to a stupid bug in the commit checking script, I couldn't
just remove the svn:keyword tag from the new files, I had to add
fbsd:nokeywords to all the files (including ones that didn't need it)

3 days agoWhitespace commit (literally): Add a missing space.
gavin [Thu, 22 Sep 2016 13:59:27 +0000 (13:59 +0000)]
Whitespace commit (literally): Add a missing space.

Sponsored by: EuroBSDCon 2016 Devsummit, Belgrade, Serbia.

3 days agoMerge OpenSSL 1.0.2i.
jkim [Thu, 22 Sep 2016 13:27:44 +0000 (13:27 +0000)]
Merge OpenSSL 1.0.2i.

3 days agoImport OpenSSL 1.0.2i.
jkim [Thu, 22 Sep 2016 13:04:03 +0000 (13:04 +0000)]
Import OpenSSL 1.0.2i.

3 days agoUse bsdlabel as we don't have hardlink disklabel -> bsdlabel
br [Thu, 22 Sep 2016 12:53:11 +0000 (12:53 +0000)]
Use bsdlabel as we don't have hardlink disklabel -> bsdlabel
on some platforms.

Reviewed by: ngie
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision:

3 days agoSet the standard freebsd brand note for ELF binaries on MIPS,
br [Thu, 22 Sep 2016 12:48:01 +0000 (12:48 +0000)]
Set the standard freebsd brand note for ELF binaries on MIPS,
so binaries now get correct osreldate.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision:

3 days agoAdjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).
br [Thu, 22 Sep 2016 12:41:53 +0000 (12:41 +0000)]
Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).

sooptcopyin() checks if size of data provided by user is <= than we can
accept, else it strips down the size. On bigendian platforms we have to
move pointer as well so we copy the actual data.

Reviewed by: gnn
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision:

3 days agoMake the cloudabi32 kernel module available on ARMv6.
ed [Thu, 22 Sep 2016 12:08:26 +0000 (12:08 +0000)]
Make the cloudabi32 kernel module available on ARMv6.

Now that all of the necessary bits for ARMv6 support for CloudABI have
been checked in, let's hook the kernel module up to the build and
document its existence.

3 days agofd: simplify fgetvp_rights by using fget_cap_locked
oshogbo [Thu, 22 Sep 2016 11:54:20 +0000 (11:54 +0000)]
fd: simplify fgetvp_rights by using fget_cap_locked

Reviewed by: mjg

3 days agocapsicum: propagate rights on accept(2)
oshogbo [Thu, 22 Sep 2016 09:58:46 +0000 (09:58 +0000)]
capsicum: propagate rights on accept(2)

Descriptor returned by accept(2) should inherits capabilities rights from
the listening socket.

PR: 201052
Reviewed by: emaste, jonathan
Discussed with: many
Differential Revision:

3 days agoAdd TP-Link Archer T4U.
kevlo [Thu, 22 Sep 2016 09:33:22 +0000 (09:33 +0000)]
Add TP-Link Archer T4U.
It will be used by the updated rtwn(4) / urtwn(4) driver.

3 days agoMake it possible to safely use TPIDRURW from userspace.
ed [Thu, 22 Sep 2016 08:14:59 +0000 (08:14 +0000)]
Make it possible to safely use TPIDRURW from userspace.

On amd64, arm64 and i386, we have the possibility to switch between TLS
areas in userspace. The nice thing about this is that it makes it easier
to do light-weight threading, if we ever feel like doing that. On armv6,
let's go into the same direction by making it possible to safely use the
TPIDRURW register, which is intended for this purpose.

Clean up the ARMv6 code to remove md_tp entirely. Simply add a dedicated
field to the PCB to hold the value of TPIDRURW across context switches,
like we do for any other register. As userspace currently uses the
read-only TPIDRURO register, simply ensure that we keep both values in
sync where possible. The system calls for modifying the read-only
register will simply write the intended value into both registers, so
that it lazily ends up in the PCB during the next context switch.

Reviewed by:
Approved by: andrew
Reviewed by: imp
Differential Revision:

3 days agoSmall tweaks to the diskinfo(8) manual page, to make it more consistent
trasz [Thu, 22 Sep 2016 07:55:07 +0000 (07:55 +0000)]
Small tweaks to the diskinfo(8) manual page, to make it more consistent
with others.

MFC after: 1 month

3 days agoAdd "diskinfo -i", a simple aio-based IOPS benchmark.
trasz [Thu, 22 Sep 2016 07:33:43 +0000 (07:33 +0000)]
Add "diskinfo -i", a simple aio-based IOPS benchmark.

MFC after: 1 month

3 days agoThe getsecs() function is implemented in platform- and bootfw-specific
stevek [Thu, 22 Sep 2016 06:24:40 +0000 (06:24 +0000)]
The getsecs() function is implemented in platform- and bootfw-specific
files and, in a number of these places, there were problems with how they
were declared.

Some used int return instead of time_t. On some architectures the bit
width of time_t did not naturally fit into an integer and could lead to
some unexpected behavior. (For example, 32-bit ARM builds uses a 64-bit

Make sure the function prototypes always specify void for the argument
list when they do not have any arguemnts, otherwise some compilers can
complain about the prototype.

Reported by: Kevin Zheng
Reviewed by: sjg
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
MFC after: 1 month
Differential Revision:

3 days agoRegenerate syscall provider argument strings.
markj [Thu, 22 Sep 2016 04:50:03 +0000 (04:50 +0000)]
Regenerate syscall provider argument strings.

3 days agoAnnotate syscall provider pointer arguments with the "userland" keyword.
markj [Thu, 22 Sep 2016 04:49:31 +0000 (04:49 +0000)]
Annotate syscall provider pointer arguments with the "userland" keyword.

This causes dtrace to automatically copyin arguments from userland, so
one no longer has to explicitly use the copyin() action to do so. Moreover,
copyin() on userland addresses is a no-op, so existing scripts should be
unaffected by this change.

Discussed with: rstone
MFC after: 2 weeks

3 days agoRevert r306148 to fix build
cem [Thu, 22 Sep 2016 00:25:23 +0000 (00:25 +0000)]
Revert r306148 to fix build

Requested by: jpaetzel
Reported by: Larry Rosenman <ler at>, Jenkins

3 days agoUpdate oce driver to
jpaetzel [Wed, 21 Sep 2016 22:53:16 +0000 (22:53 +0000)]
Update oce driver to

Submitted by: Venkat Duvvuru <>

3 days agoRevert part of r306065
jhibbits [Wed, 21 Sep 2016 22:09:17 +0000 (22:09 +0000)]
Revert part of r306065

This is a separate change I was testing.

3 days agoRegenerate.
bdrewery [Wed, 21 Sep 2016 21:42:06 +0000 (21:42 +0000)]

3 days agoSYSTEM_COMPILER is not forced off with META_MODE after r304682.
bdrewery [Wed, 21 Sep 2016 21:32:05 +0000 (21:32 +0000)]
SYSTEM_COMPILER is not forced off with META_MODE after r304682.

Sponsored by: Dell EMC Isilon

3 days ago[iwm] use rate control info from the node txrates; use mgmtrate for EAPOL frames
adrian [Wed, 21 Sep 2016 20:56:10 +0000 (20:56 +0000)]
[iwm] use rate control info from the node txrates; use mgmtrate for EAPOL frames

This changes the transmit rate control code to do a few things:

* use fixed rates (mcast, ucast, mgmt) where required.
* Don't use a hard-coded 11a or 11bg rate for non-data frames -
  use what net80211 says we should use.
* use mgmtrate for EAPOL frames.

Reviewed by: avos
Differential Revision:

3 days ago[net80211] don't add IBSS node table entries for neighbors from other SSIDs.
adrian [Wed, 21 Sep 2016 19:48:07 +0000 (19:48 +0000)]
[net80211] don't add IBSS node table entries for neighbors from other SSIDs.

The adhoc probe/beacon input path was creating nodes for all SSIDs.
This wasn't a problem when the NICs were configured to only process
frames for the current BSSID, but that didn't allow IBSS merges.
Once avos and I flipped on "beacons from all BSSIDs" to allow for
correct IBSS merging, we found this interesting behaviour.

This adds a check against the current SSID.

* If there's no VAP SSID, allow anything
* If there's a VAP SSID, check if the incoming frame has a suitable
  SSID and if so, allow it.

This prevents nodes being created for other SSIDs in probe and beacon
frames - ie, beacons overlapping IBSSes with different SSIDs, and
probe requests from arbitrary devices.


* AR9380, IBSS mode, both local and other IBSSes.

Reviewed by: avos
Differential Revision:

3 days agoFix typo.
np [Wed, 21 Sep 2016 19:30:34 +0000 (19:30 +0000)]
Fix typo.

3 days agocxgbetool: Add T6 support to the SGE context decoder.
np [Wed, 21 Sep 2016 19:26:36 +0000 (19:26 +0000)]
cxgbetool: Add T6 support to the SGE context decoder.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

3 days agoAdd myself (jrm) to calendar.freebsd
jrm [Wed, 21 Sep 2016 18:52:49 +0000 (18:52 +0000)]
Add myself (jrm) to calendar.freebsd

Approved by:    swills (mentor)

3 days agoAdd evdev support to ums(4)
gonzo [Wed, 21 Sep 2016 18:52:03 +0000 (18:52 +0000)]
Add evdev support to ums(4)

event generation is disabled by default in favour of sysmouse. This
behavoiur is controlled by kern.evdev.rcpt_mask sysctl, bit 2 should
be set to give priority to hw over sysmouse

Submitted by: Vladimir Kondratiev <>
Reviewed by: hans
Differential Revision:

3 days agoAdd myself (jrm) as a ports committer and update mentor/mentee relationships
jrm [Wed, 21 Sep 2016 18:50:11 +0000 (18:50 +0000)]
Add myself (jrm) as a ports committer and update mentor/mentee relationships

Approved by: swills (mentor)

3 days agoAdd evdev support to ukbd driver
gonzo [Wed, 21 Sep 2016 18:47:21 +0000 (18:47 +0000)]
Add evdev support to ukbd driver

event generation is disabled by default in favour of kbdmux. This
behavoiur is controlled by kern.evdev.rcpt_mask sysctl, bit 3 should
be set to give priority to hw over mux

Submitted by: Vladimir Kondratiev <>
Reviewed by: hans
Differential Revision:

3 days agoUpdate mkimg(1) author's contact info
asomers [Wed, 21 Sep 2016 18:42:17 +0000 (18:42 +0000)]
Update mkimg(1) author's contact info

Reviewed by: marcel, imp
MFC after: 3 days
Sponsored by: Spectra Logic Corp
Differential Revision:

3 days agoReduce code duplication by factoring out the delta_t() function.
trasz [Wed, 21 Sep 2016 18:07:25 +0000 (18:07 +0000)]
Reduce code duplication by factoring out the delta_t() function.
No functional changes.

MFC after: 1 month

3 days agoposix_openpt.2: Sort includes per style(9)
cem [Wed, 21 Sep 2016 17:51:27 +0000 (17:51 +0000)]
posix_openpt.2: Sort includes per style(9)

Sponsored by: Dell EMC Isilon

3 days agoFix invalid vendor ID constant (typo).
jhb [Wed, 21 Sep 2016 16:51:56 +0000 (16:51 +0000)]
Fix invalid vendor ID constant (typo).

During a bus rescan the check for an invalid vendor ID of a subfunction
used the wrong constant.

Submitted by: Dexuan Cui <>
MFC after: 3 days

3 days ago1) For already non-standard %z extension implement GNU compatible formats:
ache [Wed, 21 Sep 2016 15:47:40 +0000 (15:47 +0000)]
1) For already non-standard %z extension implement GNU compatible formats:
+hh and -hh.
2) Check for incorrect values for %z.

MFC after:      7 days

3 days agoHopefully, fix build of the module outside the kernel tree.
kib [Wed, 21 Sep 2016 14:42:23 +0000 (14:42 +0000)]
Hopefully, fix build of the module outside the kernel tree.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

3 days agoAdd support for the TP-Link TG-3468 v2.
kevlo [Wed, 21 Sep 2016 14:15:15 +0000 (14:15 +0000)]
Add support for the TP-Link TG-3468 v2.

This is an RTL8168 chip, which we already support so all we have to do is add
the vendor ID.

PR: 212876
Submitted by: Tobias Kortkamp <>
MFC after: 3 days

4 days agoRefine the dirname(3) compatibility workaround a bit more.
ed [Wed, 21 Sep 2016 13:03:55 +0000 (13:03 +0000)]
Refine the dirname(3) compatibility workaround a bit more.

Right now our workaround is so good that it doesn't throw any warnings
on misuse. This means that people will keep on using the old version
of dirname(3) silently without fixing their code.

Go ahead and change the prototype of __old_dirname() to also use a plain
char *, so that we still get a compiler warning. This won't have any
negative effect on building older versions of FreeBSD on HEAD, as those
are built with -Werror disabled.

Differential Revision:

4 days agoFix misuse of the basename() and dirname() functions.
ed [Wed, 21 Sep 2016 13:02:43 +0000 (13:02 +0000)]
Fix misuse of the basename() and dirname() functions.

These functions are allowed to overwrite their input. Pull a copy of the
input parameter and call dirname() and basename() on that instead. Do
ensure that we reload the pathname value between calls.

4 days agoUse kqueue(2) instead of select(2).
br [Wed, 21 Sep 2016 11:59:52 +0000 (11:59 +0000)]
Use kqueue(2) instead of select(2).
This helps to ensure we will not lose SIGINT sent by parent to child.

Reviewed by: sbruno, ngie
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision:

4 days agoAdd kernel interfaces to call EFI Runtime Services.
kib [Wed, 21 Sep 2016 11:31:58 +0000 (11:31 +0000)]
Add kernel interfaces to call EFI Runtime Services.

Runtime services require special execution environment for the call.
Besides that, OS must inform firmware about runtime virtual memory map
which will be active during the calls, with the SetVirtualAddressMap()
runtime call, done while the 1:1 mapping is still used.  There are two
complication: the SetVirtualAddressMap() effectively must be done from
loader, which needs to know kernel address map in advance.  More,
despite not explicitely mentioned in the specification, both 1:1 and
the map passed to SetVirtualAddressMap() must be active during the
SetVirtualAddressMap() call.  Second, there are buggy BIOSes which
require both mappings active during runtime calls as well, most likely
because they fail to identify all relocations to perform.

On amd64, we can get rid of both problems by providing 1:1 mapping for
the duration of runtime calls, by temprorary remapping user addresses.
As result, we avoid the need for loader to know about future kernel
address map, and avoid bugs in BIOSes.  Typically BIOS only maps
something in low 4G.  If not runtime bugs, we would take advantage of
the DMAP, as previous versions of this patch did.

Similar but more complicated trick can be used even for i386 and 32bit
runtime, if and when the EFI boot on i386 is supported.  We would need
a trampoline page, since potentially whole 4G of VA would be switched
on calls, instead of only userspace portion on amd64.

Context switches are disabled for the duration of the call, FPU access
is granted, and interrupts are not disabled.  The later is possible
because kernel is mapped during calls.

To test, the sysctl mib debug.efi_time is provided, setting it to 1
makes one call to EFI get_time() runtime service, on success the efitm
structure is printed to the control terminal.  Load efirt.ko, or add
EFIRT option to the kernel config, to enable code.

Discussed with: emaste, imp
Tested by: emaste (mac, qemu)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

4 days agoCosmetics - add missing newline.
trasz [Wed, 21 Sep 2016 11:27:56 +0000 (11:27 +0000)]
Cosmetics - add missing newline.

MFC after: 1 month

4 days agoMake the "r/s" and "w/s" fields in "iostat -x" a little bit wider;
trasz [Wed, 21 Sep 2016 11:22:19 +0000 (11:22 +0000)]
Make the "r/s" and "w/s" fields in "iostat -x" a little bit wider;
five chars is way too narrow for todays disks.

MFC after: 1 month

4 days agoMake it possible for diskinfo(8) to operate on files. This is useful
trasz [Wed, 21 Sep 2016 11:17:58 +0000 (11:17 +0000)]
Make it possible for diskinfo(8) to operate on files.  This is useful
with -t and upcoming -i.

MFC after: 1 month

4 days agoDisable extattr test on UFS1.
br [Wed, 21 Sep 2016 10:58:58 +0000 (10:58 +0000)]
Disable extattr test on UFS1.

This test supports native extended attributes only (e.g. UFS2)

Reviewed by: asomers, ngie
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision:

4 days agoRename efi_systbl to efi_systbl_phys, the variable contains the
kib [Wed, 21 Sep 2016 10:55:28 +0000 (10:55 +0000)]
Rename efi_systbl to efi_systbl_phys, the variable contains the
physical address of the EFI System Table.  Add _KERNEL guard around
its declaration in sys/efi.h.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 days agoAdd a way for the architecture to specify the calling ABI for methods
kib [Wed, 21 Sep 2016 10:35:44 +0000 (10:35 +0000)]
Add a way for the architecture to specify the calling ABI for methods
in the EFI Runtime Services Table.  On amd64, the calling conventions
are MS.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 days agoSimple post-mortem reporter for amd64 loader.efi.
kib [Wed, 21 Sep 2016 10:22:46 +0000 (10:22 +0000)]
Simple post-mortem reporter for amd64 loader.efi.

There is no way to see anything about the faults occuring in
loader.efi. Some intel BIOSes do output a line into serial port at
115200/8/1 regardless of the current port settings with the EFI error
number, but this is too little, and not always available, esp. if the
user does not know where to look.

The patch adds a simple facility to grab exceptions and at least dump
generic registers and some exception details.  Due to the relative
complexity of correctly taking over the BIOS IDT setup, only install
the facility on user request.

Two new commands, 'grab_faults' and 'ungrab_faults' are provided,
first one takes over, second undoes the first. It is supposed that
user would execute 'grab' by the developer direction of collecting the
debugging data.  The 'fault' command generates exception to test the

Fault handlers use dedicated stack to improve chances of catching
stack/TSS exceptions.  Due to this, BIOS IDT is duplicated into a
private copy, and debugger needs to find a free GDT slot for TSS. This
is done in somewhat complicated efi_redirect_exceptions().

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision:

4 days agoMake resettodr_lock accessible outside subr_rtc.c. Protect
kib [Wed, 21 Sep 2016 10:15:08 +0000 (10:15 +0000)]
Make resettodr_lock accessible outside subr_rtc.c.  Protect
CLOCK_GETTIME() with the lock.

Now all time-related accesses to the CMOS for RTC should be under the
lock.  This is needed to allow upcoming EFI Runtime Services support
to provide required execution environment for the firmware calls.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week