]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMerge ^/head r318560 through r318657.
Dimitry Andric [Mon, 22 May 2017 19:28:24 +0000 (19:28 +0000)]
Merge ^/head r318560 through r318657.

7 years agoFollowing upstream trunk, enable the new global instruction selection
Dimitry Andric [Mon, 22 May 2017 19:06:39 +0000 (19:06 +0000)]
Following upstream trunk, enable the new global instruction selection
(GlobalISel), cleanup some defines, and adjust the libllvm Makefile for
this.

7 years agoPull in r302416 from upstream llvm trunk (by Martin Storsjö):
Dimitry Andric [Mon, 22 May 2017 16:16:48 +0000 (16:16 +0000)]
Pull in r302416 from upstream llvm trunk (by Martin Storsjö):

  [ARM] Clear the constant pool cache on explicit .ltorg directives

  Multiple ldr pseudoinstructions with the same constant value will
  reuse the same constant pool entry. However, if the constant pool is
  explicitly flushed with a .ltorg directive, we should not try to
  reference constants in the previous pool any longer, since they may
  be out of range.

  This fixes assembling hand-written assembler source which repeatedly
  loads the same constant value, across a binary size larger than the
  pc-relative fixup range for ldr instructions (4096 bytes). Such
  assembler source already uses explicit .ltorg instructions to emit
  constant pools with regular intervals. However if we try to reuse
  constants emitted in earlier pools, they end up out of range.

  This makes the output of the testcase match what binutils gas does
  (prior to this patch, it would fail to assemble).

  Differential Revision: https://reviews.llvm.org/D32847

This should fix "out of range pc-relative fixup value" errors, when
compiling certain ARM inline assembly for www/webkit-gtk[23].

Reported by: mmel
MFC after: 3 days

7 years agoFor now, disable building libc++experimental for arm, since there are a
Dimitry Andric [Mon, 22 May 2017 16:13:30 +0000 (16:13 +0000)]
For now, disable building libc++experimental for arm, since there are a
number of static assertion failures in the time_t related parts.

Reported by: mmel, kib

7 years agoRemove glimpse make target added in r181432
Enji Cooper [Mon, 22 May 2017 15:53:30 +0000 (15:53 +0000)]
Remove glimpse make target added in r181432

The textproc/glimpse port expired over 3 years ago because there weren't any
more publicly available distfiles, and because it lacked a maintainer. Remove
the target as it's no longer executable on FreeBSD.

Differential Revision: D10764
MFC after: 1 month
Reviewed by: imp
Sponsored by: Dell EMC Isilon

7 years agoThe connect() system call should return -1 and set errno to EAFNOSUPPORT
Michael Tuexen [Mon, 22 May 2017 15:29:10 +0000 (15:29 +0000)]
The connect() system call should return -1 and set errno to EAFNOSUPPORT
if it is called on a TCP socket
 * with an IPv6 address and the socket is bound to an
    IPv4-mapped IPv6 address.
 * with an IPv4-mapped IPv6 address and the socket is bound to an
   IPv6 address.
Thanks to Jonathan T. Leighton for reporting this issue.

Reviewed by: bz gnn
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D9163

7 years agoAdd support for Amazon Elastic Network Adapter (ENA) NIC
Zbigniew Bodek [Mon, 22 May 2017 14:46:13 +0000 (14:46 +0000)]
Add support for Amazon Elastic Network Adapter (ENA) NIC

ENA is a networking interface designed to make good use of modern CPU
features and system architectures.

The ENA device exposes a lightweight management interface with a
minimal set of memory mapped registers and extendable command set
through an Admin Queue.

The driver supports a range of ENA devices, is link-speed independent
(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
a negotiated and extendable feature set.

Some ENA devices support SR-IOV. This driver is used for both the
SR-IOV Physical Function (PF) and Virtual Function (VF) devices.

ENA devices enable high speed and low overhead network traffic
processing by providing multiple Tx/Rx queue pairs (the maximum number
is advertised by the device via the Admin Queue), a dedicated MSI-X
interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized
data placement.

The ENA driver supports industry standard TCP/IP offload features such
as checksum offload and TCP transmit segmentation offload (TSO).
Receive-side scaling (RSS) is supported for multi-core scaling.

The ENA driver and its corresponding devices implement health
monitoring mechanisms such as watchdog, enabling the device and driver
to recover in a manner transparent to the application, as well as
debug logs.

Some of the ENA devices support a working mode called Low-latency
Queue (LLQ), which saves several more microseconds. This feature will
be implemented for driver in future releases.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Jakub Palider <jpa@semihalf.com>
Jan Medala <jan@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10427

7 years agoAllow PORTSDIR to be overridden in the pkg-stage target.
Glen Barber [Mon, 22 May 2017 14:21:45 +0000 (14:21 +0000)]
Allow PORTSDIR to be overridden in the pkg-stage target.

Submitted by: Johannes Jost Meixner (original)
PR: 218393
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoAdd 11.1 to the mdoc(7) mdoc.local.in.
Glen Barber [Mon, 22 May 2017 14:21:07 +0000 (14:21 +0000)]
Add 11.1 to the mdoc(7) mdoc.local.in.

Sponsored by: The FreeBSD Foundation

7 years agoCorrect the "first appeared in" version for efivar(8).
Glen Barber [Mon, 22 May 2017 13:55:59 +0000 (13:55 +0000)]
Correct the "first appeared in" version for efivar(8).

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoRevert r318583 (libthr: use default WARNS level of 6)
Eric van Gyzen [Mon, 22 May 2017 13:21:28 +0000 (13:21 +0000)]
Revert r318583 (libthr: use default WARNS level of 6)

Revert this while I fix RISC-V, SPARC, and probably all architectures
that use GCC.

Reported by: kib
Pointy hat to: vangyzen
Sponsored by: Dell EMC

7 years agoRegen sysent after r318634, no open(2) in capability mode
Ed Maste [Mon, 22 May 2017 11:45:45 +0000 (11:45 +0000)]
Regen sysent after r318634, no open(2) in capability mode

Sponsored by: The FreeBSD Foundation

7 years agodisallow open(2) in capability mode
Ed Maste [Mon, 22 May 2017 11:43:19 +0000 (11:43 +0000)]
disallow open(2) in capability mode

Previously open(2) was allowed in capability mode, with a comment that
suggested this was likely the case to facilitate debugging. The system
call would still fail later on, but it's better to disallow the syscall
altogether.

We now have the kern.trap_enotcap sysctl or PROC_TRAPCAP_CTL proccontrol
to aid in debugging.

In any case libc has translated open() to the openat syscall since
r277032.

Reviewed by: kib, rwatson
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10850

7 years agobsdinstall: do not use distextract in scripted mode
Roger Pau Monné [Mon, 22 May 2017 11:41:17 +0000 (11:41 +0000)]
bsdinstall: do not use distextract in scripted mode

It requires a tty, which might not be available in scripted installs. Instead
extract the sets manually using tar.

Reviewed by: tsoome
Sponsored by: Citrix Systems R&D
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D10736

7 years agobsdinstall: mount is not needed for the ZFS install case
Roger Pau Monné [Mon, 22 May 2017 11:38:39 +0000 (11:38 +0000)]
bsdinstall: mount is not needed for the ZFS install case

Because the datasets are already mounted by zfsboot, and the mount script
doesn't know anything about ZFS. Also do not execute the "umount" script for
ZFS for the same reasons.

Reviewed by: dteske, tsoome
Sponsored by: Citrix Systems R&D
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D10738

7 years agoxen/netfront: don't drop the RX lock in xn_rxeof
Roger Pau Monné [Mon, 22 May 2017 11:33:44 +0000 (11:33 +0000)]
xen/netfront: don't drop the RX lock in xn_rxeof

Since netfront uses different locks for the RX and TX paths there's no need to
drop the RX lock before calling if_input.

Suggested by: jhb
Tested by: cperciva
Sponsored by: Citrix Systems R&D
MFC with: r318523

7 years agoRefactor & compact struct i6addr_t #ifdef: remove redundant structure
Cy Schubert [Mon, 22 May 2017 03:01:35 +0000 (03:01 +0000)]
Refactor & compact struct i6addr_t #ifdef: remove redundant structure
definintion when USE_INET6 is false.

MFC after: 1 week

7 years agonm: document 'r' symbol type
Ed Maste [Mon, 22 May 2017 01:10:12 +0000 (01:10 +0000)]
nm: document 'r' symbol type

PR: 219245
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years ago[ar71xx] fix up dump space a la what jhb@ did elsewhere a while ago.
Adrian Chadd [Sun, 21 May 2017 23:55:58 +0000 (23:55 +0000)]
[ar71xx] fix up dump space a la what jhb@ did elsewhere a while ago.

7 years ago[libcompiler-rt] add bswapdi2/bswapsi2
Adrian Chadd [Sun, 21 May 2017 23:15:32 +0000 (23:15 +0000)]
[libcompiler-rt] add bswapdi2/bswapsi2

This is required for mips gcc 6.3 userland to build/run.

Reviewed by: emaste, dim
Approved by: emaste
Differential Revision: https://reviews.freebsd.org/D10838

7 years agoMake catman(1) use mandoc(1) by default
Baptiste Daroussin [Sun, 21 May 2017 22:28:28 +0000 (22:28 +0000)]
Make catman(1) use mandoc(1) by default

catman(1) checks if mandoc(1) do support the manpage before trying to generate
the catpage and falls back on nroff, using the same mechanism as man(1).

7 years agoUpdates for efivar.8
Benjamin Kaduk [Sun, 21 May 2017 22:10:08 +0000 (22:10 +0000)]
Updates for efivar.8

Fix spelling [1], appease igor and mandoc -Tlint, and adopt the
language style to be more consistent with our corpus.

PR: 219434 [1]
Submitted by: olgeni [1]

7 years agoAdd PICFLAG to build libc++experimental.a, so it can be used in all
Dimitry Andric [Sun, 21 May 2017 21:33:15 +0000 (21:33 +0000)]
Add PICFLAG to build libc++experimental.a, so it can be used in all
situations.

Noticed by: kib

7 years agomsdosfs: constify
Ed Maste [Sun, 21 May 2017 20:00:49 +0000 (20:00 +0000)]
msdosfs: constify

Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation

7 years agomsdosfs: correct constant and typo in comment
Ed Maste [Sun, 21 May 2017 19:48:16 +0000 (19:48 +0000)]
msdosfs: correct constant and typo in comment

Revisions:
fat.h 1.5 1.6

Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation

7 years agomsdosfs: capitalize FAT appropriately
Ed Maste [Sun, 21 May 2017 19:29:28 +0000 (19:29 +0000)]
msdosfs: capitalize FAT appropriately

Diff reduction with NetBSD, including some nearby minor whitespace or
style fixes.

Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation

7 years agoAdd libc++experimental.a for std::experimental support
Dimitry Andric [Sun, 21 May 2017 17:07:12 +0000 (17:07 +0000)]
Add libc++experimental.a for std::experimental support

This adds a separate library for supporting std::experimental features.
It is purposefully static, and must be explicitly linked into programs
using -lc++experimental.

PLEASE NOTE: there is NO WARRANTY as to any stability or continuing
existence of the features in the std::experimental parts of the C++
library!

Reviewed by: ed
Differential Revision: https://reviews.freebsd.org/D10840

7 years agoFix build of AIO tests with -DDEBUG
Alan Somers [Sun, 21 May 2017 15:37:08 +0000 (15:37 +0000)]
Fix build of AIO tests with -DDEBUG

Also, redefine some constants for clarity.  No functional change.

MFC after: 1 week

7 years agocompress: Allow uncompress -c with multiple pathnames, as required by POSIX.
Jilles Tjoelker [Sun, 21 May 2017 14:35:16 +0000 (14:35 +0000)]
compress: Allow uncompress -c with multiple pathnames, as required by POSIX.

Per POSIX, allow passing multiple pathnames to uncompress -c, concatenating
the uncompressed data.

Passing multiple pathnames to compress -c remains disallowed, since the
result cannot be decompressed.

PR: 219387
Reported by: Jörg Schilling

7 years agocompress: Add basic tests.
Jilles Tjoelker [Sun, 21 May 2017 14:05:32 +0000 (14:05 +0000)]
compress: Add basic tests.

7 years agoAdd get_cpu() and put_cpu().
Mark Johnston [Sun, 21 May 2017 00:06:36 +0000 (00:06 +0000)]
Add get_cpu() and put_cpu().

MFC after: 1 week

7 years agoUpdate the exports.5 man page to reflect the change in default uid/gid
Rick Macklem [Sat, 20 May 2017 23:25:07 +0000 (23:25 +0000)]
Update the exports.5 man page to reflect the change in default uid/gid
made by r318262.

This is a content change.

7 years agoFix up two assertions following malloc(). vangyzen@ notified me of
Cy Schubert [Sat, 20 May 2017 18:16:26 +0000 (18:16 +0000)]
Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by: vangyzen@
MFC after: 1 week

7 years agoAdd -w to usage string.
Dag-Erling Smørgrav [Sat, 20 May 2017 18:02:31 +0000 (18:02 +0000)]
Add -w to usage string.

Reported by: Jamie Landeg-Jones <jamie@catflap.org>
MFC after: 1 week

7 years agodma.8: fix problems reported by igor and 'mandoc -Tlint'
Eric van Gyzen [Sat, 20 May 2017 17:42:58 +0000 (17:42 +0000)]
dma.8: fix problems reported by igor and 'mandoc -Tlint'

dma.8:77:contraction:Queue the mail, but [don't] attempt to deliver it.
dma.8:85:repeated:s [are are] ignored.
dma.8:87:contraction:[Don't] run in the background.
dma.8:201:contraction:Use the catch-all alias only if you [don't] want any local mail to be

mandoc: dma.8:308:5: WARNING: macro neither callable nor escaped: Sm

MFC after: 3 days

7 years agodma.8: use the correct name for 'SECURETRANSFER'
Eric van Gyzen [Sat, 20 May 2017 17:39:23 +0000 (17:39 +0000)]
dma.8: use the correct name for 'SECURETRANSFER'

The code uses 'SECURETRANS', but the config file uses 'SECURETRANSFER'.

MFC after: 3 days

7 years agolibthr: Use CLI flags instead of pragmas to disable warnings
Eric van Gyzen [Sat, 20 May 2017 17:33:47 +0000 (17:33 +0000)]
libthr: Use CLI flags instead of pragmas to disable warnings

People tweaking the build system or compilers tend to look into
the Makefile and not into the source.  Having some warning controls
in the Makefile and some in the source code is surprising.

Pragmas have the advantage that they leave the warnings enabled
for more code, but that advantage isn't very relevant in these cases.

Requested by: kib
Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10832

7 years agolibthr: use default WARNS level of 6
Eric van Gyzen [Sat, 20 May 2017 17:32:30 +0000 (17:32 +0000)]
libthr: use default WARNS level of 6

Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10832

7 years agoRemove old spinlock_debug code from libc
Eric van Gyzen [Sat, 20 May 2017 17:32:01 +0000 (17:32 +0000)]
Remove old spinlock_debug code from libc

This no longer seems useful.  Remove it.

This was prompted by a "cast discards volatile qualifier" warning
in libthr when WARNS=6.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10832

7 years agolibthr: change CHECK_AND_INIT_RWLOCK to an inline function
Eric van Gyzen [Sat, 20 May 2017 17:30:48 +0000 (17:30 +0000)]
libthr: change CHECK_AND_INIT_RWLOCK to an inline function

This was prompted by a compiler warning about 'ret' shadowing
a local variable in the callers of the macro.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10832

7 years agolibthr: disable thread-safety warnings
Eric van Gyzen [Sat, 20 May 2017 17:29:36 +0000 (17:29 +0000)]
libthr: disable thread-safety warnings

These warnings don't make sense for code that implements
the locking primitives.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10832

7 years agoFix non-recoverable name resolution failures due to negative cache
Cy Schubert [Sat, 20 May 2017 16:58:48 +0000 (16:58 +0000)]
Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

positive-time-to-live hosts 30
negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

hosts: files cache dns

Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR: 207804
Submitted by: Jov <amutu@amutu.com>
MFC after: 1 week

7 years agoImprove time-since-last-scrub calculation.
Michael Reifenberger [Sat, 20 May 2017 16:47:00 +0000 (16:47 +0000)]
Improve time-since-last-scrub calculation.
This can be needed to compensate anticongestion delays in 410.pkg-audit or 480.leapfile-ntpd.

PR: 217622
Submitted by: wbe@psr.com
MFC after: 2 weeks

7 years agoAfter r317383 (removal of NATM), also remove usr/include/dev/utopia from
Dimitry Andric [Sat, 20 May 2017 11:40:37 +0000 (11:40 +0000)]
After r317383 (removal of NATM), also remove usr/include/dev/utopia from
BSD.include.dist.

7 years agobsdgrep: Correct per-line line metadata printing
Ed Maste [Sat, 20 May 2017 11:20:03 +0000 (11:20 +0000)]
bsdgrep: Correct per-line line metadata printing

Metadata printing with -b, -H, or -n flags suffered from a few flaws:

1) -b/offset printing was broken when used in conjunction with -o

2) With -o, bsdgrep did not print metadata for every match/line, just
   the first match of a line

3) There were no tests for this

Address these issues by outputting this data per-match if the -o flag is
specified, and prior to outputting any matches if -o but not --color,
since --color alone will not generate a new line of output for every
iteration over the matches.

To correct -b output, fudge the line offset as we're printing matches.

While here, make sure we're using grep_printline in -A context.  Context
printing should *never* look at the parsing context, just the line.

The tests included do not pass with gnugrep in base due to it exhibiting
similar quirky behavior that bsdgrep previously exhibited.

Submitted by: Kyle Evans <kevans91@ksu.edu>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10580

7 years agobsdgrep: emit more than MAX_LINE_MATCHES per line
Ed Maste [Sat, 20 May 2017 03:51:31 +0000 (03:51 +0000)]
bsdgrep: emit more than MAX_LINE_MATCHES per line

We should not set an arbitrary cap on the number of matches on a line,
and in any case MAX_LINE_MATCHES of 32 is much too low.  Instead, if we
match more than MAX_LINE_MATCHES, keep processing and matching from the
last match until all are found.

For the regression test, we produce 4096 matches (larger than we expect
we'll ever set MAX_LINE_MATCHES) and make sure we actually get 4096
lines of output with the -o flag.

We'll also make sure that every distinct line is getting its own line
number to detect line metadata not being printed as appropriate along
the way.

PR: 218811
Submitted by: Kyle Evans <kevans91@ksu.edu>
Reported by: jbeich
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10577

7 years ago[net80211] prepare for A-MSDU/A-MPDU offload crypto / sequence number checking.
Adrian Chadd [Sat, 20 May 2017 00:43:52 +0000 (00:43 +0000)]
[net80211] prepare for A-MSDU/A-MPDU offload crypto / sequence number checking.

When doing AMSDU offload, the driver (for now!) presents 802.11 frames with
the same sequence number and crypto sequence number / IV values up to the stack.
But, this will trip afoul over the sequence number detection.

So drivers now have a way to signify that a frame is part of an offloaded
AMSDU group, so we can just ensure that we pass those frames up to the
stack.

The logic will be a bit messy - the TL;DR will be that if it's part of
the previously seen sequence number then it belongs in the same burst.
But if we get a repeat of the same sequence number (eg we sent an ACK
but the receiver didn't hear it) then we shouldn't be passing those frames
up.  So, we can't just say "all subframes go up", we need to track
whether we've seen the end of a burst of frames for the given sequence
number or not, so we know whether to actually pass them up or not.

The first part of doing all of this is to ensure the ieee80211_rx_stats
struct is available in the RX sequence number check path and the
RX ampdu reorder path.  So, start by passing the pointer into these
functions to avoid doing another lookup.

The actual support will come in a subsequent commit once I know the
functionality actually works!

7 years agobsdgrep: fix segfault with --mmap
Ed Maste [Sat, 20 May 2017 00:42:47 +0000 (00:42 +0000)]
bsdgrep: fix segfault with --mmap

r313948 partially fixed --mmap behavior but was incomplete.  This commit
generally reverts it and does it the more correct way- by just consuming
the rest of the buffer and moving on.

PR: 219402
Submitted by: Kyle Evans <kevans91@ksu.edu>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10820

7 years agoExclude ccr(4) from arm LINT since it excludes cxgbe(4).
John Baldwin [Fri, 19 May 2017 22:54:45 +0000 (22:54 +0000)]
Exclude ccr(4) from arm LINT since it excludes cxgbe(4).

7 years agoMerge ^/head r318380 through r318559.
Dimitry Andric [Fri, 19 May 2017 21:20:01 +0000 (21:20 +0000)]
Merge ^/head r318380 through r318559.

7 years agoo Missed flag restored.
Maxim Konovalov [Fri, 19 May 2017 20:02:32 +0000 (20:02 +0000)]
o Missed flag restored.

PR: 219395
Submitted by: Tiwei Bie

7 years agomsdosfs: use C99 types
Ed Maste [Fri, 19 May 2017 18:13:41 +0000 (18:13 +0000)]
msdosfs: use C99 types

General cleanup, for diff reduction with NetBSD and future use by FAT
support in makefs.

Submitted by: Siva Mahadevan <smahadevan@freebsdfoundation.org>
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10821

7 years agosys/fs/tmpfs/vnd_test: make md(4) allocation dynamic
Enji Cooper [Fri, 19 May 2017 17:14:29 +0000 (17:14 +0000)]
sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic

The previous logic was flawed in the sense that it assumed that /dev/md3
was always available. This was a caveat I noted in r306038, that I hadn't
gotten around to solving before now.

Cache the device for the mountpoint after executing mdmfs, then use the
cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
device.

Apply sed expressions to use reuse logic in the NetBSD code that could
also be applied to FreeBSD, just with different tools.

Differential Revision: D10766
MFC after: 1 week
Reviewed by: bdrewery
Sponsored by: Dell EMC Isilon

7 years agoInstall {cron.d,newsyslog.conf.d,syslog.d} via `make distribution`, not `make install`
Enji Cooper [Fri, 19 May 2017 17:04:01 +0000 (17:04 +0000)]
Install {cron.d,newsyslog.conf.d,syslog.d} via `make distribution`, not `make install`

I incorrectly started this pattern in r277541 with the opensm newsyslog.conf.d file,
and continued using it in r318441 and r318443.

This will fix the files being handled improperly via installworld, preventing tools like
etcupdate, mergemaster, etc from functioning properly when comparing the installed
contents on a system vs the contents in a source tree when doing merges.

PR: 219404
Submitted by: Dan McGregor <dan.mcgregor@usask.ca>
MFC after: 2 weeks
MFC with: r277541, r318441, r318443
Sponsored by: Dell EMC Isilon

7 years agolibthr: fix warnings at WARNS=6
Eric van Gyzen [Fri, 19 May 2017 13:04:05 +0000 (13:04 +0000)]
libthr: fix warnings at WARNS=6

Fix warnings about the following when WARNS=6 (which I will commit soon):

- casting away const
- no previous 'extern' declaration for non-static variable
- others as explained by #pragmas and comments
- unused parameters

The last is the only functional change.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10808

7 years agomlx4: Use the CQ quota for SRIOV when creating completion EQs
Hans Petter Selasky [Fri, 19 May 2017 12:22:48 +0000 (12:22 +0000)]
mlx4: Use the CQ quota for SRIOV when creating completion EQs

When creating EQs to handle CQ completion events for the PF or for
VFs, we create enough EQE entries to handle completions for the max
number of CQs that can use that EQ.

When SRIOV is activated, the max number of CQs a VF (or the PF) can
obtain is its CQ quota (determined by the Hypervisor resource
tracker).  Therefore, when creating an EQ, the number of EQE entries
that the VF should request for that EQ is the CQ quota value (and not
the total number of CQs available in the firmware).

Under SRIOV, the PF, also must use its CQ quota, because the resource
tracker also controls how many CQs the PF can obtain.

Using the firmware total CQs instead of the CQ quota when creating EQs
resulted wasting MTT entries, due to allocating more EQEs than were
needed.

MFC after: 3 days
Sponsored by: Mellanox Technologies

7 years agoIncrease maximum text segment size.
Michal Meloun [Fri, 19 May 2017 11:45:14 +0000 (11:45 +0000)]
Increase maximum text segment size.
LLVM binaries are huge...

MFC after: 3 days

7 years agoFix the queue delay estimation in PIE/FQ-PIE when the timestamp
Don Lewis [Fri, 19 May 2017 08:38:03 +0000 (08:38 +0000)]
Fix the queue delay estimation in PIE/FQ-PIE when the timestamp
(TS) method is used.  When packet timestamp is used, the "current_qdelay"
keeps storing the last queue delay value calculated in the dequeue
function.  Therefore, when a burst of packets arrives followed by
a pause, the "current_qdelay" will store a high value caused by the
burst and stick to that value during the pause because the queue
delay measurement is done inside the dequeue function.  This causes
the drop probability calculation function to calculate high drop
probability value instead of zero and prevents the burst allowance
mechanism from working properly.  Fix this problem by resetting
"current_qdelay" inside the drop probability calculation function
when the queue length is zero and TS option is used.

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after: 1 week

7 years agoFix boot up on ARMADA38X uniprocessor variant
Wojciech Macek [Fri, 19 May 2017 08:26:41 +0000 (08:26 +0000)]
Fix boot up on ARMADA38X uniprocessor variant

Marvell Armada 380 is a uni-processor variant of the 38x SoC
family. A function platform_mp_setmaxid() was setting a hardcoded
value, which caused boot fail on A380. Fix this by relying on
the CPU count obtained from device tree nodes.

Submitted by:  Marcin Wojtas <mw@semihalf.com
Obtained from: Semihalf
Sponsored by:  Netgate
Reviewed by:   loos
Differential revision: https://reviews.freebsd.org/D10783

7 years agoFix MPIC mask/unmask
Wojciech Macek [Fri, 19 May 2017 08:25:40 +0000 (08:25 +0000)]
Fix MPIC mask/unmask

Before the fix for single interrupt, both percpu and non-percpu routes
were enabled/disable at the same time.

Submitted by:  Marcin Wojtas <mw@semihalf.com
Obtained from: Semihalf
Sponsored by:  Stormshield, Netgate
Reviewed by:   loos
Differential revision: https://reviews.freebsd.org/D10716

7 years agoPoll PHY status using internal e6000sw registers
Wojciech Macek [Fri, 19 May 2017 08:24:23 +0000 (08:24 +0000)]
Poll PHY status using internal e6000sw registers

e6000sw family automatically reflects PHY status in each port's registers.
Therefore it is not necessary to do a full PHY polling squence, which
results in much quicker operation and much less significant usage of
the SMI bus.

Care must be taken that the resulting ifmedia_active is identical to
what the PHY will compute, or gratuitous link status changes will
occur whenever the PHYs update function is called.

This patch implements above improvement. On the occasion set a pointer to
the proc structure to be part of software context instead of being
a global variable.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10714

7 years agoxen/netfront: don't drop the ring RX lock with inconsistent ring state
Roger Pau Monné [Fri, 19 May 2017 08:19:51 +0000 (08:19 +0000)]
xen/netfront: don't drop the ring RX lock with inconsistent ring state

Make sure the RX ring lock is only released when the state of the ring is
consistent, or else concurrent calls to xn_rxeof might get an inconsistent ring
state and thus some packets might be processed twice.

Note that this is not very common, and could only happen when an interrupt is
delivered while in xn_ifinit.

Reported by: cperciva
Tested by: cperciva
MFC after: 1 week
Sponsored by: Citrix Systems R&D

7 years agoEnable proper configuration of CESA MBUS windows
Wojciech Macek [Fri, 19 May 2017 08:19:39 +0000 (08:19 +0000)]
Enable proper configuration of CESA MBUS windows

For all Marvell devices, MBUS windows configuration is done
in a common place. Only CESA was an exception, so move its
related code from driver to mv_common.c. This way it uses
same proper DRAM information, same as  all other interfaces
instead of parsing DT /memory node directly.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10723

7 years agoImprove busy-wait loop during switch phy access in e6000sw
Wojciech Macek [Fri, 19 May 2017 08:16:47 +0000 (08:16 +0000)]
Improve busy-wait loop during switch phy access in e6000sw

Hitherto implementation of PHY polling resulted in a risk of an
endless loop and very high occupation of the SMI bus. Improve the
operation by limiting the polling tries and adding sleepable
pause.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10713

7 years agoxen/blkfront: correctly detach a disk with active users
Roger Pau Monné [Fri, 19 May 2017 08:11:15 +0000 (08:11 +0000)]
xen/blkfront: correctly detach a disk with active users

Call disk_gone when the backend switches to the "Closing" state and blkfront
still has pending users. This allows the disk to be detached, and will call
into xbd_closing by itself when the geom layout cleanup has finished.

Reported by: bapt
Tested by: manu
Reviewed by: bapt
Sponsored by: Citrix Systems R&D
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D10772

7 years agoSync qsort.c with userland r318515.
Xin LI [Fri, 19 May 2017 06:37:16 +0000 (06:37 +0000)]
Sync qsort.c with userland r318515.

(Note that MIN macro is removed in favor of sys/param.h's version).

PR: 213922

7 years agoFix time handling in cv_timedwait_hires().
Alexander Motin [Fri, 19 May 2017 05:12:58 +0000 (05:12 +0000)]
Fix time handling in cv_timedwait_hires().

pthread_cond_timedwait() receives absolute time, not relative.  Passing
wrong time there caused two threads of zdb to spin in a tight loop.

MFC after: 1 week

7 years agoThe current qsort(3) implementation ignores the sizes of partitions, and
Xin LI [Fri, 19 May 2017 04:59:12 +0000 (04:59 +0000)]
The current qsort(3) implementation ignores the sizes of partitions, and
always perform recursion on the left partition, then use a tail call to
handle the right partition.  In the worst case this could require O(N)
levels of recursions.

Reduce the possible recursion level to log2(N) by always recursing on the
smaller partition instead.

Obtained from: PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096

7 years agoUse size_t.
Xin LI [Fri, 19 May 2017 04:44:14 +0000 (04:44 +0000)]
Use size_t.

Inspired by: OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11

7 years agonet/vlan: Revert 305177
Sepherosa Ziehau [Fri, 19 May 2017 01:42:31 +0000 (01:42 +0000)]
net/vlan: Revert 305177

Miss read the parentheses.

Reported by: oleg@
Reviewed by: hps@
MFC after: 3 days
Sponsored by: Microsoft

7 years agoThe result of right shifting a negative signed value is implementation
Don Lewis [Fri, 19 May 2017 01:23:06 +0000 (01:23 +0000)]
The result of right shifting a negative signed value is implementation
defined.  On machines without arithmetic shift instructions, zero bits
may be shifted in from the left, giving a large positive result instead
of the desired divide-by power-of-2.  Fix this by operating on the
absolute value and compensating for the possible negation later.

Reverse the order of the underflow/overflow tests and the exponential
decay calculation to avoid the possibility of an erroneous overflow
detection if p is a sufficiently small non-negative value.  Also
check for negative values of prob before doing the exponential decay
to avoid another instance of of right shifting a negative value.

Tested by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
MFC after: 1 week

7 years agoRemove the EXFAIL annotation for tests which pass as of r309596.
Mark Johnston [Fri, 19 May 2017 00:25:09 +0000 (00:25 +0000)]
Remove the EXFAIL annotation for tests which pass as of r309596.

Reported by: bdrewery
Sponsored by: Dell EMC Isilon

7 years agosh: Keep output buffer across builtins.
Jilles Tjoelker [Thu, 18 May 2017 22:10:04 +0000 (22:10 +0000)]
sh: Keep output buffer across builtins.

Allocating and deallocating repeatedly the 1024-byte buffer for stdout from
builtins costs CPU time for little or no benefit.

A simple loop containing builtins that write to a file descriptor, such as
  i=0; while [ "$i" -lt 1000000 ]; do printf .; i=$((i+1)); done >/dev/null
is over 10% faster in a simple benchmark on an amd64 virtual machine.

7 years agosh: Ensure memout.bufsize matches allocated buffer, if it exists.
Jilles Tjoelker [Thu, 18 May 2017 21:44:14 +0000 (21:44 +0000)]
sh: Ensure memout.bufsize matches allocated buffer, if it exists.

7 years agoLanguage fixes.
Edward Tomasz Napierala [Thu, 18 May 2017 19:42:19 +0000 (19:42 +0000)]
Language fixes.

Submitted by: wblock
MFC after: 2 weeks

7 years agoDon't bother enqueuing a page immediately before freeing it.
Mark Johnston [Thu, 18 May 2017 18:37:19 +0000 (18:37 +0000)]
Don't bother enqueuing a page immediately before freeing it.

No functional change intended.

MFC after: 1 week

7 years agoFix a few uses of kern_yield() in the TTM and the LinuxKPI.
Mark Johnston [Thu, 18 May 2017 18:35:14 +0000 (18:35 +0000)]
Fix a few uses of kern_yield() in the TTM and the LinuxKPI.

kern_yield(0) effectively causes the calling thread to be rescheduled
immediately since it resets the thread's priority to the highest possible
value. This can cause livelocks when the pattern
"while (!trylock()) kern_yield(0);" is used since the thread holding the
lock may linger on the runqueue for the CPU on which the looping thread is
running.

MFC after: 1 week

7 years agoMerge llvm, clang, lld, lldb, compiler-rt and libc++ r303291, and update
Dimitry Andric [Thu, 18 May 2017 18:33:33 +0000 (18:33 +0000)]
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303291, and update
build glue.

7 years agoAvoid open-coding PRI_UNCHANGED.
Mark Johnston [Thu, 18 May 2017 18:24:11 +0000 (18:24 +0000)]
Avoid open-coding PRI_UNCHANGED.

MFC after: 1 week

7 years agomakefs: drop WARNS back to 2
Ed Maste [Thu, 18 May 2017 17:55:33 +0000 (17:55 +0000)]
makefs: drop WARNS back to 2

GCC warns about additional signed comparision issues compared to Clang.
Drop WARNS for now until the underlying issue is fixed.

7 years agoindent(1): Support binary integer literals.
Piotr Pawel Stefaniak [Thu, 18 May 2017 17:15:58 +0000 (17:15 +0000)]
indent(1): Support binary integer literals.
This was done by Romain Tartière for PR123553. I initially thought that it would break code like this:
#define b00101010 -1
if (0 b00101010)
...

by joining 0 and b00101010 together. However, the real problem with that patch was that once it saw a 0, it assumed that the number was base 2, 8 or 16, ignoring base 10 floating point numbers. I fixed that.

I didn't copy the diagnostic part of the original patch as it seems out of scope of implementing binary integer literals formatting.

PR: 123553
Submitted by: romain (original version)
Approved by: pfg (mentor)

7 years agomakefs: Add soft-updates option
Emmanuel Vadot [Thu, 18 May 2017 14:19:06 +0000 (14:19 +0000)]
makefs: Add soft-updates option

Add the ffs option to enable soft-updates.
The option is only processed is ufs2 has been selected.

Reviewed by: emaste, bapt (earlier version), allanjude (earlier version)
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D10773

7 years agomakefs: clean up signedness warnings and bump WARNS to 3
Ed Maste [Thu, 18 May 2017 14:05:29 +0000 (14:05 +0000)]
makefs: clean up signedness warnings and bump WARNS to 3

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10650

7 years agoAdd tests for some cases in r318298.
Konstantin Belousov [Thu, 18 May 2017 13:49:53 +0000 (13:49 +0000)]
Add tests for some cases in r318298.

The first test triggers the out of bounds read of the 'left' array. It
only fails when realpath.c is compiled with '-fsanitize=address'.

The other test checks for ENOENT when running into an empty
symlink. This matches NetBSD's realpath(3) semantics. Previously,
empty symlinks were treated like ".".

Submitted by: Jan Kokemц╪ller <jan.kokemueller@gmail.com>
PR: 219154
MFC after: 2 weeks

7 years agoExplain the new fields in top(1) related to ZFS compressed ARC
Allan Jude [Thu, 18 May 2017 12:55:07 +0000 (12:55 +0000)]
Explain the new fields in top(1) related to ZFS compressed ARC

Reviewed by: bcr
X-MFC-with: 316314
Differential Revision: https://reviews.freebsd.org/D10781

7 years agoUpdate my copyright, note The FreeBSD Foundation involvement.
Konstantin Belousov [Thu, 18 May 2017 09:34:26 +0000 (09:34 +0000)]
Update my copyright, note The FreeBSD Foundation involvement.
While tweaking copyright block, switch to use __FBSDID for tag.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoFix style [1], add static keyword before static function definition.
Konstantin Belousov [Thu, 18 May 2017 09:31:30 +0000 (09:31 +0000)]
Fix style [1], add static keyword before static function definition.

Noted by: bapt [1]
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoFix typo.
Edward Tomasz Napierala [Thu, 18 May 2017 08:25:07 +0000 (08:25 +0000)]
Fix typo.

MFC after: 2 weeks

7 years agoConditionally handle the crontab entry for atrun(8)
Enji Cooper [Thu, 18 May 2017 06:33:55 +0000 (06:33 +0000)]
Conditionally handle the crontab entry for atrun(8)

The default crontab prior to this commit assumes atrun(8) is always
present, which isn't true if MK_AT == no. Move atrun(8) execution
from /etc/crontab to /etc/cron.d/at, and base /etc/cron.d/at's installation
on MK_AT. cron(8) will detect /etc/cron.d/at's presence when the configuration
is loaded and run atrun every 5 minutes like it would prior to this commit.

SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at
because atrun(8) executes programs, which may rely on environment
set in the current default /etc/crontab.

Noted by: bdrewery (in an internal review)
MFC after: 2 months
Relnotes: yes (may need to add environmental modifications to
     /etc/cron.d/at)
Sponsored by: Dell EMC Isilon

7 years agoRevert r318441: the commit message was incoherent
Enji Cooper [Thu, 18 May 2017 06:27:37 +0000 (06:27 +0000)]
Revert r318441: the commit message was incoherent

7 years agoHandle the cron.d entry for MK_AT in cron conditionally
Enji Cooper [Thu, 18 May 2017 06:25:39 +0000 (06:25 +0000)]
Handle the cron.d entry for MK_AT in cron conditionally

Install /etc/cron.d/at if MK_AT != no, always using it, which tries
to run a non-existent program via cron(8) every 5 minutes with the
default /etc/crontab, prior to this commit.

SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at
because atrun(8) executes programs, which may rely on environment
currently set via /etc/crontab.

Noted by: bdrewery (in an internal review)
MFC after: 2 months
Relnotes: yes (may need to add environmental modifications to
     /etc/cron.d/at)
Sponsored by: Dell EMC Isilon

7 years agoNormalize SYSDIR on SRCTOP instead of .CURDIR
Enji Cooper [Thu, 18 May 2017 06:15:42 +0000 (06:15 +0000)]
Normalize SYSDIR on SRCTOP instead of .CURDIR

This is being done to simplify pathing for CFLAGS and source files.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoNormalize .PATH on SRCTOP
Enji Cooper [Thu, 18 May 2017 06:13:29 +0000 (06:13 +0000)]
Normalize .PATH on SRCTOP

This will help Jenkins dedupe 9 warnings between the static build and
the module build of ipsec(4).

Missed in SRCTOP conversion in r314651.

MFC with: r314651
Sponsored by: Dell EMC Isilon

7 years agoRevert local changes to find_progenv accidentally committed in r318436
Enji Cooper [Thu, 18 May 2017 01:46:30 +0000 (01:46 +0000)]
Revert local changes to find_progenv accidentally committed in r318436

MFC after: 2 weeks
MFC with: r318436
Sponsored by: Dell EMC Isilon

7 years agousr.bin/getconf: add some initial tests
Enji Cooper [Thu, 18 May 2017 01:43:30 +0000 (01:43 +0000)]
usr.bin/getconf: add some initial tests

Items tested via this commit are:
- Some basic POSIX constants.
- Some valid programming environments with -v.
- Some invalid programming environments via -v.

NOTE: this test makes assumptions about ILP32/LP32 vs LP64 that are
currently not true on all architectures to avoid hardcoding some
architectures in the tests. I'm working on improving getconf(1) to be
more sane about handling ILP32/LP32 vs LP64. Future commits are coming
soon to address this.

MFC after: 2 weeks
Tested with: amd64, i386
Sponsored by: Dell EMC Isilon

7 years agoMake the `.gperf.c` suffix rule depend on fake-gperf.awk
Enji Cooper [Thu, 18 May 2017 01:35:07 +0000 (01:35 +0000)]
Make the `.gperf.c` suffix rule depend on fake-gperf.awk

Parameterize out fake-gperf.awk to avoid duplicating the path

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix some nroff syntax in rtld.1.
Jonathan Anderson [Thu, 18 May 2017 00:32:05 +0000 (00:32 +0000)]
Fix some nroff syntax in rtld.1.

When I originally documented the LD_LIBRARY_PATH_FDS environment variable,
I used `.Ev` rather than `.It Ev` to introduce it; this led to the
documentation being embedded in the previous paragraph (LD_LIBRARY_PATH).

7 years agoAllow rtld direct-exec to take a file descriptor.
Jonathan Anderson [Wed, 17 May 2017 22:51:28 +0000 (22:51 +0000)]
Allow rtld direct-exec to take a file descriptor.

When executing rtld directly, allow a file descriptor to be explicitly
specified rather than opened from the given path. This, together with the
LD_LIBRARY_PATH_FDS environment variable, allows dynamically-linked
applications to be executed from within capability mode.

Also add some rudimentary argument parsing (without pulling in getopt or
the like) to accept this file descriptor, a help (-h) option and a basic
usage string.

Reviewed by: kib
Sponsored by: NSERC, RDC
Differential Revision: https://reviews.freebsd.org/D10751

7 years agoAdd a driver for the Chelsio T6 crypto accelerator engine.
John Baldwin [Wed, 17 May 2017 22:13:07 +0000 (22:13 +0000)]
Add a driver for the Chelsio T6 crypto accelerator engine.

The ccr(4) driver supports use of the crypto accelerator engine on
Chelsio T6 NICs in "lookaside" mode via the opencrypto framework.

Currently, the driver supports AES-CBC, AES-CTR, AES-GCM, and AES-XTS
cipher algorithms as well as the SHA1-HMAC, SHA2-256-HMAC, SHA2-384-HMAC,
and SHA2-512-HMAC authentication algorithms.  The driver also supports
chaining one of AES-CBC, AES-CTR, or AES-XTS with an authentication
algorithm for encrypt-then-authenticate operations.

Note that this driver is still under active development and testing and
may not yet be ready for production use.  It does pass the tests in
tests/sys/opencrypto with the exception that the AES-GCM implementation
in the driver does not yet support requests with a zero byte payload.

To use this driver currently, the "uwire" configuration must be used
along with explicitly enabling support for lookaside crypto capabilities
in the cxgbe(4) driver.  These can be done by setting the following
tunables before loading the cxgbe(4) driver:

    hw.cxgbe.config_file=uwire
    hw.cxgbe.cryptocaps_allowed=-1

MFC after: 1 month
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D10763

7 years agoFix the offset for the CPU0 MPIC registers.
Luiz Otavio O Souza [Wed, 17 May 2017 22:05:07 +0000 (22:05 +0000)]
Fix the offset for the CPU0 MPIC registers.

Please note that only a subset of CPU0 registers are exported.  CPU1
registers are not touched.

Obtained from: ARMADA38X Functional Specifications
Sponsored by: Rubicon Communications, LLC (Netgate)