]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agodevfs: add root vnode caching
mjg [Sun, 6 Oct 2019 22:16:55 +0000 (22:16 +0000)]
devfs: add root vnode caching

See r353150.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21646

4 years agozfs: add root vnode caching
mjg [Sun, 6 Oct 2019 22:16:00 +0000 (22:16 +0000)]
zfs: add root vnode caching

This replaces the approach added in r338927.

See r353150.

Sponsored by: The FreeBSD Foundation

4 years agovfs: add optional root vnode caching
mjg [Sun, 6 Oct 2019 22:14:32 +0000 (22:14 +0000)]
vfs: add optional root vnode caching

Root vnodes looekd up all the time, e.g. when crossing a mount point.
Currently used routines always perform a costly lookup which can be
trivially avoided.

Reviewed by: jeff (previous version), kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21646

4 years agoamd64 pmap: implement per-superpage locks
mjg [Sun, 6 Oct 2019 22:13:35 +0000 (22:13 +0000)]
amd64 pmap: implement per-superpage locks

The current 256-lock sized array is a problem in the following ways:
- it's way too small
- there are 2 locks per cacheline
- it is not NUMA-aware

Solve these issues by introducing per-superpage locks backed by pages
allocated from respective domains.

This significantly reduces contention e.g. during poudriere -j 104.
See the review for results.

Reviewed by: kib
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21833

4 years agopowerpc/pmap64: Properly parenthesize PV_LOCK_COUNT macros
jhibbits [Sun, 6 Oct 2019 19:11:01 +0000 (19:11 +0000)]
powerpc/pmap64: Properly parenthesize PV_LOCK_COUNT macros

As pointed out by mjg, without the parentheses the calculations done against
these macros are incorrect, resulting in only 1/3 of locks being used.

Reported by: mjg

4 years agoloader.efi: for text mode, use STM to scroll the whole screen
tsoome [Sun, 6 Oct 2019 18:38:58 +0000 (18:38 +0000)]
loader.efi: for text mode, use STM to scroll the whole screen

Since local UEFI console is implemented on top of framebuffer,
we need to avoid redrawing the whole screen ourselves, but let
Simple Text Mode to do the scroll for us.

4 years agoPlumb an mbuf leak in a code path that should not be taken. Also avoid
tuexen [Sun, 6 Oct 2019 08:47:10 +0000 (08:47 +0000)]
Plumb an mbuf leak in a code path that should not be taken. Also avoid
that this path is taken by setting the tail pointer correctly.
There is still bug related to handling unordered unfragmented messages
which were delayed in deferred handling.
This issue was found by OSS-Fuzz testing the usrsctp stack and reported in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17794

MFC after: 3 days

4 years agoRe-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around
kevans [Sun, 6 Oct 2019 04:19:49 +0000 (04:19 +0000)]
Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around

Diff partially stolen from CheriBSD; these bits need -Wl,-z,notext in order
to build in an LLVM world. They are needed for all flavors/sizes of MIPS.
This will eventually get fixed in LLVM, but it's unclear when.

Reported by: arichardson, emaste
Differential Revision: https://reviews.freebsd.org/D21696

4 years agoriscv: use the common sub-word {,f}cmpset implementation
kevans [Sun, 6 Oct 2019 01:35:31 +0000 (01:35 +0000)]
riscv: use the common sub-word {,f}cmpset implementation

Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D21888

4 years agoMark "private use area" characters as printable.
yuripv [Sat, 5 Oct 2019 22:17:54 +0000 (22:17 +0000)]
Mark "private use area" characters as printable.

At least some of the characters in E000-F8FF range are used by Powerline
fonts, and having no attributes for these ranges in UnicodeData.txt
other than "Other, Private Use" it should be safe to mark all of them as
printable.  Some actually were before r340491, so this fixes the
regression introduced there as well.

PR: 240911
Reviewed by: bapt
Tested by: Daniel Ponte <amigan@gmail.com>
Differential Revision: https://reviews.freebsd.org/D21850

4 years agoRemove the remnants of SI_CHEAPCLONE
kevans [Sat, 5 Oct 2019 21:52:06 +0000 (21:52 +0000)]
Remove the remnants of SI_CHEAPCLONE

SI_CHEAPCLONE was introduced in r66067 for use with cloned bpfs. It was
later also used in tty, tun, tap at points. The rough timeline for being
removed in each of these is as follows:

- r181690: bpf switched to use cdevpriv API by ed@
- r181905: ed@ rewrote the TTY later to be mpsafe
- r204464: kib@ removes it from tun/tap, declaring it unused

I've not yet been able to dig up any other consumers in the intervening 9
years. It is no longer set on any devices in the tree and leaves an
interesting situation in make_dev_sv where we're ok with the device already
being set SI_NAMED.

4 years agokern_conf: fully initialize cloned devices with make_dev_args, too
kevans [Sat, 5 Oct 2019 21:44:18 +0000 (21:44 +0000)]
kern_conf: fully initialize cloned devices with make_dev_args, too

Attempting to initialize si_drv{1,2} with mda_si_drv{1,2} does not work if
you are operating on cloned devices.

clone_create must be called prior to the make_dev* family to create/return
the device on the clonelist as needed. This device is later returned early
in newdev(), prior to si_drv{0,1,2} initialization.

This patch simply breaks out of the loop if we've found a device and
finishes init.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21904

4 years agoPre-generate Big5 charmap from CLDR data.
yuripv [Sat, 5 Oct 2019 21:28:46 +0000 (21:28 +0000)]
Pre-generate Big5 charmap from CLDR data.

The one used previously was missing the characters in 0-127 range,
making various tools try to escape them in output.

PR: 235100
Reviewed by: bapt
Tested by: Ting-Wei Lan <lantw44@gmail.com>
Differential Revision: https://reviews.freebsd.org/D21794

4 years agodevfs: plug redundant bwillwrite avoidance
mjg [Sat, 5 Oct 2019 17:44:33 +0000 (17:44 +0000)]
devfs: plug redundant bwillwrite avoidance

vn_write already checks for vnode type to see if bwillwrite should be called.

This effectively reverts r244643.

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

4 years agoarm64: rockchip: usb2phy: Add set/get mode
manu [Sat, 5 Oct 2019 17:36:33 +0000 (17:36 +0000)]
arm64: rockchip: usb2phy: Add set/get mode

We only support host mode so those functions are just added so
we won't panic when generic-{e,o}hci will set the phy to host mode.

MFC after: 1 month
X-MFC-With: r353062

4 years agoFix a use after free bug when removing remote addresses.
tuexen [Sat, 5 Oct 2019 13:28:01 +0000 (13:28 +0000)]
Fix a use after free bug when removing remote addresses.
This bug was found by OSS-Fuzz and reported in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18004

MFC after: 3 days

4 years agoPlumb an mbuf leak found by Mark Wodrich from Google by fuzz testing the
tuexen [Sat, 5 Oct 2019 12:34:50 +0000 (12:34 +0000)]
Plumb an mbuf leak found by Mark Wodrich from Google by fuzz testing the
userland stack and reporting it in:
https://github.com/sctplab/usrsctp/issues/396

MFC after: 3 days

4 years agoCorrect grammos and typos.
schweikh [Sat, 5 Oct 2019 09:59:00 +0000 (09:59 +0000)]
Correct grammos and typos.

4 years agoFix the adding of padding to COOKIE-ECHO chunks.
tuexen [Sat, 5 Oct 2019 09:46:11 +0000 (09:46 +0000)]
Fix the adding of padding to COOKIE-ECHO chunks.

Thanks to Mark Wodrich who found this issue while fuzz testing the
usrsctp stack and reported the issue in
https://github.com/sctplab/usrsctp/issues/382

MFC after: 3 days

4 years agoZFS: fix several of the "zpool create" tests
asomers [Sat, 5 Oct 2019 03:19:53 +0000 (03:19 +0000)]
ZFS: fix several of the "zpool create" tests

* Remove zpool_create_013_neg.  FreeBSD doesn't have an equivalent of
  Solaris's metadevices.  GEOM would be the equivalent, but since all geoms
  are the same from ZFS's perspective, this test would be redundant with
  zpool_create_012_neg

* Remove zpool_create_014_neg.  FreeBSD does not support swapping to regular
  files.

* Remove zpool_create_016_pos.  This test is redundant with literally every
  other test that creates a disk-backed pool.

* s:/etc/vfstab:/etc/fstab in zpool_create_011_neg

* Delete the VTOC-related portion of zpool_create_008_pos.  FreeBSD doesn't
  use VTOC.

* Replace dumpadm with dumpon and swap with swapon in multiple tests.

* In zpool_create_015_neg, don't require "zpool create -n" to fail.  It's
  reasonable for that variant to succeed, because it doesn't actually open
  the zvol.

* Greatly simplify zpool_create_012_neg.  Make it safer, too, but not
  interfering with the system's regular swap devices.

* Expect zpool_create_011_neg to fail (PR 241070)

* Delete some redundant cleanup steps in various tests

* Remove some unneeeded ATF timeout specifications.  The default is fine.

PR: 241070
MFC after: 2 weeks
Sponsored by: Axcient

4 years agoZFS: the hotspare_add_004_neg test needs at least two disks
asomers [Sat, 5 Oct 2019 01:34:35 +0000 (01:34 +0000)]
ZFS: the hotspare_add_004_neg test needs at least two disks

MFC after: 2 weeks
Sponsored by: Axcient

4 years agoAdd missing definition in DEBUG code.
cy [Fri, 4 Oct 2019 22:10:38 +0000 (22:10 +0000)]
Add missing definition in DEBUG code.

MFC after: 3 days

4 years agonvdimm(4): Fix Clang build after r353110
cem [Fri, 4 Oct 2019 21:47:09 +0000 (21:47 +0000)]
nvdimm(4): Fix Clang build after r353110

Clang spuriously warns about some well-defined C99 static initializers.
Mute it.

X-MFC-With: r353110

4 years agoMake the hw.intrs sysctl OID read-only
vangyzen [Fri, 4 Oct 2019 21:46:11 +0000 (21:46 +0000)]
Make the hw.intrs sysctl OID read-only

The handler ignores the new value, so make the OID read-only.

I found this while working on r353111.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

4 years agoAdd CTLFLAG_STATS to several debug.softdep sysctl OIDs
vangyzen [Fri, 4 Oct 2019 21:44:52 +0000 (21:44 +0000)]
Add CTLFLAG_STATS to several debug.softdep sysctl OIDs

Refer to r353111.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

4 years agoAdd CTLFLAG_STATS to some vfs sysctl OIDs
vangyzen [Fri, 4 Oct 2019 21:43:43 +0000 (21:43 +0000)]
Add CTLFLAG_STATS to some vfs sysctl OIDs

Add CTLFLAG_STATS to the following OIDs:

vfs.altbufferflushes
vfs.recursiveflushes
vfs.barrierwrites
vfs.flushwithdeps
vfs.reassignbufcalls

Refer to r353111.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

4 years agoAdd CTLFLAG_STATS to all COUNTER_U64* sysctl OIDs
vangyzen [Fri, 4 Oct 2019 21:39:11 +0000 (21:39 +0000)]
Add CTLFLAG_STATS to all COUNTER_U64* sysctl OIDs

CTLFLAG_STATS identifies a sysctl OID as statistical or informational,
as opposed to a configurable/tunable OID that changes behavior.
This can be used, for example, to verfiy that the kyua tests do not
modify configurable OIDs when allow_sysctl_side_effects is true.

Add CTLFLAG_STATS to all COUNTER_U64* OIDs.

I will add the flag to more OIDs in a few subsequent commits, to
facilitate MFC.  The flag should be added to many more OIDs.  I plan to
add it those that my test found and some nearby that looked obvious.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

4 years agonvdimm(4): Add nvdimm_e820 pseudo-bus
cem [Fri, 4 Oct 2019 18:38:47 +0000 (18:38 +0000)]
nvdimm(4): Add nvdimm_e820 pseudo-bus

nvdimm_e820 is a newbus pseudo driver that looks for "legacy" e820 PRAM
spans and creates ordinary-looking SPA devfs nodes for them
(/dev/nvdimm_spaN).

As these legacy regions lack real NFIT SPA regions and namespace
definitions, they must be administratively sliced up externally using
device.hints.  This is similar in purpose to the Linux memmap= mechanism.

It is assumed that systems with working NFIT tables will not have any use
for this driver, and that that will be the prevailing style going forward,
so if there are no explicit hints provided, this driver does not
automatically create any devices.

Reviewed by: kib (previous version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21885

4 years agodtrace: 64-bits registers support
oshogbo [Fri, 4 Oct 2019 16:17:00 +0000 (16:17 +0000)]
dtrace: 64-bits registers support

The registers in ilumos and FreeBSD have a different number.
In the illumos, last 32-bits register defined is SS an in FreeBSD is GS.
While translating register we should comper it to the highest one.

PR:             240358
Reported by:    lwhsu@
MFC after:      2 weeks

4 years agotuntap(4): loosen up tunclose restrictions
kevans [Fri, 4 Oct 2019 13:43:07 +0000 (13:43 +0000)]
tuntap(4): loosen up tunclose restrictions

Realistically, this cannot work. We don't allow the tun to be opened twice,
so it must be done via fd passing, fork, dup, some mechanism like these.
Applications demonstrably do not enforce strict ordering when they're
handing off tun devices, so the parent closing before the child will easily
leave the tun/tap device in a bad state where it can't be destroyed and a
confused user because they did nothing wrong.

Concede that we can't leave the tun/tap device in this kind of state because
of software not playing the TUNSIFPID game, but it is still good to find and
fix this kind of thing to keep ifconfig(8) up-to-date and help ensure good
discipline in tun handling.

MFC after:  3 days

4 years agoDo not remove the locale directory when building a system without locales
bapt [Fri, 4 Oct 2019 10:24:10 +0000 (10:24 +0000)]
Do not remove the locale directory when building a system without locales

This directory is actually needed during make installworld and will prevent
to reinstall a system after make delete-old is done.

PR: 226137
Reported by: rakuco
MFC after: 3 days

4 years agoUpdate ffs_getcg() function to accept a flags parameter to be passed
mckusick [Fri, 4 Oct 2019 05:28:36 +0000 (05:28 +0000)]
Update ffs_getcg() function to accept a flags parameter to be passed
to breadn_flags() in preparation for later need when doing forcible
unmount when disk dies or is removed.

No functional change.

Sponsored by: Netflix

4 years agoThe implementation of arm64_tlb_flushID_SE() was removed from cpufunc_asm.S
alc [Fri, 4 Oct 2019 03:55:53 +0000 (03:55 +0000)]
The implementation of arm64_tlb_flushID_SE() was removed from cpufunc_asm.S
in r313347.  Eliminate its declaration from this file.

MFC after: 1 week

4 years agocaroot: commit initial bundle
kevans [Fri, 4 Oct 2019 02:34:20 +0000 (02:34 +0000)]
caroot: commit initial bundle

Interested users can blacklist any/all of these with certctl(8), examples:

- mv /usr/share/certs/trusted/... /usr/share/certs/blacklisted/...; \
    certctl rehash
- certctl blacklist /usr/share/certs/trusted/*; \
    certctl rehash

Certs can be easily examined after installation with `certctl list`, and
certctl blacklist will accept the hashed filename as output by list or as
seen in /etc/ssl/certs

No objection from: secteam
Relnotes: Definite maybe

4 years agoRemove aw_ehci from NOTES to fix LINT kernel builds after r353063.
jhb [Thu, 3 Oct 2019 21:37:01 +0000 (21:37 +0000)]
Remove aw_ehci from NOTES to fix LINT kernel builds after r353063.

Reported by: Jenkins

4 years agoWhen skipping the address parameter, take the padding into account.
tuexen [Thu, 3 Oct 2019 20:47:57 +0000 (20:47 +0000)]
When skipping the address parameter, take the padding into account.

MFC after: 3 days

4 years agocertctl(8): let one blacklist based on hashed filenames
kevans [Thu, 3 Oct 2019 20:45:52 +0000 (20:45 +0000)]
certctl(8): let one blacklist based on hashed filenames

It seems reasonable to allow, for instance:

$ certctl list
# reviews output -- ah, yeah, I don't trust that one
$ certctl blacklist ce5e74ef.0
$ certctl rehash

We can unambiguously determine what cert "ce5e74ef.0" refers to, and we've
described it to them in `certctl list` output -- I see little sense in
forcing another level of filesystem inspection to determien what cert file
this physically corresponds to.

4 years agoCleanup sctp_asconf_error_response() and ensure that the parameter
tuexen [Thu, 3 Oct 2019 20:39:17 +0000 (20:39 +0000)]
Cleanup sctp_asconf_error_response() and ensure that the parameter
is padded as required. This fixes the followig bug reported by
OSS-Fuzz for the usersctp stack:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17790

MFC after: 3 days

4 years agotftp: fix two minor Coverity CIDs
asomers [Thu, 3 Oct 2019 20:22:25 +0000 (20:22 +0000)]
tftp: fix two minor Coverity CIDs

Reported by: Coverity
CID 1394842: file descriptor leak in an error path
CID 1007603: single byte array overflow
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21695

4 years agocertctl(8): realpath the file before creating the symlink
kevans [Thu, 3 Oct 2019 20:05:46 +0000 (20:05 +0000)]
certctl(8): realpath the file before creating the symlink

Otherwise we end up creating broken relative symlinks in
/etc/ssl/blacklisted.

4 years agotmpfs_readdir(): unlock the locked node.
kib [Thu, 3 Oct 2019 19:55:05 +0000 (19:55 +0000)]
tmpfs_readdir(): unlock the locked node.

During readdir() we guarantee that the tn_dir.tn_parent does not go
away, but it might be replaced by a parallel rename.  Read tn_parent
only once, then use the cached value.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agotmpfs_rename: style.
kib [Thu, 3 Oct 2019 19:51:56 +0000 (19:51 +0000)]
tmpfs_rename: style.

Reformat multi-line comments to follow style.
Also fix some typos.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoallwinner: Remove a10_ehci driver
manu [Thu, 3 Oct 2019 18:58:15 +0000 (18:58 +0000)]
allwinner: Remove a10_ehci driver

We have generic-ehci since r353062 so use it.

MFC after: 1 month
X-MFC-With: r353062

4 years agoSplit out the attachment from the generic-ehci driver
manu [Thu, 3 Oct 2019 18:53:03 +0000 (18:53 +0000)]
Split out the attachment from the generic-ehci driver

Create an attachment file for the existing ACPI attachment, and create a
new FDT attachment for the generic-ehci driver.

Submitted by: andrew (Original version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19389

4 years agoAdd missing input validation. This could result in reading from
tuexen [Thu, 3 Oct 2019 18:36:54 +0000 (18:36 +0000)]
Add missing input validation. This could result in reading from
uninitialized memory.
The issue was found by OSS-Fuzz for usrsctp  and reported in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17780

MFC after: 3 days

4 years agoRestore description of packets dropped due to full reassembly queue.
jhb [Thu, 3 Oct 2019 18:24:41 +0000 (18:24 +0000)]
Restore description of packets dropped due to full reassembly queue.

r265408 renamed tcps_rcvmemdrop to tcps_rcvreassfull and gave it a more
specific description.  r279122 (libxo-ification) reverted that change.
This commit brings it back, but with a small tweak to the description.

MFC after: 2 weeks

4 years agoFix a typo in a comment.
jhb [Thu, 3 Oct 2019 18:12:34 +0000 (18:12 +0000)]
Fix a typo in a comment.

4 years agoif_tuntap: create /dev aliases when a tuntap device gets renamed
kevans [Thu, 3 Oct 2019 17:54:00 +0000 (17:54 +0000)]
if_tuntap: create /dev aliases when a tuntap device gets renamed

Currently, if you do:

$ ifconfig tun0 create
$ ifconfig tun0 name wg0
$ ls -l /dev | egrep 'wg|tun'

You will see tun0, but no wg0. In fact, it's slightly more annoying to make
the association between the new name and the old name in order to open the
device (if it hadn't been opened during the rename).

Register an eventhandler for ifnet_arrival_events and catch interface
renames. We can determine if the ifnet is a tun easily enough from the
if_dname, which matches the cevsw.d_name from the associated tuntap_driver.

Some locking dance is required because renames don't require the device to
be opened, so it could go away in the middle of handling the ioctl, but as
soon as we've verified this isn't the case we can attempt to busy the tun
and either bail out if the tun device is dying, or we can proceed with the
rename.

We only create these aliases on a best-effort basis. Renaming a tun device
to "usbctl", which doesn't exist as an ifnet but does as a /dev, is clearly
not that disastrous, but we can't and won't create a /dev for that.

4 years agoif_tuntap: add a busy/unbusy mechanism, replace destroy OPEN check
kevans [Thu, 3 Oct 2019 17:46:27 +0000 (17:46 +0000)]
if_tuntap: add a busy/unbusy mechanism, replace destroy OPEN check

A future commit will create device aliases when a tuntap device is renamed
so that it's still easily found in /dev after the rename.  Said mechanism
will want to keep the tun alive long enough to either realize that it's
about to go away or complete the alias creation, even if the alias is about
to get destroyed.

While we're introducing it, using it to prevent open devices from going away
makes plenty of sense and keeps the logic on waking up tun_destroy clean, so
we don't have multiple places trying to cv_broadcast unless it's still in
use elsewhere.

4 years agoAdd rcvar back to the linux rc script. Without it it was enabled
trasz [Thu, 3 Oct 2019 16:38:44 +0000 (16:38 +0000)]
Add rcvar back to the linux rc script.  Without it it was enabled
unconditionally.

Reported by: Michael Butler <imb at protected-networks dot net>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoRemove white-space at EOL.
schweikh [Thu, 3 Oct 2019 14:52:25 +0000 (14:52 +0000)]
Remove white-space at EOL.

4 years agoRemove host binary object drivers from GENERIC
emaste [Thu, 3 Oct 2019 12:51:57 +0000 (12:51 +0000)]
Remove host binary object drivers from GENERIC

Four drivers (hpt27xx, hptmv, hptnr, hptrr, hpt27xx) include precompiled
binary objects; have users load them as modules if they are needed.

Additional work (i.e., integrating devmatch) required before MFC.

Reviewed by: markj
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21865

4 years agoadd ability to set watchdog timeout for a shutdown
avg [Thu, 3 Oct 2019 11:23:10 +0000 (11:23 +0000)]
add ability to set watchdog timeout for a shutdown

This change allows to specify a watchdog(9) timeout for a system
shutdown.  The timeout is activated when the watchdogd daemon is
stopped.  The idea is to a prevent any indefinite hang during late
stages of the shutdown.  The feature is implemented in rc.d/watchdogd,
it builds upon watchdogd -x option.

Note that the shutdown timeout is not actiavted when the watchdogd
service is individually stopped by an operator.  It is also not
activated for the 'shutdown' to the single-user mode.  In those cases it
is assumed that the operator knows what they are doing and they have
means to recover the system should it hang.

Significant subchanges and implementation details:
- the argument to rc.shutdown, completely unused before, is assigned to
  rc_shutdown variable that can be inspected by rc scripts
- init(8) passes "single" or "reboot" as the argument, this is not
  changed
- the argument is not mandatory and if it is not set then rc_shutdown is
  set to "unspecified"
- however, the default jail management scripts and jail configuration
  examples have been updated to pass "jail" to rc.shutdown, just in case
- the new timeout can be set via watchdogd_shutdown_timeout rc option
- for consistency, the regular timeout can now be set via
  watchdogd_timeout rc option
- watchdogd_shutdown_timeout and watchdogd_timeout override timeout
  specifications in watchdogd_flags
- existing configurations, where the new rc options are not set, should
  keep working as before

I am not particularly wed to any of the implementation specifics.
I am open to changing or removing any of them as long as the provided
functionality is the same (or very close) to the proposed one.
For example, I think it can be implemented without using watchdogd -x,
by means of watchdog(1) alone.  In that case there would be a small
window between stopping watchdogd and running watchdog, but I think that
that is acceptable.

Reviewed by: bcr (man page changes)
MFC after: 5 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D21221

4 years agoZFS: add bookmark renaming
avg [Thu, 3 Oct 2019 11:08:45 +0000 (11:08 +0000)]
ZFS: add bookmark renaming

The feature is implemented as an extension of the existing
ZFS_IOC_RENAME ioctl.  Both the userland and the DSL interfaces support
renaming only a single bookmark at a time.  As of now, there is no ZCP
interface to the new functionality.  I am going to add it once the DSL
interface passes a test of time.

This change picks up support for zfs_ioc_namecheck_t::ENTITY_NAME that
was added to ZoL as part of Redacted Send/Receive feature by Paul
Dagnelie <pcd@delphix.com>.  This is needed to allow a bookmark name in
zc_name.

Discussed with: mahrens
Reviewed by: bcr (man page)
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D21795

4 years agoRemove unnecessary vm/vm_page.h and vm/vm_pager.h includes from
kib [Thu, 3 Oct 2019 08:25:09 +0000 (08:25 +0000)]
Remove unnecessary vm/vm_page.h and vm/vm_pager.h includes from
tmpfs/tmpfs_vnodes.c.

Submitted by: ota@j.email.ne.jp
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21881

4 years agoFix build failure from r353026. Somehow module build allowed this.
glebius [Thu, 3 Oct 2019 04:41:57 +0000 (04:41 +0000)]
Fix build failure from r353026. Somehow module build allowed this.

Pointy hat to: glebius

4 years agoProtect access to seq->xwin[] with the seq mutex.
glebius [Thu, 3 Oct 2019 02:34:51 +0000 (02:34 +0000)]
Protect access to seq->xwin[] with the seq mutex.

MFC after: 5 weeks

4 years ago- Remove the compile time limit for number of links a ng_bridge node
glebius [Thu, 3 Oct 2019 02:32:55 +0000 (02:32 +0000)]
- Remove the compile time limit for number of links a ng_bridge node
  can handle.  Instead using an array on node private data, use per-hook
  private data.
- Use NG_NODE_FOREACH_HOOK() to traverse through hooks instead of array.

PR: 240787
Submitted by: Lutz Donnerhacke <lutz donnerhacke.de>
Differential Revision:   https://reviews.freebsd.org/D21803

4 years agoBump .Dd for earlier update (should have been part of r353024).
ian [Wed, 2 Oct 2019 23:19:34 +0000 (23:19 +0000)]
Bump .Dd for earlier update (should have been part of r353024).

4 years agoClarify how the -f option for daemon(8) interacts with other options
ian [Wed, 2 Oct 2019 23:06:17 +0000 (23:06 +0000)]
Clarify how the -f option for daemon(8) interacts with other options
related to redirecting stdout and stderr.

4 years agoFix the EMBEDFS_FORMAT helper variable for riscv64.
jhb [Wed, 2 Oct 2019 21:49:39 +0000 (21:49 +0000)]
Fix the EMBEDFS_FORMAT helper variable for riscv64.

It was defined with the wrong MACHINE_ARCH previously.  This permits
using an MFS image without defining MD_ROOT_SIZE which has various
benefits (one being that the build is able to treat the MFS image as
a dependency and properly re-link the kernel with the new image when
building with NO_CLEAN).

MFC after: 2 weeks
Sponsored by: DARPA

4 years agoSwitch EC2 AMIs from using the dual-dhclient script to using the new
cperciva [Wed, 2 Oct 2019 21:35:39 +0000 (21:35 +0000)]
Switch EC2 AMIs from using the dual-dhclient script to using the new
dual-dhclient-daemon daemon.  This makes it possible to stop/restart
the dhclients.

MFC after: 1 month

4 years agosimplify path handling in sysctl_try_reclaim_vnode
emaste [Wed, 2 Oct 2019 21:01:23 +0000 (21:01 +0000)]
simplify path handling in sysctl_try_reclaim_vnode

MAXPATHLEN / PATH_MAX includes space for the terminating NUL, and namei
verifies the presence of the NUL.  Thus there is no need to increase the
buffer size here.

The sysctl passes the string excluding the NUL, so req->newlen equal to
PATH_MAX is too long.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21876

4 years agonvdimm: Fix error path mis-free
cem [Wed, 2 Oct 2019 19:13:35 +0000 (19:13 +0000)]
nvdimm: Fix error path mis-free

Regression introduced in r343629 when malloc result was renamed from spa to
spa_mapping and the 'spa' name was instead used to iterate a table, but the
free() target was not updated.

Reviewed by: kib, scottph
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21871

4 years agoOverride the TLS model when building mips64 binaries and static libraries
kevans [Wed, 2 Oct 2019 17:18:18 +0000 (17:18 +0000)]
Override the TLS model when building mips64 binaries and static libraries

GCC uses "dynamic" TLS models when -fpic or -fPIC is explicitly
specified on the command line (which is only true for shared libraries).
It uses "static" (or "exec") TLS models otherwise.  In particular, GCC
does _not_ use dynamic TLS models when PIC is implicitly enabled (which
it is on MIPS), only if a PIC flag is explicitly provided.

llvm uses "dynamic" TLS models if PIC is enabled either via a PIC flag
or if it is implicily enabled (as on MIPS64).  This means that llvm on
MIPS64 always uses "dynamic" TLS models.  However, dynamic TLS models
do not work for static binaries and libraries as the __tls_get_addr
function they invoke is only defined in rtld.

Written by: jhb
Reviewed by: arichardson
Differential Revision: https://reviews.freebsd.org/D21699

4 years agoclang: use -mxgot for 32-bit mips
kevans [Wed, 2 Oct 2019 17:15:38 +0000 (17:15 +0000)]
clang: use -mxgot for 32-bit mips

Various bits in usr.bin/clang/* will fail to compile without -mxgot due to
truncated relocations. -mxgot entails a speed penalty, but I suspect we
don't care as much about compiler performance in 32-bit mips land.

Reviewed by: arichardson
Differential Revision: https://reviews.freebsd.org/D21698

4 years agosparc64: use generic sub-word atomic *cmpset
kevans [Wed, 2 Oct 2019 17:08:20 +0000 (17:08 +0000)]
sparc64: use generic sub-word atomic *cmpset

Most of this diff is refactoring to reduce duplication between the different
acq_ and rel_ variants.

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

4 years agomips: use generic sub-word atomic *cmpset
kevans [Wed, 2 Oct 2019 17:07:59 +0000 (17:07 +0000)]
mips: use generic sub-word atomic *cmpset

Most of this diff is refactoring to reduce duplication between the different
acq_ and rel_ variants.

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

4 years agoProvide generic sub-word atomic *cmpset
kevans [Wed, 2 Oct 2019 17:06:28 +0000 (17:06 +0000)]
Provide generic sub-word atomic *cmpset

Provide *cmpset_{8,16} as wrappers around atomic_fcmpset_32. Initial users
will be mips and sparc64, and perhaps parts of powerpc.

This are not for general consumption; machine/atomic.h should include this
header as needed to provide atomic_{,f}cmpset_{8,16} and machine/atomic.h
should provide acq_ and rel_ variants.

Reviewed by: jhibbits, kib
Differential Revision: https://reviews.freebsd.org/D21822

4 years agoUse OBJT_PHYS VM objects for kernel modules.
markj [Wed, 2 Oct 2019 16:34:42 +0000 (16:34 +0000)]
Use OBJT_PHYS VM objects for kernel modules.

OBJT_DEFAULT incurs some unnecessary overhead given that kernel module
pages cannot be paged out.

Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21862

4 years agoHarmonize the hptmv blob's build rule with that of other hpt* drivers.
markj [Wed, 2 Oct 2019 16:18:50 +0000 (16:18 +0000)]
Harmonize the hptmv blob's build rule with that of other hpt* drivers.

No functional change intended.

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21866

4 years agoAdd a comment explaining why the opensolaris_load line in loader.conf
gjb [Wed, 2 Oct 2019 16:09:28 +0000 (16:09 +0000)]
Add a comment explaining why the opensolaris_load line in loader.conf
is explicitly added.

Requested by: rgrimes
MFC after: 3 days
MFC with: r353004
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoRevert r352953: Convert pnmatch to single element array in regexec calls
kan [Wed, 2 Oct 2019 16:08:01 +0000 (16:08 +0000)]
Revert r352953: Convert pnmatch to single element array in regexec calls

Requested by: cem

4 years agoDisallow fcntl(F_READAHEAD) when the vnode is not a regular file.
markj [Wed, 2 Oct 2019 15:45:49 +0000 (15:45 +0000)]
Disallow fcntl(F_READAHEAD) when the vnode is not a regular file.

The mountpoint may not have defined an iosize parameter, so an attempt
to configure readahead on a device file can lead to a divide-by-zero
crash.

The sequential heuristic is not applied to I/O to or from device files,
and posix_fadvise(2) returns an error when v_type != VREG, so perform
the same check here.

Reported by: syzbot+e4b682208761aa5bc53a@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21864

4 years agolibusb: LIBUSB_DEBUG environment variable override of libusb_set_debug
kevans [Wed, 2 Oct 2019 15:19:39 +0000 (15:19 +0000)]
libusb: LIBUSB_DEBUG environment variable override of libusb_set_debug

The debug level generally just controls verbosity of libusb for debugging
libusb devices/usage. We allow the environment to set the debug level
independent of the application, but the application will always override
this if it explicitly sets the debug level.

Changing the environment is easy, but patching the software to change the
debug level isn't necessarily easy or possible. Further, there's this
write-only debug_fixed variable that would seem to imply that the debug
level should be fixed, but it isn't currently used. Change the logic to use
strtol() so we can detect real 0 vs. conversion failure, then honor
debug_fixed in libusb_set_debug.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21877

4 years agomips: fcmpset: do not spin on sc failure
kevans [Wed, 2 Oct 2019 15:13:40 +0000 (15:13 +0000)]
mips: fcmpset: do not spin on sc failure

For ll/sc architectures, atomic(9) allows failure modes where *old == val
due to write failure and callers should compensate for this. Do not retry on
failure, just leave 0 in ret and fail the operation if we couldn't sc it.
This lets the caller determine if it should retry or not.

Reviewed by: kib
Looks ok: imp
Differential Revision: https://reviews.freebsd.org/D21836

4 years agoExplicitly add opensolaris_load="YES" to loader.conf through the
gjb [Wed, 2 Oct 2019 13:30:17 +0000 (13:30 +0000)]
Explicitly add opensolaris_load="YES" to loader.conf through the
installer when installing the system on a ZFS root filesystem.

For arm64, zfs_load="YES" does not add opensolaris.ko as a kld
dependency, so add it explicitly to prevent boot-time failures
out-of-box.

PR: 240478
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoUnbreak etcupdate(8) and mergemaster(8) after r352950
kevans [Wed, 2 Oct 2019 12:46:28 +0000 (12:46 +0000)]
Unbreak etcupdate(8) and mergemaster(8) after r352950

r352950 introduced improper case fall-through for shell scripts. Fix it with
a pipe.

Reported by: lwhsu, David Wolfskill

4 years agoFix build failure for gcc after r352983, due to
hselasky [Wed, 2 Oct 2019 12:45:39 +0000 (12:45 +0000)]
Fix build failure for gcc after r352983, due to
not using static variable declared by net/sff8472.h .

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix build failure for 32-bit platforms after r352991, due to
hselasky [Wed, 2 Oct 2019 12:02:14 +0000 (12:02 +0000)]
Fix build failure for 32-bit platforms after r352991, due to
incorrect printf() formatter string.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRename etc/rc.d/abi to etc/rc.d/linux; after moving out the SysV IPC stuff
trasz [Wed, 2 Oct 2019 11:40:40 +0000 (11:40 +0000)]
Rename etc/rc.d/abi to etc/rc.d/linux; after moving out the SysV IPC stuff
it's entirely linux-specific.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21830

4 years agoBump driver version for mlx5core, mlx5en(4) and mlx5ib(4).
hselasky [Wed, 2 Oct 2019 11:15:35 +0000 (11:15 +0000)]
Bump driver version for mlx5core, mlx5en(4) and mlx5ib(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoPrint numeric error_type and module_status in mlx5core
hselasky [Wed, 2 Oct 2019 11:06:01 +0000 (11:06 +0000)]
Print numeric error_type and module_status in mlx5core
in case the strings are not available.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd print to show user a reason for rejecting buffer size change in mlx5en(4).
hselasky [Wed, 2 Oct 2019 11:05:05 +0000 (11:05 +0000)]
Add print to show user a reason for rejecting buffer size change in mlx5en(4).

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoOnly update lossy buffers config when manual PFC configuration was done
hselasky [Wed, 2 Oct 2019 11:02:54 +0000 (11:02 +0000)]
Only update lossy buffers config when manual PFC configuration was done
in mlx5en(4).

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoImprove mlx5_fwdump_prep logging in mlx5core.
hselasky [Wed, 2 Oct 2019 11:01:05 +0000 (11:01 +0000)]
Improve mlx5_fwdump_prep logging in mlx5core.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRandomize the delay when waiting for VSC flag in mlx5core.
hselasky [Wed, 2 Oct 2019 10:59:44 +0000 (10:59 +0000)]
Randomize the delay when waiting for VSC flag in mlx5core.

The PRM suggests random 0 - 10ms to prevent multiple waiters on the same
interval in order to avoid starvation.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoUse size_t for byte_to_write variable when comparing to eeprom_info_out_len
hselasky [Wed, 2 Oct 2019 10:58:27 +0000 (10:58 +0000)]
Use size_t for byte_to_write variable when comparing to eeprom_info_out_len
which is also size_t in mlx5tool(8).

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoWait for FW readiness before initializing command interface in mlx5core.
hselasky [Wed, 2 Oct 2019 10:53:28 +0000 (10:53 +0000)]
Wait for FW readiness before initializing command interface in mlx5core.

Before attempting to initialize the command interface we must wait till
the fw_initializing bit is clear.

If we fail to meet this condition the hardware will drop our
configuration, specifically the descriptors page address.  This scenario
can happen when the firmware is still executing an FLR flow and did not
finish yet so the driver needs to wait for that to finish.

Linux commits:
6c780a0267b8
b8a92577f4be.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoFix regression issue about bad refcounting of unlimited send tags
hselasky [Wed, 2 Oct 2019 10:46:57 +0000 (10:46 +0000)]
Fix regression issue about bad refcounting of unlimited send tags
in mlx5en(4) after r348254.

The unlimited send tags are shared amount multiple connections and are
not allocated per send tag allocation request. Only increment the refcount.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoSeal transmit path with regards to using destroyed mutex in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:43:49 +0000 (10:43 +0000)]
Seal transmit path with regards to using destroyed mutex in mlx5en(4).

It may happen during link down that the running state may be observed
non-zero in the transmit routine, right before the running state is
cleared. This may end up using a destroyed mutex.

Make all channel mutexes and callouts persistant.

Preserve receive and send queue statistics during link toggle.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRemove unused cpu field from channel structure in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:26:26 +0000 (10:26 +0000)]
Remove unused cpu field from channel structure in mlx5en(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoRemove mkey_be from channel structure in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:25:47 +0000 (10:25 +0000)]
Remove mkey_be from channel structure in mlx5en(4).
Use value from priv structure instead.
This saves some space in the channel structure.

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoReturn an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core.
hselasky [Wed, 2 Oct 2019 10:24:13 +0000 (10:24 +0000)]
Return an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd sysctl(8) to get and set forward error correction, FEC, configuration
hselasky [Wed, 2 Oct 2019 10:22:15 +0000 (10:22 +0000)]
Add sysctl(8) to get and set forward error correction, FEC, configuration
in mlx5en(4).

MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd the ability to query the EEPROM information in mlx5tool(8).
hselasky [Wed, 2 Oct 2019 10:19:17 +0000 (10:19 +0000)]
Add the ability to query the EEPROM information in mlx5tool(8).

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoMove EEPROM information query from a sysctl in mlx5en(4) to an ioctl
hselasky [Wed, 2 Oct 2019 10:14:55 +0000 (10:14 +0000)]
Move EEPROM information query from a sysctl in mlx5en(4) to an ioctl
in mlx5core. The EEPROM information is not only a property of the
mlx5en(4) driver.

Submitted by: slavash@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd support for buffer parameter manipulations in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:08:04 +0000 (10:08 +0000)]
Add support for buffer parameter manipulations in mlx5en(4).

The following sysctls are added:
dev.mce.N.conf.qos.cable_length
dev.mce.N.conf.qos.buffers_size
dev.mce.N.conf.qos.buffers_prio

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoImport Linux code to query/set buffer state in mlx5en(4).
hselasky [Wed, 2 Oct 2019 10:05:34 +0000 (10:05 +0000)]
Import Linux code to query/set buffer state in mlx5en(4).

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoAdd mlx5e_dbg() compatibility macro.
hselasky [Wed, 2 Oct 2019 09:59:42 +0000 (09:59 +0000)]
Add mlx5e_dbg() compatibility macro.

Submitted by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies