]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r344214:
Andriy Voskoboinyk [Fri, 22 Feb 2019 08:04:50 +0000 (08:04 +0000)]
MFC r344214:
Refresh OptionalObsoleteFiles.inc for MK_PMC:

- Add missing /usr/sbin/pmc, pmcformat.h, libpmcstat.h and pmc.haswellxeon.3
to the list.
- Correct man page section for pmcstudy.8.
- Include recently added libipt and libopencsd for corresponding TARGET_ARCH

5 years agoMFC r344201:
Andriy Voskoboinyk [Thu, 21 Feb 2019 23:53:52 +0000 (23:53 +0000)]
MFC r344201:
Remove vi(1)-related files via 'make delete-old' when WITHOUT_VI=1 is set.

5 years agoMFC r344120:
Konstantin Belousov [Thu, 21 Feb 2019 12:13:27 +0000 (12:13 +0000)]
MFC r344120:
Unify i386 and amd64 getcontextx.c, and use ifuncs while there.

5 years agoMFC r344119:
Konstantin Belousov [Thu, 21 Feb 2019 12:10:56 +0000 (12:10 +0000)]
MFC r344119:
x86 __vdso_gettc(): use machine/cpufunc.h function for CPUID.

5 years agoMFC r344118:
Konstantin Belousov [Thu, 21 Feb 2019 12:09:04 +0000 (12:09 +0000)]
MFC r344118:
Provide userspace versions of do_cpuid() and cpuid_count() on i386.

5 years agoMFC r344198:
Andriy Voskoboinyk [Thu, 21 Feb 2019 09:54:10 +0000 (09:54 +0000)]
MFC r344198:
GC ATA_REQUEST_TIMEOUT option remnants

It was removed from code in r249083 and from sys/conf/options in r249213.

PR: 193935, 222170

5 years agoMFC r344264:
Dimitry Andric [Thu, 21 Feb 2019 07:22:05 +0000 (07:22 +0000)]
MFC r344264:

Add one additional file to libllvmminimal, since in some cases (e.g.
upgrading from stable/10 to stable/11) symbols from it are needed to
link llvm-tblgen and clang-tblgen.

Reported by: kib

5 years agoMFC r344261:
Dimitry Andric [Thu, 21 Feb 2019 07:20:17 +0000 (07:20 +0000)]
MFC r344261:

Pull in r345199 from upstream libc++ trunk (by Petr Hosek):

  Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are
  floating-point types."

  This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
  extensions and compilers other than Clang don't define these for C++.

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

This prevents "_Float16 is not supported on this target" errors in
libc++'s type_traits header, in some cases.

Reported by: Charlie Li

5 years agoMFC r343827:
Jason A. Harmening [Thu, 21 Feb 2019 06:40:15 +0000 (06:40 +0000)]
MFC r343827:

r342089 changed cap_syslog(3) to preserve the stdio descriptors inherited
from its parent so that LOG_PERROR would work.  However, this caused
dhclient(8)'s stdio streams to remain open across daemonization, breaking
the ability to capture its foreground output as done in netconfig_ipv4.

Fix this by reverting r341692 and instead passing the parent's stderr
descriptor as an argument to cap_openlog() only when LOG_PERROR is specified
in logopt.

PR: 234514

5 years agoMFC r343125 (by cem): ioat(4): Set __result_use_check on ioat_acquire_reserve
Alexander Motin [Thu, 21 Feb 2019 00:17:24 +0000 (00:17 +0000)]
MFC r343125 (by cem): ioat(4): Set __result_use_check on ioat_acquire_reserve

Even M_WAITOK callers must check for failure.  For example, if the device is
quiescing, either due to automatic error-recovery induced reset, or due to
administrative detach, the routine will return ENXIO and the acquire
reference will not be held.  So, there is no mode in which it is safe to
assume the routine succeeds without checking.

5 years agoMFC r344024:
David Bright [Wed, 20 Feb 2019 22:48:38 +0000 (22:48 +0000)]
MFC r344024:

CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c

In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that
fall to the bottom of the case set `lp` to `NULL`, so the test for a
non-NULL value of `lp` and call to `free()` if true is dead code as
the test can never be true. Fix by eliminating the whole if
statement. To guard against a possible future change that accidentally
violates this assumption, use a `KASSERT()` to catch if `lp` is
non-NULL.

Sponsored by: Dell EMC Isilon

5 years agoMFC r343165 (by jhibbits):
Dimitry Andric [Wed, 20 Feb 2019 20:28:48 +0000 (20:28 +0000)]
MFC r343165 (by jhibbits):

Fix top(1) long options handling

getopt_long(3) requires the long options be terminated by a NULL block.
Without the terminator, an invalid long option results in a segmentation
fault.

Reported by: Brandon Bergren

MFC r343957:

Fix multiple warnings in usr.bin/top about discarded qualifiers from
both clang and gcc, by either constifying variables, or when that is not
possible, using __DECONST.

MFC r343958:

Fix multiple warnings in usr.bin/top about variables shadowing global
declarations from base gcc, by renaming those variables.

MFC r343959:

Fix the first couple of AddressSanitizer violations in usr.bin/top.

Avoid setting zero bytes beyond the length of the 'thisline' parameters
in i_process() and u_process(), and don't attempt to memset a negative
number of bytes.

5 years agoMFC r344042:
Pedro F. Giffuni [Wed, 20 Feb 2019 14:10:46 +0000 (14:10 +0000)]
MFC r344042:
UMA: unsign some variables related to allocation in hash_alloc().

As a followup to r343673, unsign some variables related to allocation
since the hashsize cannot be negative. This gives a bit more space to
handle bigger allocations and avoid some implicit casting.

While here also unsign uh_hashmask, it makes little sense to keep it
signed.

Differential Revision: https://reviews.freebsd.org/D19148

5 years agoMFC r343967:
Sergey Kandaurov [Wed, 20 Feb 2019 11:58:40 +0000 (11:58 +0000)]
MFC r343967:
Sync "struct addrinfo" declaration with netdb.h.

PR: 225880

5 years agoMFC r343945:
Sergey Kandaurov [Wed, 20 Feb 2019 11:56:30 +0000 (11:56 +0000)]
MFC r343945:
Document the ENOBUFS errno in setsockopt(2).

PR: 200649

5 years agoMFC r344103:
Andrey V. Elsukov [Wed, 20 Feb 2019 10:22:48 +0000 (10:22 +0000)]
MFC r344103:
  In r335015 PCB destroing was made deferred using epoch_call().

  But ipsec_delete_pcbpolicy() uses some VNET-virtualized variables,
  and thus it needs VNET context, that is missing during gtaskqueue
  executing. Use inp_vnet context to set curvnet in in_pcbfree_deferred().

  PR: 235684

5 years agoMFC r344061:
Kristof Provost [Tue, 19 Feb 2019 18:22:55 +0000 (18:22 +0000)]
MFC r344061:

garp: Fix vnet related panic for gratuitous arp

Gratuitous ARP packets are sent from a timer, which means we don't have a vnet
context set. As a result we panic trying to send the packet.

Set the vnet context based on the interface associated with the interface
address.

To reproduce:
sysctl net.link.ether.inet.garp_rexmit_count=2
ifconfig vtnet1 10.0.0.1/24 up

PR: 235699
Reviewed by: vangyzen@

5 years agoMFC r342114:
Edward Tomasz Napierala [Tue, 19 Feb 2019 10:28:59 +0000 (10:28 +0000)]
MFC r342114:

Add kern.rpc.gss.client_max, to make it possible to bump it easily.
This can drastically lower the load on gssd(8) on large NFS servers.

5 years agoMFC r344043:
Ben Widawsky [Tue, 19 Feb 2019 02:26:47 +0000 (02:26 +0000)]
MFC r344043:

termcap: Add an entry for kitty

The project is here:
https://github.com/kovidgoyal/kitty/

I created a port (which now needs updating):
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233010

If only we could use terminfo :(

Approved by:    bapt
Differential Revision: https://reviews.freebsd.org/D19060

5 years agoMFC r344023:
Brooks Davis [Mon, 18 Feb 2019 18:44:20 +0000 (18:44 +0000)]
MFC r344023:

mdmfs: Fix many bugs in automatic md(4) creation.

This code allocated a correctly sized buffer, read past the end of the
source buffer, writing off the end of the target buffer, and then writing
a '\0' terminator past the end of the target buffer (in the wrong place).
It then leaked the buffer.

Switch to a statically sized buffer on the stack and update the source
pointer and length before use so the correct things are copied.

Fix a logic error in the checks that the format of the line is as
expected and move on out of an assert.

Remove an unneeded close(). fclose() closes the descriptor.

Found with: CheriABI
Obtained from: CheriBSD
Reviewed by: kib, jhb, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19122

5 years agoMFC r343543: bectl(8) test: Force destroy the zpool in cleanup
Kyle Evans [Mon, 18 Feb 2019 16:11:11 +0000 (16:11 +0000)]
MFC r343543: bectl(8) test: Force destroy the zpool in cleanup

This is a wild guess as to why bectl tests failed once upon a time in CI,
given no apparent way to see a transcript of cleanup routines with Kyua. The
bectl tests construct a new, clean zpool for every test. The failure
indicated was because of a mount that was leftover from a previous test, but
the previous test had succeeded so it's not clear how the mount remained
leftover unless the `zpool get health ${pool}` had somehow failed.

5 years agoMFC r344018:
Andrey V. Elsukov [Mon, 18 Feb 2019 10:51:27 +0000 (10:51 +0000)]
MFC r344018:
  Remove `set' field from state structure and use set from parent rule.

  Initially it was introduced because parent rule pointer could be freed,
  and rule's information could become inaccessible. In r341471 this was
  changed. And now we don't need this information, and also it can become
  stale. E.g. rule can be moved from one set to another. This can lead
  to parent's set and state's set will not match. In this case it is
  possible that static rule will be freed, but dynamic state will not.
  This can happen when `ipfw delete set N` command is used to delete
  rules, that were moved to another set.
  To fix the problem we will use the set number from parent rule.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC: r343164
Dmitry Morozovsky [Mon, 18 Feb 2019 10:11:26 +0000 (10:11 +0000)]
MFC: r343164

Clarify error messages a bit.

X-Found-With: r343112
Reviewed by: eugen (implicitly, when r343112 analysis)

5 years agoMFC r343896,r343922: dhclient: Pass through exit status from script
Jilles Tjoelker [Sun, 17 Feb 2019 20:25:07 +0000 (20:25 +0000)]
MFC r343896,r343922: dhclient: Pass through exit status from script

The wait status is translated into 8 bits the same way as the shell
calculates $?.

5 years agoMFC r343723:
Konstantin Belousov [Sun, 17 Feb 2019 09:57:43 +0000 (09:57 +0000)]
MFC r343723:
i386: Do not ever store to other-CPU counter64 slot.

5 years agoMFC r343966:
Konstantin Belousov [Sun, 17 Feb 2019 09:56:11 +0000 (09:56 +0000)]
MFC r343966:
struct xswdev on amd64 requires compat32 shims after ino64.

5 years agoMFC r343699:
Andriy Voskoboinyk [Sun, 17 Feb 2019 03:21:18 +0000 (03:21 +0000)]
MFC r343699:
net80211: do not setup Tx parameters for unsupported modes.

That should shorten 'ifconfig <wlan> list txparam' output since
unsupported modes will not be shown.

5 years agoMFC r343696:
Andriy Voskoboinyk [Sun, 17 Feb 2019 03:11:42 +0000 (03:11 +0000)]
MFC r343696:
net80211: do not setup roaming parameters for unsupported modes.

ifconfig(8) prints per-mode parameters if they are non-zero; since
we have 13 possible modes with 3...5 typically supported this change
should greatly reduce amount of information for 'ifconfig <wlan> list roam'
command.

While here ensure that sta_roam_check() will not use roaming parameters
for unsupported modes (it should not).

This change effectively reverts r188776.

5 years agoMFC r343501:
Andriy Voskoboinyk [Sun, 17 Feb 2019 02:58:44 +0000 (02:58 +0000)]
MFC r343501:
Add NO_6_BYTE / NO_SYNC_CACHE quirks for (C|D|E).* Olympus digital cameras

PR: 97472
Submitted by: Fabio Luis Girardi <papelhigienico@gmail.com>
Reviewed by: imp

5 years agoMFC r344112:
Dimitry Andric [Sat, 16 Feb 2019 19:49:12 +0000 (19:49 +0000)]
MFC r344112:

Pull in r353907 from upstream llvm trunk (by Reid Kleckner):

  [MC] Make symbol version errors non-fatal

  We stil don't have a source location, which is pretty lame, but at
  least we won't tell the user to file a clang bug report anymore.

  Fixes PR40712

This will make errors for symbols with @@ versions that are not defined
non-fatal.  For example:

  void f(void)
  {
    __asm__(".symver foo,bar@@baz");
  }

will now result in:

  error: versioned symbol bar@@baz must be defined

instead of clang crashing with a diagnostic report.

PR: 234671
Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40712

5 years agoMerge clang 7.0.1 and several follow-up changes
Dimitry Andric [Sat, 16 Feb 2019 15:43:49 +0000 (15:43 +0000)]
Merge clang 7.0.1 and several follow-up changes

MFC r341825:

Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_70 branch r348686 (effectively, 7.0.1 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 7.0.0 are available here:
<http://releases.llvm.org/7.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/lld/docs/ReleaseNotes.html>

PR: 230240, 230355
Relnotes: yes

MFC r342123:

Update clang, llvm, lld, lldb, compiler-rt and libc++ version number to
7.0.1 release r349250.  There were no functional changes since the 7.0.1
rc3 import.

PR: 230240, 230355
Relnotes: yes

r343429 | emaste | 2019-01-25 15:46:13 +0100 (Fri, 25 Jan 2019) | 16 lines

clang: default to DWARF 4 as of FreeBSD 13

FreeBSD previously defaulted to DWARF 2 because several tools (gdb,
ctfconvert, etc.) did not support later versions.  These have either
been fixed or are deprecated.

Note that gdb 6 still exists but has been moved out of $PATH into
/usr/libexec and is intended only for use by crashinfo(8).  The kernel
build sets the DWARF version explicitly via -gdwarf2, so this should
have no effect there.

PR: 234887 [exp-run]
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17930

MFC r343916:

Pull in r352607 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPSW as a Def on some FP instructions that were missing it.

Pull in r353141 from upstream llvm trunk (by Craig Topper):

  [X86] Connect the default fpsr and dirflag clobbers in inline
  assembly to the registers we have defined for them.

  Summary:
  We don't currently map these constraints to physical register numbers
  so they don't make it to the MachineIR representation of inline
  assembly.

  This could have problems for proper dependency tracking in the
  machine schedulers though I don't have a test case that shows that.

  Reviewers: rnk

  Reviewed By: rnk

  Subscribers: eraman, llvm-commits

  Tags: #llvm

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

Pull in r353489 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPCW as a register and start using it as an implicit use on
  floating point instructions.

  Summary:
  FPCW contains the rounding mode control which we manipulate to
  implement fp to integer conversion by changing the roudning mode,
  storing the value to the stack, and then changing the rounding mode
  back. Because we didn't model FPCW and its dependency chain, other
  instructions could be scheduled into the middle of the sequence.

  This patch introduces the register and adds it as an implciit def of
  FLDCW and implicit use of the FP binary arithmetic instructions and
  store instructions. There are more instructions that need to be
  updated, but this is a good start. I believe this fixes at least the
  reduced test case from PR40529.

  Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor

  Subscribers: dim, llvm-commits

  Tags: #llvm

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

These should fix a problem in clang 7.0 where it would sometimes emit
long double floating point instructions in a slightly wrong order,
leading to failures in our libm tests.  In particular, the cbrt_test
test case 'cbrtl_powl' and the trig_test test case 'reduction'.

Also bump __FreeBSD_cc_version, to be able to detect this in our test
suite.

Reported by:    lwhsu
PR: 234040
Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40206

MFC r344056:

Pull in r339734 from upstream llvm trunk (by Eli Friedman):

  [ARM] Make PerformSHLSimplify add nodes to the DAG worklist correctly.

  Intentionally excluding nodes from the DAGCombine worklist is likely
  to lead to weird optimizations and infinite loops, so it's generally
  a bad idea.

  To avoid the infinite loops, fix DAGCombine to use the
  isDesirableToCommuteWithShift target hook before performing the
  transforms in question, and implement the target hook in the ARM
  backend disable the transforms in question.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=38530 . (I don't have a
  reduced testcase for that bug. But we should have sufficient test
  coverage for PerformSHLSimplify given that we're not playing weird
  tricks with the worklist. I can try to bugpoint it if necessary,
  though.)

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

This should fix a possible hang when compiling sys/dev/nxge/if_nxge.c
(which exists now only in the stable/11 branch) for arm.

5 years agoMFC r343918: Teach /etc/rc.d/growfs how to handle systems running ZFS.
Colin Percival [Sat, 16 Feb 2019 09:50:17 +0000 (09:50 +0000)]
MFC r343918: Teach /etc/rc.d/growfs how to handle systems running ZFS.

5 years agoMFC r339831 (imp): Move LUA_ROOT to /boot/lua
Kyle Evans [Sat, 16 Feb 2019 06:12:16 +0000 (06:12 +0000)]
MFC r339831 (imp): Move LUA_ROOT to /boot/lua

While this is mostly unused today, this is a better place than
/usr/local/lua.

5 years agoMFC r343601:
Kyle Evans [Sat, 16 Feb 2019 04:48:30 +0000 (04:48 +0000)]
MFC r343601:
install(1): Fix relative path calculation with partial common dest/src

For example, from the referenced PR [1]:

$ mkdir /tmp/lib/ /tmp/libexec
$ touch /tmp/lib/foo.so
$ install -lrs /tmp/lib/foo.so /tmp/libexec/

The common path identification bits terminate src at /tmp/lib/ and the
destination at /tmp/libe. The subsequent backtracking is then incorrect, as
it traverses the destination and backtraces exactly one level while eating
the 'libexec' because it was previously (falsely) identified as common with
'lib'.

The obvious fix would be to make sure we've actually terminated just after
directory separators and rewind a character if we haven't. In the above
example, we would end up rewinding to /tmp/ and subsequently doing the right
thing.

Test case added.

PR: 235330 [1]

5 years agoMFC: r343011
Yoshihiro Takahashi [Sat, 16 Feb 2019 03:18:09 +0000 (03:18 +0000)]
MFC: r343011

  Use ${SRCTOP}/contrib/com_err/com_err.h instead of the installed com_err.h.
  This fixes build when com_err.h is not installed.

PR: 234691

5 years agoMFC r343094:
Andriy Voskoboinyk [Sat, 16 Feb 2019 01:19:14 +0000 (01:19 +0000)]
MFC r343094:
iwn(4): (partially) rewrite A-MPDU Tx path

The change fixes ifnet counters and improves Tx stability when A-MPDU
is used.

MFC r343292:
iwn(4): drop i_seq field initialization for A-MPDU frames

It is done by net80211 since r319460.

PR: 192641, 210211
Reviewed by: adrian, dhw
Differential Revision: https://reviews.freebsd.org/D10728

5 years agoMFC r343980:
Andriy Voskoboinyk [Sat, 16 Feb 2019 01:05:22 +0000 (01:05 +0000)]
MFC r343980:
ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter

5 years agoMFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
Eugene Grosbein [Sat, 16 Feb 2019 00:38:25 +0000 (00:38 +0000)]
MFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
function while processing not entirely correct jail.conf(5) file
having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
so extrap variable stays NULL.

Reported by:    marck

5 years agoMFC r343909:
Andriy Voskoboinyk [Sat, 16 Feb 2019 00:37:08 +0000 (00:37 +0000)]
MFC r343909:
newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
when output file cannot be opened

PR: 201732
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r343327:
Vladimir Kondratyev [Fri, 15 Feb 2019 20:52:32 +0000 (20:52 +0000)]
MFC r343327:

Add quirk to enable mic and headphones redirection on HP Spectre laptops.

Tested on HP Spectre 13 AF006UR.

5 years agoMFC r343163:
Vladimir Kondratyev [Fri, 15 Feb 2019 20:45:12 +0000 (20:45 +0000)]
MFC r343163:

psm(4): detect Lenovo top-button clickpads

libinput has special handling for Lenovo ThinkPad *40 series, where it
treats clicks on the top button area as if they came from the TrackPoint:
https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html

Detect these devices and set the corresponding evdev property.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D18676

5 years agoMFC r344132:
Eric Joyner [Fri, 15 Feb 2019 19:13:11 +0000 (19:13 +0000)]
MFC r344132:

ixl: Fix panic caused by bug exposed by r344062

Don't use a struct if_irq for IFLIB_INTR_IOV type interrupts since that results
in get_core_offset() being called on them, and get_core_offset() doesn't
handle IFLIB_INTR_IOV type interrupts, which results in an assert() being triggered
in iflib_irq_set_affinity().

PR: 235730
Reported by: Jeffrey Pieper <jeffrey.e.pieper@intel.com>
Sponsored by: Intel Corporation

5 years agoMFC r343855, r343859:
Konstantin Belousov [Fri, 15 Feb 2019 11:33:48 +0000 (11:33 +0000)]
MFC r343855, r343859:
Use ifunc to select the barrier instruction for RDTSC.

5 years agoMFC r343899:
Konstantin Belousov [Fri, 15 Feb 2019 11:20:25 +0000 (11:20 +0000)]
MFC r343899:
In null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.

PR: 235549

5 years agoMFC r343897, r343898:
Konstantin Belousov [Fri, 15 Feb 2019 11:19:12 +0000 (11:19 +0000)]
MFC r343897, r343898:
Some style for nullfs_mount().
Before using VTONULL(), check that the covered vnode belongs to nullfs.

5 years agoMFC r343891:
Konstantin Belousov [Fri, 15 Feb 2019 11:13:39 +0000 (11:13 +0000)]
MFC r343891:
Fix renameat(2) for CAPABILITIES kernelsi.

MFC Note: Layout of the struct nameidata is changed.  I specifically
decided to not move the new field to the end of the new structure since
it would mostly make the corruption silent.  __FreeBSD_version is bumped.

5 years agoMFC r343617, r343618:
Konstantin Belousov [Fri, 15 Feb 2019 09:49:09 +0000 (09:49 +0000)]
MFC r343617, r343618:
Make iflib a loadable module.

5 years agoMFC r343905:
Hans Petter Selasky [Fri, 15 Feb 2019 09:20:10 +0000 (09:20 +0000)]
MFC r343905:
Improve Bluetooth device discovery support for Android and Microsoft devices.

Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
project at github.com.

PR: 210089
Sponsored by: Mellanox Technologies

5 years agoMerge r343895:
Gleb Smirnoff [Fri, 15 Feb 2019 00:29:44 +0000 (00:29 +0000)]
Merge r343895:
  Allow some nesting of ng_iface(4) interfaces and add a configuration knob.

PR: 235500

5 years agoMFC r343530:
Alan Somers [Thu, 14 Feb 2019 20:33:35 +0000 (20:33 +0000)]
MFC r343530:

ifconfig: fix endianness bug displaying pfsync interfaces

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D19005

5 years agoMFC r300938, r342154
Alan Somers [Thu, 14 Feb 2019 20:31:05 +0000 (20:31 +0000)]
MFC r300938, r342154

r300938 by ngie:
Remove the sa(8) tests if MK_ACCT == no when "make delete-old" is run

sa(8) is conditionally installed based on MK_ACCT != no today

Sponsored by: EMC / Isilon Storage Division

r342154:
OptionalObsoleteFiles: Fix deleting usr/tests/usr.sbin/sa

It's a directory, not a file.

Reported by: ngie
X-MFC-With: 300938

5 years agoMFC r342153, r342172-r342173
Alan Somers [Thu, 14 Feb 2019 20:29:33 +0000 (20:29 +0000)]
MFC r342153, r342172-r342173

r342153:
Conditionally install /etc/rc.d/audit* based on ${MK_AUDIT}

/usr/sbin/audit(dist)?d are only installed if ${MK_AUDIT} == yes. Their
supporting scripts should only be installed in those instances as well.

Submitted by: ngie
Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd/pull/242

r342172:
audit(4) tests: require /etc/rc.d/auditd

These tests should be skipped if /etc/rc.d/auditd is missing, which could be
the case if world was built with WITHOUT_AUDIT set.  Also, one test case
requires /etc/rc.d/accounting.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/240

r342173:
Conditionalize installtion audit(4) tests on MK_AUDIT

MK_AUDIT already controls auditd(8), praudit(1), etc.  It should also control
the audit test suite.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/240

5 years agoMFC r341390, r341392, r341667
Alan Somers [Thu, 14 Feb 2019 20:26:59 +0000 (20:26 +0000)]
MFC r341390, r341392, r341667

r341390:
Remove some dead code from the geli tests

This is detritus in the Makefile, leftover from 327662.

r341392:
Unbreak geli/gmirror testcases if their geom classes cannot be loaded

The problem with the logic prior to this commit was twofold:

1. The wrong set of idioms (TAP-compatible) were being applied to the ATF
   testcases when run, resulting in confusing ATF failure results on setup.
2. The cleanup subroutines were broken when the geom classes could not be
   loaded as they exited with 0 unexpectedly.

This commit changes the test code to source the class-specific configuration
(conf.sh) once globally, instead of sourcing it per testcase and per cleanup
subroutine, and to call the ATF-specific setup subroutine(s) inline in
the testcases.

The refactoring done is effectively a no-op for the TAP testcases, modulo
any refactoring done to create common code between the ATF and TAP
testcases.

This unbreaks the geli testcases converted to ATF in r327662 and r327683,
and the gmirror testcases added in r327780, respectively, when the geom
class could not be loaded.

tests/sys/geom/class/mirror/...
    While here, ignore errors when turning debug failpoint sysctl off, which
    could occur if the gmirror class was not loaded.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/241

r341667:
geom tests: Fix cleanup of ATF tests since r341392

r341392 changed common test cleanup routines in a way that allowed them to
be used by TAP tests as well as ATF tests.  However, a late change made
during code review resulted in cleanup being broken for ATF tests, which
source geom_subr.sh separately during the body and cleanup phases of the
test.  The result was that md(4) devices wouldn't get cleaned up.

X-MFC-With: 341392

5 years agoMFC r341598:
Alan Somers [Thu, 14 Feb 2019 20:24:33 +0000 (20:24 +0000)]
MFC r341598:

stat(2): clarify which syscalls modify file timestamps

The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
of date and probably not accurate to begin with.  Update it, and make it
clear that the list is open-ended.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D18410

5 years agoMFC r340988:
Alan Somers [Thu, 14 Feb 2019 18:01:06 +0000 (18:01 +0000)]
MFC r340988:

vfs_aio.c: rename "physio" symbols to "bio".

aio has two paths: an asynchronous "physio" path and a synchronous path.
Confusingly, physio(9) isn't actually used by the "physio" path, and never
has been.  In fact, it may even be called by the synchronous path!  Rename
the "physio" path to the "bio" path to reflect what it actually does:
directly compose BIOs and send them to character devices.

5 years agoMFC r343850:
Konstantin Belousov [Thu, 14 Feb 2019 14:50:47 +0000 (14:50 +0000)]
MFC r343850:
contigmalloc: handle M_EXEC.

5 years agoMFC r343868:
Andriy Voskoboinyk [Thu, 14 Feb 2019 09:48:13 +0000 (09:48 +0000)]
MFC r343868:
Correct ypldap(8) install path in OptionalObsoleteFiles.inc

It's installed to /usr/sbin, not to /usr/bin.

While here, add missing manpages and /var/yp directory to the list.

5 years agoMFC r343930:
Guangyuan Yang [Thu, 14 Feb 2019 09:12:19 +0000 (09:12 +0000)]
MFC r343930:

Remove -R option which was added to sysctl(8) man page per r244106, but it is not implemented.

Submitted by: Alfonso Siciliano <alfix86@gmail.com>
Reviewed by: 0mp, imp
Differential Revision:  https://reviews.freebsd.org/D19012

5 years agoMFC r343591:
Cy Schubert [Thu, 14 Feb 2019 00:52:03 +0000 (00:52 +0000)]
MFC r343591:

Do not obtain an already held read lock. This causes a witness panic when
ipfs is invoked. This is the second of two panics resolving PR 235110.

PR: 235110
Reported by: David.Boyd49@twc.com

5 years agoMFC r339577:
Ben Widawsky [Wed, 13 Feb 2019 19:00:06 +0000 (19:00 +0000)]
MFC r339577:

acpi: Add an interface to obtain DSM information

The Device Specific Method (_DSM) is on optional object that defines
device specific controls. This will be useful for our power management
controller in upcoming patches. More information can be found in ACPI
spec 6.2 section 9.1.1

https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf

This patch had a minor modification changing ENOMEM to AE_NO_MEMORY
after it got review and approval but before committing.

Test Plan: Tested in my s0ix branch

Reviewed by: kib
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D17121

5 years agoMFC r340000:
Ben Widawsky [Wed, 13 Feb 2019 18:55:47 +0000 (18:55 +0000)]
MFC r340000:

linuxkpi: Add GFP flags needed for ttm drivers

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Requested by: bwidawsk
Approved by: emaste (mentor)

5 years agoMFC: r343372
Marius Strobl [Wed, 13 Feb 2019 16:02:52 +0000 (16:02 +0000)]
MFC: r343372

ixl(4): Fix handling data passed with ioctl from NVM update tool

From Krzysztof:

Ensure that the entire data buffer passed from the NVM update tool is copied in
to kernel space and copied back out to user space using copyin() and copyout().

PR: 234104
Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reported by: Finn <ixbug@riseup.net>
Differential Revision: https://reviews.freebsd.org/D18817

5 years agoMFC: r339459
Marius Strobl [Wed, 13 Feb 2019 15:30:06 +0000 (15:30 +0000)]
MFC: r339459

ixl/iavf(4): Fix GCC 6.4.0 build

Don't define redundant prototypes.

5 years agoMFC: r343622
Marius Strobl [Wed, 13 Feb 2019 15:27:17 +0000 (15:27 +0000)]
MFC: r343622

ix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled

This patch and commit message are based on r340256 created by Jacob Keller:

The iflib stack does not disable TSO automatically when TXCSUM is
disabled, instead assuming that the driver will correctly handle TSOs
even when CSUM_IP is not set.

This results in iflib calling ixgbe_isc_txd_encap with packets which have
CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of
this, ixgbe_tx_ctx_setup will not setup the IPv4 checksum offloading.

This results in bad TSO packets being sent if a user disables TXCSUM
without disabling TSO.

Fix this by updating the ixgbe_tx_ctx_setup function to check both
CSUM_IP and CSUM_IP_TSO when deciding whether to enable checksums.

Once this is corrected, another issue for TSO packets is revealed. The
driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that
causes the ip->sum field to be zero'd. This is necessary for ix
hardware to correctly perform TSOs.

However, if TXCSUM is disabled, then the work around is not enabled, as
CSUM_IP will not be set when the iflib stack checks to see if it should
clear the sum field.

Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the ix and
ixv interface files.

Once both of these changes are made, the ix and ixv drivers should
correctly offload TSO packets when TSO offload is enabled, regardless
of whether TXCSUM is enabled or disabled.

Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: IntelNetworking
Differential Revision: https://reviews.freebsd.org/D18470

5 years agoMFC: r343621
Marius Strobl [Wed, 13 Feb 2019 15:19:31 +0000 (15:19 +0000)]
MFC: r343621

ix(4): Run {mod,msf,mbx,fdir,phy}_task in if_update_admin_status

From Piotr:

This patch introduces adapter->task_requests register responsible for
recording requests for mod_task, msf_task, mbx_task, fdir_task and
phy_task calls. Instead of enqueueing these tasks with
GROUPTASK_ENQUEUE, handlers will be called directly from
ixgbe_if_update_admin_status() while holding ctx lock.

SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is
deleted and rewritten in ixgbe_handle_msf() task without holding ctx
lock. This change is needed to maintain data coherency when sharing
adapter info via ioctl() calls.

Patch co-authored by Krzysztof Galazka <krzysztof.galazka@intel.com>.

PR: 221317
Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: sbruno@, IntelNetworking
Differential Revision: https://reviews.freebsd.org/D18468

5 years agoMFC: r343934
Marius Strobl [Wed, 13 Feb 2019 14:39:16 +0000 (14:39 +0000)]
MFC: r343934

- Remove the redundant device disabled hint handling; ever since
  r241119 that's performed globally by device_attach(9).
- As for the EM-class of devices, em(4) supports multiple queues
  and MSI-X respectively only with 82574 devices. However, since
  the conversion to iflib(4), em(4) relies on the interrupt type
  fallback mechanism, i. e. MSI-X -> MSI -> INTx, of iflib(4) to
  figure out the interrupt type to use for the EM-class (as well
  as the IGB-class) of MACs. Moreover, despite the datasheet for
  82583V not mentioning any support of MSI-X, there actually are
  82583V devices out there that report a varying number of MSI-X
  messages as supported. The interrupt type fallback of iflib(4)
  is causing two failure modes depending on the actual number of
  MSI-X messages supported for such instances of 82583V:
  1) With only one MSI-X message supported, none is left for the
     RX/TX queues as that one message gets assigned to the admin
     interrupt. Worse, later on - which will be addressed with a
     separate fix - iflib(4) interprets that one messages as MSI
     or INTx to be set up, but fails to actually do so as it has
     previously called pci_alloc_msix(9). [1, 2]
  2) With more message supported, their distribution is okay but
     then em_if_msix_intr_assign() doesn't work for 82583V, with
     the interface being left in a non-working state, too. [3]
  Thus, let em_if_attach_pre() indicate to iflib(4) to try MSI-X
  with 82574 only, and at most MSI for the remainder of EM-class
  devices.
  While at it, remove "try_second_bar" as it's polarity inverted
  and not actually needed.
- Remove code from em_if_timer() that effectively is a NOP since
  the conversion to iflib(4) ("trigger" is no longer read).
  While at it, let the comment for em_if_timer() reflect reality
  after said conversion.
- Implement an ifdi_watchdog_reset method which only updates the
  em(4) "watchdog_events" counter but doesn't perform any reset,
  so that the em(4) "watchdog_timeouts" SYSCTL (iflib(4) doesn't
  provide a counterpart) reflects reality and these timeouts add
  to IFCOUNTER_OERRORS again after the iflib(4) conversion.
- Remove the "mbuf_defrag_fail" and "tx_dma_fail" SYSCTLS; since
  the iflib(4) conversion, associated counters are disconnected,
  but iflib(4) provides "mbuf_defrag_failed" and "tx_map_failed"
  respectively as equivalents.
- Move the description preceding lem_smartspeed() to the correct
  spot before em_reset() and bring back appropriate comments for
  {igb,em}_initialize_rss_mapping() and lem_smartspeed() lost in
  the iflib(4) conversion.
- Adapt some other function descriptions and INIT_DEBUGOUT() use
  to match reality after the iflib(4) conversion.
- Put the debugging message of em_enable_vectors_82574() (missed
  in r343578) under bootverbose, too.

PR: 219428 [1], 235246 [2], 235147 [3]
Reviewed by: erj (previous version)
Differential Revision: https://reviews.freebsd.org/D19108

5 years agoMFC: r343369
Marius Strobl [Wed, 13 Feb 2019 14:36:24 +0000 (14:36 +0000)]
MFC: r343369

intel iflib drivers: correct initialization of tx_cidx_processed

From Jake:

In r341156 ("Fix first-packet completion", 2018-11-28) a hack to work
around a delta calculation determining how many descriptors were used
was added to ixl_isc_tx_credits_update_dwb.

The same fix was also applied to the em and igb drivers in r340310, and
to ix in r341156.

The hack checked the case where prev and cur were equal, and then added
one. This works, because by the time we do the delta check, we already
know there is at least one packet available, so the delta should be at
least one.

However, it's not a complete fix, and as indicated by the comment is
really a hack to work around the real bug.

The real problem is that the first time that we transmit a packet,
tx_cidx_processed will be set to point to the start of the ring.
Ultimately, the credits_update function expects it to point to the
*last* descriptor that was processed. Since we haven't yet processed any
descriptors, pointing it to 0 results in this incorrect calculation.

Fix the initialization code to have it point to the end of the ring
instead. One way to think about this, is that we are setting the value
to be one prior to the first available descriptor.

Doing so, corrects the delta calculation in all cases. The original fix
only works if the first packet has exactly one descriptor. Otherwise, we
will report 1 less than the correct value.

As part of this fix, also update the MPASS assertions to match the real
expectations. First, ensure that prev is not equal to cur, since this
should never happen. Second, remove the assertion about prev==0 || delta
!= 0. It looks like that originated from when the em driver was
converted to iflib. It seems like it was supposed to ensure that delta
was non-zero. However, because we originally returned 0 delta for the
first calculation, the "prev == 0" was tacked on.

Instead, replace this with a check that delta is greater than zero,
after the correction necessary when the ring pointers wrap around.

This new solution should fix the same bug as r341156 did, but in a more
robust way.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@
Differential Revision: https://reviews.freebsd.org/D18545

5 years agoMFC r342945, r342947, r343020
Lars Engels [Wed, 13 Feb 2019 14:32:14 +0000 (14:32 +0000)]
MFC r342945, r342947, r343020

Add `bluetooth-config` script to simplify setting up bluetooth connections to
devices like mice, keyboards, bt-audio, ...

This script currently allows scanning for nearby devices, adds one to
/etc/bluetooth/hosts, adds an entry to hcsecd's conf and if it is a HID, add an
entry to bthidd's configs, as well.

Submitted by:   erdgeist <erdgeist at erdgeist.org>
Approved by:    bapt
MFC after:      2 weeks
Differential Revision:  D3778
Reviewers:      bapt, emax

5 years agoMFC: r343203
Marius Strobl [Wed, 13 Feb 2019 14:27:59 +0000 (14:27 +0000)]
MFC: r343203

ixgbe: this statement may fall through warnings with gcc

The recent gcc versions (7 and 8 at least) can check for switch case
statements for fall through (implicit-fallthrough). When fall through
is intentional, the default method for warning suppression is to place
comment /* FALLTHROUGH */ exactly before next case statement.

Differential Revision: https://reviews.freebsd.org/D18577

5 years agoMFC: r342749
Marius Strobl [Wed, 13 Feb 2019 13:09:16 +0000 (13:09 +0000)]
MFC: r342749

mp_ring: avoid items offset difference between iflib and mp_ring
on architectures without 64-bit atomics

Reported by: Augustin Cavalier <waddlesplash@gmail.com>

5 years agoMFC r343871:
Andriy Voskoboinyk [Wed, 13 Feb 2019 09:28:48 +0000 (09:28 +0000)]
MFC r343871:
recoverdisk(1): fclose() file supplied via '-r readlist' parameter when
it's no longer needed

PR: 204952
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r343579
Vincenzo Maffione [Wed, 13 Feb 2019 09:03:23 +0000 (09:03 +0000)]
MFC r343579

netmap: fix lock order reversal related to kqueue usage

When using poll(), select() or kevent() on netmap file descriptors,
netmap executes the equivalent of NIOCTXSYNC and NIOCRXSYNC commands,
before collecting the events that are ready. In other words, the
poll/kevent callback has side effects. This is done to avoid the
overhead of two system call per iteration (e.g., poll() + ioctl(NIOC*XSYNC)).

When the kqueue subsystem invokes the kqueue(9) f_event callback
(netmap_knrw), it holds the lock of the struct knlist object associated
to the netmap port (the lock is provided at initialization, by calling
knlist_init_mtx).
However, netmap_knrw() may need to wake up another netmap port (or even
the same one), which means that it may need to call knote().
Since knote() needs the lock of the struct knlist object associated to
the to-be-wake-up netmap port, it is possible to have a lock order reversal
problem (AB/BA deadlock).

This change prevents the deadlock by executing the knote() call in a
per-selinfo taskqueue, where it is possible to hold a mutex.

Reviewed by:    aleksandr.fedorov_itglobal.com
Differential Revision:  https://reviews.freebsd.org/D18956

5 years agoMFC r343586: Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.
Alexander Motin [Wed, 13 Feb 2019 00:39:03 +0000 (00:39 +0000)]
MFC r343586: Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.

In all cases where ZFS sends BIO_FLUSH, it first waits for all related
writes to complete, so its BIO_FLUSH does not care about strict ordering.
Removal of one makes life much easier at least for NVMe driver, which
hardware has no concept of request ordering, relying completely on software.

5 years agoMFC r343582,r343588:Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.
Alexander Motin [Wed, 13 Feb 2019 00:37:16 +0000 (00:37 +0000)]
MFC r343582,r343588:Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.

r212160 tightened this from always using MSG_SIMPLE_Q_TAG to always
MSG_ORDERED_Q_TAG.  Since it also marked all BIO_FLUSH requests with
BIO_ORDERED, this commit changes nothing immediately, but it returns
BIO_FLUSH callers ability to actually specify ordering they really
need, alike to other request types.

5 years agoMFC r343585: Only sort requests of types that have concept of offset.
Alexander Motin [Wed, 13 Feb 2019 00:33:01 +0000 (00:33 +0000)]
MFC r343585: Only sort requests of types that have concept of offset.

Other types, such as BIO_FLUSH or BIO_ZONE, or especially new/unknown ones,
may imply some degree of ordering even if strict ordering is not requested
explicitly.

5 years agoRevert the r343077 MFC after it was reverted in -current.
Warner Losh [Tue, 12 Feb 2019 20:12:41 +0000 (20:12 +0000)]
Revert the r343077 MFC after it was reverted in -current.

Approved by: core@

5 years agoMFC r342946: Remove accessing remote node and domain objects
Ram Kishore Vegesna [Tue, 12 Feb 2019 17:07:15 +0000 (17:07 +0000)]
MFC r342946: Remove accessing remote node and domain objects
while processing cam actions.
  Issue:
    ocs_fc(4) driver panics. It's induced by setting the port_state
  sysctl to offline, then online, then offline, then online, and so
  forth and so on in rapid succession.

  Reason:
    While we set the port_state to online fc discovery will start and OS
  is enumerating the target discs by calling ocs_action(),  then set the
  port state to "offline" which deletes domain/sport/nodes.

    In ocs_action()->XPT_GET_TRAN_SETTINGS we are accessing the remote
  node which can be invalid to get the wwpn, wwnn and port.

  Fix:
    Removed accessing of remote node and domain in some ocs_action() cases.
    Populated the required values from ocs_fcport.
    This removes the dependency of node and domain structures while
  processing XPT_PATH_INQ and XPT_GET_TRAN_SETTINGS.
     We will invalidate the target entries after the device lost
  timeout(30 seconds).

Approved by:ken,mav

5 years agoMFC 343548:
Dmitry Morozovsky [Tue, 12 Feb 2019 13:58:16 +0000 (13:58 +0000)]
MFC 343548:

  Allow dashes as a valid character in UFS labels.

5 years agoMFC r343772, r343867
Vincenzo Maffione [Tue, 12 Feb 2019 09:07:46 +0000 (09:07 +0000)]
MFC r343772, r343867

netmap: refactor logging macros and pipes

Changelist:
    - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr
      and nm_prlim, to avoid possible naming conflicts.
    - Add netmap_krings_mode_commit() helper function and use that
      to reduce code duplication.
    - Refactor pipes control code to export some functions that
      can be reused by the veth driver (on Linux) and epair(4).
    - Add check to reject API requests with version less than 11.
    - Small code refactoring for the null adapter.

5 years agoMFC r343870:
Andriy Voskoboinyk [Tue, 12 Feb 2019 07:03:37 +0000 (07:03 +0000)]
MFC r343870:
ipcs(1): drop obsolete error checking

This code is unreachable since r77551.

PR: 201728

5 years agoMFC r342904:
Enji Cooper [Tue, 12 Feb 2019 03:12:19 +0000 (03:12 +0000)]
MFC r342904:

route(8): clarify -prefixlen description

Try to reword -prefixlen section to more clearly and accurately describe how
the -prefixlen modifier works.

While here, fix a word that igor considered a typo: aggregatable addresses is a
valid technical term per RFC-2374, however, it was superseded by the term
"aggregator" in RFC-3587.

Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19155

5 years agoMFC r343444:
Enji Cooper [Tue, 12 Feb 2019 02:57:28 +0000 (02:57 +0000)]
MFC r343444:

Document that `sendfile` will return an invalid value for `sbytes` if provided an invalid address

This is meant to clarify the fact that the system call will not fail
with -1/EFAULT, as one might expect, when reading the sendfile(2)
manpage today.

While here, pet the mandoc linter, when dealing with the section that
describes valid values for `flags`.

PR: 232210
Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19151

5 years agoMFC r343562, r343563: Reimplement BIO_ORDERED handling in nvd(4).
Alexander Motin [Tue, 12 Feb 2019 00:53:14 +0000 (00:53 +0000)]
MFC r343562, r343563: Reimplement BIO_ORDERED handling in nvd(4).

This fixes BIO_ORDERED semantics while also improving performance by:
 - sleeping also before BIO_ORDERED bio, as defined, not only after;
 - not queueing BIO_ORDERED bio to taskqueue if no other bios running;
 - waking up sleeping taskqueue explicitly rather then rely on polling.

On Samsung SSD 970 PRO this shows sync write latency, measured with
`diskinfo -wS`, reduction from ~2ms to ~1.1ms by not sleeping without
reason till next HZ tick.

On the same device ZFS pool with 8 ZVOLs synchronously writing 4KB blocks
shows ~950 IOPS instead of ~750 IOPS before.  I suspect ZFS does not need
BIO_ORDERED on BIO_FLUSH at all, but that will be next question.

5 years agoMFC r343919:
Patrick Kelsey [Tue, 12 Feb 2019 00:00:32 +0000 (00:00 +0000)]
MFC r343919:
Fix em(4) interrupt routing

When configured with more tx queues than rx queues,
em_if_msix_intr_assign() was incorrectly routing the tx event
interrupts.

Reviewed by: erj, marius
Differential Revision: https://reviews.freebsd.org/D19070

5 years agoMFC r343535:
Patrick Kelsey [Mon, 11 Feb 2019 23:35:34 +0000 (23:35 +0000)]
MFC r343535:
Speed up non-status operations applied to a single interface

When performing a non-status operation on a single interface, it is
not necessary for ifconfig to build a list of all addresses in the
system, sort them, then iterate through them looking for the entry for
the single interface of interest. Doing so becomes increasingly
expensive as the number of interfaces in the system grows (e.g., in a
system with 1000+ vlan(4) interfaces).

Reviewed by: ae, kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18919

5 years agoMFC r343534:
Patrick Kelsey [Mon, 11 Feb 2019 23:33:16 +0000 (23:33 +0000)]
MFC r343534:
Don't re-evaluate ALTQ kernel configuration due to events on non-ALTQ interfaces

Re-evaluating the ALTQ kernel configuration can be expensive,
particularly when there are a large number (hundreds or thousands) of
queues, and is wholly unnecessary in response to events on interfaces
that do not support ALTQ as such interfaces cannot be part of an ALTQ
configuration.

Reviewed by: kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18918

5 years agoMFC r343995:
Patrick Kelsey [Mon, 11 Feb 2019 23:30:30 +0000 (23:30 +0000)]
MFC r343995:
Reduce the time it takes the kernel to install a new PF config containing a large number of queues

In general, the time savings come from separating the active and
inactive queues lists into separate interface and non-interface queue
lists, and changing the rule and queue tag management from list-based
to hash-bashed.

In HFSC, a linear scan of the class table during each queue destroy
was also eliminated.

There are now two new tunables to control the hash size used for each
tag set (default for each is 128):

net.pf.queue_tag_hashsize
net.pf.rule_tag_hashsize

Reviewed by: kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D19131

MFC r343996:
Place pf_altq_get_nth_active() under the ALTQ ifdef

5 years agoMFC r343291:
Patrick Kelsey [Mon, 11 Feb 2019 23:24:39 +0000 (23:24 +0000)]
MFC r343291:
Convert vmx(4) to being an iflib driver.

Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add
iflib_dma_alloc_align() to the iflib API.

Performance is generally better with the tunable/sysctl
dev.vmx.<index>.iflib.tx_abdicate=1.

Reviewed by: shurd
Relnotes: yes
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18761

MFC r343301:
Add missing dependency to vmxnet3 Makefile and clean it up a bit otherwise.

MFC r343688:
Fix interrupt index configuration when using MSI interrupts.

When in MSI mode, the device was only being configured with one
interrupt index, but it needs two - one for the actual interrupt and
one to park the tx queue at.

Also clarified comments relating to interrupt index assignment.

Reported by: Yuri Pankov <yuripv@yuripv.net>

5 years agoMFC r343287:
Patrick Kelsey [Mon, 11 Feb 2019 23:13:38 +0000 (23:13 +0000)]
MFC r343287:
Reduce pf.conf parsing cost for configs that define N queues from O(N^2) to O(N)

The number of syscalls made during parsing of any config that
defines tables is also reduced, and incorrect warnings that HFSC
parent queue bandwidths were smaller than the sum of their child
bandwidths have been fixed.

Reviewed by: kp
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18759

MFC r343296:
Remove unused function gsc_destroy()

gsc_destroy() is no longer needed as of r343287.

MFC r344025:
Fix the fix added in r343287 for spurious HFSC bandwidth check errors

The logic added in r343287 to avoid false-positive
sum-of-child-bandwidth check errors for HFSC queues has a bug in it
that causes the upperlimit service curve of an HFSC queue to be pulled
down to its parent's linkshare service curve if it happens to be above
it.

Upon further inspection/reflection, this generic
sum-of-child-bandwidths check does not need to be fixed for HFSC - it
needs to be skipped.  For HFSC, the equivalent check is to ensure the
sum of child linkshare service curves are at or below the parent's
linkshare service curve, and this check is already being performed by
eval_pfqueue_hfsc().

This commit reverts the affected parts of r343287 and adds new logic
to skip the generic sum-of-child-bandwidths check for HFSC.

Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D19124

5 years agoMFC r343520:
Kristof Provost [Mon, 11 Feb 2019 19:08:01 +0000 (19:08 +0000)]
MFC r343520:

pfctl: Point users to net.pf.request_maxcount if large requests are rejected

The kernel will reject very large tables to avoid resource exhaustion
attacks. Some users run into this limit with legitimate table
configurations.

The error message in this case was not very clear:

  pf.conf:1: cannot define table nets: Invalid argument
  pfctl: Syntax error in config file: pf rules not loaded

If a table definition fails we now check the request_maxcount sysctl,
and if we've tried to create more than that point the user at
net.pf.request_maxcount:

  pf.conf:1: cannot define table nets: too many elements.
  Consider increasing net.pf.request_maxcount.
  pfctl: Syntax error in config file: pf rules not loaded

PR: 235076

5 years agoMFC r343921:
Benedict Reuschling [Mon, 11 Feb 2019 17:47:22 +0000 (17:47 +0000)]
MFC r343921:
Add an example to pw.8 about how to add an existing user to a group.

Instead of using pw to modify group membership, users often edit
/etc/group by hand, which is discouraged.  Provide an example of
adding a user to the wheel group, which is a common use case.
I'm using a different user here as in the previous example as that
deleted the user (although the examples don't necessarily have to
be followed in order).

Reviewed by: rgrimes,0mp
Approved by: 0mp
Differential Revision: https://reviews.freebsd.org/D19123

5 years agoMFC r339877-r339879,r343564-r343566,r343580,r343754:
Konstantin Belousov [Mon, 11 Feb 2019 15:02:02 +0000 (15:02 +0000)]
MFC r339877-r339879,r343564-r343566,r343580,r343754:
Untangle jemalloc and mutexes initialization.

The merge includes required warnings cleanup by arichardson, both to
avoid conflicts and to make rtld_malloc.c compilable with the libthr
WARNS settings.

5 years agoMFC r343727: Use switch instead of chained if/else to improve readability.
Alexander Motin [Mon, 11 Feb 2019 14:50:33 +0000 (14:50 +0000)]
MFC r343727: Use switch instead of chained if/else to improve readability.

Submitted by:   Ryan Moeller <ryan@freqlabs.com>
Sponsored by:   iXsystems, Inc.

5 years agoMFC r343728: Check element type before setting LEDs.
Alexander Motin [Mon, 11 Feb 2019 14:48:45 +0000 (14:48 +0000)]
MFC r343728: Check element type before setting LEDs.

With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Sponsored by: iXsystems, Inc.

5 years agoMFC r343745, r343752: Add missed tunables/sysctls for some new vdev variables.
Alexander Motin [Mon, 11 Feb 2019 14:46:59 +0000 (14:46 +0000)]
MFC r343745, r343752: Add missed tunables/sysctls for some new vdev variables.

While there, make few existing sysctls writeable, since there is no reason
not to.

5 years agoMFC r343560:
Oleksandr Tymoshenko [Mon, 11 Feb 2019 08:55:38 +0000 (08:55 +0000)]
MFC r343560:

calendar(1): Fix Aschermittwoch date for Austrian calendar

PR: 165516
Submitted by: jhs@berklix.com

5 years agoMFC r343209:
Oleksandr Tymoshenko [Mon, 11 Feb 2019 08:52:48 +0000 (08:52 +0000)]
MFC r343209:

[smbfs] Allow semicolon in mounts that support long names

Semicolon is a legal character in long names but not in 8.3 format.
Move it to respective character set.

PR: 140068
Submitted by: tom@uffner.com

5 years agoMFC r343204:
Oleksandr Tymoshenko [Mon, 11 Feb 2019 08:49:56 +0000 (08:49 +0000)]
MFC r343204:

[ifconfig] Print more WPS attributes in verbose "list scan" output

- Move WPS related defines to dedicated file
- Add handlers for more WPS attributes

PR: 217317
Submitted by: J.R. Oldroyd <fbsd@opal.com>

5 years agoMFC r343890:
Konstantin Belousov [Mon, 11 Feb 2019 07:09:02 +0000 (07:09 +0000)]
MFC r343890:
do_execve(): lock vnode when needed.

5 years agoMFC r343815:
Andriy Voskoboinyk [Mon, 11 Feb 2019 00:31:58 +0000 (00:31 +0000)]
MFC r343815:
iwn(4): plug initialization path vs interrupt handler races

There are few places in interrupt handler where the driver
lock is dropped; ensure that device is still running before
processing remaining ring entries.

PR: 192641