]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoThis small fix makes it so we properly follow
Randall Stewart [Wed, 12 Feb 2020 13:04:19 +0000 (13:04 +0000)]
This small fix makes it so we properly follow
the RFC and only enable ECN when both the
CWR and ECT bits our set within the SYN packet.

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D23645

4 years agoRemove all trailing white space from the BBR/Rack fold. Bits
Randall Stewart [Wed, 12 Feb 2020 12:40:06 +0000 (12:40 +0000)]
Remove all trailing white space from the BBR/Rack fold. Bits
left around by emacs (thanks emacs).

4 years agoNow that all of the stats framework is
Randall Stewart [Wed, 12 Feb 2020 12:36:55 +0000 (12:36 +0000)]
Now that all of the stats framework is
in FreeBSD the bits that disabled stats
when netflix-stats is not defined is no longer
needed. Lets remove these bits so that we
will properly use stats per its definition
in BBR and Rack.

Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D23088

4 years agoFix indent.
Konstantin Belousov [Wed, 12 Feb 2020 12:23:46 +0000 (12:23 +0000)]
Fix indent.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agovfs: refactor vputx and add more comment
Mateusz Guzik [Wed, 12 Feb 2020 11:19:07 +0000 (11:19 +0000)]
vfs: refactor vputx and add more comment

Reviewed by: jeff (previous version)
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D23530

4 years agovfs: drop remaining zpcpu casts
Mateusz Guzik [Wed, 12 Feb 2020 11:18:12 +0000 (11:18 +0000)]
vfs: drop remaining zpcpu casts

4 years agovfs: switch to smp_rendezvous_cpus_retry for vfs_op_thread_enter/exit
Mateusz Guzik [Wed, 12 Feb 2020 11:17:45 +0000 (11:17 +0000)]
vfs: switch to smp_rendezvous_cpus_retry for vfs_op_thread_enter/exit

In particular on amd64 this eliminates an atomic op in the common case,
trading it for IPIs in the uncommon case of catching CPUs executing the
code while the filesystem is getting suspended or unmounted.

4 years agorms: use smp_rendezvous_cpus_retry instead of a hand-rolled variant
Mateusz Guzik [Wed, 12 Feb 2020 11:17:18 +0000 (11:17 +0000)]
rms: use smp_rendezvous_cpus_retry instead of a hand-rolled variant

4 years agoAdd smp_rendezvous_cpus_retry
Mateusz Guzik [Wed, 12 Feb 2020 11:16:55 +0000 (11:16 +0000)]
Add smp_rendezvous_cpus_retry

This is a wrapper around smp_rendezvous_cpus which enables use of IPI
handlers which can fail and require retrying.

wait_func argument is added to to provide a routine which can be used to
poll CPU of interest for when the IPI can be retried.

Handlers which succeed must call smp_rendezvous_cpus_done to denote that
fact.

Discussed with:  jeff
Differential Revision: https://reviews.freebsd.org/D23582

4 years agoamd64: provide custom zpcpu set/add/sub routines
Mateusz Guzik [Wed, 12 Feb 2020 11:15:33 +0000 (11:15 +0000)]
amd64: provide custom zpcpu set/add/sub routines

Note that clobbers are highly overzealous, can be cleaned up later.

4 years agoDedup zpcpu assertions into one macro and guard the rest with #ifndef
Mateusz Guzik [Wed, 12 Feb 2020 11:14:23 +0000 (11:14 +0000)]
Dedup zpcpu assertions into one macro and guard the rest with #ifndef

Sponsored by: The FreeBSD Foundation

4 years agoamd64: store per-cpu allocations subtracted by __pcpu
Mateusz Guzik [Wed, 12 Feb 2020 11:12:13 +0000 (11:12 +0000)]
amd64: store per-cpu allocations subtracted by __pcpu

This eliminates a runtime subtraction from counter_u64_add.

before:
mov    0x4f00ed(%rip),%rax        # 0xffffffff80c01788 <numfullpathfail4>
sub    0x808ff6(%rip),%rax        # 0xffffffff80f1a698 <__pcpu>
addq   $0x1,%gs:(%rax)

after:
mov    0x4f02fd(%rip),%rax        # 0xffffffff80c01788 <numfullpathfail4>
addq   $0x1,%gs:(%rax)

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23570

4 years agoStore offset into zpcpu allocations in the per-cpu area.
Mateusz Guzik [Wed, 12 Feb 2020 11:11:22 +0000 (11:11 +0000)]
Store offset into zpcpu allocations in the per-cpu area.

This shorten zpcpu_get and allows more optimizations.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23570

4 years agoepoch: convert zpcpu_get_cpua(.., curcpu) to zpcpu_get
Mateusz Guzik [Wed, 12 Feb 2020 11:10:10 +0000 (11:10 +0000)]
epoch: convert zpcpu_get_cpua(.., curcpu) to zpcpu_get

4 years agoAdd support for debugnet in mlx5en(4).
Hans Petter Selasky [Wed, 12 Feb 2020 10:03:25 +0000 (10:03 +0000)]
Add support for debugnet in mlx5en(4).

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAdd support for disabling and polling MSIX interrupts in mlx5core.
Hans Petter Selasky [Wed, 12 Feb 2020 09:58:19 +0000 (09:58 +0000)]
Add support for disabling and polling MSIX interrupts in mlx5core.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoUse NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
Hans Petter Selasky [Wed, 12 Feb 2020 09:19:47 +0000 (09:19 +0000)]
Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
incoming packets in taskqueue context.

This patch extends r357772.

Tested by: yp@mm.st
Sponsored by: Mellanox Technologies

4 years agoMake sure the so-called end of receive interrupts don't starve in iflib.
Hans Petter Selasky [Wed, 12 Feb 2020 08:30:07 +0000 (08:30 +0000)]
Make sure the so-called end of receive interrupts don't starve in iflib.

When the receive ring cannot be filled with mbufs, due to lack of memory,
no more interrupts may be generated to fill the receive ring later on.
Make sure to have a watchdog, to try refilling the receive ring from time
to time, hopefully when more mbufs are available.

Differential Revision: https://reviews.freebsd.org/D23315
MFC after: 1 week
Reviewed by: gallatin@
Sponsored by: Mellanox Technologies

4 years agoRemove sparc64 specific inclusion of bswap32 built-ins.
Warner Losh [Wed, 12 Feb 2020 06:56:04 +0000 (06:56 +0000)]
Remove sparc64 specific inclusion of bswap32 built-ins.

4 years agoRemove sparc64 specific warning suppression.
Warner Losh [Wed, 12 Feb 2020 06:54:34 +0000 (06:54 +0000)]
Remove sparc64 specific warning suppression.

4 years agoRemove excluding libproc and librtld_db on sparc64.
Warner Losh [Wed, 12 Feb 2020 06:54:28 +0000 (06:54 +0000)]
Remove excluding libproc and librtld_db on sparc64.

4 years agoRemove sparc64 files
Warner Losh [Wed, 12 Feb 2020 06:53:29 +0000 (06:53 +0000)]
Remove sparc64 files

These were disconnected from the build when the kernel was
removed. Since they depend on removed parts of the kernel, remove them
completely.

4 years agoRemove sparc64 specific bits of the man pages.
Warner Losh [Wed, 12 Feb 2020 06:52:22 +0000 (06:52 +0000)]
Remove sparc64 specific bits of the man pages.

4 years agocxgbe(4): Update T4/5/6 firmwares to 1.24.12.0.
Navdeep Parhar [Wed, 12 Feb 2020 02:55:06 +0000 (02:55 +0000)]
cxgbe(4): Update T4/5/6 firmwares to 1.24.12.0.

Obtained from: Chelsio Communications
MFC after: 1 month
Sponsored by: Chelsio Communications

4 years agoMark hme(4) as deprecated.
Brooks Davis [Wed, 12 Feb 2020 00:58:17 +0000 (00:58 +0000)]
Mark hme(4) as deprecated.

It was saved from the initial purge of drivers in fcp-101 due to being
the onboard Ethernet device on a number of sparc64 machines.  Now that
sparc64 is gone, it serves little purpose (PCI cards exist, but are rare
and are unlikely to have been deployed outside Sun systems).

MFC after: 3 days

4 years agoipfw nat: add missing bits after r357092 (RFC 6598/Carrier Grade NAT)
Eugene Grosbein [Wed, 12 Feb 2020 00:46:33 +0000 (00:46 +0000)]
ipfw nat: add missing bits after r357092 (RFC 6598/Carrier Grade NAT)

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Reviewed by: Lutz Donnerhacke
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23448

4 years agong_nat: avoid panic if attached directly to ng_ether and got short packet
Eugene Grosbein [Wed, 12 Feb 2020 00:31:00 +0000 (00:31 +0000)]
ng_nat: avoid panic if attached directly to ng_ether and got short packet

From the beginning, ng_nat safely assumed cleansed traffic
because of limited ways it could be attached to NETGRAPH:
ng_ipfw or ng_ppp only.

Now as it may be attached with ng_ether too, the assumption proven wrong.
Add needed check to the ng_nat. Thanks for markj for debugging this.

PR: 243096
Submitted by: Lutz Donnerhacke <lutz@donnerhacke.de>
Reported by: Robert James Hernandez <rob@sarcasticadmin.com>
Reviewed by: markj and others
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23091

4 years agoMFV r357783:
Martin Matuska [Wed, 12 Feb 2020 00:16:56 +0000 (00:16 +0000)]
MFV r357783:
Update libarchive to 3.4.2

Relevant vendor changes:
  PR #1289: atomic extraction support (bsdtar -x --safe-writes)
  PR #1308: big endian fix for UTF16 support in LHA reader
  PR #1326: reject RAR5 files that declare invalid header flags
  Issue #987: fix support 7z archive entries with Delta filter
  Issue #1317: fix compression output buffer handling in XAR writer
  Issue #1319: fix uname or gname longer than 32 characters in pax writer
  Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR
  Use localtime_r() and gmtime_r() instead of localtime() and gmtime()

X-MFC-With: r356212,r356365,r356416
MFC after: 1 week

4 years agoUpdate vendor/libarchive/dist to git 3288ebb0353beb51dfb09d444dedbe9235ead53d
Martin Matuska [Tue, 11 Feb 2020 23:48:03 +0000 (23:48 +0000)]
Update vendor/libarchive/dist to git 3288ebb0353beb51dfb09d444dedbe9235ead53d

Libarchive 3.4.2

Relevant vendor changes:
  PR #1289: atomic extraction support (bsdtar -x --safe-writes)
  PR #1308: big endian fix for UTF16 support in LHA reader
  PR #1326: reject RAR5 files that declare invalid header flags
  Issue #987: fix support 7z archive entries with Delta filter
  Issue #1317: fix compression output buffer handling in XAR writer
  Issue #1319: fix uname or gname longer than 32 characters in pax writer
  Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR
  Use localtime_r() and gmtime_r() instead of localtime() and gmtime()

4 years agoTemporarily skip flakey test case sys.kern.ptrace_test.ptrace__parent_exits_before_child
Li-Wen Hsu [Tue, 11 Feb 2020 23:17:58 +0000 (23:17 +0000)]
Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__parent_exits_before_child

PR: 244056
Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip failing test case sys.kern/ptrace_test/ptrace__parent_wait_after_attach
Li-Wen Hsu [Tue, 11 Feb 2020 22:48:12 +0000 (22:48 +0000)]
Temporarily skip failing test case sys.kern/ptrace_test/ptrace__parent_wait_after_attach

PR: 244055
Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip sys.geom.class.multipath.failloop.failloop in CI
Li-Wen Hsu [Tue, 11 Feb 2020 22:21:22 +0000 (22:21 +0000)]
Temporarily skip sys.geom.class.multipath.failloop.failloop in CI

This case uses `dtrace -c` but it has some issues at the moment

PR: 244053
Sponsored by: The FreeBSD Foundation

4 years agoRemove assertion from TASK_INIT() macro, since some users of
Gleb Smirnoff [Tue, 11 Feb 2020 20:59:41 +0000 (20:59 +0000)]
Remove assertion from TASK_INIT() macro, since some users of
sys/taskqueue.h may not have includes that define MPASS. It
was useful during testing of r357771, but can be omitted now.
An invalid value of priority will yield only in potential
priority inversion, not a crash.

This fixes compilation of ports/x11/nvidia-driver.

4 years agoReduce nc timeout in sys.mac.portacl.*
Li-Wen Hsu [Tue, 11 Feb 2020 20:41:51 +0000 (20:41 +0000)]
Reduce nc timeout in sys.mac.portacl.*

It is not necessary to wait that long for localhost.

Sponsored by: The FreeBSD Foundation

4 years agolibmemstat: Catch up with r357776.
Mark Johnston [Tue, 11 Feb 2020 20:15:49 +0000 (20:15 +0000)]
libmemstat: Catch up with r357776.

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

4 years agoReduce lock hold time in keg_drain().
Mark Johnston [Tue, 11 Feb 2020 20:06:33 +0000 (20:06 +0000)]
Reduce lock hold time in keg_drain().

Maintain a count of free slabs in the per-domain keg structure and use
that to clear the free slab list in constant time for most cases.  This
helps minimize lock contention induced by reclamation, in preparation
for proactive trimming of excesses of free memory.

Reviewed by: jeff, rlibby
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23532

4 years agoRevert https://svnweb.freebsd.org/changeset/base/357761
Michael Tuexen [Tue, 11 Feb 2020 20:02:20 +0000 (20:02 +0000)]
Revert https://svnweb.freebsd.org/changeset/base/357761

This was suggested by cem@

4 years agoFix duplicate target warning.
Alexander Leidinger [Tue, 11 Feb 2020 19:39:59 +0000 (19:39 +0000)]
Fix duplicate target warning.

4 years agoMark lio taskqueue as requiring network epoch.
Gleb Smirnoff [Tue, 11 Feb 2020 19:13:34 +0000 (19:13 +0000)]
Mark lio taskqueue as requiring network epoch.

4 years agoUse NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
Gleb Smirnoff [Tue, 11 Feb 2020 18:57:07 +0000 (18:57 +0000)]
Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
incoming packets in taskqueue context.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23518

4 years agoAdd flag to struct task to mark the task as requiring network epoch.
Gleb Smirnoff [Tue, 11 Feb 2020 18:48:07 +0000 (18:48 +0000)]
Add flag to struct task to mark the task as requiring network epoch.

When processing a taskqueue and a task has associated epoch, then
enter for duration of the task.  If consecutive tasks belong to the
same epoch, batch them.  Now we are talking about the network epoch
only.

Shrink the ta_priority size to 8-bits.  No current consumers use
a priority that won't fit into 8 bits.  Also complexity of
taskqueue_enqueue() is a square of maximum value of priority, so
we unlikely ever want to go over UCHAR_MAX here.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23518

4 years agovfs: fix vhold race in mnt_vnode_next_lazy_relock
Mateusz Guzik [Tue, 11 Feb 2020 18:19:56 +0000 (18:19 +0000)]
vfs: fix vhold race in mnt_vnode_next_lazy_relock

vdrop can set the hold count to 0 and wait for the ->mnt_listmtx held by
mnt_vnode_next_lazy_relock caller. The routine incorrectly asserted the
count has to be > 0.

Reported by: pho
Tested by: pho

4 years agoAdd missing EPOCH(9) wrapper in ipfw(8).
Hans Petter Selasky [Tue, 11 Feb 2020 18:16:29 +0000 (18:16 +0000)]
Add missing EPOCH(9) wrapper in ipfw(8).

Backtrace:
panic()
ip_output()
dyn_tick()
softclock_call_cc()
softclock()
ithread_loop()

Differential Revision: https://reviews.freebsd.org/D23599
Reviewed by: glebius@ and ae@
Found by: mmacy@
Reported by: jmd@
Sponsored by: Mellanox Technologies

4 years agoDon't start an SCTP timer using a net, which has been removed.
Michael Tuexen [Tue, 11 Feb 2020 18:15:57 +0000 (18:15 +0000)]
Don't start an SCTP timer using a net, which has been removed.

Submitted by: Taylor Brandstetter
MFC after: 1 week

4 years agoamd64: remove redundant sa->code assignment from cpu_fetch_syscall_args_fallback
Mateusz Guzik [Tue, 11 Feb 2020 18:15:23 +0000 (18:15 +0000)]
amd64: remove redundant sa->code assignment from cpu_fetch_syscall_args_fallback

It is already set in the only caller.

4 years agocapsicum: restore the cap_rights_contains symbol
Mateusz Guzik [Tue, 11 Feb 2020 18:13:53 +0000 (18:13 +0000)]
capsicum: restore the cap_rights_contains symbol

It is expected to be provided by libc.

PR: 244033
Reported by:  Jan Kokemueller

4 years agoif_media.h: Add 50G KR4 ethernet media type.
Konstantin Belousov [Tue, 11 Feb 2020 18:03:45 +0000 (18:03 +0000)]
if_media.h: Add 50G KR4 ethernet media type.

Submitted by: Adam Peace <adam.e.peace@gmail.com>
Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D23620

4 years agoif_media.c: staticize and constify ifmedia description structures used under IFMEDIA_...
Konstantin Belousov [Tue, 11 Feb 2020 17:45:01 +0000 (17:45 +0000)]
if_media.c: staticize and constify ifmedia description structures used under IFMEDIA_DEBUG.

The reason for this change is to make it clear the scope of the in-kernel usage
of IFM_TYPE_DESCRIPTIONS and IFM_SUBTYPE_ETHERNET_DESCRIPTIONS macros.  Also it
is somewhat better C.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies
Differential revision: https://reviews.freebsd.org/D23620

4 years agoif_media.c: use __FBSDID().
Konstantin Belousov [Tue, 11 Feb 2020 17:41:45 +0000 (17:41 +0000)]
if_media.c: use __FBSDID().

Reviewed by: hselasky
Sponsored by: Mellanox Technologies
Differential revision: https://reviews.freebsd.org/D23620

4 years agoAdd PCI Express driver for the ARM Neoverse N1 System Development
Ruslan Bukin [Tue, 11 Feb 2020 15:12:09 +0000 (15:12 +0000)]
Add PCI Express driver for the ARM Neoverse N1 System Development
Platform (N1SDP).

Neoverse N1 is a high-performance ARM microarchitecture designed
by the ARM Holdings for the server market.

The PCI part on N1SDP was shipped untested and suffers from some
integration issues.

For instance accessing to not existing BDFs causes System Error
(SError) exception. To mitigate this, the firmware scans the bus,
catches SErrors and creates a table with valid BDFs. That allows
us to filter-out accesses to invalid BDFs in this driver.

Also the root complex config space (BDF == 0) has an unusual
location in memory map, so remapping accesses to it is required.

Finally, the config space is restricted to 32-bit accesses only.

This was tested on the ARM boxes kindly provided by the ARM Ltd
to the DARPA CHERI Project.

In collaboration with: andrew
Reviewed by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23349

4 years agoUse an int instead of a bool variable, since bool is not supported
Michael Tuexen [Tue, 11 Feb 2020 14:00:27 +0000 (14:00 +0000)]
Use an int instead of a bool variable, since bool is not supported
on all platforms the stack is running on in userland.

4 years agoMFV r357712: file 5.38.
Xin LI [Tue, 11 Feb 2020 07:02:48 +0000 (07:02 +0000)]
MFV r357712: file 5.38.

MFC after: 2 weeks

4 years agobackup-passwd: mask out all passwords in the diff
Kyle Evans [Tue, 11 Feb 2020 06:12:02 +0000 (06:12 +0000)]
backup-passwd: mask out all passwords in the diff

The previous expression borked if a username had a plus or hyphen in it.
This is needlessly restrictive- at leSt a hyphen in the middle is valid.
Instead of playing this game, let's just assume the username can't contain a
colon and mask out the second field.

Submitted by: sigsys gmail com
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D23548

4 years agoMount /dev while deinstalling pkg inside EC2 AMIs.
Colin Percival [Tue, 11 Feb 2020 04:05:45 +0000 (04:05 +0000)]
Mount /dev while deinstalling pkg inside EC2 AMIs.

This gets rid of (harmless) warnings:
"pkg: Cannot open /dev/null:No such file or directory".

MFC after: 2 weeks

4 years agoRemove /qemu from EC2 ARM AMIs
Colin Percival [Tue, 11 Feb 2020 04:03:22 +0000 (04:03 +0000)]
Remove /qemu from EC2 ARM AMIs

I forgot to do this as part of r345858 -- I added it to the
vm_extra_pre_umount in vmimage.subr but forgot that function
was overridden in the EC2 build.

MFC after: 2 weeks

4 years agovfs: fix device count leak on vrele racing with vgone
Mateusz Guzik [Mon, 10 Feb 2020 22:28:54 +0000 (22:28 +0000)]
vfs: fix device count leak on vrele racing with vgone

The race is:

CPU1                                CPU2
                                    devfs_reclaim_vchr
make v_usecount 0
                                      VI_LOCK
                                      sees v_usecount == 0, no updates
                                      vp->v_rdev = NULL;
                                      ...
                                      VI_UNLOCK
VI_LOCK
v_decr_devcount
  sees v_rdev == NULL, no updates

In this scenario si_devcount decrement is not performed.

Note this can only happen if the vnode lock is not held.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23529

4 years agoRestore the behavior of allowing empty string in a string sysctl
Li-Wen Hsu [Mon, 10 Feb 2020 20:53:59 +0000 (20:53 +0000)]
Restore the behavior of allowing empty string in a string sysctl

Added as a special case to avoid unnecessary memory operations.

Reviewed by: delphij
Sponsored by: The FreeBSD Foundation

4 years agoFix for unbalanced EPOCH(9) usage in the generic kernel interrupt
Hans Petter Selasky [Mon, 10 Feb 2020 20:23:08 +0000 (20:23 +0000)]
Fix for unbalanced EPOCH(9) usage in the generic kernel interrupt
handler.

Interrupt handlers are removed via intr_event_execute_handlers() when
IH_DEAD is set. The thread removing the interrupt is woken up, and
calls intr_event_update(). When this happens, the ie_hflags are
cleared and re-built from all the remaining handlers sharing the
event. When the last IH_NET handler is removed, the IH_NET flag will
be cleared from ih_hflags (or ie_hflags may still be being rebuilt in
a different context), and the ithread_execute_handlers() may return
with ie_hflags missing IH_NET. This can lead to a scenario where
IH_NET was present before calling ithread_execute_handlers, and is not
present at its return, meaning the need for epoch must be cached
locally.

This can happen when loading and unloading network drivers. Also make
sure the ie_hflags is not cleared before being updated.

This is a regression issue after r357004.

Backtrace:
panic()
# trying to access epoch tracker on stack of dead thread
_epoch_enter_preempt()
ifunit_ref()
ifioctl()
fo_ioctl()
kern_ioctl()
sys_ioctl()
syscallenter()
amd64_syscall()

Differential Revision: https://reviews.freebsd.org/D23483
Reviewed by: glebius@, gallatin@, mav@, jeff@ and kib@
Sponsored by: Mellanox Technologies

4 years agoUse __riscv instead of __riscv__
Warner Losh [Mon, 10 Feb 2020 18:28:02 +0000 (18:28 +0000)]
Use __riscv instead of __riscv__

I misread arch(7) when I added this...

Noticed by: jhb@ and mhorne@

4 years agoModify the vm.panic_on_oom sysctl to take a count of events.
Jonathan T. Looney [Mon, 10 Feb 2020 18:06:38 +0000 (18:06 +0000)]
Modify the vm.panic_on_oom sysctl to take a count of events.

Currently, the vm.panic_on_oom sysctl is a boolean which controls the
behavior of the VM system when it encounters an out-of-memory situation.
If set to 0, the VM system kills the largest process. If set to any other
value, the VM system will initiate a panic.

This change makes the sysctl a count of events. If set to 0, the VM system
kills the largest process. If set to any other value, the VM system will
kill the largest process until it has seen the specified number of
out-of-memory events. Once it reaches the specified number of events, it
will initiate a panic.

This change is helpful in capturing cores when the system is in a perpetual
cycle of out-of-memory events (as opposed to just hitting one or two
sporadic out-of-memory events).

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D23601

4 years agoRemove ifdefs for ia64 and sparc64.
Warner Losh [Mon, 10 Feb 2020 17:17:08 +0000 (17:17 +0000)]
Remove ifdefs for ia64 and sparc64.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoRefresh architecture list with latest:
Warner Losh [Mon, 10 Feb 2020 17:17:03 +0000 (17:17 +0000)]
Refresh architecture list with latest:

Remove: sparc, sparc64 (twice), ia64, alpha
Add: riscv64

Remove now-useless sparc64 ifdef

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoRemove sparc64 specific eeprom command
Warner Losh [Mon, 10 Feb 2020 17:16:59 +0000 (17:16 +0000)]
Remove sparc64 specific eeprom command

This command was only ever for sparc64, so remove it. Remove
usr.sbin/Makeiile.sparc64 as well since it only references ofwdump
(cross platform) and eeprom.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoFor valid arch values (really $MACHINE), remove references to alpha
Warner Losh [Mon, 10 Feb 2020 17:16:54 +0000 (17:16 +0000)]
For valid arch values (really $MACHINE), remove references to alpha
and sparc64. Add references to arm64 and riscv

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoFix a comment for the SUN geom class.
Warner Losh [Mon, 10 Feb 2020 17:16:50 +0000 (17:16 +0000)]
Fix a comment for the SUN geom class.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoFix comment. It mentioned sparc64 specifically, but alignment issues
Warner Losh [Mon, 10 Feb 2020 17:16:45 +0000 (17:16 +0000)]
Fix comment. It mentioned sparc64 specifically, but alignment issues
are present elsewhere.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoRemove sparc64 ifdef
Warner Losh [Mon, 10 Feb 2020 17:16:41 +0000 (17:16 +0000)]
Remove sparc64 ifdef

Now we default to setting the hardware clock to UTC
everywhere. sparc64 was the old odd-man out before.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoRemove sparc64 example.
Warner Losh [Mon, 10 Feb 2020 17:16:26 +0000 (17:16 +0000)]
Remove sparc64 example.

Reivewed by: cy@, bcr@
Differential Revision: https://reviews.freebsd.org/D23593

4 years agoRevert r357710 and 357711 until they can be debugged
Scott Long [Mon, 10 Feb 2020 14:27:28 +0000 (14:27 +0000)]
Revert r357710 and 357711 until they can be debugged

4 years agovfs: fix lock recursion in vrele
Mateusz Guzik [Mon, 10 Feb 2020 13:54:34 +0000 (13:54 +0000)]
vfs: fix lock recursion in vrele

vrele is supposed to be called with an unlocked vnode, but this was never
asserted for if v_usecount was > 0. For such counts the lock is never touched
by the routine. As a result the kernel has several consumers which expect
vunref semantics and get away with calling vrele since they happen to never do
it when this is the last reference (and for some of them this may happen to be
a guarantee).

Work around the problem by changing vrele semantics to tolerate being called
with a lock. This eliminates a possible bug where the lock is already held and
vputx takes it anyway.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23528

4 years agoTidy up zpcpu_replace*
Mateusz Guzik [Mon, 10 Feb 2020 13:52:25 +0000 (13:52 +0000)]
Tidy up zpcpu_replace*

- only compute the target address once
- remove spurious type casting, zpcpu_get already return the correct type

While here add missing newlines to other routines.

4 years agoMake linux(4) use kern_socketpair(9) instead of going through
Edward Tomasz Napierala [Mon, 10 Feb 2020 13:24:14 +0000 (13:24 +0000)]
Make linux(4) use kern_socketpair(9) instead of going through
sys_socketpair().  It's a cleanup; no functional changes.

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

4 years agoAdd USB host controller PCI ID's for Hygon.
Hans Petter Selasky [Mon, 10 Feb 2020 11:09:56 +0000 (11:09 +0000)]
Add USB host controller PCI ID's for Hygon.

Differential Revision: https://reviews.freebsd.org/D23564
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoUse humanize_number to format available and bad space sizes.
Xin LI [Mon, 10 Feb 2020 04:16:41 +0000 (04:16 +0000)]
Use humanize_number to format available and bad space sizes.

Reviewed by: mckusick (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23050

4 years agocron(8): rip out do_univ
Kyle Evans [Mon, 10 Feb 2020 02:44:29 +0000 (02:44 +0000)]
cron(8): rip out do_univ

This was an old Dynix hack, the function is a NOP on FreeBSD. We have no
need to retain this; Dynix was discontinued long ago.

4 years agocron(8): convert vfork() usage to fork()
Kyle Evans [Mon, 10 Feb 2020 02:40:23 +0000 (02:40 +0000)]
cron(8): convert vfork() usage to fork()

vfork() is error-prone, and the usage here definitely grew to not be
clearly OK given vfork-semantics; e.g. setusercontext(3) within the child.

Rip out vfork() and the rest of the references to it. fork is heavier, but
it's unclear that the difference will be all that obvious.

Reported by: Andrew Gierth and sigsys@gmail.com

4 years agoVendor import of file 5.38
Xin LI [Mon, 10 Feb 2020 01:33:52 +0000 (01:33 +0000)]
Vendor import of file 5.38

4 years agoMissed a file in r357710, add it here.
Scott Long [Mon, 10 Feb 2020 00:26:41 +0000 (00:26 +0000)]
Missed a file in r357710, add it here.

4 years agoAdd rudamentary support for UFS to probe whether a block device supports the
Scott Long [Mon, 10 Feb 2020 00:23:20 +0000 (00:23 +0000)]
Add rudamentary support for UFS to probe whether a block device supports the
BIO_SPEEDUP command.  Add complimentary support to the CAM periphs that
support it.

4 years agoImplement atomic_testandclear_{32,int,long} for 32-bit arm. Also, replace
Ian Lepore [Mon, 10 Feb 2020 00:05:04 +0000 (00:05 +0000)]
Implement atomic_testandclear_{32,int,long} for 32-bit arm.  Also, replace
the existing implementation of atomic_testandset with the same new algorithm,
which uses fewer instructions and fewer registers.

4 years agoStop the PMTU and HB timer when removing a net, not when freeing it.
Michael Tuexen [Sun, 9 Feb 2020 22:40:05 +0000 (22:40 +0000)]
Stop the PMTU and HB timer when removing a net, not when freeing it.

Submitted by: Taylor Brandstetter
MFC after: 1 week

4 years agologin.conf(5): update commented-out standard, too
Kyle Evans [Sun, 9 Feb 2020 22:35:49 +0000 (22:35 +0000)]
login.conf(5): update commented-out standard, too

MAIL now has a mail capability, instead, as of r357560.

4 years agoCleanup timer handling.
Michael Tuexen [Sun, 9 Feb 2020 22:05:41 +0000 (22:05 +0000)]
Cleanup timer handling.

Submitted by: Taylor Brandstetter
MFC after: 1 week

4 years agomips: mark GOOGLETEST broken, due to no fault of its own
Kyle Evans [Sun, 9 Feb 2020 18:53:53 +0000 (18:53 +0000)]
mips: mark GOOGLETEST broken, due to no fault of its own

As explained in the comment; GOOGLETEST cannot currently be compiled on any
mips variant at the moment due to the cross toolchain seemingly using the
wrong spec and not pulling in libgcc. We'll be fine when llvm 10 lands, at
which point this should be reverted most expeditiously.

4 years agoAdd a missing word in rc.conf.5
Mateusz Piotrowski [Sun, 9 Feb 2020 15:13:56 +0000 (15:13 +0000)]
Add a missing word in rc.conf.5

PR: 243972
Submitted by: PauAmma <pauamma@gundo.com>
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D23584

4 years agoAdd procstat(1) sigfastblock command to show process sigfastblock word address.
Konstantin Belousov [Sun, 9 Feb 2020 12:30:50 +0000 (12:30 +0000)]
Add procstat(1) sigfastblock command to show process sigfastblock word address.

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoAdd sysctl kern.proc.sigfastblk for reporting sigfastblock word address.
Konstantin Belousov [Sun, 9 Feb 2020 12:29:51 +0000 (12:29 +0000)]
Add sysctl kern.proc.sigfastblk for reporting sigfastblock word address.

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoUse sigfastblock(2) for masking signals in libthr.
Konstantin Belousov [Sun, 9 Feb 2020 12:27:22 +0000 (12:27 +0000)]
Use sigfastblock(2) for masking signals in libthr.

Ensure proper handshake to transfer sigfastblock(2) blocking word
ownership from rtld to libthr.

Unfortunately sigfastblock(2) is not enough to stop intercepting
signals in libthr, because critical sections must ensure more than
just signal blocking.

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoUse sigfastblock(2) in rtld.
Konstantin Belousov [Sun, 9 Feb 2020 12:22:43 +0000 (12:22 +0000)]
Use sigfastblock(2) in rtld.

This allows for rtld to not issue two sigprocmask(2) syscalls for each
symbol binding operation in single-threaded processes.  Rtld needs to
block signals as part of locking to ensure signal safety of the bind
process, because signal handlers might need to lazily resolve symbol
references.

As result, number of syscalls issued on startup by simple programs not
using libthr, is typically reduced 2x.  For instance, for hello world,
I see:
non-sigfastblock
# (truss ./hello > /dev/null) |& wc -l
      63
sigfastblock
# (truss ./hello > /dev/null) |& wc -l
      37

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoAdd AT_BSDFLAGS support to _elf_aux_info(3).
Konstantin Belousov [Sun, 9 Feb 2020 12:12:03 +0000 (12:12 +0000)]
Add AT_BSDFLAGS support to _elf_aux_info(3).

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoAdd AT_BSDFLAGS auxv entry.
Konstantin Belousov [Sun, 9 Feb 2020 12:10:37 +0000 (12:10 +0000)]
Add AT_BSDFLAGS auxv entry.

The intent is to provide bsd-specific flags relevant to interpreter
and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
auxv entry.

Use bsdflags to report kernel support for sigfastblock(2).  This
allows rtld and libthr to safely infer the syscall presence without
SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoRegen.
Konstantin Belousov [Sun, 9 Feb 2020 11:53:37 +0000 (11:53 +0000)]
Regen.

4 years agoAdd a way to manage thread signal mask using shared word, instead of syscall.
Konstantin Belousov [Sun, 9 Feb 2020 11:53:12 +0000 (11:53 +0000)]
Add a way to manage thread signal mask using shared word, instead of syscall.

A new syscall sigfastblock(2) is added which registers a uint32_t
variable as containing the count of blocks for signal delivery.  Its
content is read by kernel on each syscall entry and on AST processing,
non-zero count of blocks is interpreted same as the signal mask
blocking all signals.

The biggest downside of the feature that I see is that memory
corruption that affects the registered fast sigblock location, would
cause quite strange application misbehavior. For instance, the process
would be immune to ^C (but killable by SIGKILL).

With consumers (rtld and libthr added), benchmarks do not show a
slow-down of the syscalls in micro-measurements, and macro benchmarks
like buildworld do not demonstrate a difference. Part of the reason is
that buildworld time is dominated by compiler, and clang already links
to libthr. On the other hand, small utilities typically used by shell
scripts have the total number of syscalls cut by half.

The syscall is not exported from the stable libc version namespace on
purpose.  It is intended to be used only by our C runtime
implementation internals.

Tested by: pho
Disscussed with: cem, emaste, jilles
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D12773

4 years agoMFV r357687: Import NFS fix for O_SEARCH tests
Kyle Evans [Sun, 9 Feb 2020 04:05:30 +0000 (04:05 +0000)]
MFV r357687: Import NFS fix for O_SEARCH tests

The version that ended upstream was ultimately slightly different than the
version committed here; notably, statvfs() is used but it's redefined
appropriately to statfs() on FreeBSD since we don't provide the fstypename
for the former interface.

4 years agoNetBSD: tests: Import NFS O_SEARCH test fix
Kyle Evans [Sun, 9 Feb 2020 04:01:46 +0000 (04:01 +0000)]
NetBSD: tests: Import NFS O_SEARCH test fix

4 years agoEnter the network epoch in the xdma interrupt handler if required
Ruslan Bukin [Sat, 8 Feb 2020 23:07:29 +0000 (23:07 +0000)]
Enter the network epoch in the xdma interrupt handler if required
by a peripheral device driver.

Sponsored by: DARPA, AFRL

4 years agoBind CTL backends taskqueues to the CTL process.
Alexander Motin [Sat, 8 Feb 2020 21:59:46 +0000 (21:59 +0000)]
Bind CTL backends taskqueues to the CTL process.

MFC after: 2 weeks

4 years agomemset.3: better fix previous typo
Eitan Adler [Sat, 8 Feb 2020 21:17:48 +0000 (21:17 +0000)]
memset.3: better fix previous typo

Upon re-reading the whole sentence this is a better fix.

MFC with: r357681

4 years agoFix a KASSERT since chained mbufs are accepted by the xdma bounce
Ruslan Bukin [Sat, 8 Feb 2020 21:02:20 +0000 (21:02 +0000)]
Fix a KASSERT since chained mbufs are accepted by the xdma bounce
buffer loader. m_copydata() will copy entire chain to a single buffer.

Sponsored by: DARPA, AFRL

4 years agomemset.3: fix a a duplicate word
Eitan Adler [Sat, 8 Feb 2020 20:56:38 +0000 (20:56 +0000)]
memset.3: fix a a duplicate word