]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMark two things as unused (since they are only sometimes used) and
imp [Sun, 3 Dec 2017 04:55:33 +0000 (04:55 +0000)]
Mark two things as unused (since they are only sometimes used) and
toss in a DECONST to remove a const in some tricky code that would
require too extensive a change to unwind otherwise.

Sponsored by: Netflix

6 years agoProvide a md_load64 prototype.
imp [Sun, 3 Dec 2017 04:55:28 +0000 (04:55 +0000)]
Provide a md_load64 prototype.

Sponsored by: Netflix

6 years agoCast void * pointer to char * so the arg matches the %s format.
imp [Sun, 3 Dec 2017 04:55:23 +0000 (04:55 +0000)]
Cast void * pointer to char * so the arg matches the %s format.

Sponsored by: Netflix

6 years agoDisconnet ps3 from the build. There's too many warnings to fix. Also,
imp [Sun, 3 Dec 2017 04:55:19 +0000 (04:55 +0000)]
Disconnet ps3 from the build. There's too many warnings to fix. Also,
it's going to be removed soon anyway once the final lingering issues
with kboot are resolved. Go ahead and disconnect it from the build a
little early.

Sponsored by: Netflix
OK'd by: nathanw@

6 years agoDeclare our strange brand of main().
imp [Sun, 3 Dec 2017 04:55:14 +0000 (04:55 +0000)]
Declare our strange brand of main().

Sponsored by: Netflix

6 years agoAllow this file to be used in libsa without warning...
imp [Sun, 3 Dec 2017 04:55:09 +0000 (04:55 +0000)]
Allow this file to be used in libsa without warning...

Sponsored by: Netflix

6 years agoe_entry can be smaller than a pointer. Cast it to an intptr_t before
imp [Sun, 3 Dec 2017 04:55:04 +0000 (04:55 +0000)]
e_entry can be smaller than a pointer. Cast it to an intptr_t before
casting it to a uint64_t *.

6 years agoCast mdp (a vm_offset_t) to void * to match prototype.
imp [Sun, 3 Dec 2017 04:54:59 +0000 (04:54 +0000)]
Cast mdp (a vm_offset_t) to void * to match prototype.

Sponsored by: Netflix

6 years agoInclude machine/md_var to pick up __syncicache prototype.
imp [Sun, 3 Dec 2017 04:54:54 +0000 (04:54 +0000)]
Include machine/md_var to pick up __syncicache prototype.

Sponsored by: Netflix

6 years agoDelcare md_load in libofw.h. Make all prototypes match for ofw
imp [Sun, 3 Dec 2017 04:54:49 +0000 (04:54 +0000)]
Delcare md_load in libofw.h. Make all prototypes match for ofw
provided md_load functions.

Sponsored by: Netflix

6 years agoConst poison the propname. It's never set and we often pass it const
imp [Sun, 3 Dec 2017 04:54:18 +0000 (04:54 +0000)]
Const poison the propname. It's never set and we often pass it const
char *.

Sponsored by: Netflix

6 years agogrep test: Fix copyright notice
kevans [Sun, 3 Dec 2017 02:23:29 +0000 (02:23 +0000)]
grep test: Fix copyright notice

The copyright notice was erroneously introduced as one from the NetBSD
foundation due to it being copied from a file in the NetBSD test suite, but
this file itself is not derived from or supplied with the NetBSD test suite.

MFC after: 3 days

6 years agolib/msun: remove trailing whitespace from e_pow.c
emaste [Sun, 3 Dec 2017 01:56:03 +0000 (01:56 +0000)]
lib/msun: remove trailing whitespace from e_pow.c

Submitted by: Steve Kargl
MFC after: 1 week

6 years agoAdd if media and link status events to vxlan
bryanv [Sat, 2 Dec 2017 22:04:00 +0000 (22:04 +0000)]
Add if media and link status events to vxlan

PR: 214359
MFC after: 2 weeks

6 years agoAdd include guard to fpmath.h
eadler [Sat, 2 Dec 2017 19:42:08 +0000 (19:42 +0000)]
Add include guard to fpmath.h

Submitted by: kargl

6 years agoAdd missing word
eadler [Sat, 2 Dec 2017 19:10:52 +0000 (19:10 +0000)]
Add missing word

Reported by: swildner@dragonflybsd.org

6 years agoMake the assignment of CRTARCH conditional, even in the armhf case, and
dim [Sat, 2 Dec 2017 17:39:04 +0000 (17:39 +0000)]
Make the assignment of CRTARCH conditional, even in the armhf case, and
slightly rework the .if statement.  While here, fix a minor typo.

6 years agoSPDX: Complete license IDs for ext2fs.
pfg [Sat, 2 Dec 2017 17:22:55 +0000 (17:22 +0000)]
SPDX: Complete license IDs for ext2fs.

6 years agodiag/httpd-error: remove
eadler [Sat, 2 Dec 2017 17:10:13 +0000 (17:10 +0000)]
diag/httpd-error: remove

This is a script for a web server in a specific
configuration. Current web servers don't produce
similar log files and it isn't FreeBSD's
goal to produce a log file analyzer.

6 years agoAdd forgotten libgeom.
imp [Sat, 2 Dec 2017 15:25:45 +0000 (15:25 +0000)]
Add forgotten libgeom.

Sponsored by: Netflix

6 years agoDocument autofs(6) sysctl variables.
trasz [Sat, 2 Dec 2017 13:12:00 +0000 (13:12 +0000)]
Document autofs(6) sysctl variables.

PR: 219414
MFC after: 2 weeks

6 years agoAdd -u (--to-unix) and -e (--to-efi) to convert unix or efi paths to
imp [Sat, 2 Dec 2017 07:29:24 +0000 (07:29 +0000)]
Add -u (--to-unix) and -e (--to-efi) to convert unix or efi paths to
the other.

Sponsored by: Netflix

6 years agoCreate a function to translate UEFI paths to unix paths
imp [Sat, 2 Dec 2017 07:29:19 +0000 (07:29 +0000)]
Create a function to translate UEFI paths to unix paths

efivar_device_path_to_unix_path translates from UEFI to Unix
efivar_unix_path_to_device_path translates from Unix to UEFI

At present, only HD() device types are supported (both GPT and
MBR). CdRom and floppy devices aren't supported. ZFS isn't supported
because there's no way in the UEFI standard to specify a ZFS datastore.
Network devices aren't supported either.

Three forms of Unix path are accepted: /path/to/file (for a mounted
filesystem), //path/to/file (uses the EFI partition on the same disk
as /), and dev:/path/to/file (for unmounted filesystem). Two forms are
produced (the first and last).

Sponsored by: Netflix

6 years agoRead multiple lines when parsing the data. Allow multiple device paths
imp [Sat, 2 Dec 2017 07:29:07 +0000 (07:29 +0000)]
Read multiple lines when parsing the data. Allow multiple device paths
to be read when formatting device paths. Set the upper limit to 64k
(most of these paths are < 64 bytes).

Sponsored by: Netflix

6 years agopf.os: Add OpenBSD:6.1
eadler [Sat, 2 Dec 2017 06:23:02 +0000 (06:23 +0000)]
pf.os: Add OpenBSD:6.1

Obtained From: OpenBSD

6 years agoReap dead code
asomers [Sat, 2 Dec 2017 06:05:03 +0000 (06:05 +0000)]
Reap dead code

usr.bin/dc/inout.c
Reap some dead code that was killed back in 2003 in OpenBSD, in
version 1.8 of this file.

MFC after: 3 weeks

6 years agoIntroduce bwn(4) support for the bhnd(4) bus.
landonf [Sat, 2 Dec 2017 02:21:27 +0000 (02:21 +0000)]
Introduce bwn(4) support for the bhnd(4) bus.

Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support
for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi
adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect
found in post-2009 Broadcom Wi-Fi hardware, are not supported by
siba_bwn(4).

The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port)
provides a unified kernel interface to a superset of the hardware supported
by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern
PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as
Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their
SSB or BCMA backplane.

This diff introduces opt-in bwn(4) support for bhnd(4) by providing:

 - A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via
   bhnd(4) instead of siba_bwn(4).
 - A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally
   probes at a higher priority than the siba_bwn(4) PCI driver.
 - A set of compatibility shims that perform translation of bwn(4)'s
   siba_bwn function calls into their bhnd(9) API equivalents when bwn(4)
   is attached via a bhnd(4) bus parent. When bwn(4) is attached via
   siba_bwn(4), all siba_bwn function calls are simply passed through to
   their original implementations.

To test bwn(4) with bhnd(4), place the following lines in loader.conf(5):

  hw.bwn_pci.preferred="1"

  if_bwn_pci_load="YES
  bwn_v4_ucode_load="YES"
  bwn_v4_lp_ucode_load="YES"

To verify that bwn(4) is using bhnd(4), you can check dmesg:

  bwn0: <Broadcom 802.11 MAC/PHY/Radio, rev 15> ... on bhnd0

... or devinfo(8):

pcib2
  pci2
    bwn_pci0
      bhndb0
        bhnd0
          bwn0
          ...

bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently
supported by bwn(4), including:

  - BCM4312
  - BCM4318
  - BCM4321

With minimal changes to the DMA code (not included in this commit), I was
also able to test support for newer BCMA devices by bringing up basic
working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets:

  - BCM43224
  - BCM43225

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation & Plausible Labs
Differential Revision: https://reviews.freebsd.org/D13041

6 years agoOverride memattr for mmap on the Freescale DIU driver
jhibbits [Sat, 2 Dec 2017 01:42:07 +0000 (01:42 +0000)]
Override memattr for mmap on the Freescale DIU driver

The Display Interface Unit (DIU) uses main memory for the framebuffer, which
is already mapped as cache coherent physical memory.  Prevent mmap() from
using its own attributes which may otherwise conflict.

6 years agobhnd_pmu(4): Do not leak our chipc provider reference or clkctl state in
landonf [Sat, 2 Dec 2017 01:10:45 +0000 (01:10 +0000)]
bhnd_pmu(4): Do not leak our chipc provider reference or clkctl state in
failure paths of bhnd_pmu_attach()

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhndb(4): Fix leak of child devices and MSI vectors.
landonf [Sat, 2 Dec 2017 01:07:41 +0000 (01:07 +0000)]
bhndb(4): Fix leak of child devices and MSI vectors.

- Add missing call to device_delete_children() in bhndb_detach(), without
  which we're left with stale child devices on module unload.
- Pass the parent PCI device to pci_release_msi(), not the bhndb_pci(4)
  child.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhnd_chipc(4): Break cyclic references to the ChipCommon device
landonf [Sat, 2 Dec 2017 00:52:59 +0000 (00:52 +0000)]
bhnd_chipc(4): Break cyclic references to the ChipCommon device

bhnd_chipc's children may hold strong provider references to their parent;
we must detach any children before attempting to deregister the bhnd_chipc
device as a bus service provider.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agobhndb(4): Fix incorrect assertion in bhndb_deregister_intr_handler().
landonf [Sat, 2 Dec 2017 00:09:58 +0000 (00:09 +0000)]
bhndb(4): Fix incorrect assertion in bhndb_deregister_intr_handler().

When deregistered, a handler should be in an 'active' state.

Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation

6 years agoFix all warnings related to geli and ZFS support on x86.
imp [Sat, 2 Dec 2017 00:07:37 +0000 (00:07 +0000)]
Fix all warnings related to geli and ZFS support on x86.

Default WARNS to 0 still, since there's still some warnings on other
architectures.

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

6 years agoTweaks to the beri boot loader so that it builds w/o warnings.
imp [Sat, 2 Dec 2017 00:07:31 +0000 (00:07 +0000)]
Tweaks to the beri boot loader so that it builds w/o warnings.

Sponsored by: Netflix

6 years agoUndefine _STANDALONE since this is test code. This is unsastifying,
imp [Sat, 2 Dec 2017 00:07:25 +0000 (00:07 +0000)]
Undefine _STANDALONE since this is test code. This is unsastifying,
but since we sadly only have one test, put this in as a stopgap.

Sponsored by: Netflix

6 years agoFix random() and srandom() prototypes to match the standard.
imp [Sat, 2 Dec 2017 00:07:19 +0000 (00:07 +0000)]
Fix random() and srandom() prototypes to match the standard.

These prototypes were needlessly different from the standard. Fix them
to be the same, and fix the surrounding code after the changes.

Sponsored by: Netflix

6 years agoMove geli to common DO32 stuff
imp [Sat, 2 Dec 2017 00:07:14 +0000 (00:07 +0000)]
Move geli to common DO32 stuff

define DO32 since this is only build in amd64/i386
Remove files not needed.

Sponsored by: Netflix

6 years agoWe don't need both _STAND and _STANDALONE. There's more places that
imp [Sat, 2 Dec 2017 00:07:09 +0000 (00:07 +0000)]
We don't need both _STAND and _STANDALONE. There's more places that
use _STANDALONE, so change the former to the latter.

Sponsored by: Netflix

6 years agoCleanup CFALGS usage here
imp [Sat, 2 Dec 2017 00:07:04 +0000 (00:07 +0000)]
Cleanup CFALGS usage here

Only define the CFLAGS we need.
SSP_CFLAGS is now defined globally, no need to define it here.
Define -D_STANDALONE globally for src/stand builds.

Sponsored by: Netflix

6 years agoMinor flags cleanup
imp [Sat, 2 Dec 2017 00:06:58 +0000 (00:06 +0000)]
Minor flags cleanup

Move kernel includes and libsa includes together at the top of defs.mk
Move all machine specific defines from Makefile.inc to their friends
in defs.mk.
Add comments and remove now useless junk after the move.

Sponsored by: Netflix

6 years agoRemove stale dependency on ufsread.c
imp [Sat, 2 Dec 2017 00:06:52 +0000 (00:06 +0000)]
Remove stale dependency on ufsread.c

Remove the now-useless dependency on ufsread.c. In some cases, it was
on the wrong file. But in all cases, we now automatically generate
.depend files, so we don't need it explicitly.

Sponsored by: Netflix

6 years agoFix missing .Dd bump
imp [Fri, 1 Dec 2017 22:52:45 +0000 (22:52 +0000)]
Fix missing .Dd bump

6 years agoPlug a name cache lock leak.
markj [Fri, 1 Dec 2017 22:51:02 +0000 (22:51 +0000)]
Plug a name cache lock leak.

Reviewed by: mjg
MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoCorrect history for Unix 2nd Edition through 6th Edition for the
imp [Fri, 1 Dec 2017 22:48:20 +0000 (22:48 +0000)]
Correct history for Unix 2nd Edition through 6th Edition for the
system calls. Man pages are missing for v2 and v5, so any entries for
those versions were inferred by new implementations of these functions
in libc.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl

6 years agovmstat: fix style(9) violations and bump WARNS.
kib [Fri, 1 Dec 2017 22:38:28 +0000 (22:38 +0000)]
vmstat: fix style(9) violations and bump WARNS.

Based on the patch by: Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by: Mysterious Code Ltd. (Pawel),
  The FreeBSD Foundation (me)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13228

6 years agoMark all the system calls that were in 1st Edition Unix as such in the
imp [Fri, 1 Dec 2017 22:26:36 +0000 (22:26 +0000)]
Mark all the system calls that were in 1st Edition Unix as such in the
HISTORY section. Note: Any system calls that were added prior to v7,
but after v1 weren't changed.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2

6 years agofmt(1): Fix usage of Nm macro
eadler [Fri, 1 Dec 2017 21:44:23 +0000 (21:44 +0000)]
fmt(1): Fix usage of Nm macro

6 years agoa10_gpio: Add support for more modern pin configuration
kevans [Fri, 1 Dec 2017 20:51:08 +0000 (20:51 +0000)]
a10_gpio: Add support for more modern pin configuration

a10_gpio previously accepted only {allwinner,}drive and {allwinner,}pull for
drive/bias setting, while newer DTS is using drive-strength and
bias-{disable,pull-up,pull-down} properties. Accept these properties as
well.

Additionally make bias and drive strength optional rather than required; not
setting them should just indicate that we do not need to configure these
properties.

Tested on: BananaPi-M3 (a83t)
Reviewed by: manu
Approved by: emaste (implicit)
Obtained from: NetBSD (partially)
Differential Revision: https://reviews.freebsd.org/D13284

6 years agoAdd support for SIOCGIFXMEDIA to iflib
shurd [Fri, 1 Dec 2017 17:58:20 +0000 (17:58 +0000)]
Add support for SIOCGIFXMEDIA to iflib

SIOCGIFXMEDIA is required for extended ethernet media types,
but iflib did not support it.

Reported by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D13312

6 years agoAdd "vmaddr" ps(1) keyword.
trasz [Fri, 1 Dec 2017 11:32:05 +0000 (11:32 +0000)]
Add "vmaddr" ps(1) keyword.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoDestroy seltd st_mtx and st_wait in seltdfini().
kib [Fri, 1 Dec 2017 11:18:19 +0000 (11:18 +0000)]
Destroy seltd st_mtx and st_wait in seltdfini().

A correct destruction is important for WITNESS(4) and LOCK_PROFILING(9).

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

6 years agoAdd comment for vm_map_find_min().
kib [Fri, 1 Dec 2017 10:53:08 +0000 (10:53 +0000)]
Add comment for vm_map_find_min().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-Differential revision: https://reviews.freebsd.org/D13155

6 years agoEliminate the last user of basename_r() in the base system.
ed [Fri, 1 Dec 2017 10:25:52 +0000 (10:25 +0000)]
Eliminate the last user of basename_r() in the base system.

In this case it's fairly easy to make use of basename().

6 years agoDo better cleaning in key_destroy() for VIMAGE case.
ae [Fri, 1 Dec 2017 09:59:42 +0000 (09:59 +0000)]
Do better cleaning in key_destroy() for VIMAGE case.

SPDB was cleaned using TAILQ_CONCAT() instead of calling key_unlink()
for each SP, thus we need to properly clean lists in each bucket of
V_sphashtbl to avoid panic in hashdestroy() when INVARIANTS is enabled.

Do the same for V_acqaddrhashtbl and V_acqseqhashtbl.

When we are called in DEFAULT_VNET, destroy also all global locks and
drain key_timer callout.

Reported by: kp
Tested by: kp
MFC after: 1 week

6 years agoloader.efi: efipart should exclude iPXE stub block protocol
tsoome [Fri, 1 Dec 2017 06:37:12 +0000 (06:37 +0000)]
loader.efi: efipart should exclude iPXE stub block protocol

iPXE does insert stub  BLOCK IO protocol handle to rework other issues,
this handle is not usable as it does not provide actual implementation.

We can detect this situation by checking and validating the BlockSize
property, so this update does make sure we have BlockSize at least 512B
and its value is power of 2.

PR: 223969
Reported by: Jeff Pieper
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13297

6 years agoAdd an mlink for cloudabi32(4).
ed [Fri, 1 Dec 2017 05:57:05 +0000 (05:57 +0000)]
Add an mlink for cloudabi32(4).

We already provide this for cloudabi64(4), so not adding it for
cloudabi32(4) is fairly inconsistent.

MFC after: 1 week

6 years agoRevert license change.
eadler [Fri, 1 Dec 2017 03:22:40 +0000 (03:22 +0000)]
Revert license change.

This isn't identical to the one permitted by UCB since
it is copyright multiple people.

6 years agoFix port build flags passed to make(1) after r326315, where
gjb [Thu, 30 Nov 2017 20:53:57 +0000 (20:53 +0000)]
Fix port build flags passed to make(1) after r326315, where
it was missed for embedded image builds.

MFC after: 3 days
MFC with: r326315
Sponsored by: The FreeBSD Foundation

6 years agoFix an indentation nit.
gjb [Thu, 30 Nov 2017 20:52:01 +0000 (20:52 +0000)]
Fix an indentation nit.

Sponsored by: The FreeBSD Foundation

6 years agoDocument gmirror sysctls.
markj [Thu, 30 Nov 2017 20:37:12 +0000 (20:37 +0000)]
Document gmirror sysctls.

MFC after: 2 weeks

6 years agoUpdate gmirror metadata less frequently when synchronizing.
markj [Thu, 30 Nov 2017 20:36:29 +0000 (20:36 +0000)]
Update gmirror metadata less frequently when synchronizing.

We periodically record synchronization progress in the metadata
block of the disk being synchronized; this allows an interrupted
synchronization to be resumed. However, the frequency of these
updates heavily pessimized synchronization time on some media. This
change modifies gmirror to update metadata based on a time period,
and adds a sysctl to control that period. The default value results
in a much lower update frequency and increases the completion time
for an interrupted rebuild only marginally.

Reported by: Andre Albsmeier <andre@fbsd.e4m.org>
MFC after: 3 weeks

6 years agoSPDX: use the Beerware identifier.
pfg [Thu, 30 Nov 2017 20:33:45 +0000 (20:33 +0000)]
SPDX: use the Beerware identifier.

6 years agoProperly skip the first CPU. It only accidentally worked because the
jkim [Thu, 30 Nov 2017 20:21:42 +0000 (20:21 +0000)]
Properly skip the first CPU.  It only accidentally worked because the
CPU_FOREACH() loop always starts from BSP (cpu0) and the if condition
is always false for APs.

Reported by: cem

6 years agoPort cloudabi32.ko to FreeBSD/arm64.
ed [Thu, 30 Nov 2017 17:58:48 +0000 (17:58 +0000)]
Port cloudabi32.ko to FreeBSD/arm64.

This change adds an implementation of a sysent for running CloudABI
armv6 and armv7 binaries on FreeBSD/arm64. It is a somewhat literal copy
of the armv6 version, except that it's been patched up to use the proper
registers.

Just like for cloudabi32.ko on FreeBSD/amd64, we make use of a vDSO that
automatically pads system call parameters to 64-bit value. These are
stored in a buffer on the stack, meaning we need to use copyin() and
copyout() unconditionally.

6 years agoSPDX: oops .. not from CMU.
pfg [Thu, 30 Nov 2017 15:58:38 +0000 (15:58 +0000)]
SPDX: oops .. not from CMU.

6 years agoSPDX: Consider code from Carnegie-Mellon University.
pfg [Thu, 30 Nov 2017 15:48:35 +0000 (15:48 +0000)]
SPDX: Consider code from Carnegie-Mellon University.

Interesting cases, most likely from CMU Mach sources.

6 years agoSPDX: wrong license.
pfg [Thu, 30 Nov 2017 15:45:42 +0000 (15:45 +0000)]
SPDX: wrong license.

6 years agoFix assertion when ZFS fails to open certain devices
asomers [Thu, 30 Nov 2017 15:36:06 +0000 (15:36 +0000)]
Fix assertion when ZFS fails to open certain devices

"panic: vdev_geom_close_locked: cp->private is NULL"
This panic will result if ZFS fails to open a device due to either of the
following reasons:

1) The device's sector size is greater than 8KB.
2) ZFS wants to open the device RW, but it can't be opened for writing.

The solution is to change the initialization order to ensure that the
assertion will be satisfied.

PR: 221066
Reported by: David NewHamlet <wheelcomplex@gmail.com>
Reviewed by: avg
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13278

6 years agoRevert r326399
asomers [Thu, 30 Nov 2017 15:34:55 +0000 (15:34 +0000)]
Revert r326399

Accidentally committed wrong file

Pointy hat to: asomers
Sponsored by: Spectra Logic Corp

6 years agoFix assertion when ZFS fails to open certain devices
asomers [Thu, 30 Nov 2017 15:28:29 +0000 (15:28 +0000)]
Fix assertion when ZFS fails to open certain devices

"panic: vdev_geom_close_locked: cp->private is NULL"
This panic will result if ZFS fails to open a device due to either of the
following reasons:

1) The device's sector size is greater than 8KB.
2) ZFS wants to open the device RW, but it can't be opened for writing.

The solution is to change the initialization order to ensure that the
assertion will be satisfied.

PR: 221066
Reported by: David NewHamlet <wheelcomplex@gmail.com>
Reviewed by: avg
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13278

6 years agoSPDX: Fix some cases wrongly attributed to MIT.
pfg [Thu, 30 Nov 2017 15:10:11 +0000 (15:10 +0000)]
SPDX: Fix some cases wrongly attributed to MIT.

In the cases of BSD-style license variants without clauses, use 0BSD for
the time being in lack of a better description.

6 years agor326394 is calling malloc with M_WAITOK under a lock, revert for now
manu [Thu, 30 Nov 2017 14:06:54 +0000 (14:06 +0000)]
r326394 is calling malloc with M_WAITOK under a lock, revert for now

Reported by: andrew

6 years agodevfs: Avoid a malloc/free if we just need to increment the refcount
manu [Thu, 30 Nov 2017 12:38:42 +0000 (12:38 +0000)]
devfs: Avoid a malloc/free if we just need to increment the refcount

MFC after: 1 week
Sponsored by: Gandi.net

6 years agoMake the ddb(4) "set" command list variables when called without parameters.
trasz [Thu, 30 Nov 2017 12:22:15 +0000 (12:22 +0000)]
Make the ddb(4) "set" command list variables when called without parameters.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoProperly define the VLAN_XXX() function macros to avoid miscompilation when
hselasky [Thu, 30 Nov 2017 11:35:22 +0000 (11:35 +0000)]
Properly define the VLAN_XXX() function macros to avoid miscompilation when
used inside "if" statements comparing with another value.

Detailed explanation:
"if (a ? b : c != 0)" is not the same like "if ((a ? b : c) != 0)"
which is the expected behaviour of a function macro.

Affects:
toecore, linuxkpi and ibcore.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Mellanox Technologies

6 years agoPrevent OOB access on corrupted msdos directories.
delphij [Thu, 30 Nov 2017 08:28:17 +0000 (08:28 +0000)]
Prevent OOB access on corrupted msdos directories.

Submitted by: Veo Zhang <veo live com>
MFC after: 2 weeks

6 years agoUpdate man page for r325354.
fabient [Thu, 30 Nov 2017 08:28:04 +0000 (08:28 +0000)]
Update man page for r325354.

Reported by: bjk

6 years agoFinish cleaning up license :\
eadler [Thu, 30 Nov 2017 08:23:40 +0000 (08:23 +0000)]
Finish cleaning up license :\

6 years agoFix typo
eadler [Thu, 30 Nov 2017 07:24:33 +0000 (07:24 +0000)]
Fix typo

Reported by: mjg, zrj@dragonflybsd.org

6 years agoFix pthread_condattr(3) type
eadler [Thu, 30 Nov 2017 07:15:32 +0000 (07:15 +0000)]
Fix pthread_condattr(3) type

Reported by: Sascha Wildner <swildner@dragonflybsd.org>
Reviewed by: mjg

6 years agoRemove advertising clause from pr(1)
eadler [Thu, 30 Nov 2017 07:08:45 +0000 (07:08 +0000)]
Remove advertising clause from pr(1)

Permitted by https://www.freebsd.org/copyright/license.html
Renumber 4->3 to be consistent with other files

6 years agoUse const pointers to avoid casting away constness.
imp [Thu, 30 Nov 2017 05:01:56 +0000 (05:01 +0000)]
Use const pointers to avoid casting away constness.

The host_open interface was a legitimate mismatch to the userboot
function, while the other pointers didn't need to be non-const.

This makes the powerpc warning free again.

Sponsored by: Netflix

6 years agoAdd a tunable "debug.hwpstate_verify" to check P-state after changing it and
jkim [Thu, 30 Nov 2017 01:40:07 +0000 (01:40 +0000)]
Add a tunable "debug.hwpstate_verify" to check P-state after changing it and
turn it off by default.  It is very inefficient to verify current P-state of
each core, especially for CPUs with many cores.  When multiple commands are
requested to the same power domain before completion of pending transitions,
the last command is executed according to the manual.  Because requests are
serialized by the caller, all cores will receive the same command for each
call.  Do not call sched_bind() and sched_unbind().  It is redundant because
the caller does it anyway.

6 years agoFix style(9).
jkim [Wed, 29 Nov 2017 23:52:31 +0000 (23:52 +0000)]
Fix style(9).

6 years agoIt's time to retire AHC_REG_PRETTY_PRINT and AHD_REG_PRETTY_PRINT from
scottl [Wed, 29 Nov 2017 23:41:49 +0000 (23:41 +0000)]
It's time to retire AHC_REG_PRETTY_PRINT and AHD_REG_PRETTY_PRINT from
the standard kernels.  They are still available as custom compile
options.

6 years agoThe sched_add() function is not only used when the thread is initially
hselasky [Wed, 29 Nov 2017 23:28:40 +0000 (23:28 +0000)]
The sched_add() function is not only used when the thread is initially
started, but also by the turnstiles to mark a thread as runnable for
all locks, for instance sleepqueues do:
setrunnable()->sched_wakeup()->sched_add()

In r326218 code was added to allow booting from non-zero CPU numbers
by setting the ts_cpu field inside the ULE scheduler's sched_add()
function. This had an undesired side-effect that prior sched_pin() and
sched_bind() calls got disregarded. This patch fixes the
initialization of the ts_cpu field for the ULE scheduler to only
happen once when the initial thread is constructed during system
init. Forking will then later on ensure that a valid ts_cpu value gets
copied to all children.

Reviewed by: jhb, kib
Discussed with: nwhitehorn
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D13298
Sponsored by: Mellanox Technologies

6 years agoDon't fail the build due to clang integer constant range warnings
arichardson [Wed, 29 Nov 2017 21:16:14 +0000 (21:16 +0000)]
Don't fail the build due to clang integer constant range warnings

This warning checks whether a constant is out of range of the integer
type. An example is `comparison of 'u_int' > 4294967295 is always false`
and in this case the warning makes sense.
However, when the type is a typedef that can be either 64 or 32 bits the
if condition is only tautological in some configurations so this should
not be a warning that fails the build.

Reviewed by: dim
Approved by: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D12912

6 years agoVerify the object/vnode association after vget() in vm_pageout_clean().
markj [Wed, 29 Nov 2017 19:47:09 +0000 (19:47 +0000)]
Verify the object/vnode association after vget() in vm_pageout_clean().

It's theoretically possible for the vnode and object to be disassociated
while locks are dropped around the vget() call, in which case we
shouldn't proceed with laundering.

Noted and reviewed by: kib
MFC after: 1 week

6 years agoFix comment introduced in r326369
shurd [Wed, 29 Nov 2017 18:21:17 +0000 (18:21 +0000)]
Fix comment introduced in r326369

The code uses the set of all CPUs, it doesn't zero out the set.

Sponsored by: Limelight Networks

6 years agoEnsure that ctx->ifc_cpus is always initialized
shurd [Wed, 29 Nov 2017 18:14:57 +0000 (18:14 +0000)]
Ensure that ctx->ifc_cpus is always initialized

If a device didn't support MSI-X, ctx->ifc_cpus would not be initialized,
but the IRQ allocation routines still uses the value.  Move the
initialization to common code.

Sponsored by: Limelight Networks

6 years agoRemove some comments that became incorrect with r325530.
markj [Wed, 29 Nov 2017 14:34:05 +0000 (14:34 +0000)]
Remove some comments that became incorrect with r325530.

6 years agoFix several noticed style issues.
danfe [Wed, 29 Nov 2017 12:49:22 +0000 (12:49 +0000)]
Fix several noticed style issues.

Reviewed by: bde
Approved by: bapt

6 years agoImplement hardware mlx5(4) rx timestamps.
kib [Wed, 29 Nov 2017 10:04:11 +0000 (10:04 +0000)]
Implement hardware mlx5(4) rx timestamps.

Driver support is only provided for ConnectX4/5.

System-time timestamp is calculated based on the free-running counter
timestamp provided by hardware.  Driver periodically samples the
counter to calibrate it against the system clock and uses linear
interpolation to convert.  Stability of the crystal which drives the
clock is +-50 ppm at the operational temperature, which makes the
algorithm good enough.

The calculation is somewhat delicate because all values are 64bit and
overflow the naive formula for linear interpolation.  The calculation
drops the least significant bits in advance, see the PREC shift in
mlx5_mbuf_tstmp().

Hardware stamps can be turned off by 'ifconfig mceN -hwrxtsmp'.  Buggy
firmware might result in small but visible errors in the reported
timestamps, detectable e.g. by nonsensical (negative) RTT values for
LAN pings.

Reviewed by: gallatin, hselasky
Sponsored by: Mellanox Technologies
Differential revision: https://reviews.freebsd.org/D12638

6 years agoDisallow TUN and TAP character device IOCTLs to modify the network device
hselasky [Wed, 29 Nov 2017 09:40:11 +0000 (09:40 +0000)]
Disallow TUN and TAP character device IOCTLs to modify the network device
type to any value. This can cause page faults and panics due to accessing
uninitialized fields in the "struct ifnet" which are specific to the network
device type.

MFC after: 1 week
Found by: jau@iki.fi
PR: 223767
Sponsored by: Mellanox Technologies

6 years agoRemove unused include.
delphij [Wed, 29 Nov 2017 09:18:24 +0000 (09:18 +0000)]
Remove unused include.

MFC after: 2 weeks

6 years agoReplace a reference to a license in another file with the license text.
jhb [Wed, 29 Nov 2017 05:07:54 +0000 (05:07 +0000)]
Replace a reference to a license in another file with the license text.

The relevant file was recently renamed, so the reference was stale.
In addition, explicit licenses are more typical in our sources.

6 years agoOnly check the page tables if within the KVA.
jhibbits [Wed, 29 Nov 2017 01:26:07 +0000 (01:26 +0000)]
Only check the page tables if within the KVA.

Devices aren't mapped within the KVA, and with the way 64-bit hashes the
addresses pte_vatopa() may not return a 0 physical address for a device.

MFC after: 1 week

6 years agoImport lua 5.3.4 to contrib
imp [Wed, 29 Nov 2017 00:46:36 +0000 (00:46 +0000)]
Import lua 5.3.4 to contrib

6 years agoEliminate kmem_arena and kmem_object in preparation for further NUMA commits.
jeff [Tue, 28 Nov 2017 23:40:54 +0000 (23:40 +0000)]
Eliminate kmem_arena and kmem_object in preparation for further NUMA commits.

The arena argument to kmem_*() is now only used in an assert.  A follow-up
commit will remove the argument altogether before we freeze the API for the
next release.

This replaces the hard limit on kmem size with a soft limit imposed by UMA.  When
the soft limit is exceeded we periodically wakeup the UMA reclaim thread to
attempt to shrink KVA.  On 32bit architectures this should behave much more
gracefully as we exhaust KVA.  On 64bit the limits are likely never hit.

Reviewed by: markj, kib (some objections)
Discussed with: alc
Tested by: pho
Sponsored by: Netflix / Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13187

6 years agoMove domain iterators into the page layer where domain selection should take
jeff [Tue, 28 Nov 2017 23:18:35 +0000 (23:18 +0000)]
Move domain iterators into the page layer where domain selection should take
place.  This makes the majority of the phys layer explicitly domain specific.

Reviewed by: markj, kib (some objections)
Discussed with: alc
Tested by: pho
Sponsored by: Netflix & Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13014