]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agocat: style nits
Mariusz Zaborski [Wed, 20 Jan 2021 17:46:26 +0000 (18:46 +0100)]
cat: style nits

Pointed out by: jhb

3 years agorelease: fix PORT variable
Glen Barber [Wed, 20 Jan 2021 17:15:13 +0000 (12:15 -0500)]
release: fix PORT variable

Reported by: Yasuhiro Kimura (yasu xat utahime dot org)
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoaio: micro-optimize the lio_opcode assignments
Alan Somers [Sun, 3 Jan 2021 04:25:05 +0000 (21:25 -0700)]
aio: micro-optimize the lio_opcode assignments

This allows slightly more efficient opcode testing in-kernel.  It is
transparent to userland, except to applications that sneakily submit
aio fsync or aio mlock operations via lio_listio, which has never been
documented, requires the use of deliberately undefined constants
(LIO_SYNC and LIO_MLOCK), and is arguably a bug.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D27942

3 years agoifconfig: add vlanproto "qiniq" as an alias for "802.1ad"
Allan Jude [Tue, 19 Jan 2021 23:22:07 +0000 (23:22 +0000)]
ifconfig: add vlanproto "qiniq" as an alias for "802.1ad"

QinQ is better known by this name, so accept it as an alias

Reported-by: Mike Geiger
Reviewed-by: melifaro, hselasky, rpokala
MFC-with: 366917
Sponsored-by: Klara Inc.
Differential-Revision: https://reviews.freebsd.org/D28245

3 years agowpa_supplicant uses PF_ROUTE to return the routing table in order to
Cy Schubert [Wed, 20 Jan 2021 15:20:22 +0000 (07:20 -0800)]
wpa_supplicant uses PF_ROUTE to return the routing table in order to
determine the length of the routing table buffer. As of 81728a538d24
wpa_supplicant is started before the routing table has been populated
resulting in the length of zero to be returned. This causes
wpa_supplicant to loop endlessly. (The workaround is to kill and restart
wpa_supplicant as by the time it is restarted the routing table is
populated.)

(Personally, I was not able to reproduce this unless wlan0 was a member of
lagg0. However, others experienced this problem on standalone wlan0.)

PR: 252844
Submitted by: shu <ankohuu _ outlook.com>
Reported by: shu <ankohuu _ outlook.com>
Reviewed by: cy
X-MFC with: 81728a538d24f483d0986850fa3f51d5d84d8f26
Differential Revision: https://reviews.freebsd.org/D28249

3 years agoRegenerate src.conf(5) after 7c5a624afae4
Kyle Evans [Wed, 20 Jan 2021 14:29:16 +0000 (08:29 -0600)]
Regenerate src.conf(5) after 7c5a624afae4

WITHOUT_CRYPT no longer implies WITHOUT_WIRELESS after the aforementioned
commit.

3 years agoAddress panic with PRR due to missed initialization of recover_fs
Richard Scheffenegger [Wed, 20 Jan 2021 11:06:34 +0000 (12:06 +0100)]
Address panic with PRR due to missed initialization of recover_fs

Summary:
When using the base stack in conjunction with RACK, it appears that
infrequently, ++tp->t_dupacks is instantly larger than tcprexmtthresh.

This leaves the recover flightsize (sackhint.recover_fs) uninitialized,
leading to a div/0 panic.

Address this by properly initializing the variable just prior to first
use, if it is not properly initialized.

In order to prevent stale information from a prior recovery to
negatively impact the PRR calculations in this event, also clear
recover_fs once loss recovery is finished.

Finally, improve the readability of the initialization of recover_fs
when t_dupacks == tcprexmtthresh by adjusting the indentation and
using the max(1, snd_nxt - snd_una) macro.

Reviewers: rrs, kbowling, tuexen, jtl, #transport, gnn!, jmg, manu, #manpages

Reviewed By: rrs, kbowling, #transport

Subscribers: bdrewery, andrew, rpokala, ae, emaste, bz, bcran, #linuxkpi, imp, melifaro

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

3 years agolibc: Fix null pointer arithmetic warning in mergesort
Alex Richardson [Wed, 20 Jan 2021 09:56:01 +0000 (09:56 +0000)]
libc: Fix null pointer arithmetic warning in mergesort

This file has other questionable code and "optimizations" (such as copying
one int at a time) that are probably no longer useful, so it might make
sense to replace it with a different implementation at some point.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D28134

3 years agoEmit uprintf() output for initproc if there is no controlling terminal
Alex Richardson [Wed, 20 Jan 2021 09:54:46 +0000 (09:54 +0000)]
Emit uprintf() output for initproc if there is no controlling terminal

This patch helped me debug why /sbin/init was not being loaded after
making changes to the image activator in CheriBSD.

Reviewed By: jhb (earlier version), kib
Differential Revision: https://reviews.freebsd.org/D28121

3 years agoMinor simplification of MK_PMC case in usr.sbin/Makefile
Alex Richardson [Wed, 20 Jan 2021 09:52:58 +0000 (09:52 +0000)]
Minor simplification of MK_PMC case in usr.sbin/Makefile

MK_PMC is already guarded by MK_CXX in src.opts.mk, so we can actually
merge it with the following SUBDIR statement after c1a3d7f20696.

Suggested By: jrtc27

3 years agonewvers.sh: add support for gitup(1)
Michael Osipov [Tue, 5 Jan 2021 10:48:39 +0000 (11:48 +0100)]
newvers.sh: add support for gitup(1)

gitup writes a .gituprevision file into the shallow clone directory. Read that
file and print commit information only.

Submitted by: Michael Osipov <michael.osipov@siemens.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/449

While here, drop the redundant branch name from the git output and don't
count commits in shallow clones.

Reported by: Michael Osipov <michael.osipov@siemens.com>
MFC after: 2 weeks

3 years agoRemove the unnecessary space before the colon
Mateusz Piotrowski [Wed, 20 Jan 2021 08:46:15 +0000 (09:46 +0100)]
Remove the unnecessary space before the colon

MFC after: 3 days

3 years agocache: augment sdt probe in cache_fplookup_dot
Mateusz Guzik [Wed, 20 Jan 2021 07:23:14 +0000 (07:23 +0000)]
cache: augment sdt probe in cache_fplookup_dot

Same as 6d386b4c ("cache: save a branch in cache_fplookup_next")

3 years agocache: whitespace nit in cache_fplookup_modifying
Mateusz Guzik [Wed, 20 Jan 2021 07:22:04 +0000 (07:22 +0000)]
cache: whitespace nit in cache_fplookup_modifying

3 years agoktls: Improve handling of the bind_threads tunable a bit
Mark Johnston [Wed, 20 Jan 2021 02:32:33 +0000 (21:32 -0500)]
ktls: Improve handling of the bind_threads tunable a bit

- Only check for empty domains if we actually tried to configure domain
  affinity in the first place.  Otherwise setting bind_threads=1 will
  always cause the sysctl value to be reported as zero.  This is
  harmless since the threads end up being bound, but it's confusing.
- Try to improve the sysctl description a bit.

Reviewed by: gallatin, jhb
Submitted by: Klara, Inc.
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D28161

3 years agoopencrypto: Add comments describing the new crypto_session layout
Mark Johnston [Wed, 20 Jan 2021 02:32:33 +0000 (21:32 -0500)]
opencrypto: Add comments describing the new crypto_session layout

Requested by: rpokala

3 years agoarm64, riscv: Set VM_KMEM_SIZE_SCALE to 1
Mark Johnston [Wed, 20 Jan 2021 01:34:36 +0000 (20:34 -0500)]
arm64, riscv: Set VM_KMEM_SIZE_SCALE to 1

This setting limits the amount of memory that can be allocated to UMA.
On systems with a direct map and ample KVA, however, there is no reason
for VM_KMEM_SIZE_SCALE to be larger than 1.  This appears to have been
inherited from the 32-bit ARM platform definitions.

Also remove VM_KMEM_SIZE_MIN, which is not needed when
VM_KMEM_SIZE_SCALE is defined to be 1.[*]

Reviewed by: alc, kp, kib
Reported by: alc [*]
Submitted by: Klara, Inc.
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D28225

3 years agoarm64: Stop setting VM_BCACHE_SIZE_MAX
Mark Johnston [Wed, 20 Jan 2021 01:34:35 +0000 (20:34 -0500)]
arm64: Stop setting VM_BCACHE_SIZE_MAX

This setting places a (small) limit on the size of the buffer cache,
constraining UFS performance on large servers.  The setting comes from
the initial arm64 implementation and appears to be vestigal.  Remove it.

Reviewed by: kib
Submitted by: Klara, Inc.
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D28162

3 years agoopencrypto: Fix assignment of crypto completions to worker threads
Mark Johnston [Wed, 20 Jan 2021 01:34:35 +0000 (20:34 -0500)]
opencrypto: Fix assignment of crypto completions to worker threads

Since r336439 we simply take the session pointer value mod the number of
worker threads (ncpu by default).  On small systems this ends up
funneling all completion work through a single thread, which becomes a
bottleneck when processing IPSec traffic using hardware crypto drivers.
(Software drivers such as aesni(4) are unaffected since they invoke
completion handlers synchonously.)

Instead, maintain an incrementing counter with a unique value per
session, and use that to distribute work to completion threads.

Reviewed by: cem, jhb
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28159

3 years agoopencrypto: Embed the driver softc in the session structure
Mark Johnston [Wed, 20 Jan 2021 01:34:35 +0000 (20:34 -0500)]
opencrypto: Embed the driver softc in the session structure

Store the driver softc below the fields owned by opencrypto.  This is
a bit simpler and saves a pointer dereference when fetching the driver
softc when processing a request.

Get rid of the crypto session UMA zone.  Session allocations are
frequent or performance-critical enough to warrant a dedicated zone.

No functional change intended.

Reviewed by: cem, jhb
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28158

3 years agoAdd a new FreeBSD/arm64 kernel configuration, GENERIC-MMCCAM-NODEBUG,
Robert Watson [Sat, 16 Jan 2021 12:42:26 +0000 (12:42 +0000)]
Add a new FreeBSD/arm64 kernel configuration, GENERIC-MMCCAM-NODEBUG,
which is the same as GENERIC-MMCCAM but using a nodebug baseline.

Reviewed by: andrew, br (earlier version), jrtc27 (earlier version)
Differential revision: https://reviews.freebsd.org/D28091

3 years agoadd missing .Xr..
John-Mark Gurney [Tue, 19 Jan 2021 22:18:55 +0000 (14:18 -0800)]
add missing .Xr..

3 years agoRemove remaining uses of ${COMPILER_FEATURES:Mc++11}
Alex Richardson [Tue, 19 Jan 2021 15:05:43 +0000 (15:05 +0000)]
Remove remaining uses of ${COMPILER_FEATURES:Mc++11}

All supported compilers have C++11 support so these checks can be replaced
with MK_CXX guards.
See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252759

PR: 252759
Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D28234

3 years agoFix macro-redefined warning in gnu/diff for fputc_unlocked
Alex Richardson [Tue, 19 Jan 2021 11:35:15 +0000 (11:35 +0000)]
Fix macro-redefined warning in gnu/diff for fputc_unlocked

While updating config.h to set HAVE_DECL_FPUTC_UNLOCKED to 1 also update
the other macros that are defined in stdio.h.

3 years agogetopt: Fix conversion from string-literal to non-const char *
Alex Richardson [Tue, 19 Jan 2021 11:35:04 +0000 (11:35 +0000)]
getopt: Fix conversion from string-literal to non-const char *

Define a non-const static char EMSG[] = "" to avoid having to add
__DECONST() to all uses of EMSG. Also make current_dash a const char *
to fix this warning.

3 years agoFix make includes path to nvpair.h
Alex Richardson [Tue, 19 Jan 2021 11:40:05 +0000 (11:40 +0000)]
Fix make includes path to nvpair.h

Fixes a typo introduced in 9e5787d2284e187abb5b654d924394a65772e004

3 years agoinclude: Delete stale symlinks using find(1) instead of a shell loop.
Alex Richardson [Tue, 19 Jan 2021 11:35:12 +0000 (11:35 +0000)]
include: Delete stale symlinks using find(1) instead of a shell loop.

This reduces the number of execve() syscalls during make includes by 88.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27622

3 years agoRequire uint32_t alignment for ipfw_insn
Alex Richardson [Tue, 19 Jan 2021 11:32:33 +0000 (11:32 +0000)]
Require uint32_t alignment for ipfw_insn

There are many casts of this struct to uint32_t, so we also need to ensure
that it is sufficiently aligned to safely perform this cast on architectures
that don't allow unaligned accesses. This fixes lots of -Wcast-align warnings.

Reviewed By: ae
Differential Revision: https://reviews.freebsd.org/D27879

3 years agolibalias: Fix remaining compiler warnings
Alex Richardson [Tue, 19 Jan 2021 11:32:32 +0000 (11:32 +0000)]
libalias: Fix remaining compiler warnings

This fixes some sign-compare warnings and adds a missing static to a
variable declaration.

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

3 years agolibalias: Fix -Wcast-align compiler warnings
Alex Richardson [Tue, 19 Jan 2021 11:32:32 +0000 (11:32 +0000)]
libalias: Fix -Wcast-align compiler warnings

This fixes -Wcast-align warnings caused by the underaligned `struct ip`.
This also silences them in the public functions by changing the function
signature from char * to void *. This is source and binary compatible and
avoids the -Wcast-align warning.

Reviewed By: ae, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D27882

3 years agoloader: comment on rgb_to_color_index()
Toomas Soome [Wed, 13 Jan 2021 16:38:08 +0000 (18:38 +0200)]
loader: comment on rgb_to_color_index()

Add small comment block about rgb_to_color_index().

3 years agoloader: handle malloc failures in vbe_init, use consistent naming
Toomas Soome [Mon, 18 Jan 2021 08:52:08 +0000 (10:52 +0200)]
loader: handle malloc failures in vbe_init, use consistent naming

Handle malloc failures in vbe_init().

If it should so happen and we do get malloc failure in vbe_init(),
use original mode list.

Replace nitems with nentries to have naming consistency and avoid
confusion with nitems() macro.

Reported by: yuripv, rpokala

3 years agoConvert unmapped mbufs before computing checksums in IPsec.
John Baldwin [Tue, 19 Jan 2021 19:51:27 +0000 (11:51 -0800)]
Convert unmapped mbufs before computing checksums in IPsec.

This is similar to the logic used in ip_output() to convert mbufs
prior to computing checksums.  Unmapped mbufs can be sent when using
sendfile() over IPsec or using KTLS over IPsec.

Reported by: Sony Arpita Das @ Chelsio QA
Reviewed by: np
Sponsored by: Chelsio
Differential Revision: https://reviews.freebsd.org/D28187

3 years agoarm64: Clear FPU flags in the pcb in cpu_copy_thread().
John Baldwin [Fri, 8 Jan 2021 22:56:54 +0000 (14:56 -0800)]
arm64: Clear FPU flags in the pcb in cpu_copy_thread().

New threads start off with clean FPU state instead of inheriting state
from the parent thread.

PR: 247945
Sponsored by: Netflix

3 years agoarm64: Trim duplicate code from cpu_fork_kthread_handler().
John Baldwin [Fri, 8 Jan 2021 22:56:22 +0000 (14:56 -0800)]
arm64: Trim duplicate code from cpu_fork_kthread_handler().

cpu_fork_kthread_handler() is always called after either cpu_fork() or
cpu_copy_thread().  The arm64 version was duplicating some of the work
already done by both of those functions.

Sponsored by: Netflix

3 years agorelease.sh: bump Copyright year after previous commit
Glen Barber [Tue, 19 Jan 2021 18:53:29 +0000 (13:53 -0500)]
release.sh: bump Copyright year after previous commit

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agorelease: Add workaround to use SVN for ports
Glen Barber [Tue, 19 Jan 2021 18:38:33 +0000 (13:38 -0500)]
release: Add workaround to use SVN for ports

The ports tree is scheduled to be converted from Subversion to Git
after the currently-scheduled 13.0-RELEASE, so the source of truth
will be Subversion for the ports tree.

Implement a hack specifically for this case.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoixl: Permit 802.1ad frames to pass though the chip
Lutz Donnerhacke [Tue, 19 Jan 2021 14:56:16 +0000 (15:56 +0100)]
ixl: Permit 802.1ad frames to pass though the chip

This patch is a quick hack to change the internal Ethertype used
within the chip.  All frames with this type are dropped silently.
This patch allows you to overwrite the factory default 0x88a8, which
is used by IEEE 802.1ad VLAN stacking.

Reviewed by: kp, philip, brueffer
Approved by: kp (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24179

3 years agoRELNOTES: correct sense and name for allow_wx sysctl
Ed Maste [Tue, 19 Jan 2021 13:53:07 +0000 (08:53 -0500)]
RELNOTES: correct sense and name for allow_wx sysctl

The sysctl is kern.elf64.allow_wx and defaults to 1, allow W+X mappings.

Reported by: alc

3 years agohtu21: driver for HTU21D I2C temperature and humidity sensor
Andriy Gapon [Tue, 19 Jan 2021 12:57:24 +0000 (14:57 +0200)]
htu21: driver for HTU21D I2C temperature and humidity sensor

MFC after: 2 weeks
Relnotes: perhaps

3 years agolockmgr: fix upgrade
Mateusz Guzik [Thu, 7 Jan 2021 06:45:49 +0000 (07:45 +0100)]
lockmgr: fix upgrade

TRYUPGRADE requests kept failing when they should not have due to wrong
macro used to count readers.

Fixes: f6b091fbbd77cbb0 ("lockmgr: rewrite upgrade to stop always dropping the lock")
Noted by: asomers
Differential Revision: https://reviews.freebsd.org/D27947

3 years agoarm64 busdma: Fix loading of small bounced buffers.
Michal Meloun [Wed, 13 Jan 2021 12:50:54 +0000 (13:50 +0100)]
arm64 busdma: Fix loading of small bounced buffers.

 - Don't oversize the buffer fragment. PAGE_SIZE - (curaddr & PAGE_MASK)
   may be greater than the total length of the buffer.
 - Don't use roundup2(len, alignment) to calculate the buffer fragment
   size. The length of current bounced fragment is not subject to alignment
   restriction, and next fragment should start at the page boundary.

Tested by: bz, s199p.wa1k9r@gmail.com

3 years agoRemove dependency on files in /usr/bin
Stefan Eßer [Tue, 19 Jan 2021 11:46:52 +0000 (12:46 +0100)]
Remove dependency on files in /usr/bin

In order to reduce the pre-requisites of this file, implement the
pattern matching and creation of a temporary test directory without
use of grep respectively mktemp.

The new version makes it possible to provide a writable /tmp in any
case and independently of other local or remote file systems (except /
and /dev) being mounted.

The use of "dd if=/dev/random" has the same dependency on /dev/random
being operational as the previous version that used "mktemp". If this
is found to be an issue on platforms that do not have gathered
sufficient entropy at the time when this scriot is run, I suggest to
replace the "dd" command with "ps lauxww" to get a somewhat random
test directory name.

Approved by: rgrimes, glebius, cy
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D28209

3 years agolinux: map EBUSY returned by ptrace into ESRCH
Edward Tomasz Napierala [Fri, 15 Jan 2021 17:11:41 +0000 (17:11 +0000)]
linux: map EBUSY returned by ptrace into ESRCH

The ptrace(2) Linux man page claims the syscall returns ESRCH,
if the tracee is not stopped; the native ptrace(2) returns EBUSY.

Sponsored by: The FreeBSD Foundation

3 years agolinux: fix PTRACE_POKEDATA and PTRACE_POKETEXT.
Edward Tomasz Napierala [Fri, 15 Jan 2021 16:57:24 +0000 (16:57 +0000)]
linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT.

Sponsored by: The FreeBSD Foundation

3 years agolinux: remove spurious newline.
Edward Tomasz Napierala [Thu, 14 Jan 2021 22:48:56 +0000 (22:48 +0000)]
linux: remove spurious newline.

Sponsored by: The FreeBSD Foundation

3 years agocache: fix some typos
Mateusz Guzik [Tue, 19 Jan 2021 09:17:14 +0000 (10:17 +0100)]
cache: fix some typos

3 years agocache: drop-write only var from cache_fplookup_preparse
Mateusz Guzik [Tue, 19 Jan 2021 09:13:30 +0000 (10:13 +0100)]
cache: drop-write only var from cache_fplookup_preparse

3 years agocache: save a branch in cache_fplookup_next
Mateusz Guzik [Tue, 19 Jan 2021 09:08:24 +0000 (10:08 +0100)]
cache: save a branch in cache_fplookup_next

Previously the code would branch on top find out whether it should
branch on SDT probe and bumping the numposhits counter, depending
on cache_fplookup_cross_mount.

Arguably it should be done regardless of what said function returns.

3 years agoSupport COM3 and COM4 serial ports.
Peter Grehan [Tue, 19 Jan 2021 17:30:22 +0000 (03:30 +1000)]
Support COM3 and COM4 serial ports.

Submitted by: Jan Poctavek <janci@binaryparadise.com>, otis
Reviewed by: grehan (bhyve), imp, 0mp (manpages)
Differential Revision: https://reviews.freebsd.org/D28207

3 years agovirtio: Handle possible failure of virtio_finalize_features()
Bryan Venteicher [Tue, 19 Jan 2021 04:55:26 +0000 (04:55 +0000)]
virtio: Handle possible failure of virtio_finalize_features()

Try to standardize how drivers negotiate feature and the
function names

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27930

3 years agoif_vtnet: Add counter for received host LRO
Bryan Venteicher [Tue, 19 Jan 2021 04:55:26 +0000 (04:55 +0000)]
if_vtnet: Add counter for received host LRO

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27928

3 years agoif_vtnet: Misc Tx path cleanup
Bryan Venteicher [Tue, 19 Jan 2021 04:55:26 +0000 (04:55 +0000)]
if_vtnet: Misc Tx path cleanup

  - Add and fix a few error path counters
  - Improve sysctl descriptions
  - Use flags consistently to determine IPv4 vs IPv6

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27926

3 years agoif_vtnet: Set lro_nsegs for host LRO packets
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Set lro_nsegs for host LRO packets

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27933

3 years agoif_vtnet: Resort softc fields
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Resort softc fields

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27925

3 years agoif_vtnet: Remove unnecessary TUNABLE_INTs because of CTLFLAG_RDTUN
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Remove unnecessary TUNABLE_INTs because of CTLFLAG_RDTUN

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27923

3 years agoif_vtnet: Schedule Rx task if pending items when enabling interrupt
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Schedule Rx task if pending items when enabling interrupt

Prior to V1, the driver would enable interrupts and then notify the
host that DRIVER_OK. Since for V1, DRIVER_OK needs to be set before
notifying the virtqueues, there may be items in the queues waiting
to be processed by the time interrupts are enabled.

This fixes a bug where the Rx queue would appear stuck, only being
usable after an interface down/up cycle.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27922

3 years agoif_vtnet: Disable F_MTU feature if MTU is invalid
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Disable F_MTU feature if MTU is invalid

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27931

3 years agoif_vtnet: Limit allocations of unused virtqueues
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Limit allocations of unused virtqueues

For multiqueue, we may use fewer than the provided maximum number of
queues. Try to limit allocations of the unused queues: no interrupts,
no indirect descriptors, and no taskqueues.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27921

3 years agoif_vtnet: Rework 4be723f63 max multiqueue pairs check
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Rework 4be723f63 max multiqueue pairs check

Verify the max_virtqueue_pairs is within the range allowed by
the spec.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27920

3 years agoif_vtnet: Add support for software LRO
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Add support for software LRO

This useful when running on hosts that support checksum offloading
but not the GUEST_TSO (LRO) feature. Or potentially, some GRO-like
support when doing forwarding.

Only enable SW LRO when the host LRO is not available since both
tends to be harmful, and difficult to enable/disable selectively
with only a single IFCAP_LRO flag.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27919

3 years agoif_vtnet: Set the interface max TSO values
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Set the interface max TSO values

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27917

3 years agoif_vtnet: Add support for CTRL_GUEST_OFFLOADS feature
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Add support for CTRL_GUEST_OFFLOADS feature

This allows the Rx checksum and LRO to be modified without a full
reinit of the device.

Remove IFCAP_RXCSUM_IPV6 from the interface capabilities since in
VirtIO Rx checksums are just enabled or disabled for all protocols.

Properly update IFCAP_LRO if LRO is becomes disabled when Rx
checksums are disabled.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27916

3 years agoif_vtnet: Move ioctl handlers into separate functions
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Move ioctl handlers into separate functions

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27914 https://reviews.freebsd.org/D27915

3 years agoif_vtnet: Cleanup the reinit process
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Cleanup the reinit process

In modern VirtIO, the virtqueues cannot be notified before setting
DRIVER_OK status.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27932

3 years agoif_vtnet: Cleanup the interface setup methods
Bryan Venteicher [Tue, 19 Jan 2021 04:55:25 +0000 (04:55 +0000)]
if_vtnet: Cleanup the interface setup methods

Defer the ether_ifattach until the interface capabilities
are configured

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27913

3 years agoif_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27912

3 years agoif_vtnet: Move the Tx interrupt threshold into the Txq structure
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Move the Tx interrupt threshold into the Txq structure

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27911

3 years agoif_vtnet: Defer updating generated MAC address until attached
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Defer updating generated MAC address until attached

This improves spec compliance because the driver is not suppose
to notify the device prior to setting the DRIVER_OK status, which
could happen with the VIRTIO_NET_F_CTRL_MAC_ADDR.

The VIRTIO_NET_F_MAC feature should always be negotiated so would
be a rare situation.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27910

3 years agoif_vtnet: Remove at attach PROMISC handling
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Remove at attach PROMISC handling

This may have been required in an early, early, early version of the
specification but I cannot find any reference to it, and a promiscuous
default seems very odd so remove this code.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27909

3 years agoif_vtnet: Support VIRTIO_NET_F_SPEED_DUPLEX
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Support VIRTIO_NET_F_SPEED_DUPLEX

This features lets the guest driver know the speed and duplex of
the "link". Instead of trying to support many media types based
on the possible/likely speeds/duplexes, only use the speed to
set the interface baudrate.

Cleanup ifmedia code to match other drivers.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27908

3 years agoif_vtnet: Support VIRTIO_NET_F_MTU
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Support VIRTIO_NET_F_MTU

This feature lets the guest driver know the maximum MTU size
supported by the host device. If set, use this to limit the
acceptable MTUs, and improve how the receive mbuf cluster size
then is selected.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27907

3 years agoif_vtnet: Rx path cleanup
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Rx path cleanup

  - Fix the NEEDS_CSUM and DATA_VALID checksum flags. The NEEDS_CSUM
    checksum is incomplete (partial) so offer a fallback for the driver
    to calculate the checksum. Simplify DATA_VALID because we know
    the host has validated the checksum.

  - Default 4K mbuf clusters for mergeable buffers. May need to
    scale this down to 2K clusters in certain configurations such
    many queue pairs, big queues (like 4096 in GCP), and low memory.

  - Use the MTU when calculated the receive mbuf cluster size
    when not doing TSO/LRO. This will need more adjustment once
    the MTU feature is supported.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27906

3 years agovirtio_blk: Use DISKFLAG_WRITE_PROTECT for RO disks
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
virtio_blk: Use DISKFLAG_WRITE_PROTECT for RO disks

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27905

3 years agoif_vtnet: Add initial modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
if_vtnet: Add initial modern (V1) support

Very basic support to get packets flowing on modern QEMU but still
several conformance issues remain that will be addressed in later
commits.

First of many passes at cleaning up various accumulated cruft

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27904

3 years agovirtio_scsi: Add modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
virtio_scsi: Add modern (V1) support

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27903

3 years agovirtio_blk: Add modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
virtio_blk: Add modern (V1) support

Rework the header file changes from 2cc8a52 to use our
canonical upstream, Linux.

geom_disk already checks DISKFLAG_CANDELETE for BIO_DELETE
so remove an unnecessary check.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27902

3 years agovirtio_console: Add modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:24 +0000 (04:55 +0000)]
virtio_console: Add modern (V1) support

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27901

3 years agovirtio_balloon: Add modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:23 +0000 (04:55 +0000)]
virtio_balloon: Add modern (V1) support

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27900

3 years agovirtio_random: Add modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:23 +0000 (04:55 +0000)]
virtio_random: Add modern (V1) support

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27899

3 years agovirtio_pci: Add sysctl to show current features
Bryan Venteicher [Tue, 19 Jan 2021 04:55:23 +0000 (04:55 +0000)]
virtio_pci: Add sysctl to show current features

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27898

3 years agovirtio: Add modern (v1) virtqueue support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:23 +0000 (04:55 +0000)]
virtio: Add modern (v1) virtqueue support

This only supports the legacy virtqueue format that is now called
"Split Virtqueues". Support for the new "Packed Virtqueues" described
in v1.1 is left for a later date.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27857

3 years agovirtio: Add VirtIO PCI modern (V1) support
Bryan Venteicher [Tue, 19 Jan 2021 04:55:23 +0000 (04:55 +0000)]
virtio: Add VirtIO PCI modern (V1) support

Use the existing legacy PCI driver as the basis for shared code
between the legacy and modern PCI drivers. The existing virtio_pci
kernel module will contain both the legacy and modern drivers.

Changes to the virtqueue and each device driver (network, block, etc)
for V1 support come in later commits.

Update the MMIO driver to reflect the VirtIO bus method changes, but
the modern compliance can be improved on later.

Note that the modern PCI driver requires bus_map_resource() to be
implemented, which is not the case on all archs.

The hw.virtio.pci.transitional tunable default value is zero so
transitional devices will continue to be driven via the legacy
driver.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27856

3 years agoRevert: virtio: Support non-legacy network device and queue
Bryan Venteicher [Tue, 19 Jan 2021 04:55:23 +0000 (04:55 +0000)]
Revert: virtio: Support non-legacy network device and queue

And subsequent fix 576b099a.

By adding the mergable header to the vtnet_rx_header structure, the size
was increased by 2 bytes, breaking the alignment of this structure as
described the in preceding comments.

Furthermore, the mergable header does not belong the structure. With the
mergable feature, the header is placed in line with the data, so there is
no need for a separate segment, and misleading to follow the mergable
header with any padding.

The V1 header is effectively identical to mergable header, and the driver
has long supported the mergable feature. Revert this so the later changes
that add V1 support can show how V1 is derived from the existing mergable
buffers support, and to facilitate a later MFC.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27855

3 years agopkgbase: differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases
Emmanuel Vadot [Thu, 14 Jan 2021 12:56:38 +0000 (13:56 +0100)]
pkgbase: differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases

The current postfix conversions are:

  CURRENT / STABLE / PRERELEASE, 12.x-CURRENT becomes 12.snapYYYYMMDDhhmmss
  ALPHAx -> .ax, so 11.3-ALPHA1 becomes 11.3.a1.YYYYMMDDhhmmss
  BETAx -> .bx, so 12.1-BETA2 becomes 12.1.b2.YYYYMMDDhhmmss
  RCx -> .rcx, so 13.0-RC3 becomes 13.0.rc3.YYYYMMDDhhmmss
  RELEASE -> (nothing), so 12.1-RELEASE becomes 12.1
  RELEASE-pX -> pX, so 12.1-RELEASE-p1 becomes 12.1p1

Note that for development branches we will start to drop the minor version
component entirely, which more closely matches how these branches are
physically named (stable/NN).

snap is a new prefix that was added to pkg in [0], which is simply a more
verbose version of the current ".s" used.

As noted, build timestamps are also added to ALPHA/BETA/RC versions.  This
is largely irrelevant for re@ snapshots because they will only produce one
set of snapshots for each alpha/beta/rc, but external folks may produce
multiple in that timeframe -- at least for alpha.  For them, it is
imperative that the builds have a differentiating characteristic like this
rather than multiple builds across multiple revisions being versioned
identically.

[0] https://github.com/freebsd/pkg/pull/1929

Reviewed by: gjb, manu
Submitted by: rene (original, original version)
Differential Revision: https://reviews.freebsd.org/D28167

3 years agojail: Clean up some function placement and improve comments.
Jamie Gritton [Tue, 19 Jan 2021 01:23:51 +0000 (17:23 -0800)]
jail: Clean up some function placement and improve comments.

Move prison_hold, prison_hold_locked ,prison_proc_hold, and
prison_proc_free to a more intuitive part of the file (together with
with prison_free and prison_free_locked), and add or improve comments
to these and others, to better describe what's going in the prison
reference cycle.

No functional changes.

3 years agoppbus: Fix the direction of the PPISEPPA ioctl
Mark Johnston [Tue, 19 Jan 2021 00:44:42 +0000 (19:44 -0500)]
ppbus: Fix the direction of the PPISEPPA ioctl

PR: 252711
Submitted by: Eugene <merfi@nearly.ru>

3 years agomake maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V
Oleksandr Tymoshenko [Wed, 30 Dec 2020 06:59:03 +0000 (22:59 -0800)]
make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V

Use a machdep.nirq tunable intead of compile-time constant NIRQ
as a value for maximum number of interrupts. It allows keep a system
footprint small by default with an option to increase the limit
for large systems like server-grade ARM64

Reviewd by: mhorne
Differential Revision: https://reviews.freebsd.org/D27844
Submitted by: Klara, Inc.
Sponsored by: Ampere Computing

3 years agojail: Fix a stray mutex from 76ad42abf9d4.
Jamie Gritton [Mon, 18 Jan 2021 23:47:09 +0000 (15:47 -0800)]
jail: Fix a stray mutex from 76ad42abf9d4.

3 years agoaesni: Ensure that key schedules are aligned
Mark Johnston [Mon, 18 Jan 2021 22:07:56 +0000 (17:07 -0500)]
aesni: Ensure that key schedules are aligned

Rather than depending on malloc() returning 16-byte aligned chunks,
allocate some extra pad bytes and ensure that key schedules are
appropriately aligned.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D28157

3 years agosafexcel: Maintain per-session context records
Mark Johnston [Mon, 18 Jan 2021 22:07:56 +0000 (17:07 -0500)]
safexcel: Maintain per-session context records

The context record contains key material precomputed by the driver at
session creation time.  Rather than storing various components of the
context record in each session, go a bit further and store the full
context record image so that safexcel_process() can simply copy the
image into each request submitted to the hardware.  This simplifies the
data path and eliminates a bunch of unnecessary conditional logic that
was getting executed for each request.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agosafexcel: Simplify request allocation
Mark Johnston [Mon, 18 Jan 2021 22:07:56 +0000 (17:07 -0500)]
safexcel: Simplify request allocation

Rather than preallocating a set of requests and moving them between
queues during state transitions, maintain a shadow of the command
descriptor ring to track the driver context of each request.  This is
simpler and requires less synchronization between safexcel_process() and
the ring interrupt handler.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agosafexcel: Handle command/result descriptor exhaustion gracefully
Mark Johnston [Mon, 18 Jan 2021 22:07:56 +0000 (17:07 -0500)]
safexcel: Handle command/result descriptor exhaustion gracefully

Rather than returning a hard error in this case, return ERESTART so that
upper layers get a chance to retry the request (or drop it, depending on
the desired policy).

This case is hard to hit due to the somewhat low bound on queued
requests, but that will no longer be true after an upcoming change.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agosafexcel: Add counters for some resource exhaustion conditions
Mark Johnston [Mon, 18 Jan 2021 22:07:55 +0000 (17:07 -0500)]
safexcel: Add counters for some resource exhaustion conditions

This is useful when analyzing performance problems.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agosafexcel: Dispatch requests to the current CPU's ring
Mark Johnston [Mon, 18 Jan 2021 22:07:55 +0000 (17:07 -0500)]
safexcel: Dispatch requests to the current CPU's ring

This gives better performance in some tests than the previous policy of
statically binding each session to a ring.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agolinuxkpi: Fix the shrinker scan target
Mark Johnston [Mon, 18 Jan 2021 22:07:55 +0000 (17:07 -0500)]
linuxkpi: Fix the shrinker scan target

Use the number of items scanned to control the duration of the shrink
loop.  Otherwise, if a consumer like TTM is not able to free the number
of items requested for some reason, the shrinker keeps looping forever.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28224

3 years agoarmv8crypto: print a message on probe failure
Mitchell Horne [Mon, 18 Jan 2021 20:59:21 +0000 (16:59 -0400)]
armv8crypto: print a message on probe failure

Similar to the message printed by aesni(4), let the user know if the
driver is unsupported by their CPU.

PR: 252543
Reported by: gbe
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agopkgbase: limit PKG_VERSION_FROM calculation to real-update-packages
Kyle Evans [Mon, 18 Jan 2021 19:34:54 +0000 (13:34 -0600)]
pkgbase: limit PKG_VERSION_FROM calculation to real-update-packages

PKG_ABI is defined in some other targets that do not need to shell out and
calculate PKG_VERSION_FROM. Moreover, it produces extra errors when
bootstrapping an initial pkgbase repo, as the /latest link doesn't exist
yet.

3 years agojail: Add prison_isvalid() and prison_isalive()
Jamie Gritton [Mon, 18 Jan 2021 18:56:20 +0000 (10:56 -0800)]
jail: Add prison_isvalid() and prison_isalive()

prison_isvalid() checks if a prison record can be used at all, i.e.
pr_ref > 0.  This filters out prisons that aren't fully created, and
those that are either in the process of being dismantled, or will be
at the next opportunity.  While the check for pr_ref > 0 is simple
enough to make without a convenience function, this prepares the way
for other measures of prison validity.

prison_isalive() checks not only validity as far as the useablity of
the prison structure, but also whether the prison is visible to user
space.  It replaces a test for pr_uref > 0, which is currently only
used within kern_jail.c, and not often there.

Both of these functions also assert that either the prison mutex or
allprison_lock is held, since it's generally the case that unlocked
prisons aren't guaranteed to remain useable for any length of time.
This isn't entirely true, for example a thread can assume its own
prison is good, but most exceptions will exist inside of kern_jail.c.

3 years agoKTLS: Enable KERN_TLS in GENERIC on amd64
Andrew Gallatin [Thu, 14 Jan 2021 17:44:06 +0000 (12:44 -0500)]
KTLS: Enable KERN_TLS in GENERIC on amd64

Based on discussions on freebsd-arch@, enable KERN_TLS in
GENERIC on amd64, but leave it disabled via the
sysctl kern.ipc.tls.enable.  Users wishing to enable
ktls must set kern.ipc.tls.enable=1

While here, fix wording in NOTES to mention that KERN_TLS
also does receive now.

Sponsored by: Netflix

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D28163