]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoAdd feature codes from NVMe 1.3 specification:
imp [Fri, 25 Aug 2017 21:38:29 +0000 (21:38 +0000)]
Add feature codes from NVMe 1.3 specification:

o Automomous Power State Transition
o Host Memory Buffer
o Timestamp
o Keep Alive Timer
o Host Controlled Thermal Management
o Non-Operational Power State Config

Also note that feature codes 0x78-0x7f are reserved for the NVMe
Management Interface.

Sponsored by: Netflix

6 years agoUse counter(9) for PLPMTUD counters.
sbruno [Fri, 25 Aug 2017 19:41:38 +0000 (19:41 +0000)]
Use counter(9) for PLPMTUD counters.

Remove unused PLPMTUD sysctl counters.

Bump UPDATING and FreeBSD Version to indicate a rebuild is required.

Submitted by: kevin.bowling@kev009.com
Reviewed by: jtl
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D12003

6 years agoDecode arguments passed to thr_set_name().
jhb [Fri, 25 Aug 2017 19:06:36 +0000 (19:06 +0000)]
Decode arguments passed to thr_set_name().

MFC after: 1 month

6 years agoPacify GCC on mips32 after r322893
asomers [Fri, 25 Aug 2017 18:51:10 +0000 (18:51 +0000)]
Pacify GCC on mips32 after r322893

Though technically correct, GCC complains about usingi a "%zd" format
specifier for a long.

Reported by: cem
MFC after: 3 weeks
X-MFC-With: 322893
Sponsored by: Spectra Logic

6 years agoCorrect a regression in the previous change, r322459. Specifically, the
alc [Fri, 25 Aug 2017 18:47:23 +0000 (18:47 +0000)]
Correct a regression in the previous change, r322459.  Specifically, the
removal of the "blk" parameter from blst_meta_alloc() had the unintended
effect of generating an out-of-range allocation when the cursor reaches
the end of the tree if the number of managed blocks in the tree equals
the so-called "radix" (which in the blist code is not the standard notion
of what a radix is but rather the maximum number of leaves in a tree of
the current height.)  In other words, only certain swap configurations
were affected, which is why earlier testing did not reveal the problem.

Submitted by: Doug Moore <dougm@rice.edu>
Reported by: pho, kib
Tested by: pho
X-MFC with: r322459
Differential Revision: https://reviews.freebsd.org/D12106

6 years agoMake spinconsole platform independent and hook it up into EFI loader on
sobomax [Fri, 25 Aug 2017 17:29:48 +0000 (17:29 +0000)]
Make spinconsole platform independent and hook it up into EFI loader on
i386 and amd64. Not enabled on ARMs, those are lacking timer routines.

MFC after: 2 moths
Sponsored by: Sippy Software, Inc.

6 years agogetmntinfo(3): Scale faster, and return sooner
cem [Fri, 25 Aug 2017 16:38:21 +0000 (16:38 +0000)]
getmntinfo(3): Scale faster, and return sooner

getmntinfo(3) is designed around a relatively static or slow growing set of
current mounts.  It tried to detect a race with somewhat concurrent mount
and re-call getfsstat(2) in that case, looping indefinitely.  It also
allocated space for a single extra mount as slop.

In the case where the user has a large number of mounts and is adding them
at a rapid pace, it fell over.

This patch makes two functional changes:

1. Allocate even more slop.  Double whatever the last getfsstat(2) returned.

2. Abort and return some known results after looping a few times
   (arbitrarily, 3).  If the list is constantly changing, we can't guarantee
   we return a full result to the user at any point anyways.

While here, add very basic functional tests for getmntinfo(3) to the libc
suite.

PR: 221743
Submitted by: Peter Eriksson <peter AT ifm.liu.se> (earlier version)
Sponsored by: Dell EMC Isilon

6 years agoReplace makefs' hand-rolled unescaping with strunvis
benno [Fri, 25 Aug 2017 16:10:16 +0000 (16:10 +0000)]
Replace makefs' hand-rolled unescaping with strunvis

mtree path names and link attributes are encoded, generally using strvis. Newer
versions of mtree will use C-style escapes but previously the accepted form was
octal escapes. makefs' mtree code spots the C-style escapes but fails to deal
with octal escapes correctly.

Remove mtree's escape-decoding code (except for a few instances where it's
needed) and instead pass pathnames and link targets through strunvis prior to
use.

Reviewed by: marcel
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12104

6 years agodd(1): Incorrect casting of arguments
asomers [Fri, 25 Aug 2017 15:31:55 +0000 (15:31 +0000)]
dd(1): Incorrect casting of arguments

dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and
back again to detect whether or not the original arguments were negative.
This is not correct, and causes problems with boundary cases, for example
when count is SSIZE_MAX-1.

PR: 191263
Submitted by: will@worrbase.com
Reviewed by: pi, asomers
MFC after: 3 weeks

6 years agoMake entries for the United States more consistent.
ed [Fri, 25 Aug 2017 12:28:34 +0000 (12:28 +0000)]
Make entries for the United States more consistent.

MFC after: 1 week

6 years agoAdd melifaro@ to the calendar.freebsd
ae [Fri, 25 Aug 2017 11:24:45 +0000 (11:24 +0000)]
Add melifaro@ to the calendar.freebsd

Submitted by: melifaro

6 years agoSync CloudABI compatibility against the latest upstream version (v0.13).
ed [Fri, 25 Aug 2017 11:01:39 +0000 (11:01 +0000)]
Sync CloudABI compatibility against the latest upstream version (v0.13).

With Flower (CloudABI's network connection daemon) becoming more
complete, there is no longer any need for creating any unconnected
sockets. Socket pairs in combination with file descriptor passing is all
that is necessary, as that is what is used by Flower to pass network
connections from the public internet to listening processes.

Remove all of the kernel bits that were used to implement socket(),
listen(), bindat() and connectat(). In principle, accept() and
SO_ACCEPTCONN may also be removed, but there are still some consumers
left.

Obtained from: https://github.com/NuxiNL/cloudabi
MFC after: 1 month

6 years agoFix bugs in (mostly) not-yet-activated parts of early/emergency output:
bde [Fri, 25 Aug 2017 10:57:17 +0000 (10:57 +0000)]
Fix bugs in (mostly) not-yet-activated parts of early/emergency output:

- map the hard-coded frame buffer address above KERNBASE.  Using the
  physical address only worked because of larger mapping bugs.

  The hard-coded frame buffer address only works on x86.  Use messy ifdefs
  to try to avoid warnings about unused code for other arches.

- remove the sysctl for reading and writing the table kernel console
  attributes.  Writing only worked for emergency output since normal
  output uses unalterd copies.

- fix the test for the emergency console being usable

- explain why a hard-coded attribute is used very early.  Emergency output
  works on x86 even before the pcpu pointer is initialized.

6 years agoProtect v_rdev dereference with the vnode interlock instead of the
kib [Fri, 25 Aug 2017 09:51:22 +0000 (09:51 +0000)]
Protect v_rdev dereference with the vnode interlock instead of the
vnode lock.

Caller of softdep_count_dependencies() may own a buffer lock, which
might conflict with the lock order.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 10 days

6 years agoAdd myself (smh) to calendar.freebsd
smh [Fri, 25 Aug 2017 08:21:02 +0000 (08:21 +0000)]
Add myself (smh) to calendar.freebsd

Sponsored by: Multiplay

6 years agoSupport setting the colors of cursors for the VGA renderer.
bde [Fri, 25 Aug 2017 07:04:41 +0000 (07:04 +0000)]
Support setting the colors of cursors for the VGA renderer.

Advertise this by changing the defaults to mostly red.  If you don't like
this, change them (almost) back using:
   vidcontrol -c charcolors,base=7,height=0
   vidcontrol -c mousecolors,base=0[,height=15]

The (graphics mode only) mouse cursor colors were hard-coded to a black
border and lightwhite interior.  Black for the border is the worst
possible default, since it is the same as the default black background
and not good for any dark background.  Reversing this gives the better
default of X Windows.  Coloring everything works better still.  Now
the coloring defaults to a lightwhite border and red interior.

Coloring for the character cursor is more complicated and mode
dependent.  The new coloring doesn't apply for hardware cursors.  For
non-block cursors, it only applies in graphics mode.  In text mode,
the cursor color was usually a hard-coded (dull)white for the background
only, unless the foreground was white when it was a hard-coded black
for the background only, unless the foreground was white and the
background was black it was reverse video.  In graphics mode, it was
always reverse video for the block cursor.  Reverse video is worse,
especially over cutmarking regions, since cutmarking still uses simple
reverse video (nothing better is possible in text mode) and double
reverse video for the cursor gives normal video.  Now, graphics mode
uses the same algorithm as the best case for text mode in all cases
for graphics mode.  The hard-coded sequence { white, black, } for the
background is now { red, white, blue, } where the first 2 colors can
be configured.  The blue color at the end is a sentinel which prevents
reverse video being used in most cases but breaks the compatibility
setting for white on black and black on white characters.  This will
be fixed later.  The compatibility setting is most needed for mono modes.

The previous commit to syscons.c changed sc_cnterm() to be more careful.
It followed null pointers in some cases.  But sc_cnterm() has been
unreachable for 15+ years since changes for multiple consoles turned
off calls to the the cnterm destructor for all console drivers.  Before
them, it was only called at boot time.  So no driver with an attached
console has ever been unloadable and not even the non-console destructors
have been tested much.

6 years agoUse _Static_assert
imp [Fri, 25 Aug 2017 04:33:06 +0000 (04:33 +0000)]
Use _Static_assert

These files are compiled in userland too, so we can't use sys/systm.h
and rely on CTASSERT. Switch to using _Static_assert instead.

MFC After: 3 days
Sponsored by: Netflix

6 years agoSanity check sizes
imp [Fri, 25 Aug 2017 04:05:53 +0000 (04:05 +0000)]
Sanity check sizes

Add compile time sanity checks to make sure that packed structures are
the proper size, typically as defined in the NVMe standard.

6 years agoEnable bus mastering on the device before resetting the device. The
imp [Fri, 25 Aug 2017 03:15:18 +0000 (03:15 +0000)]
Enable bus mastering on the device before resetting the device. The
card has to do PCIe transactions to complete the reset process, but
can't do them, per the PCIe spec, unless bus mastering is enabled.

Submitted by: Kinjal Patel
PR: 22166

6 years agoOops, the previous commit was missing 1 line.
bde [Fri, 25 Aug 2017 02:41:01 +0000 (02:41 +0000)]
Oops, the previous commit was missing 1 line.

6 years agoFix missing switching of the terminal emulator when switching the
bde [Fri, 25 Aug 2017 02:37:32 +0000 (02:37 +0000)]
Fix missing switching of the terminal emulator when switching the
terminal state for kernel console output.

r56043 in 2000 added many complications to support dynamic selection
of the terminal emulator using modules and the ioctl CONS_SETTERM.
This was never completed.  There are still no modules, but it is easy
to restore the scterm and dumb emulators at compile time.  Then
boot-time configuration for the preferred one doesn't work right, but
CONS_SETTERM almost works after fixing this bug.  CONS_SETTERM only
switches the emulator for the user state, leaving the kernel state(s)
still using the boot-time emulator.  The fix is especially important
when switching from sc to scteken, since the scteken state has pointers
in it.

Rename kernel_console_ts to sc_kts.

6 years agoFix 100.chksetuid and 110.neggrpperm for mountpoints with spaces
asomers [Fri, 25 Aug 2017 00:28:56 +0000 (00:28 +0000)]
Fix 100.chksetuid and 110.neggrpperm for mountpoints with spaces

Also, fix them for mountpoints with tabs.

PR: 48325
Reported by: pguyot@kallisys.net, aaron@baugher.biz
MFC after: 3 weeks

6 years agoGarbage collect RT_NORTREF, which is no longer in use after FLOWTABLE removal.
glebius [Thu, 24 Aug 2017 23:08:12 +0000 (23:08 +0000)]
Garbage collect RT_NORTREF, which is no longer in use after FLOWTABLE removal.

6 years agoixv(4): Add more robust mailbox API negotiation
erj [Thu, 24 Aug 2017 22:56:22 +0000 (22:56 +0000)]
ixv(4): Add more robust mailbox API negotiation

The previous update to the driver to 3.2.12-k changed the VF's API version
to 1.2, but did not let the VF fall back to 1.1 or 1.0 versions. So, this
patch tries 1.2 first, then the older versions in succession if that fails.

This should allow the VF driver to negotiate 1.1 and work with older PF
drivers, such as the one used in Amazon's EC2 service.

PR: 220872
Submitted by: Jeb Cramer <jeb.j.cramer@intel.com>
MFC after: 1 week
Sponsored by: Intel Corporation

6 years agoExpand the latency tracking array from 1.024s to 8.192s to help track
imp [Thu, 24 Aug 2017 22:11:10 +0000 (22:11 +0000)]
Expand the latency tracking array from 1.024s to 8.192s to help track
extreme outliers from dodgy drives. Adjust comments to reflect this,
and make sure that the number of latency buckets match in the two
places where it matters.

6 years agoFix 32-bit overflow on latency measurements
imp [Thu, 24 Aug 2017 22:10:58 +0000 (22:10 +0000)]
Fix 32-bit overflow on latency measurements

o Allow I/O scheduler to gather times on 32-bit systems. We do this by shifting
  the sbintime_t over by 8 bits and truncating to 32-bits. This gives us 8.24
  time. This is sufficient both in range (256 seconds is about 128x what current
  users need) and precision (60ns easily meets the 1ms smallest bucket size
  measurements). 64-bit systems are unchanged. Centralize all the time math so
  it's easy to tweak tha range / precision tradeoffs in the future.
o While I'm here, the I/O scheduler should be using periph_data rather than
  sim_data since it is operating on behalf of the periph.

Differential Review: https://reviews.freebsd.org/D12119

6 years agoAdd a test case for a connection on accept queue that is reset before
glebius [Thu, 24 Aug 2017 20:52:02 +0000 (20:52 +0000)]
Add a test case for a connection on accept queue that is reset before
it is accepted.  In that case accept(2) shall return ECONNABORTED.
Accept filters provide help with easily replicating that case.

6 years agoThird take on the r319685 and r320480. Actually allow for call soisconnected()
glebius [Thu, 24 Aug 2017 20:49:19 +0000 (20:49 +0000)]
Third take on the r319685 and r320480.  Actually allow for call soisconnected()
via soisdisconnected(), and in the earlier unlock earlier to avoid lock
recursion.

This fixes a situation when a socket on accept queue is reset before being
accepted.

Reported by: Jason Eggleston <jeggleston llnw.com>

6 years agoUpgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
dim [Thu, 24 Aug 2017 20:19:27 +0000 (20:19 +0000)]
Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
the upstream release_50 branch.

As of this version, lib/msun's trig test should also work correctly
again (see bug 220989 for more information).

PR: 220989
MFC after: 2 months
X-MFC-with: r321369

6 years agozfsd(8): Close a race condition when onlining a disk paritition
asomers [Thu, 24 Aug 2017 19:48:41 +0000 (19:48 +0000)]
zfsd(8): Close a race condition when onlining a disk paritition

When inserting a partitioned disk, devfs and geom will announce the whole
disk before they announce the partition. If the partition containing ZFS
extends to one of the disk's extents, then zfsd will see a ZFS label on the
whole disk and attempt to online it. ZFS is smart enough to activate the
partition instead of the whole disk, but only if GEOM has already created
the partition's provider.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Add a zpool_read_all_labels method. It's similar to
zpool_read_label, but it will return the number of labels found.

cddl/usr.sbin/zfsd/zfsd_event.cc
When processing a DevFS CREATE event, only online a VDEV if we can
read all four ZFS labels.

Reviewed by: mav
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11920

6 years agoRemove unused declaration and update ddb.4
cem [Thu, 24 Aug 2017 19:16:25 +0000 (19:16 +0000)]
Remove unused declaration and update ddb.4

A follow-up to r322836.

Warnings for the unused declaration were breaking some second tier
architectures, but did not show up in Clang on x86.

Reported by: markj (ddb.4), emaste (declaration)
Sponsored by: Dell EMC Isilon

6 years agoFix qlnx_tso_check() so that every window of
davidcs [Thu, 24 Aug 2017 19:09:42 +0000 (19:09 +0000)]
Fix qlnx_tso_check() so that every window of
(ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr) has atleast
ETH_TX_LSO_WINDOW_MIN_LEN bytes

MFC after:5 days

6 years agoMerge print_lockchain and print_sleepchain
cem [Thu, 24 Aug 2017 15:12:16 +0000 (15:12 +0000)]
Merge print_lockchain and print_sleepchain

When debugging a deadlock, it is useful to follow the full chain of locks as
far as possible.

Reviewed by: jhb
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12115

6 years agoStop masking FSGSBASE and SMEP features under monitors.
kib [Thu, 24 Aug 2017 10:57:34 +0000 (10:57 +0000)]
Stop masking FSGSBASE and SMEP features under monitors.

Not enabling FSGSBASE in %cr4 does not prevent reporting of the
feature by the CPUID instruction (blame Int*l).  As result, kernels
which were run under monitors pretended that usermode cannot modify
TLS base without the syscall, while libc noted right combination of
capable CPU and the new kernel version, trying to use the WRFSBASE
instruction.

Really old hypervisors that cannot handle enablement of these features
in %cr4 would require the manual configuration, by setting the loader
tunable hw.cpu_stdext_disable=0x81

Reported by: lwhsu, mjoras
Sponsored by: The FreeBSD Foundation
MFC after: 18 days

6 years agoSave KGSBASE in pcb before overriding it with the guest value.
kib [Thu, 24 Aug 2017 10:49:53 +0000 (10:49 +0000)]
Save KGSBASE in pcb before overriding it with the guest value.

Reported by: lwhsu, mjoras
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 18 days

6 years agoOnly emit the trailing new line added in r322613 when not operating in quiet
lstewart [Thu, 24 Aug 2017 08:20:23 +0000 (08:20 +0000)]
Only emit the trailing new line added in r322613 when not operating in quiet
mode.

Reported by: pho
MFC after: 1 week
X-MFC-with: r322210

6 years agoCompile fixes for LINT on 32-bit platforms.
hselasky [Thu, 24 Aug 2017 08:09:42 +0000 (08:09 +0000)]
Compile fixes for LINT on 32-bit platforms.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies

6 years agoAdd "xlnx,zynq-7000" to zedboard and zybo compatible property
gonzo [Thu, 24 Aug 2017 02:08:52 +0000 (02:08 +0000)]
Add "xlnx,zynq-7000" to zedboard and zybo compatible property

This property is required to boot CURRENT on zedboard and zybo

PR: 221208
Submitted by: Thomas Skibo <thoma555-bsd@yahoo.com>

6 years agobsdgrep: add a primitive literal matcher
kevans [Thu, 24 Aug 2017 01:23:33 +0000 (01:23 +0000)]
bsdgrep: add a primitive literal matcher

fgrep/grep -F will error out at runtime if compiled with a regex(3)
that does not define REG_NOSPEC or REG_LITERAL. glibc is one such regex(3)
implementation, and as it turns out they don't support literal matching at
all.

Provide a primitive literal matcher for use with glibc and other
implementations that don't support literal matching so that we don't
completely lose fgrep/grep -F if compiled against libgnuregex on stable/10,
stable/11, or other systems that we don't necessarily support.

This is a wholly unoptimized implementation with no plans to optimize it as
of now. This is due to both its use-case being primarily on unsupported
systems in the near-distant future and that it's reinventing the wheel that
we already have available as a feature of regex(3).

Reviewed by: cem, emaste, ngie
Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12056

6 years agobsdgrep: add some additional tests for fgrep
kevans [Thu, 24 Aug 2017 01:20:52 +0000 (01:20 +0000)]
bsdgrep: add some additional tests for fgrep

Previously added tests only check that fgrep is somewhat sane and works. Add
some more tests that check that the implementation is basically functional
and not producing incorrect results with various flags.

Reviewed by: cem, emaste, ngie
Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12056

6 years agoImprove the coverage of debug symbols for MK_DEBUG_FILES.
jhb [Wed, 23 Aug 2017 23:30:25 +0000 (23:30 +0000)]
Improve the coverage of debug symbols for MK_DEBUG_FILES.

- Include debug symbols in static libraries.  This permits binaries
  to include debug symbols for functions obtained from static libraries.
- Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be
  overridden by setting DEBUG_FILES_CFLAGS.  Use this to limit the debug
  information for llvm libraries and binaries.

Reviewed by: emaste
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D12025

6 years agoiflib: call device's if_init function during vlan initialization.
sbruno [Wed, 23 Aug 2017 21:49:56 +0000 (21:49 +0000)]
iflib:  call device's if_init function during vlan initialization.

Submitted by: bhargava.marreddy@broadcom.com
Reviewed by: shurd
Sponsored by: Broadcom
Differential Revision: https://reviews.freebsd.org/D12098

6 years agoAdd missing restart_queue initialization.
mav [Wed, 23 Aug 2017 19:00:06 +0000 (19:00 +0000)]
Add missing restart_queue initialization.

MFC after: 1 week

6 years agotop: use __mips__ and __NetBSD__ for consistency
emaste [Wed, 23 Aug 2017 17:56:55 +0000 (17:56 +0000)]
top: use __mips__ and __NetBSD__ for consistency

r322767 fixed the mips64 build failure with Clang with a minimal change
to use __FreeBSD__ instead of FreeBSD in a #if test.  For consistency
and to facilitate possible upstreaming change the other macros in the
test to their canonical form.

Discussed with: jhb

6 years agoFix a resource leak in an error case in camdd_buf_sg_create().
ken [Wed, 23 Aug 2017 17:52:49 +0000 (17:52 +0000)]
Fix a resource leak in an error case in camdd_buf_sg_create().

Submitted by: Coverity
CID: 1341622
MFC after: 3 days
Sponsored by: Spectra Logic

6 years agoSet the bus number field when attaching a PCI device.
markj [Wed, 23 Aug 2017 16:50:10 +0000 (16:50 +0000)]
Set the bus number field when attaching a PCI device.

MFC after: 1 week

6 years agoAvoid TCP log messages which are false positives.
tuexen [Wed, 23 Aug 2017 15:08:51 +0000 (15:08 +0000)]
Avoid TCP log messages which are false positives.

This is https://svnweb.freebsd.org/changeset/base/322812, just for
alternate TCP stacks.

XMFC with:  322812

6 years agoAvoid TCP log messages which are false positives.
tuexen [Wed, 23 Aug 2017 14:50:08 +0000 (14:50 +0000)]
Avoid TCP log messages which are false positives.

The check for timestamps are too early to handle SYN-ACK correctly.
So move it down after the corresponing processing has been done.

PR: 216832
Obtained from: antonfb@hesiod.org
MFC after: 1 week

6 years agoSet MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools
emaste [Wed, 23 Aug 2017 12:47:10 +0000 (12:47 +0000)]
Set MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools

LLD_BOOTSTRAP is intended to control the linker used to link world and
kernel, while LLD_IS_LD is intended to control the linker installed in
that world.

Force LLD_IS_LD equal to LLD_BOOTSTRAP for the cross-tools build and
install phase, so that lld will be installed as the ld to run on the
host, when LLD_BOOTSTRAP is set.

PR: 221543
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12072

6 years agoAdd new mlx5ib(4) driver to the kernel source tree which supports
hselasky [Wed, 23 Aug 2017 12:09:37 +0000 (12:09 +0000)]
Add new mlx5ib(4) driver to the kernel source tree which supports
Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of
PCI express network cards.

There is currently no user-space support and this driver only supports
kernel side non-routable RoCE V1. The krping kernel module can be used
to test this driver. Full user-space support including RoCE V2 will be
added as part of the ongoing upgrade to ibcore from Linux 4.9. Otherwise
this driver is feature equivalent to mlx4ib(4). The mlx5ib(4) kernel
module will only be built when WITH_OFED=YES is specified.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies

6 years agoCorrect typo in usage string.
benno [Tue, 22 Aug 2017 23:55:09 +0000 (23:55 +0000)]
Correct typo in usage string.

Submitted by: peterpakos (GitHub username)
MFC after: 1 day

6 years agoFix size to copyout(9) for cpuset_getid(2).
jkim [Tue, 22 Aug 2017 20:46:29 +0000 (20:46 +0000)]
Fix size to copyout(9) for cpuset_getid(2).

MFC after: 3 days

6 years agoFix off-by-one error when parsing SRAT table.
mav [Tue, 22 Aug 2017 19:56:30 +0000 (19:56 +0000)]
Fix off-by-one error when parsing SRAT table.

Reviewed by: jhb
MFC after: 1 week

6 years agoRemove an unneeded call to pmap_invalidate_all. This was never called as
andrew [Tue, 22 Aug 2017 18:20:25 +0000 (18:20 +0000)]
Remove an unneeded call to pmap_invalidate_all. This was never called as
the anyvalid variable is never set.

MFC after: 1 week
Sponsored by: DARPA, AFRL

6 years agoEnsure that fs/gs bases are stored in pcb before copying the pcb for
kib [Tue, 22 Aug 2017 18:15:47 +0000 (18:15 +0000)]
Ensure that fs/gs bases are stored in pcb before copying the pcb for
new process or thread.

Reported and tested by: ae, dhw
Sponsored by: The FreeBSD Foundation
MFC after: 20 days

6 years agonewvers.sh: accommodate `git worktree`
emaste [Tue, 22 Aug 2017 17:57:34 +0000 (17:57 +0000)]
newvers.sh: accommodate `git worktree`

newvers.sh looks for a .vcs subdirectory (e.g. .git, .svn) to determine
which vcs info tool to run (e.g., git rev-parse, svn info).

(As of r308789 if a .vcs subdirectory is not found at ${TOPDIR} then
newvers.sh walks up successive parent directories, testing for the .vcs
subdirectory at each step.  This is done in case the FreeBSD source is
built in a subdirectory as part of some larger project, but either way
newvers.sh still tests for the .vcs subdirectory.)

However, when using git worktree there is no .git subdirectory but
rather a plain text .git file which contains a reference to the main
working tree.

Change findvcs() to test that the .vcs entry exists, regardless of type.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoFix a bug in pmap_protect where we invalidate the wrong page. With this we
andrew [Tue, 22 Aug 2017 17:38:06 +0000 (17:38 +0000)]
Fix a bug in pmap_protect where we invalidate the wrong page. With this we
can now remove an unneeded call to invalidate all entries.

MFC after: 1 week
Sponsored by: DARPA, AFRL

6 years agoRevert part of r322770 in usr.sbin/chown/tests/chown_test.sh,
gjb [Tue, 22 Aug 2017 17:23:29 +0000 (17:23 +0000)]
Revert part of r322770 in usr.sbin/chown/tests/chown_test.sh,
which incorrectly adds atf_expect_fail() where there is no
failure case.

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

6 years agoAdd some miscellaneous definitions to support the DRM drivers.
markj [Tue, 22 Aug 2017 17:13:28 +0000 (17:13 +0000)]
Add some miscellaneous definitions to support the DRM drivers.

MFC after: 1 week

6 years agoUse py-google-compute-engine instead for releasing Google Compute
gjb [Tue, 22 Aug 2017 15:34:27 +0000 (15:34 +0000)]
Use py-google-compute-engine instead for releasing Google Compute
Engine (GCE) images with an updated version of Google's tools.

PR: 221714
Submitted by: helen _dot_ koike _@_ collabora_dot_com (original)
MFC after: 5 days
Sponsored by: The FreeBSD Foundation

6 years agoFix a comment on uncommitted work.
andrew [Tue, 22 Aug 2017 13:53:53 +0000 (13:53 +0000)]
Fix a comment on uncommitted work.

6 years agoMove the l0 pagetable address to struct mdproc. It is a property of the
andrew [Tue, 22 Aug 2017 13:16:14 +0000 (13:16 +0000)]
Move the l0 pagetable address to struct mdproc. It is a property of the
whole process so should live there.

Sponsored by: DARPA, AFRL

6 years agoRestructure camdd(8) slightly to make it easier to add support for
ken [Tue, 22 Aug 2017 13:08:22 +0000 (13:08 +0000)]
Restructure camdd(8) slightly to make it easier to add support for
additional protocols.

Submitted by: Chuck Tuffli <chuck@tuffli.net>
MFC after: 1 week
Differential Revision: D11230

6 years agoImport zstandard 1.3.1
bapt [Tue, 22 Aug 2017 11:11:49 +0000 (11:11 +0000)]
Import zstandard 1.3.1

6 years agoAdd missing compiler.h
bapt [Tue, 22 Aug 2017 11:09:16 +0000 (11:09 +0000)]
Add missing compiler.h

6 years agoImport zstd 1.3.1
bapt [Tue, 22 Aug 2017 11:02:59 +0000 (11:02 +0000)]
Import zstd 1.3.1

6 years agosubr_smp: Clean up topology analysis, add additional layers
cem [Tue, 22 Aug 2017 00:10:15 +0000 (00:10 +0000)]
subr_smp: Clean up topology analysis, add additional layers

Rather than repeatedly nesting loops, separate concerns with a single loop
per call stack level.  Use a table to drive the recursive routine.  Handle
missing topology layers more gracefully (infer a single unit).

Analyze some additional optional layers which may be present on e.g. AMD Zen
systems (groups, aka dies, per package; and cachegroups, aka CCXes, per
group).

Display that additional information in the boot-time topology information,
when it is relevent (non-one).

Reviewed by: markj@, mjoras@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12019

6 years agoUse an updated copy of the CDDL header boilerplate from illumos.
markj [Mon, 21 Aug 2017 22:26:49 +0000 (22:26 +0000)]
Use an updated copy of the CDDL header boilerplate from illumos.

Reported by: Yuri Pankov <yuripv@gmx.com>
X-MFC with: r322774

6 years agoAdd a regression test for r322773.
markj [Mon, 21 Aug 2017 21:58:42 +0000 (21:58 +0000)]
Add a regression test for r322773.

MFC after: 1 week

6 years agoFix an off-by-two in the llquantize() action parameter validation.
markj [Mon, 21 Aug 2017 21:56:02 +0000 (21:56 +0000)]
Fix an off-by-two in the llquantize() action parameter validation.

The aggregation created by llquantize() partitions values into buckets; the
lower bound of the bucket containing the largest values is b^{m+1}, where
b and m are the second and fourth parameters to the action, respectively.
Bucket bounds are stored in a 64-bit integer, and so the llquantize()
validation checks need to verify that b^{m+1} fits in 64 bits. However, it
was only verifying that b^{m-1} fits in 64 bits, so certain parameter
combinations could trigger assertion failures in libdtrace.

PR: 219451
MFC after: 1 week

6 years agoEnable hardfloat CPU instructions in the FP exception handler.
jhb [Mon, 21 Aug 2017 21:48:24 +0000 (21:48 +0000)]
Enable hardfloat CPU instructions in the FP exception handler.

This permits compiling with clang's integrated assembler.

Sponsored by: DARPA / AFRL

6 years agoUpgrade FW to 5.4.66
davidcs [Mon, 21 Aug 2017 20:27:45 +0000 (20:27 +0000)]
Upgrade FW to 5.4.66
sysctls to display stats, stats polled every 2 seconds
Modify QLA_LOCK()/QLA_UNLOCK() to not sleep after acquiring mtx_lock
Add support to turn OFF/ON error recovery following heartbeat failure for
debug purposes.
Set default max values to 32 Tx/Rx/SDS rings

MFC after:5 days

6 years agoApply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
gjb [Mon, 21 Aug 2017 20:23:05 +0000 (20:23 +0000)]
Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
and r322101), adding atf_expect_fail() before chflags(8) is invoked
if the filesystem is ZFS, which does not support UF_IMMUTABLE.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoImprove the performance of the arm64 thread switching code.
andrew [Mon, 21 Aug 2017 18:12:32 +0000 (18:12 +0000)]
Improve the performance of the arm64 thread switching code.

The full system memory barrier around a TLB invalidation is stricter than
required. It needs to wait on accesses to main memory, with just the weaker
store variant before the invalidate. As such use the dsb istst, tlbi, dlb
ish sequence already used in pmap.

The tlbi instruction in this sequence is also unnecessarily using a
broadcast invalidate when it just needs to invalidate the local CPUs TLB.
Switch to a non-broadcast variant of this instruction.

Sponsored by: DARPA, AFRL

6 years agoFix FreeBSD-presence macro to fix the build on mips with clang.
jhb [Mon, 21 Aug 2017 17:52:09 +0000 (17:52 +0000)]
Fix FreeBSD-presence macro to fix the build on mips with clang.

GCC doesn't define 'mips' which is why it doesn't trip over this.

Sponsored by: DARPA / AFRL

6 years agoInclude {u,}{div,mod}si3() on mips in libcompiler_rt.
jhb [Mon, 21 Aug 2017 17:49:01 +0000 (17:49 +0000)]
Include {u,}{div,mod}si3() on mips in libcompiler_rt.

These builtins were listed in the mips-specific Symbol.map for libc but
were not implemented.  Compiling mips with recent clang requires these
symbols.

Sponsored by: DARPA / AFRL

6 years agoAdd a guard around _ILP32 for mips.
jhb [Mon, 21 Aug 2017 17:45:06 +0000 (17:45 +0000)]
Add a guard around _ILP32 for mips.

This is already done for other architectures in this file and fixes the
build with clang.

6 years agoOptimize libc to get and set TLS using the RDFSBASE and RDGSBASE
kib [Mon, 21 Aug 2017 17:39:12 +0000 (17:39 +0000)]
Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE
instructions, if supported both by CPU and kernel.

Reviewed by: jhb (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D12023

6 years agoMake WRFSBASE and WRGSBASE instructions functional.
kib [Mon, 21 Aug 2017 17:38:02 +0000 (17:38 +0000)]
Make WRFSBASE and WRGSBASE instructions functional.

Right now, we enable the CR4.FSGSBASE bit on CPUs which support the
facility (Ivy and later), to allow usermode to read fs and gs bases
without syscalls. This bit also controls the write access to bases
from userspace, but WRFSBASE and WRGSBASE instructions currently
cannot be used, because return path from both exceptions or interrupts
overrides bases with the values from pcb.

Supporting the instructions is useful because this means that usermode
can implement green-threads completely in userspace without issuing
syscalls to change all of the machine context.

Support is implemented by saving the fs base and user gs base when
PCB_FULL_IRET flag is set. The flag is set on the context switch,
which potentially causes clobber of the bases due to activation of
another context, and when explicit modification of the user context by
a syscall or exception handler is performed. In particular, the patch
moves setting of the flag before syscalls change context.

The changes to doreti_exit and PUSH_FRAME to clear PCB_FULL_IRET on
entry from userspace can be considered a bug fixes on its own.

Reviewed by: jhb (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D12023

6 years agoAvoid dereferencing potentially freed workitem in
kib [Mon, 21 Aug 2017 16:23:44 +0000 (16:23 +0000)]
Avoid dereferencing potentially freed workitem in
softdep_count_dependencies().

Buffer's b_dep list is protected by the SU mount lock.  Owning the
buffer lock is not enough to guarantee the stability of the list.

Calculation of the UFS mount owning the workitems from the buffer must
be much more careful to not dereference the work item which might be
freed meantime.  To get to ump, use the pointers chain which does not
involve workitems at all.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

6 years agoStyle.
kib [Mon, 21 Aug 2017 16:16:02 +0000 (16:16 +0000)]
Style.

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoUpdate the tests(7) manual page to note the test suite is installed
gjb [Mon, 21 Aug 2017 14:14:13 +0000 (14:14 +0000)]
Update the tests(7) manual page to note the test suite is installed
by default as of 11.0-RELEASE.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoRemove stale comments.
ae [Mon, 21 Aug 2017 13:54:29 +0000 (13:54 +0000)]
Remove stale comments.

MFC after: 1 week

6 years agoFix the regression introduced in r275710.
ae [Mon, 21 Aug 2017 13:52:21 +0000 (13:52 +0000)]
Fix the regression introduced in r275710.

When a security policy should match TCP connection with specific ports,
the SYN+ACK segment send by syncache_respond() is considered as forwarded
packet, because at this moment TCP connection does not have PCB structure,
and ip_output() is called without inpcb pointer. In this case SPIDX filled
for SP lookup will not contain TCP ports and security policy will not
be found. This can lead to unencrypted SYN+ACK on the wire.

This patch restores the old behavior, when ports will not be filled only
for forwarded packets.

Reported by: Dewayne Geraghty <dewayne.geraghty at heuristicsystems.com.au>
MFC after: 1 week

6 years agoReplace the include path using CURDIR with KRB5DIR. This is consistent
cy [Mon, 21 Aug 2017 12:42:05 +0000 (12:42 +0000)]
Replace the include path using CURDIR with KRB5DIR. This is consistent
with the rest of the Makefiles in kerberos5/.

MFC after: 1 week

6 years agoFix for deadlock situation in the LinuxKPI's RCU synchronize API.
hselasky [Mon, 21 Aug 2017 11:51:40 +0000 (11:51 +0000)]
Fix for deadlock situation in the LinuxKPI's RCU synchronize API.

Deadlock condition:
The return value of TDQ_LOCKPTR(td) is the same for two threads.

1) The first thread signals a wakeup while keeping the rcu_read_lock().
This invokes sched_add() which in turn will try to lock TDQ_LOCK().

2) The second thread is calling synchronize_rcu() calling mi_switch() over
and over again trying to yield(). This prevents the first thread from running
and releasing the RCU reader lock.

Solution:
Release the thread lock while yielding to allow other threads to acquire the
lock pointed to by TDQ_LOCKPTR(td).

Found by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoUpgrade our copies of clang, llvm, lld and libc++ to r311219 from the
dim [Mon, 21 Aug 2017 07:03:02 +0000 (07:03 +0000)]
Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the
upstream release_50 branch.

MFC after: 2 months
X-MFC-with: r321369

6 years agoBring back the much more readable unified format for differences in
marius [Sun, 20 Aug 2017 20:38:15 +0000 (20:38 +0000)]
Bring back the much more readable unified format for differences in
/etc/{group,master.passwd}. This was originally turned on for all of
/etc/{aliases,group,master.passwd} in r55196, but then backed out
only for the latter two in r56697, as the adaption of the sed(1)ing
done in r56308 was incorrect. This left us with inconsistent diff(1)
formats in the daily output of periodic(8) ever since, despite in
r56697 having been promised to be revisited. So properly adapt the
password hash filtering to the unified format and turn the later on
again for /etc/{group,master.passwd}, too.

6 years agoSimplify the code.
kib [Sun, 20 Aug 2017 11:18:16 +0000 (11:18 +0000)]
Simplify the code.

Noted by: Oliver Pinter
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoDo not drop NFS vnode lock when performing consistency checks.
kib [Sun, 20 Aug 2017 10:08:45 +0000 (10:08 +0000)]
Do not drop NFS vnode lock when performing consistency checks.

Currently several paths in the NFS client upgrade the shared vnode
lock to exclusive, which might cause temporal dropping of the lock.
This action appears to be fatal for nullfs mounts over NFS. If the
operation is performed over nullfs vnode, then bypassed down to NFS
VOP, and the lock is dropped, other thread might reclaim the upper
nullfs vnode.  Since on reclaim the nullfs vnode lock and NFS vnode
lock are split, the original lock state of the nullfs vnode is not
restored.  As result, VFS operations receive not locked vnode after a
VOP call.

Stop upgrading the vnode lock when we check the consistency or flush
buffers as result of detected inconsistency.  Instead, allocate a new
lockmgr lock for each NFS node, which is locked exclusive instead of
the vnode lock upgrade.  In other words, the other parallel
modification of the vnode are excluded by either vnode lock conflict
or exclusivity of the new lock when the vnode lock is shared.

Also revert r316529 because now the vnode cannot be reclaimed during
ncl_vinvalbuf().

In collaboration with: pho
Reviewed by: rmacklem
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12083

6 years agoAllow vinvalbuf() to operate with the shared vnode lock.
kib [Sun, 20 Aug 2017 10:07:45 +0000 (10:07 +0000)]
Allow vinvalbuf() to operate with the shared vnode lock.

This mode allows other clean buffers to arrive while we flush the buf
lists for the vnode, which is fine for the targeted use.  We only need
that all buffers existed at the time of the function start were
flushed.  In fact, only one assert has to be relaxed.

In collaboration with: pho
Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12083

6 years agoSimplify amd64 trap().
kib [Sun, 20 Aug 2017 09:52:25 +0000 (09:52 +0000)]
Simplify amd64 trap().

- Use more relevant name 'signo' instead of 'i' for the local variable
  which contains a signal number to send for the current exception.
- Eliminate two labels 'userout' and 'out' which point to the very end
  of the trap() function.  Instead use return directly.
- Re-indent the prot_fault_translation block by reducing if() nesting.
- Some more monor style changes.

Requested and reviewed by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoTrim excessive 'extern' and remove unused declaration.
kib [Sun, 20 Aug 2017 09:42:09 +0000 (09:42 +0000)]
Trim excessive 'extern' and remove unused declaration.

Reviewed by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoUse ANSI C declaration for trap_pfault(). Style.
kib [Sun, 20 Aug 2017 09:39:10 +0000 (09:39 +0000)]
Use ANSI C declaration for trap_pfault().  Style.

Reviewed by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoDefine prefetch() only if it hasn't already been defined.
markj [Sun, 20 Aug 2017 01:42:01 +0000 (01:42 +0000)]
Define prefetch() only if it hasn't already been defined.

MFC after: 1 week

6 years agoAdd a couple of trivial headers to the LinuxKPI.
markj [Sun, 20 Aug 2017 01:40:24 +0000 (01:40 +0000)]
Add a couple of trivial headers to the LinuxKPI.

MFC after: 1 week

6 years agohwpstate: Add support for family 17h pstate info from MSRs
cem [Sun, 20 Aug 2017 00:41:49 +0000 (00:41 +0000)]
hwpstate: Add support for family 17h pstate info from MSRs

This information is normally available via acpi_perf, but in case it is not,
add support for fetching the information via MSRs on AMD family 17h (Zen)
processors.  Zen uses a slightly different formula than previous generation
AMD CPUs.

This was inspired by, but does not fix, PR 221621.

Reported by: Sean P. R. <seanpr AT swbell.net>
Reviewed by: mjoras@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12082

6 years agoFix setting of defaults for the text cursor.
bde [Sat, 19 Aug 2017 23:13:33 +0000 (23:13 +0000)]
Fix setting of defaults for the text cursor.

There was already a per-vty defaults field, but it was useless since it was
only initialized when propagating the global settings and thus no different
from the current global settings and not per-vty.  The global defaults field
was also invariant after boot time, but not quite so useless.

Fix this by adding a second selection bit the the control flags of the
relevant ioctl().  vidcontrol doesn't support this yet.  Setting either
default propagates the change to the current setting for the same level
and then to all lower levels.

Improve the 3-way escape sequence used by termcap to control the cursor.
The "normal" (ve) case has always used reset, so the user could set
it to anything, but since the reset is to a global value this is not
very useful, especially since the "very visible" (vs) case doesn't
reset but inconsistently forces to a blinking block.  Change vs to
first reset and then XOR the blinking bit so that it is predictably
different from ve.

6 years agoRename curr_curs_attr to base_curr_attr. The actual current cursor
bde [Sat, 19 Aug 2017 21:40:42 +0000 (21:40 +0000)]
Rename curr_curs_attr to base_curr_attr.  The actual current cursor
attribute field is curs_attr.  The base field holds user data translated
in a reversible way and is needed because current field holds this in
an irreversible way for efficiency.

Factor out some common code for the reversible translation.  This is
slightly simpler now, and much easier to expand.

Translate the magic flags value -1 to a single control flag internally
up front so other flags can be trusted later.  This can be used for the
relevant ioctl() too.

Remove CONS_CURSOR_FLAGS which contained all the control flags.  It was
unused and not useful.  After adding more flags, there will be tests on
a couple at a time but never on them all.  This API should have used this
to disallow unknown flags.

6 years agoUse the known valid segment when accessing memory in #UD handler.
kib [Sat, 19 Aug 2017 21:00:02 +0000 (21:00 +0000)]
Use the known valid segment when accessing memory in #UD handler.
Make sure that %eflags.D flag is cleared for hook.
Improve comments.

When #UD dtrace code checks for a registered hook before checking that
the exception was raised from kernel mode, we might run with the user
%ds, trapping on access.  Exception entry from userspace automatically
load valid %ss, which we can use there instead.

Noted and reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 3 days