]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r346132: stand: refactor overlay loading a little bit
Kyle Evans [Tue, 16 Apr 2019 21:01:07 +0000 (21:01 +0000)]
MFC r346132: stand: refactor overlay loading a little bit

It was pointed out that manually loading a .dtb to be used rather than
relying on platform-specific method for loading .dtb will result in overlays
not being applied. This was true because overlay loading was hacked into
fdt_platform_load_dtb, rather than done in a way more independent from how
the .dtb is loaded.

Instead, push overlay loading (for now) out into an
fdt_platform_load_overlays. This method easily allows ubldr to pull in any
fdt_overlays specified in the ub env, and omits overlay-checking on
platforms where they're not tested and/or not desired (e.g. powerpc). If we
eventually stop caring about fdt_overlays from ubenv (if we ever cared),
this method should get chopped out in favor of just calling
fdt_load_dtb_overlays() directly.

5 years agoMFC r346082: libbe(3): use libzfs name validation for datasets/snapshot names
Kyle Evans [Tue, 16 Apr 2019 20:59:57 +0000 (20:59 +0000)]
MFC r346082: libbe(3): use libzfs name validation for datasets/snapshot names

Our home-rolled solution didn't quite capture all of the details, and we
didn't actually validate snapshot names at all. zfs_name_valid captures the
important details, but it doesn't necessarily expose the errors that we're
wanting to see in the be_validate_* functions. Validating lengths
independently, then the names, should make this a non-issue.

5 years agoMFC r345180, r345187: if_bridge(4): Fix module teardown
Kyle Evans [Tue, 16 Apr 2019 20:56:51 +0000 (20:56 +0000)]
MFC r345180, r345187: if_bridge(4): Fix module teardown

r345180: if_bridge(4): Fix module teardown

bridge_rtnode_zone still has outstanding allocations at the time of
destruction in the current model because all of the interface teardown
happens in a VNET_SYSUNINIT, -after- the MOD_UNLOAD has already been
processed.  The SYSUNINIT triggers destruction of the interfaces, which then
attempts to free the memory from the zone that's already been destroyed, and
we hit a panic.

Solve this by virtualizing the uma_zone we allocate the rtnodes from to fix
the ordering. bridge_rtable_fini should also take care to flush any
remaining routes that weren't taken care of when dynamic routes were flushed
in bridge_stop.

r345187: bridge: Fix STP-related panic

After r345180 we need to have the appropriate vnet context set to delete an
rtnode in bridge_rtnode_destroy().
That's usually the case, but not when it's called by the STP code (through
bstp_notify_rtage()).

We have to set the vnet context in bridge_rtable_expire() just as we do in the
other STP callback bridge_state_change().

5 years agoMFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
Alexander Motin [Tue, 16 Apr 2019 18:31:40 +0000 (18:31 +0000)]
MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.

 - Do not retry if periph was invalidated.
 - Do not decrement retry_count if already zero.
 - Report action_string when applicable.

5 years agoMFC r346065:
Konstantin Belousov [Tue, 16 Apr 2019 17:55:54 +0000 (17:55 +0000)]
MFC r346065:
Add vn_fsync_buf().

5 years agoMFC r346064:
Konstantin Belousov [Tue, 16 Apr 2019 17:54:51 +0000 (17:54 +0000)]
MFC r346064:
Fix dirty buf exhaustion easily triggered with msdosfs.

5 years agoMFC r345425, r345514, r345799, r345800, r345803, r346157:
Konstantin Belousov [Tue, 16 Apr 2019 17:33:08 +0000 (17:33 +0000)]
MFC r345425, r345514, r345799, r345800, r345803, r346157:
Enable tmpfs rw->ro remounts.

5 years agoMFC r346062:
Konstantin Belousov [Tue, 16 Apr 2019 17:16:18 +0000 (17:16 +0000)]
MFC r346062:
pci_cfgreg.c: Use io port config access for early boot time.

PR: 236838

5 years agoMFC r346054: libc: update strstr implementation to match musl
Ed Maste [Tue, 16 Apr 2019 11:30:41 +0000 (11:30 +0000)]
MFC r346054: libc: update strstr implementation to match musl

musl commits:
122d67f846cb0be2c9e1c3880db9eb9545bbe38c
0239cd0681e889a269fb7691f60e81ef8d081e6b
8f5a820d147da36bcdbddd201b35d293699dacd8

Submitted by: David CARLIER <devnexen_gmail.com>
Obtained from: musl
MFC after: 1 week

5 years agoMFC: r345818, r345828
Rick Macklem [Tue, 16 Apr 2019 02:12:38 +0000 (02:12 +0000)]
MFC: r345818, r345828
Fix a race in the RPCSEC_GSS server code that caused crashes.

When a new client structure was allocated, it was added to the list
so that it was visible to other threads before the expiry time was
initialized, with only a single reference count.
The caller would increment the reference count, but it was possible
for another thread to decrement the reference count to zero and free
the structure before the caller incremented the reference count.
This could occur because the expiry time was still set to zero when
the new client structure was inserted in the list and the list was
unlocked.

This patch fixes the race by initializing the reference count to two
and initializing all fields, including the expiry time, before inserting
it in the list.

5 years agoMFC r345644,r346061:
Enji Cooper [Tue, 16 Apr 2019 01:03:38 +0000 (01:03 +0000)]
MFC r345644,r346061:

r345644 (by olivier):

Skip this test if if_tap module is not available

PR: 236842

r346061:

Polish netmap(4) testcases a bit

1. Not all kernels have netmap(4) support. Check for netmap(4) support before
   attempting to run the tests via the `PLAIN_REQUIRE_KERNEL_MODULE(..)` macro.
2. Libraries shouldn't be added to LDFLAGS; they should be added to LIBADD
   instead. This allows the build system to evaluate dependencies for sanity.
3. Sort some of the Makefile variables per bsd.README.

1., in particular, will resolve failures when running this testcase on kernels
lacking netmap(4) support, e.g., the i386 GENERIC kernels on ^/stable/11 and
^/stable/12.

PR: 237129

5 years agoMFC r344736 (by imp): Add ABORTED_BY_REQUEST to the list of things we look
Alexander Motin [Mon, 15 Apr 2019 15:09:25 +0000 (15:09 +0000)]
MFC r344736 (by imp): Add ABORTED_BY_REQUEST to the list of things we look
at DNR bit and tell why to comment (code already does this)

5 years agoMFC r344642 (by imp):
Alexander Motin [Mon, 15 Apr 2019 15:02:18 +0000 (15:02 +0000)]
MFC r344642 (by imp):
Unconditionally support unmapped BIOs. This was another shim for
supporting older kernels. However, all supported versions of FreeBSD
have unmapped I/Os (as do several that have gone EOL), remove it. It's
unlikely the driver would work on the older kernels anyway at this
point.

5 years agoMFC r344640 (by imp):
Alexander Motin [Mon, 15 Apr 2019 15:01:32 +0000 (15:01 +0000)]
MFC r344640 (by imp):
Remove #ifdef code to support FreeBSD versions that haven't been
supported in years. A number of changes have been made to the driver
that likely wouldn't work on those older versions that aren't properly
ifdef'd and it's project policy to GC such code once it is stale.

5 years agoMFC r342862 (by chuck): Add NVMe drive to NOIOB quirk list
Alexander Motin [Mon, 15 Apr 2019 15:00:13 +0000 (15:00 +0000)]
MFC r342862 (by chuck): Add NVMe drive to NOIOB quirk list

Dell-branded Intel P4600 NVMe drives benefit from NVMe 1.3's NOIOB
feature. Unfortunately just like Intel DC P4500s, they don't advertise
themselves as benefiting from this...

This changes adds P4600s to the existing list of old drives which
benefit from striping.

PR: 233969

5 years agoMFC r341710 (by imp):
Alexander Motin [Mon, 15 Apr 2019 14:58:40 +0000 (14:58 +0000)]
MFC r341710 (by imp):
Even though they are reserved, cdw2 and cdw3 can be set via nvme-cli
(and soon nvmecontrol). Go ahead and copy them into rsvd2 and rsvd3.

5 years agoMFC r340481 (by imp): Remove do-nothing nvme_modevent.
Alexander Motin [Mon, 15 Apr 2019 14:57:50 +0000 (14:57 +0000)]
MFC r340481 (by imp): Remove do-nothing nvme_modevent.

nvme_modevent no longer does anything interesting, remove it.

5 years agoMFC r340412 (by imp): Use atomic_load_acq_int() here too to poll done,
Alexander Motin [Mon, 15 Apr 2019 14:56:59 +0000 (14:56 +0000)]
MFC r340412 (by imp): Use atomic_load_acq_int() here too to poll done,
ala r328521

5 years agoMFC r339775 (by imp): Put a workaround in for command timeout malfunctioning
Alexander Motin [Mon, 15 Apr 2019 14:54:48 +0000 (14:54 +0000)]
MFC r339775 (by imp): Put a workaround in for command timeout malfunctioning

At least one NVMe drive has a bug that makeing the Command Time Out
PCIe feature unreliable. The workaround is to disable this
feature. The driver wouldn't deal correctly with a timeout anyway.
Only do this for drives that are known bad.

5 years agoMFC r346038:
Konstantin Belousov [Mon, 15 Apr 2019 12:24:19 +0000 (12:24 +0000)]
MFC r346038:
Exercise some care before sending SIGHUP to mountd.

5 years agoMFC r346031:
Konstantin Belousov [Mon, 15 Apr 2019 12:23:33 +0000 (12:23 +0000)]
MFC r346031:
Handle races when remounting UFS volume from ro to rw.

5 years agoMFC of 345758
Kirk McKusick [Mon, 15 Apr 2019 12:07:41 +0000 (12:07 +0000)]
MFC of 345758

Properly flush outstanding I/Os when forcibly deleteing a memory disk device.

Sponsored by: Netflix

5 years agoMFC r345319:
Andrey V. Elsukov [Sun, 14 Apr 2019 13:17:40 +0000 (13:17 +0000)]
MFC r345319:
  Use NET_EPOCH instead of allocating separate one.

  The code was modified to fix incompatibility that was introduced
  in r342872.

5 years agoMFC r345293:
Andrey V. Elsukov [Sun, 14 Apr 2019 13:08:18 +0000 (13:08 +0000)]
MFC r345293:
    Update NAT64LSN implementation:

    o most of data structures and relations were modified to be able support
      large number of translation states. Now each supported protocol can
      use full ports range. Ports groups now are belong to IPv4 alias
      addresses, not hosts. Each ports group can keep several states chunks.
      This is controlled with new `states_chunks` config option. States
      chunks allow to have several translation states for single alias address
      and port, but for different destination addresses.
    o by default all hash tables now use jenkins hash.
    o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on fast path.
    o one NAT64LSN instance now can be used to handle several IPv6 prefixes,
      special prefix "::" value should be used for this purpose when instance
      is created.
    o due to modified internal data structures relations, the socket opcode
      that does states listing was changed.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

MFC r345294:
  Remove extra spaces.

5 years agoMFC r344665 (by trhodes):
Andrey V. Elsukov [Sun, 14 Apr 2019 12:11:45 +0000 (12:11 +0000)]
MFC r344665 (by trhodes):
  Grammar tweaks in ipfw manual page.

5 years agoFix the build. Include net/pfil.h to be able use IPFW_WLOCK().
Andrey V. Elsukov [Sun, 14 Apr 2019 11:19:08 +0000 (11:19 +0000)]
Fix the build. Include net/pfil.h to be able use IPFW_WLOCK().
In head/ after r343619 it is not required, but this change was not MFCed.

5 years agoMFC r345264:
Andrey V. Elsukov [Sun, 14 Apr 2019 10:44:06 +0000 (10:44 +0000)]
MFC r345264:
  Add NAT64 CLAT implementation as defined in RFC6877.

  CLAT is customer-side translator that algorithmically translates 1:1
  private IPv4 addresses to global IPv6 addresses, and vice versa.
  It is implemented as part of ipfw_nat64 kernel module. When module
  is loaded or compiled into the kernel, it registers "nat64clat" external
  action. External action named instance can be created using `create`
  command and then used in ipfw rules. The create command accepts two
  IPv6 prefixes `plat_prefix` and `clat_prefix`. If plat_prefix is ommitted,
  IPv6 NAT64 Well-Known prefix 64:ff9b::/96 will be used.

    # ipfw nat64clat CLAT create clat_prefix SRC_PFX plat_prefix DST_PFX
    # ipfw add nat64clat CLAT ip4 from IPv4_PFX to any out
    # ipfw add nat64clat CLAT ip6 from DST_PFX to SRC_PFX in

  Obtained from: Yandex LLC
  Submitted by: Boris N. Lytochkin
  Relnotes: yes
  Sponsored by: Yandex LLC

5 years agoMFC r345263:
Andrey V. Elsukov [Sun, 14 Apr 2019 10:40:43 +0000 (10:40 +0000)]
MFC r345263:
  Add SPDX-License-Identifier and update year in copyright.

5 years agoMFC r345262:
Andrey V. Elsukov [Sun, 14 Apr 2019 10:38:50 +0000 (10:38 +0000)]
MFC r345262:
  Modify struct nat64_config.

  Add second IPv6 prefix to generic config structure and rename another
  fields to conform to RFC6877. Now it contains two prefixes and length:
  PLAT is provider-side translator that translates N:1 global IPv6 addresses
  to global IPv4 addresses. CLAT is customer-side translator (XLAT) that
  algorithmically translates 1:1 IPv4 addresses to global IPv6 addresses.
  Use PLAT prefix in stateless (nat64stl) and stateful (nat64lsn)
  translators.

  Modify nat64_extract_ip4() and nat64_embed_ip4() functions to accept
  prefix length and use plat_plen to specify prefix length.

  Retire net.inet.ip.fw.nat64_allow_private sysctl variable.
  Add NAT64_ALLOW_PRIVATE flag and use "allow_private" config option to
  configure this ability separately for each NAT64 instance.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC r343666, r343861-r343862, r343923, r343968, r345660, and r345810.
Navdeep Parhar [Sat, 13 Apr 2019 19:23:11 +0000 (19:23 +0000)]
MFC r343666, r343861-r343862, r343923, r343968, r345660, and r345810.

r343666:
cxgbe(4): Improved error reporting and diagnostics.

"slow" interrupt handler:
- Expand the list of INT_CAUSE registers known to the driver.
- Add decode information for many more bits but decouple it from the
  rest of intr_info so that it is entirely optional.
- Call t4_fatal_err exactly once, and from the top level PL intr handler.

t4_fatal_err:
- Use t4_shutdown_adapter from the common code to stop the adapter.
- Stop servicing slow interrupts after the first fatal one.

Driver/firmware interaction:
- CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a
  reply or something else.
- Log the raw value of pcie_fw for some errors.
- Use correct log levels (debug vs. error).

Sponsored by: Chelsio Communications

r343861:
cxgbe(4): Auto-dump the device log on a mailbox timeout or when the
firmware reports an error in pcie_fw.

Sponsored by: Chelsio Communications

r343862:
cxgbe(4): Auto-dump the CIM block's logic analyzer on a TIMER0 interrupt.

Sponsored by: Chelsio Communications

r343923:
cxgbe(4): Delay the panic due to a fatal error by 30s.

This lets information logged by the interrupt handler reach the system
log before the system goes down.

r343968:
cxgbe(4): Ignore unused interrupts.

Sponsored by: Chelsio Communications

r345660:
cxgbe(4): Count and clear interrupts generated at the software's request.

An interrupt can be requested by setting the F_SWINT bit in PL_PF_CTL.

Sponsored by: Chelsio Communications

r345810:
cxgbe(4): Add a flag to indicate that bits in interrupt cause but not in
interrupt enable are not fatal.

The firmware sets up all the interrupt enables based on run time
configuration, which means the information in the enables is more
accurate than what's compiled into the driver.  This change also allows
the fatal bits to be updated without any changes in the driver in some
cases.

Sponsored by: Chelsio Communications

5 years agoRevert r344898 (by kib), now that clang 8 has been merged:
Dimitry Andric [Sat, 13 Apr 2019 11:09:42 +0000 (11:09 +0000)]
Revert r344898 (by kib), now that clang 8 has been merged:

Disable WITH_RETPOLINE on stable/12.

It is known that clang 7 generates broken ifunc calls when retpoline is
enabled. Since libc uses ifuncs, mark WITH_RETPOLINE as always broken
and disabled. To be removed after clang 8 MFC.

This is a direct commit to the branch.

Reported by: many
Tested by: Nikola Mihaylov <c.source.code@gmail.com>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

5 years agoMFC r345450:
Andrey V. Elsukov [Sat, 13 Apr 2019 08:55:49 +0000 (08:55 +0000)]
MFC r345450:
  Add ability to automatically load ipfw_nat64, ipfw_nptv6 and ipfw_pmod

  modules by declaring corresponding variables in rc.conf. Also document
  them in rc.conf(5).

  Submitted by: Dries Michiels
  Differential Revision: https://reviews.freebsd.org/D19673

MFC r345985:
  Add firewall_[nat64|nptv6|pmod]_enable variables to /etc/defaults/rc.conf

5 years agoAfter r346168, put the actual commit dates into UPDATING and
Dimitry Andric [Sat, 13 Apr 2019 08:52:52 +0000 (08:52 +0000)]
After r346168, put the actual commit dates into UPDATING and
ObsoleteFiles.inc.  I completely forgot about those, sorry.

This is a direct commit to stable/12.

5 years agoAfter r346168, put the actual commit dates into UPDATING and
Dimitry Andric [Sat, 13 Apr 2019 08:50:41 +0000 (08:50 +0000)]
After r346168, put the actual commit dates into UPDATING and
ObsoleteFiles.inc.  I completely forgot about those, sorry.

This is a direct commit to stable/12.

5 years agoRegenerate src.conf.5 for recent changes.
Simon J. Gerraty [Fri, 12 Apr 2019 20:35:11 +0000 (20:35 +0000)]
Regenerate src.conf.5 for recent changes.

5 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Fri, 12 Apr 2019 20:03:27 +0000 (20:03 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.0 final release r356365.

MFC r340287 (by emaste):

Consolidate gcov entries in OptionalObsoleteFiles

Sponsored by: The FreeBSD Foundation

MFC r340289 (by emaste):

llvm-cov: also install as gcov (if GNU gcov is disabled)

llvm-cov provides a gcov-compatible interface when invoked as gcov.

Reviewed by: dim, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17923

MFC r340296 (by emaste):

Move llvm-profdata build into MK_LLVM_COV block

llvm-profdata is used with llvm-cov for code coverage (although llvm-cov
can also operate independently in a gcov-compatible mode).
Although llvm-profdata can be used independently of llvm-cov it makes
sense to group these under one option.

Also handle these in OptionalObsoleteFiles.inc while here.

Sponsored by: The FreeBSD Foundation

MFC r340300 (by emaste):

libllvm: Move SampleProfWriter to SRCS_MIN

It is required by llvm-profdata, now built by default under the
LLVM_COV knob.  The additional complexity that would come from avoiding
building it if CLANG_EXTRAS and LLVM_COV are both disabled is not worth
the small savings in build time.

Sponsored by: The FreeBSD Foundation

MFC r340972 (by emaste):

llvm-objdump: initial man page

Based on llvm-objdump's online documentation and usage information.
This serves as a starting point; additional detail and cleanup still
required.

Also being submitted upstream in LLVM review D54864.  I expect to use
this bespoke copy while we have LLVM 6.0 or 7.0 in FreeBSD; when we
update to LLVM 8.0 it should be upstream and we will switch to it.

PR: 233437
Reviewed by: bcr (man formatting)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18309

MFC r340973 (by emaste):

llvm-objdump.1: remove invalid options

Some options appear in llvm-objdump's usage information as a side effect
of its option parsing implementation and are not actually llvm-objdump
options.  Reported in LLVM review https://reviews.llvm.org/D54864.

Reported by: Fangrui Song
Sponsored by: The FreeBSD Foundation

MFC r340975 (by emaste):

llvm-objdump.1: fix igor / mandoc -Tlint warnings

Accidentally omitted from r340972.

MFC r341055 (by emaste):

llvm-objdump.1: remove more unintentional options

Some options come from static constructors in LLVM libraries and are
automatically added to llvm's usage output.  They're not really supposed
to be llvm-objdump options.

Reported by: Fangrui Song in LLVM review D54864
Sponsored by: The FreeBSD Foundation

MFC r344779:

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

Release notes for llvm, clang and lld 8.0.0 will soon be available here:
<https://releases.llvm.org/8.0.0/docs/ReleaseNotes.html>
<https://releases.llvm.org/8.0.0/tools/clang/docs/ReleaseNotes.html>
<https://releases.llvm.org/8.0.0/tools/lld/docs/ReleaseNotes.html>

PR: 236062
Relnotes: yes

MFC r344798 (by emaste):

libllvm: promote WithColor and xxhash to SRCS_MIN

The armv6 build failed in CI due to missing symbols (from these two
source files) in the bootstrap Clang.

This affected only armv6 because other Clang-using archs are using LLD
as the bootstrap linker, and thus include SRCS_MIW via LLD_BOOTSTRAP.

Reported by: CI, via lwhsu
Sponsored by: The FreeBSD Foundation

MFC r344825:

Add a few missed files to the MK_LLVM_TARGET_BPF=yes case, otherwise
clang and various other executables will fail to link with undefined
symbols.

Reported by: O. Hartmann <ohartmann@walstatt.org>

MFC r344852:

Put in a temporary workaround for what is likely a gcc 6 bug (it does
not occur with gcc 7 or later).  This should prevent the following error
from breaking the head-amd64-gcc CI builds:

In file included from /workspace/src/contrib/llvm/tools/lldb/source/API/SBMemoryRegionInfo.cpp:14:0:
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: 'template<class _InputIterator> lldb_private::MemoryRegionInfos::MemoryRegionInfos(_InputIterator, _InputIterator, const allocator_type&)' inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'
   using std::vector<lldb_private::MemoryRegionInfo>::vector;
                                                      ^~~~~~
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: conflicts with version inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'

Reported by: CI

MFC r344896:

Pull in r354937 from upstream clang trunk (by Jörg Sonnenberger):

  Fix inline assembler constraint validation

  The current constraint logic is both too lax and too strict. It fails
  for input outside the [INT_MIN..INT_MAX] range, but it also
  implicitly accepts 0 as value when it should not. Adjust logic to
  handle both correctly.

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

Pull in r355491 from upstream clang trunk (by Hans Wennborg):

  Inline asm constraints: allow ICE-like pointers for the "n"
  constraint (PR40890)

  Apparently GCC allows this, and there's code relying on it (see bug).

  The idea is to allow expression that would have been allowed if they
  were cast to int. So I based the code on how such a cast would be
  done (the CK_PointerToIntegral case in
  IntExprEvaluator::VisitCastExpr()).

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

These should fix assertions and errors when using the inline assembly
"n" constraint in certain ways.

In case of devel/valgrind, a pointer was used as the input for the
constraint, which lead to "Assertion failed: (isInt() && "Invalid
accessor"), function getInt".

In case of math/secp256k1, a very large integer value was used as input
for the constraint, which lead to "error: value '4624529908474429119'
out of range for constraint 'n'".

PR:             236216, 236194

MFC r344951:

Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch
r355677 (effectively, 8.0.0 rc4), resolve conflicts, and bump version
numbers.

PR: 236062

MFC r345018:

Merge LLVM libunwind trunk r351319, from just before upstream's
release_80 branch point.  Afterwards, we will merge the rest of the
changes in the actual release_80 branch.

PR: 236062

MFC r345019:

Merge LLVM libunwind release_80 branch r355677 (effectively, 8.0.0 rc4).

PR: 236062

MFC r345021:

Pull in r355854 from upstream llvm trunk (by Jonas Paulsson):

  [RegAlloc]  Avoid compile time regression with multiple copy hints.

  As a fix for https://bugs.llvm.org/show_bug.cgi?id=40986 ("excessive
  compile time building opencollada"), this patch makes sure that no
  phys reg is hinted more than once from getRegAllocationHints().

  This handles the case were many virtual registers are assigned to the
  same physreg. The previous compile time fix (r343686) in
  weightCalcHelper() only made sure that physical/virtual registers are
  passed no more than once to addRegAllocationHint().

  Review: Dimitry Andric, Quentin Colombet
  https://reviews.llvm.org/D59201

This should fix a hang when compiling certain generated .cpp files in
the graphics/opencollada port.

PR: 236313

MFC r345068 (by jhb):

Move libunwind out of contrib/llvm/projects.

Move LLVM's libunwind to its own contrib/ directory similar to other
runtime libraries like libc++ and libcxxrt.

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

MFC r345073:

Revert r308867 (which was originally committed in the clang390-import
project branch):

  Work around LLVM PR30879, which is about a bad interaction between
  X86 Call Frame Optimization on i386 and libunwind, by disallowing the
  optimization for i386-freebsd12.

  This should fix some instances of broken exception handling when
  frame pointers are omitted, in particular some unittests run during
  the build of editors/libreoffice.

  This hack will be removed as soon as upstream has implemented a more
  permanent fix for this problem.

And indeed, after r345018 and r345019, which updated LLVM libunwind to
the most recent version, the above workaround is no longer needed.  The
upstream commit which fixed this is:

  https://llvm.org/viewvc/llvm-project?view=revision&revision=292723

Specifically, 32 bit (i386-freebsd) executables optimized with omitted
frame pointers and Call Frame Optimization should now behave correctly
when a C++ exception is thrown, and the stack is unwound.

Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=30879
PR: 236062

MFC r345152:

Merge llvm, clang, compiler-rt, libc++, libunwind, lld, and lldb
release_80 branch r356034 (effectively, 8.0.0 rc5), resolve conflicts,
and bump version numbers.

PR: 236062

MFC r345231:

Add LLVM openmp trunk r351319 (just before the release_80 branch point)
to contrib/llvm.  This is not yet connected to the build, the glue for
that will come in a follow-up commit.

PR: 236062

MFC r345232:

Bootstrap svn:mergeinfo on contrib/openmp.

PR: 236062

MFC r345233:

Merge openmp release_80 branch r356034 (effectively, 8.0.0 rc5).

PR: 236062

MFC r345234:

Add openmp __kmp_gettid() wrapper, using pthread_getthreadid_np(3).
This has also been submitted upstream.

PR:           236062

MFC r345283:

Enable building libomp.so for 32-bit x86.  This is done by selectively
enabling the functions that save and restore MXCSR, since access to this
register requires SSE support.

Note that you may run into other issues with OpenMP on i386, since this
*not* yet supported upstream, and certainly not extensively tested.

PR: 236062, 236582

MFC r345345:

Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.0 final release r356365.  There were no functional changes since the
most recent merge, of 8.0.0 rc5.

Release notes for llvm, clang, lld and libc++ 8.0.0 are now available:

https://llvm.org/releases/8.0.0/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/tools/clang/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/tools/lld/docs/ReleaseNotes.html
https://llvm.org/releases/8.0.0/projects/libcxx/docs/ReleaseNotes.html

PR: 236062

MFC r345349:

Pull in r352826 from upstream lld trunk (by Fangrui Song):

  [ELF] Support --{,no-}allow-shlib-undefined

  Summary:
  In ld.bfd/gold, --no-allow-shlib-undefined is the default when
  linking an executable. This patch implements a check to error on
  undefined symbols in a shared object, if all of its DT_NEEDED entries
  are seen.

  Our approach resembles the one used in gold, achieves a good balance
  to be useful but not too smart (ld.bfd traces all DSOs and emulates
  the behavior of a dynamic linker to catch more cases).

  The error is issued based on the symbol table, different from
  undefined reference errors issued for relocations. It is most
  effective when there are DSOs that were not linked with -z defs (e.g.
  when static sanitizers runtime is used).

  gold has a comment that some system libraries on GNU/Linux may have
  spurious undefined references and thus system libraries should be
  excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The
  story may have changed now but we make --allow-shlib-undefined the
  default for now. Its interaction with -shared can be discussed in the
  future.

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: joerg, emaste, arichardson, llvm-commits

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

Pull in r352943 from upstream lld trunk (by Fangrui Song):

  [ELF] Default to --no-allow-shlib-undefined for executables

  Summary:
  This follows the ld.bfd/gold behavior.

  The error check is useful as it captures a common type of ld.so
  undefined symbol errors as link-time errors:

      // a.cc => a.so (not linked with -z defs)
      void f(); // f is undefined
      void g() { f(); }

      // b.cc => executable with a DT_NEEDED entry on a.so
      void g();
      int main() { g(); }

      // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now)
      // symbol lookup error: ... undefined symbol: f

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: llvm-commits, emaste, arichardson

  Tags: #llvm

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

Together, these add support for --no-allow-shlib-undefined, and make it
the default for executables, so they will fail to link if any symbols
from needed shared libraries are undefined.

Reported by: jbeich
PR: 236062, 236141

MFC r345449:

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

  [ARM] Don't form "ands" when it isn't scheduled correctly.

  In r322972/r323136, the iteration here was changed to catch cases at
  the beginning of a basic block... but we accidentally deleted an
  important safety check.  Restore that check to the way it was.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41116

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

This should fix "Assertion failed: (LiveCPSR && "CPSR liveness tracking
is wrong!"), function UpdateCPSRUse" errors when building the devel/xwpe
port for armv7.

PR: 236062, 236568

5 years agoMFC r345703:
Konstantin Belousov [Fri, 12 Apr 2019 15:12:08 +0000 (15:12 +0000)]
MFC r345703:
Fix initial exec TLS mode for dynamically loaded shared objects.

5 years agoMFC r345955:
Konstantin Belousov [Fri, 12 Apr 2019 15:00:42 +0000 (15:00 +0000)]
MFC r345955:
vn_vmap_seekhole(): align running offset to the block boundary.

5 years agoMFC r345702,r345954:
Konstantin Belousov [Fri, 12 Apr 2019 14:59:28 +0000 (14:59 +0000)]
MFC r345702,r345954:
Eliminate adj_free field from vm_map_entry.

5 years agoMFC r345647:
Xin LI [Fri, 12 Apr 2019 02:24:06 +0000 (02:24 +0000)]
MFC r345647:

Distinguish between lseek errors and read errores.

5 years agoAdd support for loader veriexec
Simon J. Gerraty [Fri, 12 Apr 2019 01:03:00 +0000 (01:03 +0000)]
Add support for loader veriexec

Also sbin/veriexec for mac_veriexec

MFC r343281,344564-344568,344780,344784,345289,346070

5 years agoMFC r345693, 345694: rtld: attempt to fix reloc_nonplt_object TLS allocation
Ed Maste [Fri, 12 Apr 2019 00:31:22 +0000 (00:31 +0000)]
MFC r345693, 345694: rtld: attempt to fix reloc_nonplt_object TLS allocation

on arm and mips

allocate_tls_offset returns true on success.  This still needs more
testing and review, but this change is consistent with other archs.

PR: 236880
Reported by: Andrew Gierth <andrew@tao11.riddles.org.uk> (arm)
Sponsored by: The FreeBSD Foundation

5 years agoMFC r344936: MFV/ZoL: Disable LBA weighting on files and SSDs
Alexander Motin [Thu, 11 Apr 2019 13:20:48 +0000 (13:20 +0000)]
MFC r344936: MFV/ZoL: Disable LBA weighting on files and SSDs

The LBA weighting makes sense on rotational media where the outer tracks
have twice the bandwidth of the inner tracks. However, it is detrimental
on nonrotational media such as solid state disks, where the only effect
is to ensure that metaslabs enter the best-fit allocation behavior
sooner, which is detrimental to performance. It also makes no sense on
files where the underlying filesystem can arrange things however it
wants.

Author: Richard Yao <ryao@gentoo.org>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3712
zfsonlinux/zfs@fb40095f5f0853946f8150481ca22602d1334dfe

To reduce code divergence this merge replaces equivalent but different
FreeBSD code detecting non-rotating medium vdevs.

5 years agoMFC r344934, r345014: Add separate aggregation limit for non-rotating media.
Alexander Motin [Thu, 11 Apr 2019 13:19:26 +0000 (13:19 +0000)]
MFC r344934, r345014: Add separate aggregation limit for non-rotating media.

Before sequential scrub patches ZFS never aggregated I/Os above 128KB.
Sequential scrub bumped that to 1MB, which motivation I understand for
spinning disks, since it should reduce number of head seeks.  But for
SSDs it makes much less sense to me, especially on FreeBSD, where due
to MAXPHYS limitation device will likely still see bunch of 128KB I/Os
instead of one large.  Having more strict aggregation limit allows to
avoid allocation of large memory buffer and memcpy to/from it, that is
a serious problem when bandwidth reaches few GB/s.

Sponsored by: iXsystems, Inc.

5 years agoMFC r344926:
Alexander Motin [Thu, 11 Apr 2019 13:17:51 +0000 (13:17 +0000)]
MFC r344926:
MFV/ZoL: Fix zfs_vdev_aggregation_limit bounds checking

Update the bounds checking for zfs_vdev_aggregation_limit so that
it has a floor of zero and a maximum value of the supported block
size for the pool.

Additionally add an early return when zfs_vdev_aggregation_limit
equals zero to disable aggregation.  For very fast solid state or
memory devices it may be more expensive to perform the aggregation
than to issue the IO immediately.

Author: Brian Behlendorf <behlendorf1@llnl.gov>
zfsonlinux/zfs@a58df6f53687ac6d1dee21f60de41b2552a43201

MFV/ZoL: Cap maximum aggregate IO size

Commit 8542ef8 allowed optional IOs to be aggregated beyond
the specified aggregation limit.  Since the aggregation limit
was also used to enforce the maximum block size, setting
`zfs_vdev_aggregation_limit=16777216` could result in an
attempt to allocate an ABD larger than 16M.

Author: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6259
Closes #6270
zfsonlinux/zfs@2d678f779aba26a93314c8ee1142c3985fa25cb6

5 years agoMFC r345850: Fix typos in r345849.
Alexander Motin [Thu, 11 Apr 2019 13:12:25 +0000 (13:12 +0000)]
MFC r345850: Fix typos in r345849.

5 years agoMFC r345849: List few more ATA commands.
Alexander Motin [Thu, 11 Apr 2019 13:11:20 +0000 (13:11 +0000)]
MFC r345849: List few more ATA commands.

5 years agoMFC r345887:
Guangyuan Yang [Thu, 11 Apr 2019 00:41:07 +0000 (00:41 +0000)]
MFC r345887:

Rewrite intro(4) man page.

- Remove issues that no longer apply thanks to devfs
- Add language pointing out devfs's role and referencing its config
- Add a "historical notes" section and move discussion of block vs character devs to it, including pointing out the removal of block devs
- Modernize some examples

PR: 236970
Submitted by: andrew@tao173.riddles.org.uk
Reviewed by: 0mp
Differential Revision: https://reviews.freebsd.org/D19799

5 years agoMFC r345497:
Martin Matuska [Wed, 10 Apr 2019 21:45:23 +0000 (21:45 +0000)]
MFC r345497:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1153: fixed 2 bugs in ZIP reader [1]
  PR #1143: ensure archive_read_disk_entry_from_file() uses ARCHIVE_READ_DISK
  Changes to file flags code, support more file flags on FreeBSD:
    UF_OFFLINE, UF_READONLY, UF_SPARSE, UF_REPARSE, UF_SYSTEM
    UF_ARCHIVE is not supported by intention (yet)

PR: 236300 [1]

5 years agoMFC r345847:
Konstantin Belousov [Wed, 10 Apr 2019 08:34:17 +0000 (08:34 +0000)]
MFC r345847:
msdosfs: zero tail of the last block on truncation for VREG vnodes as well.

5 years agoMFC r344662:
Enji Cooper [Tue, 9 Apr 2019 16:35:23 +0000 (16:35 +0000)]
MFC r344662:

Remove references to pdwait4(2) and `CAP_PDWAIT` from rights(4)

@cem removed references to pdwait4(2) (a nonexistent syscall) in
r320058.

This change removes references to pdwait4(2) and `CAP_PDWAIT` in
rights(4) to not mislead the user into thinking that pdwait4(2)/`CAP_PDWAIT` is
actually implemented in the stock FreeBSD kernel.

The goal of this functionality was to simplify monitoring/manipulating
processes started with `pdfork`, et al, and avoid races with waiting on pids.
The syscall was never completed though--just discussed on the capsicum mailing
list back in 2015:
https://lists.cam.ac.uk/pipermail/cl-capsicum-discuss/2015-May/msg00012.html
. That being said, there are members of the project (@rwatson, etc) who
have longterm goals to implement this syscall to better secure pdfork(2)
calls.

PR: 235871
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D19805

5 years agoMFC r345216:
Enji Cooper [Tue, 9 Apr 2019 16:16:10 +0000 (16:16 +0000)]
MFC r345216:

Remove duplicate `${PACKAGE}FILES+= cleanup.ksh` line

This mutes the duplicate target warning emitted via bsd.files.mk each build.

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D19806

5 years agoMFC r345512: Correct contradictory information on default syslog logging
Michael Gmelin [Tue, 9 Apr 2019 12:28:12 +0000 (12:28 +0000)]
MFC r345512: Correct contradictory information on default syslog logging
priority.

5 years agoMFC r344161: stand: dev_net: correct net_open's interpretation of params
Kyle Evans [Mon, 8 Apr 2019 18:38:18 +0000 (18:38 +0000)]
MFC r344161: stand: dev_net: correct net_open's interpretation of params

net_open previously casted the first vararg to a char * and this was
half-OK: at first, it is passed to netif_open, which would cast it back to
the struct devdesc * that it really is and use it properly. It is then
strdup()d and used as the netdev_name, which is objectively wrong.

Correct it so that the first vararg is properly casted to a struct devdesc *
and the netdev_name gets set properly to make it more clear at a glance that
it's not doing something horribly wrong.

5 years agoMFC r345680: NOTES: Use non-default value for BOOT_TAG
Kyle Evans [Mon, 8 Apr 2019 18:36:47 +0000 (18:36 +0000)]
MFC r345680: NOTES: Use non-default value for BOOT_TAG

5 years agoMFC r343599: libc/tests: Add test case for jemalloc/libthr bug fixed/r343566
Kyle Evans [Mon, 8 Apr 2019 18:34:43 +0000 (18:34 +0000)]
MFC r343599: libc/tests: Add test case for jemalloc/libthr bug fixed/r343566

5 years agoMFC r343065, r343373-r343390, r343477
Kyle Evans [Mon, 8 Apr 2019 18:15:10 +0000 (18:15 +0000)]
MFC r343065, r343373-r343390, r343477

r343065:
With the sync from Dragonfly BSD in r318216 a bug slipped in (also still present
upstream it seems).

The tlv variable was changed to a pointer but the advancement of the data pointer
was left as sizeof(tlv).  While the sizeof the (now) pointer equals the
sizeof 2 x uint32_t (size of the struct) on 64bit platforms, on 32bit platforms
the size of the advancement of the data pointer was wrong leading to
firmware load issues.

Correctly advance the data pointer by the size of the structure and not by
the size of a pointer.

r343373:
if_iwm - Update firmware rs table, instead of indexing the table in tx cmds.

* Rather than providing a non-zero index into the firmware RS table,
we should always use index 0 and update the firmware RS table whenever
our chosen tx rate for data-frames changes.

* Send IWM_LQ_CMD updates when the tx rate gets updated by the net80211
rate control (which is after we tell the tx status to the net80211
rate-control in iwm_mvm_rx_tx_cmd_single()).

* Disregard frames transferred with a different tx rate than the currently
selected rate for the rate-control calculations. This way we avoid
counting management frames (which are sent at a slow, and fixed rate),
as well as frames we added to the tx queue just before a new IWM_LQ_CMD
update took effect.

r343374:
if_iwm - The iwm_prepare_card_hw() in iwm_attach() is only needed on 8K hw.

* Doing the iwm_prepare_card_hw() call in iwm_attach() only on Family 8000
hardware matches the code in Linux iwlwifi.

* While there remove DEFAULT_MAX_TX_POWER definition which is unused, and
has a value different from IWL_DEFAULT_MAX_TX_POWER in iwlwifi.

r343375:
if_iwm - Move iwm_read_firmware() call into iwm_attach().

* We should load the firmware exactly once before the driver really
initializes the hardware the first time, and unload it at detach time.
There is no need to retrieve the firmware during execution of
iwm_mvm_load_ucode_wait_alive(), we should make sure we already have the
firmware data at hand before that.

* The existing sc_preinit_hook code fails to deal with the case where
if_iwm is loaded by the loader (or is statically linked) and the
firmware needs to be loaded from disk. So we can just call
iwm_read_firmware() from iwm_attach() directly.

* A separate solution will have to be added to properly defer the firmware
loading during bootup, until the necessary filesystem is mounted.

r343376:
if_iwm - Check sc->sc_attached flag in suspend/resume callbacks.

* There is (almost) nothing to do in suspend/resume if if_iwm has failed
during initialization (e.g. because of firmware load failure) and was
already uninitialized by iwm_detach_local().

r343377:
iwm - Reduce gratuitous differences with Linux iwlwifi in struct naming.

* Rename some structs and struct members for firmware handling.

r343378:
if_iwm - Update struct iwm_scan_results_notif. Remove old/unused definitions

* Remove outdated notifications IWM_SCAN_ABORT_CMD,
IWM_SCAN_START_NOTIFICATION and IWM_SCAN_RESULTS_NOTIFICATION.

* Remove unused enum iwm_scan_complete_status.

* Use the updated FW Api version 3 of struct iwm_scan_results_notif.

* No functional change, since struct iwm_scan_results_notif is never
accessed in iwm at the moment.

Taken-From: Linux iwlwifi commits 1083fd7391e989be52022f0f338e9dadc048b063
and 75118fdb63496e4611ab50380499ddd62b9de69f.

r343379:
if_iwm - Configure the PCIe LTR, fix PCI express capability accesses.

Taken-From: Linux iwlwifi

r343380:
if_iwm - Add firmware API definitions for TX power commands.

* While there remove unused IWM_UCODE_TLV_CAPA_LMAC_UPLOAD definition,
which isn't defined in iwlwifi.

Taken-From: Linux iwlwifi

r343381:
iwm - Track firmware state better, and improve handling in iwm_newstate().

* This avoids firmware resets in all the cases in iwm_newstate(). Instead
iwm_bring_down_firmware() is called, which tears down all the STA
connection state, according to the sc->sc_firmware_state value.

* Improve the behaviour of the LED blinking a bit, so it only blinks when
there really is a wireless scan going on.

* Print the newstate arg in debug output of iwm_newstate(), to help in
debugging.

This is inspired by the firmware state maintaining change in OpenBSD's iwm,
by stsp@openbsd.org (OpenBSD Git 0ddb056fb7370664b1d4b84392697cb17d1a414a).

r343382:
iwm - Avoid Tx watchdog timeout, when dropping a connection.

r343383:
iwm - Improve firmware Time Event handling.

* This is a mix of the OpenBSD Git 7fd9664469d1b717a307eebd74aeececbd3c41cc
change, and syncing with the Linux iwlwifi code.

Taken-From: Linux iwlwifi, and OpenBSD

r343384:
iwm - Clear Time Event active state, when receiving End Notification.

* This hopefully avoids some firmware panics, I was occasionally seeing,
when iwm disconnects upon losing signal to an access point at some point.

* This is synchronizing the if_iwm_time_event.c file a bit more from the
corresponding Linux iwlwifi/mvm/time-event.c.

Taken-From:     Linux iwlwifi

r343385:
iwm - Always clear watchdog timer, when bringing down firmware state.

r343386:
if_iwm - Stop iwm_watchdog callout when idle.

r343387:
iwm - Fix race during detach, where a callout is left after driver is gone.

r343388:
iwm - Update alive response handling, add v4 and remove old versions.

r343389:
iwm - Remove unused REPLY_MAX

Taken-From: Linux git e4eb275ac5cfe71686612d929a9829345b2a4ada

r343390:
iwm - Remove unused TX_CMD_NEXT_FRAME_*

Taken-From: Linux git b1e06c65fb69c5e3fddcd91987561e225eaa9bfa

r343477:
Fix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.

 * There's no reason to have a while() loop here, because:
    - if msleep returns 0, that means we were woken up by the interrupt handler,
      and we are going to exit immediately as sc_fw_chunk_done will now be 1
      (there is nothing else that sleeps on sc_fw.)
    - if msleep doesn't return 0 (i.e. it returned ETIMEDOUT) then we will
      exit immediately because of the if-test.
   So, just use a single msleep() and then check sc_fw_chunk_done as before.
 * The comment said we were sleeping for 5 seconds, but the msleep was only
   for 1. Before r314065, this was 1 second and so was the comment,
   and in that commit the comment was changed and the function call wasn't.

Possibly fixes failures to initialize uCode on certain devices.

PR: 219683

5 years agoMFC r343255: awg: fix soft reset failure with no link
Kyle Evans [Mon, 8 Apr 2019 17:59:42 +0000 (17:59 +0000)]
MFC r343255: awg: fix soft reset failure with no link

U-Boot will leave the ephy reset de-asserted and the MAC soft reset will
fail on these boards with internal PHY and no link established. Toggle reset
again before proceeding to attach/init.

5 years agoMFC r343240: iwm(4): Fix possible null pointer indirection
Kyle Evans [Mon, 8 Apr 2019 17:55:04 +0000 (17:55 +0000)]
MFC r343240: iwm(4): Fix possible null pointer indirection

5 years agoMFC r343335, r343977, r343993-r343994, r344034, r344084, r345302, r345769
Kyle Evans [Mon, 8 Apr 2019 17:41:39 +0000 (17:41 +0000)]
MFC r343335, r343977, r343993-r343994, r344034, r344084, r345302, r345769

r343335:
libbe(3): simplify import, allow replication streams

Previously, we directly used libzfs_core's lzc_receive to import to a
temporary snapshot, then cloned the snapshot and setup the properties. This
failed when attempting to import replication streams with questionable
error.

libzfs's zfs_receive is a much better fit here, so we now use it instead
with the destination dataset and let libzfs take care of the dirty details.
be_import is greatly simplified as a result.

r343977:
libbe(3): Add a destroy option for removing the origin

Currently origin snapshots are left behind when a BE is destroyed, whether
it was an auto-created snapshot or explicitly specified via, for example,
`bectl create -e be@mysnap ...`.

Removing it automatically could be argued as a POLA violation in some
circumstances, so provide a flag to be_destroy for it. An accompanying
option will be added to bectl(8) to utilize this.

Some minor style/consistency nits in the affected areas also addressed.

r343993:
bectl(8): Add -o flag to destroy to clean up the origin snapshot of BE

We can't predict when destruction of origin is needed, and currently we have
a precedent for not prompting for things. Leave the decision up to the user
of bectl(8) if they want the origin snapshot to be destroyed or not.

Emits a warning when -o isn't used and an origin snapshot is left to be
cleaned up, for the time being. This is handy when one drops the -o flag but
really did want to clean up the origin.

A couple of -e ignore's have been sprinkled around the test suite for places
that we don't care that the origin's not been cleaned up. -o functionality
tests will be added in the future, but are omitted for now to reduce
conflicts with work in flight to fix bits of the tests.

r343994:
bectl(8): commit missing test modifications from r343993

r344034:
libbe(3): Belatedly note the BE_DESTROY_ORIGIN option added in r343977

r344084:
libbe(3): Fix be_destroy behavior w.r.t. deep BE snapshots and -o

be_destroy is documented to recursively destroy a boot environment.  In the
case of snapshots, one would take this to mean that these are also
recursively destroyed.  However, this was previously not the case.
be_destroy would descend into the be_destroy callback and attempt to
zfs_iter_children on the top-level snapshot, which is bogus.

Our alternative approach is to take note of the snapshot name and iterate
through all of fs children of the BE to try destruction in the children.

The -o option is also fixed to work properly with deep BEs.  If the BE was
created with `bectl create -e otherDeepBE newDeepBE`, for instance, then a
recursive snapshot of otherDeepBE would have been taken for construction of
newDeepBE but a subsequent destroy with BE_DESTROY_ORIGIN set would only
clean up the snapshot at the root of otherDeepBE: ${BEROOT}/otherDeepBE@...

The most recent iteration instead pretends not to know how these things
work, verifies that the origin is another BE and then passes that back
through be_destroy to DTRT when snapshots and deep BEs may be in play.

r345302:
bectl(8): change jail command to execute jail(8)

The jail(8) command provides a variety of jail pseudo-parameters that are
useful to consumers of bectl, mount.devfs being the most-often-requested
paramater by bectl users.

command, exec.start, nopersist, and persist may not be specified via -o to
bectl. The command/exec.start remains passed as it always has at the end of
bectl, and persistence is dictated by -b/-U bectl jail arguments.

r345769:
libbe: Fix zfs_is_mounted check w/ snapshots

'be_destroy' can destroy a boot environment (by name) or a given snapshot.
If the target to be destroyed is a dataset, check if it's mounted. We don't
want to check if the origin dataset is mounted when destroying a snapshot.

PR: 236043

5 years agoMFC r345848: libbe(3): Add a serial to the generated snapshot names
Kyle Evans [Mon, 8 Apr 2019 17:36:24 +0000 (17:36 +0000)]
MFC r345848: libbe(3): Add a serial to the generated snapshot names

To use bectl in an example, when one creates a new boot environment with
either `bectl create <be>` or `bectl create -e <otherbe> <be>`, libbe will
take a snapshot of the original boot environment to clone. Previously, this
used %F-%T date format as the snapshot name, but this has some limitations-
attempting to create multiple boot environments in quick succession may
collide if done within the same second.

Tack a serial onto it to reduce the chances of a collision... we could still
collide if multiple processes/threads are creating boot environments at the
same time, but this is likely not a big concern as this has only been
reported as occurring in freebsd-ci setup.

5 years agoMFC r345763:
Andrey V. Elsukov [Mon, 8 Apr 2019 11:53:37 +0000 (11:53 +0000)]
MFC r345763:
  Correct a port number assignment.

  PR: 236930

5 years agoMFC r345741:
Jason A. Harmening [Sun, 7 Apr 2019 19:02:33 +0000 (19:02 +0000)]
MFC r345741:

freebsd32: fix padding of computed control message length for recvmsg()

Each control message region must be aligned on a 4-byte boundary on 32-bit
architectures. The 32-bit compat shim for recvmsg() gets the actual layout
right, but doesn't pad the payload length when computing msg_controllen for
the output message header. If a control message contains an unaligned
payload, such as the 1-byte TTL field in the example attached to PR 236737,
this can produce control message payload boundaries that extend beyond
the boundary reported by msg_controllen.

PR: 236737

5 years agoMFC r345754:
Andriy Voskoboinyk [Sun, 7 Apr 2019 13:26:45 +0000 (13:26 +0000)]
MFC r345754:
run(4): properly set F_DATAPAD radiotap flag if frame has padding between
frame header and data.

This will fix 'Mysterious OLPC stuff' for received frames and wrong
CCMP / TKIP / data decoding for transmitted frames in net/wireshark
dissector.

While here, drop unneeded comment - net80211 handles padding requirements
for Tx & Rx without driver adjustment.

Was tested with D-Link DWA-140 rev B3, STA mode.

5 years agoMFC r345751:
Andriy Voskoboinyk [Sun, 7 Apr 2019 13:11:40 +0000 (13:11 +0000)]
MFC r345751:
uath(4), urtw(4): restart driver if device does not respond after Tx request

5 years agoMFC r345753:
Andriy Voskoboinyk [Sun, 7 Apr 2019 13:04:25 +0000 (13:04 +0000)]
MFC r345753:
run(4): do not clear PROTECTED bit if frame was not decrypted by NIC.

Was tested with D-Link DWA-140 rev B3, STA / MONITOR modes.

5 years agoMFC r345729:
Andriy Voskoboinyk [Sun, 7 Apr 2019 12:57:38 +0000 (12:57 +0000)]
MFC r345729:
urtw(4): export TSF timestamp for received frames via radiotap

Was tested with Netgear WG111 v3 (RTL8187B), STA mode.

5 years agoAdd _PC_ACL_* to vop_stdpathconf
Simon J. Gerraty [Fri, 5 Apr 2019 23:34:46 +0000 (23:34 +0000)]
Add _PC_ACL_* to vop_stdpathconf

This avoid EINVAL from tmpfs etc.

Merge of r345024

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

5 years agoMFC r345816:
Guangyuan Yang [Fri, 5 Apr 2019 18:17:11 +0000 (18:17 +0000)]
MFC r345816:

Correct SMC definition in asmc(4) man page.

PR: 236954
Submitted by: fbsdbugs4@sentry.org

5 years agoMFC r345807:
Dimitry Andric [Fri, 5 Apr 2019 16:12:31 +0000 (16:12 +0000)]
MFC r345807:

Fix regression in top(1) after r344381, causing informational messages
to no longer be displayed.  This was because the reimplementation of
setup_buffer() did not copy the previous contents into any reallocated
buffer.

Reported by: James Wright <james.wright@jigsawdezign.com>
PR: 236947

5 years agoMFC r345806:
Dimitry Andric [Fri, 5 Apr 2019 16:09:23 +0000 (16:09 +0000)]
MFC r345806:

Pull in r357362 from upstream clang trunk (by David Chisnall):

  [objc-gnustep] Use .init_array not .ctors when requested.

  This doesn't make a difference most of the time but FreeBSD/ARM
  doesn't run anything in the .ctors array.

This should help with updating the libobjc2 port for armv7.

Requested by: theraven
Upstream PR: https://github.com/gnustep/libobjc2/issues/83

5 years agoMFC r345633:
Hans Petter Selasky [Fri, 5 Apr 2019 11:38:34 +0000 (11:38 +0000)]
MFC r345633:
Add new USB PCI ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoMFC r345499:
Hans Petter Selasky [Fri, 5 Apr 2019 11:35:02 +0000 (11:35 +0000)]
MFC r345499:
Change all kernel C-type macros into static inline functions.

The current kernel C-type macros might obscurely hide the fact that
the input argument might be used multiple times.

This breaks code like:
isalpha(*ptr++)

Use static inline functions instead of macros to fix this.

Reviewed by: kib @
Differential Revision: https://reviews.freebsd.org/D19694
Sponsored by: Mellanox Technologies

5 years agoMFC r345109:
Hans Petter Selasky [Fri, 5 Apr 2019 11:33:11 +0000 (11:33 +0000)]
MFC r345109:
Implement sg_virt() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345108:
Hans Petter Selasky [Fri, 5 Apr 2019 11:31:37 +0000 (11:31 +0000)]
MFC r345108:
Define SG_CHAIN and SG_END in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345107:
Hans Petter Selasky [Fri, 5 Apr 2019 11:30:13 +0000 (11:30 +0000)]
MFC r345107:
Implement pr_info_ratelimited() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345106:
Hans Petter Selasky [Fri, 5 Apr 2019 11:28:50 +0000 (11:28 +0000)]
MFC r345106:
Define some RCU debug macros in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345105:
Hans Petter Selasky [Fri, 5 Apr 2019 11:27:48 +0000 (11:27 +0000)]
MFC r345105:
Honor SYSCTL function return values when creating sysfs nodes in the LinuxKPI.
Return proper error code upon failure.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345104:
Hans Petter Selasky [Fri, 5 Apr 2019 11:26:18 +0000 (11:26 +0000)]
MFC r345104:
Implement more malloc function macros in the LinuxKPI.
Fix arguments for currently unused kvmalloc().

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345101:
Hans Petter Selasky [Fri, 5 Apr 2019 11:24:14 +0000 (11:24 +0000)]
MFC r345101:
Implement si_meminfo() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345099:
Hans Petter Selasky [Fri, 5 Apr 2019 11:20:44 +0000 (11:20 +0000)]
MFC r345099:
Implement get_task_comm() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345098:
Hans Petter Selasky [Fri, 5 Apr 2019 11:19:07 +0000 (11:19 +0000)]
MFC r345098:
Implement current_exiting() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345097:
Hans Petter Selasky [Fri, 5 Apr 2019 11:17:12 +0000 (11:17 +0000)]
MFC r345097:
Implement list_for_each_entry_from_reverse() and
list_bulk_move_tail() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345096:
Hans Petter Selasky [Fri, 5 Apr 2019 11:15:48 +0000 (11:15 +0000)]
MFC r345096:
Implement dma_map_page_attrs() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345095 and r345110:
Hans Petter Selasky [Fri, 5 Apr 2019 11:14:27 +0000 (11:14 +0000)]
MFC r345095 and r345110:
Implement ida_free() and ida_alloc_max() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345094:
Hans Petter Selasky [Fri, 5 Apr 2019 11:11:20 +0000 (11:11 +0000)]
MFC r345094:
Implement DEFINE_STATIC_SRCU() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345093:
Hans Petter Selasky [Fri, 5 Apr 2019 11:10:09 +0000 (11:10 +0000)]
MFC r345093:
Implement BITS_PER_TYPE() function macro in the LinuxKPI.
Fix some style while at it.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345092:
Hans Petter Selasky [Fri, 5 Apr 2019 11:08:50 +0000 (11:08 +0000)]
MFC r345092:
Properly define the DMA attribute values in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345091:
Hans Petter Selasky [Fri, 5 Apr 2019 11:07:15 +0000 (11:07 +0000)]
MFC r345091:
Implement dev_err_once() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345090:
Hans Petter Selasky [Fri, 5 Apr 2019 11:06:15 +0000 (11:06 +0000)]
MFC r345090:
Implement dma_set_mask_and_coherent() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

5 years agoMFC r345400-345401,345403,345412,345437:
Cy Schubert [Fri, 5 Apr 2019 01:22:30 +0000 (01:22 +0000)]
MFC r345400-345401,345403,345412,345437:

Add rc.d support for ippool(8).

I've been using ippool at my site for approximately two years. It's
about time this was committed.

PR: 218433

5 years agoMFC r344243, r345517-r345518: lualoader: More intelligent screen clearing
Kyle Evans [Thu, 4 Apr 2019 17:29:43 +0000 (17:29 +0000)]
MFC r344243, r345517-r345518: lualoader: More intelligent screen clearing

r344243:
lualoader: only clear the screen before first password prompt

This was previously an unconditional screen clear, regardless of whether or
not we would be prompting for any passwords. This is pointless, given that
the screen clear is only there to put our screen into a consistent state
before we draw the prompts and do cursor manipulation.

This is also the only screen clear besides that to draw the menu.  One can
now see early pre-loader and loader output with the menu disabled, which may
be useful for diagnostics.

r345517:
lualoader: Clear the screen before prompting for password

Assuming that the autoboot sequence was interrupted, we've done enough
cursor manipulation that the prompt for the password will be sufficiently
obscured a couple of lines up. Clear the screen and reset the cursor
position here, too.

r345518:
lualoader: Fix up some luacheck concerns

- Garbage collect an unused (removed because it was useless) constant
- Don't bother with vararg notation if args will not be used

5 years agodtc(1): Update to 1a79f5f26631
Kyle Evans [Thu, 4 Apr 2019 17:26:35 +0000 (17:26 +0000)]
dtc(1): Update to 1a79f5f26631

Highlights:
- Bugfix for order in which /delete-node/ and /delete-property/ are
  processed [0]
- /omit-if-no-ref/ support has been added (used only by U-Boot at this
  point, in theory)
- GPL dtc compat version bumped to 1.4.7
- Various small fixes and compatibility improvements

5 years agoMFC r345516: netbsd-tests: import memory bump for libc/regex/t_exhaust
Kyle Evans [Thu, 4 Apr 2019 17:24:57 +0000 (17:24 +0000)]
MFC r345516: netbsd-tests: import memory bump for libc/regex/t_exhaust

5 years agoMFC r344677: patch(1): Exit successfully if we're fed a 0-length patch
Kyle Evans [Thu, 4 Apr 2019 17:21:30 +0000 (17:21 +0000)]
MFC r344677: patch(1): Exit successfully if we're fed a 0-length patch

This change is made in the name of GNU patch compatibility. If GNU patch is
fed a zero-length patch, it will exit successfully with no output. This is
used in at least one port to date (comms/wsjtx), and we break on this usage.

It seems unlikely that anyone relies on patch(1) calling their completely
empty patch garbage and failing, and GNU compatibility is a plus if it helps
with porting, so make the switch.

5 years agoMFC r345373: Add bus_release_resource() method to nexus on arm64
Marcin Wojtas [Thu, 4 Apr 2019 12:02:48 +0000 (12:02 +0000)]
MFC r345373: Add bus_release_resource() method to nexus on arm64

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

5 years agoMFC r345371: Prevent double activation of admin interrupt in ENA
Marcin Wojtas [Thu, 4 Apr 2019 09:08:09 +0000 (09:08 +0000)]
MFC r345371: Prevent double activation of admin interrupt in ENA

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

5 years agoMFC r345359, r345384:
Mark Johnston [Thu, 4 Apr 2019 02:05:50 +0000 (02:05 +0000)]
MFC r345359, r345384:
Don't attempt to measure TSC skew when running as a VM guest.

PR: 218452

5 years agoMFC r343764 (jchandra): arm, acpi: increase size of memory region arrays
Ed Maste [Wed, 3 Apr 2019 13:19:47 +0000 (13:19 +0000)]
MFC r343764 (jchandra): arm, acpi: increase size of memory region arrays

Bump up MAX_HWCNT and MAX_EXCNT to 32 when ACPI is enabled. These are
the sizes of the hwregions and exregions arrays respectively. ACPI
firmware typically has more memory regions and the current value of
16 is not sufficient for some platforms.

This commit fixes a failure seen with AMI firmware on Cavium's Sabre
ThunderX2 reference platform. This platform needs 21 physical memory
regions and 18 excluded regions to boot correctly with the current
firmware release.

5 years agoMFC r345611:
Ravi Pokala [Wed, 3 Apr 2019 06:36:41 +0000 (06:36 +0000)]
MFC r345611:

Teach jedec_dimm(4) to be more forgiving of non-fatal errors.

It looks like some DIMMs claim to have a TSOD, but actually don't. Some
claim they weren't able to change the SPD page, but they did. Neither of
those should be fatal errors.