Commit Graph

256136 Commits

Author SHA1 Message Date
Mark Johnston
3e3eb5f45f 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
2021-01-19 20:34:36 -05:00
Mark Johnston
089eafaff3 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
2021-01-19 20:34:35 -05:00
Mark Johnston
98d788c867 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
2021-01-19 20:34:35 -05:00
Mark Johnston
d181624889 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
2021-01-19 20:34:35 -05:00
Robert Watson
adc96a51a5 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
2021-01-19 22:26:20 +00:00
John-Mark Gurney
fd11270509 add missing .Xr.. 2021-01-19 14:18:55 -08:00
Alex Richardson
c1a3d7f206 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
2021-01-19 21:37:36 +00:00
Alex Richardson
7954ad9f22 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.
2021-01-19 21:23:25 +00:00
Alex Richardson
0348c8fcfa 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.
2021-01-19 21:23:25 +00:00
Alex Richardson
74eb7f97ec Fix make includes path to nvpair.h
Fixes a typo introduced in 9e5787d228
2021-01-19 21:23:25 +00:00
Alex Richardson
8d30571d45 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
2021-01-19 21:23:25 +00:00
Alex Richardson
a81c165bce 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
2021-01-19 21:23:25 +00:00
Alex Richardson
be5972695f 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
2021-01-19 21:23:24 +00:00
Alex Richardson
bc596e5632 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
2021-01-19 21:23:24 +00:00
Toomas Soome
4bbfe4bf08 loader: comment on rgb_to_color_index()
Add small comment block about rgb_to_color_index().
2021-01-19 22:15:26 +02:00
Toomas Soome
52e3a7300d 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
2021-01-19 21:58:46 +02:00
John Baldwin
8e9313caa6 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
2021-01-19 11:52:00 -08:00
John Baldwin
c6e27f5697 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
2021-01-19 11:05:48 -08:00
John Baldwin
c7f3aa34cf 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
2021-01-19 11:05:41 -08:00
Glen Barber
33f38c8a98 release.sh: bump Copyright year after previous commit
Sponsored by:	Rubicon Communications, LLC (netgate.com)
2021-01-19 13:53:29 -05:00
Glen Barber
041b28524a 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)
2021-01-19 13:38:33 -05:00
Lutz Donnerhacke
fa6662b368 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
2021-01-19 16:01:09 +01:00
Ed Maste
5290493a20 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
2021-01-19 08:53:07 -05:00
Andriy Gapon
2c98edd6d6 htu21: driver for HTU21D I2C temperature and humidity sensor
MFC after:	2 weeks
Relnotes:	perhaps
2021-01-19 15:08:51 +02:00
Mateusz Guzik
38baca17e0 lockmgr: fix upgrade
TRYUPGRADE requests kept failing when they should not have due to wrong
macro used to count readers.

Fixes:	f6b091fbbd ("lockmgr: rewrite upgrade to stop always dropping the lock")
Noted by:	asomers
Differential Revision:	https://reviews.freebsd.org/D27947
2021-01-19 12:21:38 +00:00
Michal Meloun
f635cef2a4 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
2021-01-19 13:09:17 +01:00
Stefan Eßer
24f44a445c 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
2021-01-19 12:56:23 +01:00
Edward Tomasz Napierala
c987d6a677 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
2021-01-19 11:21:55 +00:00
Edward Tomasz Napierala
47f7345bab linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT.
Sponsored by:	The FreeBSD Foundation
2021-01-19 10:30:55 +00:00
Edward Tomasz Napierala
7d3310c4fc linux: remove spurious newline.
Sponsored by:	The FreeBSD Foundation
2021-01-19 09:56:45 +00:00
Mateusz Guzik
57dab0292a cache: fix some typos 2021-01-19 10:17:14 +01:00
Mateusz Guzik
84ab77ad27 cache: drop-write only var from cache_fplookup_preparse 2021-01-19 10:13:30 +01:00
Mateusz Guzik
6d386b4c8a 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.
2021-01-19 10:08:24 +01:00
Peter Grehan
eed1cc6cdf 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
2021-01-20 03:30:22 +10:00
Bryan Venteicher
e6cc42f181 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
2021-01-19 04:55:26 +00:00
Bryan Venteicher
2bfab35774 if_vtnet: Add counter for received host LRO
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27928
2021-01-19 04:55:26 +00:00
Bryan Venteicher
475a60aec7 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
2021-01-19 04:55:26 +00:00
Bryan Venteicher
6b53aeed91 if_vtnet: Set lro_nsegs for host LRO packets
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27933
2021-01-19 04:55:25 +00:00
Bryan Venteicher
74cd316a09 if_vtnet: Resort softc fields
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27925
2021-01-19 04:55:25 +00:00
Bryan Venteicher
33b5433fd7 if_vtnet: Remove unnecessary TUNABLE_INTs because of CTLFLAG_RDTUN
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27923
2021-01-19 04:55:25 +00:00
Bryan Venteicher
4f18e23f84 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
2021-01-19 04:55:25 +00:00
Bryan Venteicher
c3187190c7 if_vtnet: Disable F_MTU feature if MTU is invalid
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27931
2021-01-19 04:55:25 +00:00
Bryan Venteicher
bd8809df20 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
2021-01-19 04:55:25 +00:00
Bryan Venteicher
b470419ea5 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
2021-01-19 04:55:25 +00:00
Bryan Venteicher
42343a6316 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
2021-01-19 04:55:25 +00:00
Bryan Venteicher
177761e4c4 if_vtnet: Set the interface max TSO values
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27917
2021-01-19 04:55:25 +00:00
Bryan Venteicher
e36a6b1b1f 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
2021-01-19 04:55:25 +00:00
Bryan Venteicher
dc9029d863 if_vtnet: Move ioctl handlers into separate functions
Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27914 https://reviews.freebsd.org/D27915
2021-01-19 04:55:25 +00:00
Bryan Venteicher
44559b26af 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
2021-01-19 04:55:25 +00:00
Bryan Venteicher
32e0493c92 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
2021-01-19 04:55:25 +00:00