]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoia32_get_fpcontext(): xfpusave can be legitimately NULL
Konstantin Belousov [Tue, 21 Sep 2021 21:09:34 +0000 (00:09 +0300)]
ia32_get_fpcontext(): xfpusave can be legitimately NULL

(cherry picked from commit c2ee4dfd04970f1597eea58bb30eb93e1ed5a491)

2 years agoamd64: consistently use uprintf() to report weird situations in sigreturn
Konstantin Belousov [Thu, 16 Sep 2021 13:48:27 +0000 (16:48 +0300)]
amd64: consistently use uprintf() to report weird situations in sigreturn

(cherry picked from commit 2e79a216329f62a78dbbc72256e782353e220968)

2 years agoamd64: eliminate td_md.md_fpu_scratch
Konstantin Belousov [Wed, 15 Sep 2021 18:37:47 +0000 (21:37 +0300)]
amd64: eliminate td_md.md_fpu_scratch

(cherry picked from commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2)

2 years agoamd64: stop using top of the thread' kernel stack for FPU user save area
Konstantin Belousov [Mon, 13 Sep 2021 21:05:47 +0000 (00:05 +0300)]
amd64: stop using top of the thread' kernel stack for FPU user save area

MFC note: this commit changes layout of td_md for amd64, resulting in
static checks for struct thread ABI in kern_thread.c to fail.  Next
two commits restore the layout, I decided to not overcomplicate the
merge and not do the work that is going to be overwritten immediately.

(cherry picked from commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1)

2 years agolinux32: add a hack to avoid redefining the type of the savefpu tag
Konstantin Belousov [Mon, 13 Sep 2021 21:40:02 +0000 (00:40 +0300)]
linux32: add a hack to avoid redefining the type of the savefpu tag

(cherry picked from commit 0f6829488ef32142b9ea1c0806fb5ecfe0872c02)

2 years agoexec_machdep.c: some style, use ANSI C definition for sys_sigreturn()
Konstantin Belousov [Mon, 13 Sep 2021 20:37:26 +0000 (23:37 +0300)]
exec_machdep.c: some style, use ANSI C definition for sys_sigreturn()

(cherry picked from commit 9151abe323034275014dcfffb4a793bc5032bf87)

2 years agoamd64: move signal handling and register structures manipulations into exec_machdep.c
Konstantin Belousov [Mon, 13 Sep 2021 20:33:37 +0000 (23:33 +0300)]
amd64: move signal handling and register structures manipulations into exec_machdep.c

(cherry picked from commit 12ca33f44fc76890336f517ace402b47b9afb134)

2 years agoamd64: centralize definitions of CS_SECURE and EFL_SECURE
Konstantin Belousov [Tue, 14 Sep 2021 16:07:31 +0000 (19:07 +0300)]
amd64: centralize definitions of CS_SECURE and EFL_SECURE

(cherry picked from commit a42d362bb54af91d8b82dca086fa656f4624bae2)

2 years agolibc: vDSO timekeeping: Add pvclock support
Adam Fenn [Sat, 7 Aug 2021 20:11:29 +0000 (13:11 -0700)]
libc: vDSO timekeeping: Add pvclock support

(cherry picked from commit a3d932dfef5edc9d1c947b02fb93a64d63a291cb)

2 years agopvclock: Add vDSO support
Adam Fenn [Sat, 7 Aug 2021 20:10:04 +0000 (13:10 -0700)]
pvclock: Add vDSO support

(cherry picked from commit d4b2d3035a23d5dc468d41151487a8299bf45cdc)

2 years agokvm_clock: KVM paravirtual clock support
Adam Fenn [Wed, 4 Aug 2021 15:42:48 +0000 (08:42 -0700)]
kvm_clock: KVM paravirtual clock support

(cherry picked from commit 6c69c6bb4c7ffde48b130df707799d4eca21ca9f)

2 years agopvclock: Add 'struct pvclock' API
Adam Fenn [Sat, 7 Aug 2021 20:01:46 +0000 (13:01 -0700)]
pvclock: Add 'struct pvclock' API

(cherry picked from commit 0b3382b863f3195d88b99f94d5af7fe4a7b9726a)

2 years agox86: files: Make sys/x86/x86/pvclock.c optional
Adam Fenn [Wed, 4 Aug 2021 15:10:43 +0000 (08:10 -0700)]
x86: files: Make sys/x86/x86/pvclock.c optional

(cherry picked from commit 346f5a0c483b7c159efd7c8faf4a18f3e3f77158)

2 years agox86: cpufunc: Add rdtsc_ordered()
Adam Fenn [Wed, 28 Jul 2021 17:12:00 +0000 (10:12 -0700)]
x86: cpufunc: Add rdtsc_ordered()

(cherry picked from commit 652ae7b11485d9f991ea66a56aa79d4dd9cd1103)

2 years agox86: cpufunc: Add rdtscp_aux()
Adam Fenn [Mon, 26 Jul 2021 19:59:55 +0000 (12:59 -0700)]
x86: cpufunc: Add rdtscp_aux()

(cherry picked from commit 908e277230ef1a80589f85687f5b422b0e863e79)

2 years agonemtap: lb app: Validate ihl field when hashing packet
Vincenzo Maffione [Sun, 26 Sep 2021 13:44:51 +0000 (13:44 +0000)]
nemtap: lb app: Validate ihl field when hashing packet

MFC after: 1 week

(cherry picked from commit f7cef43aa9a357582a703c75dafa4a44c1b2f28c)

2 years agoti(4): Fix a typo in an error message
Gordon Bergling [Sat, 2 Oct 2021 08:51:29 +0000 (10:51 +0200)]
ti(4): Fix a typo in an error message

- s/chanels/channels/

(cherry picked from commit 42dfad2ef12755d27e0e34656a2624f0dac2c502)

2 years agoqlnxe: Fix typos in two error messages
Gordon Bergling [Sat, 2 Oct 2021 08:49:51 +0000 (10:49 +0200)]
qlnxe: Fix typos in two error messages

- s/erorr/error/

(cherry picked from commit 957d9ba0c3f908462915c9aed6900c50c8c76210)

2 years agoe1000: Function prototype cleanup
Kevin Bowling [Wed, 6 Oct 2021 21:03:38 +0000 (14:03 -0700)]
e1000: Function prototype cleanup

Drop arguments of function prototypes since the file is mixed between
listing arg names and not.

No functional changes

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D32329

(cherry picked from commit 28ccd780a96fe49364072955636829cff1589cfb)

2 years agologin: use sizeof(audit_cond) consistently, NFC
Kyle Evans [Wed, 6 Oct 2021 04:24:24 +0000 (23:24 -0500)]
login: use sizeof(audit_cond) consistently, NFC

The other three instances were already converted to use audit_cond, this
one was just changed from sizeof(long) -> sizeof(int).

(cherry picked from commit 7f4bb501768b9b3f856f91fbc8b9c80a2a4aaa04)

2 years agovfs: remove dead fifoop VOP_KQFILTER implementations
Kyle Evans [Sat, 2 Oct 2021 05:17:57 +0000 (00:17 -0500)]
vfs: remove dead fifoop VOP_KQFILTER implementations

These began to become obsolete in d6d64f0f2c26 (r137739) and the deal
was later sealed in 003e18aef4c4 (r137801) when vfs.fifofs.fops was
dropped and vop-bypass for pipes became mandatory.

PR: 225934

(cherry picked from commit 6b88668f0bfcca09035549e25d0f3c181cd537c8)

2 years agoar: provide error exit status upon failure
Ed Maste [Tue, 3 Aug 2021 18:30:06 +0000 (14:30 -0400)]
ar: provide error exit status upon failure

Previously ar and ranlib returned with exit status 0 (success) in the
case of a missing file or other error.  Update to use error handling
similar to that added by ELF Tool Chain after that project forked
FreeBSD's ar.

PR: PR257599 [exp-run]
Reported by: Shawn Webb, gehmehgeh (on HardenedBSD IRC)
Reviewed by: markj
Obtained from: elftoolchain
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31402

(cherry picked from commit 38911b3c2c7dbb9a097b44856472ebbbedde71fc)

2 years agosrc.conf.5: Regen.
John Baldwin [Fri, 8 Oct 2021 18:31:17 +0000 (11:31 -0700)]
src.conf.5: Regen.

2 years agoFlip the default for OPENSSL_KTLS to arm64
Allan Jude [Thu, 28 Jan 2021 21:28:18 +0000 (21:28 +0000)]
Flip the default for OPENSSL_KTLS to arm64

This is required to make use of KERN_TLS

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

(cherry picked from commit e6b7809cdfc4389d2fc1df2c7fdff08a4a110c77)

2 years agoRevert "Disable MK_OPENSSL_KTLS for stable/13."
John Baldwin [Fri, 8 Oct 2021 18:28:23 +0000 (11:28 -0700)]
Revert "Disable MK_OPENSSL_KTLS for stable/13."

No further issues with the KTLS support in OpenSSL have been seen
since the serf/apache bugs which motivated disabling KTLS.  In
addition, the KTLS API in OpenSSL is now finalized since it has been
released in OpenSSL 3.0.

This reverts commit 3cf25a7802a26ae3be9159c585fda6aea3d0dc08.

Approved by: jkim (maintainer), emaste
Sponsored by: Netflix

2 years agofreebsd-update(8): Add -j flag to support jails
Faraz Vahedi [Fri, 1 Oct 2021 18:48:57 +0000 (13:48 -0500)]
freebsd-update(8): Add -j flag to support jails

Make freebsd-update(8) support jails by adding the -j flag which takes
a jail jid or name as an argument. This takes advantage of the recently
added -j support to freebsd-version(8) in order to get the version of
the installed userland.

Reviewed by: dteske, kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25711

(cherry picked from commit c76da1f01064b2b9a1903b30d4b4c444b85f8724)

2 years agofreebsd-version(1): Add -j flag to support jails
Faraz Vahedi [Fri, 1 Oct 2021 18:46:23 +0000 (13:46 -0500)]
freebsd-version(1): Add -j flag to support jails

Make freebsd-version(1) support jails by adding the -j flag which takes
a jail jid or name as an argument. As with other options, -j
flags stack and display in the order requested.

Reviewed by: bcr (manpages), kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25705

(cherry picked from commit f54b18fc4d72c566912b9a41601ed87a852960e7)

2 years agotests/sys/fs/fusefs/read.cc: fix build on powerpc64
Konstantin Belousov [Wed, 22 Sep 2021 22:47:10 +0000 (01:47 +0300)]
tests/sys/fs/fusefs/read.cc: fix build on powerpc64

There sig_atomic_t is shorter than void *.
As result, it cannot keep pointer.

Assigning to void * is actually safe for us in a signal handler.

(cherry picked from commit 3fcbde5e883a253f631082b128dcdf77c840d4c0)

2 years agoReverted: Split out the loader efifb setup to a new function
Andrew Turner [Fri, 26 Feb 2021 11:47:34 +0000 (11:47 +0000)]
Reverted: Split out the loader efifb setup to a new function

(cherry picked from commit c8db60c0673d4bb7a3a3e2c043804e1ed1108c2f)
(cherry picked from commit 773fc43fb060149f8e59c183e5da79feaf118c8c)

2 years agopthread_mutexattr(3): document each pthread_mutexattr_set/get* function
Konstantin Belousov [Fri, 1 Oct 2021 01:39:39 +0000 (04:39 +0300)]
pthread_mutexattr(3): document each pthread_mutexattr_set/get* function

(cherry picked from commit be6116fdfc4d292b77b3df7d4dda029d26a73d65)

2 years agolibthr(3): explain some internals of the locks implementation
Konstantin Belousov [Fri, 1 Oct 2021 01:17:02 +0000 (04:17 +0300)]
libthr(3): explain some internals of the locks implementation

(cherry picked from commit f5b9747075a9b489226e2a911f8a1597f4b9d072)

2 years agopthread_mutexattr(3): install pthread_mutexattr_get/setpshared links
Konstantin Belousov [Fri, 1 Oct 2021 00:53:44 +0000 (03:53 +0300)]
pthread_mutexattr(3): install pthread_mutexattr_get/setpshared links

(cherry picked from commit 6bda192013fc8e6c994098fe262f2a74f424cb57)

2 years agopthread_mutexattr(3): document pthread_mutexattr_set/getpshared
Konstantin Belousov [Fri, 1 Oct 2021 00:46:16 +0000 (03:46 +0300)]
pthread_mutexattr(3): document pthread_mutexattr_set/getpshared

(cherry picked from commit 0a6e5fc29b43778bd004f7754c730e41a9ce2675)

2 years agopthread_mutexattr(3): use .Fo/.Fc to avoid too long lines
Konstantin Belousov [Fri, 1 Oct 2021 00:40:19 +0000 (03:40 +0300)]
pthread_mutexattr(3): use .Fo/.Fc to avoid too long lines

(cherry picked from commit 9f3b6cdbe87cf92d4099f3f5ff8eff3030a8076b)

2 years agoAvoid "consumer not attached in g_io_request" panic when disk lost
Kirk McKusick [Tue, 28 Sep 2021 03:03:43 +0000 (20:03 -0700)]
Avoid "consumer not attached in g_io_request" panic when disk lost
while using a UFS snapshot.

Differential revision: https://reviews.freebsd.org/D32150
Sponsored by: Netflix

(cherry picked from commit 4a365e863f209b0c82641c909a858dab53b19134)

2 years agoBring the tags and links entries for amd64 up to date.
Kirk McKusick [Thu, 23 Sep 2021 23:38:37 +0000 (16:38 -0700)]
Bring the tags and links entries for amd64 up to date.

Sponsored by: Netflix

(cherry picked from commit 1c8d670cb633d39cea68cdeecab507d2ee264705)

2 years agofusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES
Alan Somers [Thu, 16 Sep 2021 19:19:21 +0000 (13:19 -0600)]
fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES

During VOP_GETPAGES, fusefs needs to determine the file's length, which
could require a FUSE_GETATTR operation.  If that fails, it's better to
SIGBUS than panic.

Sponsored by: Axcient
Reviewed by:  markj, kib
Differential Revision: https://reviews.freebsd.org/D31994

(cherry picked from commit 4f917847c9037d9b76de188c03e13b81224431b2)

2 years agotools/test/upsdl: fix compiler warnings
Alan Somers [Tue, 14 Sep 2021 20:50:01 +0000 (14:50 -0600)]
tools/test/upsdl: fix compiler warnings

Sponsored by: Axcient

(cherry picked from commit 5dc5f849be9047309d32c4df8e7ee617c27ec43f)

2 years agoses: Guard the elm_type_names declaration by _KERNEL
Alan Somers [Mon, 30 Aug 2021 20:45:13 +0000 (14:45 -0600)]
ses: Guard the elm_type_names declaration by _KERNEL

Sponsored by: Axcient

(cherry picked from commit cc2d08d3880c2e726849ab2aa23b3d15f8aa3938)

2 years agoses: Correct spelling of "Temperature Sensor"
Alan Somers [Mon, 30 Aug 2021 19:59:32 +0000 (13:59 -0600)]
ses: Correct spelling of "Temperature Sensor"

According to SES 4 revision 2 table 71, it should be singular.

Sponsored by: Axcient

(cherry picked from commit 1fb52e4373e7f645d71059a6a403469f059044c8)

2 years agoaio: revert the workaround for bug 251828 in the tests
Alan Somers [Fri, 13 Aug 2021 22:59:10 +0000 (16:59 -0600)]
aio: revert the workaround for bug 251828 in the tests

This bug is no longer reproducible in 14.0-CURRENT and 13.0-RELEASE

PR: 251828
Reported by: markj
Reviewed by: markj
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D31535

(cherry picked from commit 825fb07c55986971b1a20e40a73c12eb0ff432e0)

2 years ago[skip ci] unix(4): LOCAL_PEERCRED works on SOCK_SEQPACKET, too.
Alan Somers [Tue, 10 Aug 2021 13:29:06 +0000 (07:29 -0600)]
[skip ci] unix(4): LOCAL_PEERCRED works on SOCK_SEQPACKET, too.

MFC after: 2 weeks
Reviewed By: dchagin
Differential Revision: https://reviews.freebsd.org/D31456

(cherry picked from commit 518e697f2accf3769dc986e254a4c79db7ec5a06)

2 years agoMFC uipc_shm: Fix kern.ipc.posix_shm_list for jails
Jamie Gritton [Wed, 29 Sep 2021 17:20:36 +0000 (10:20 -0700)]
MFC uipc_shm: Fix kern.ipc.posix_shm_list for jails

Fix error return of kern.ipc.posix_shm_list, which caused it (and thus
"posixshmcontrol ls") to fail for all jails that didn't happen to own
the last shm object in the list.

(cherry picked from commit 747a47261eee59b6e9c437cd2c1b3979df5c32ac)

2 years agoUpgrade ENA to v2.4.1
Marcin Wojtas [Fri, 23 Jul 2021 22:31:32 +0000 (15:31 -0700)]
Upgrade ENA to v2.4.1

ena: Remove redundant declaration of ena_log_level.

GCC6 raises a -Wredundant-decl error due to duplicate declarations
in ena_fbsd_log.h and ena_plat.h.

Sponsored by: Chelsio Communications

(cherry picked from commit 8843787aa1bdbd10de6ba47a04489179ec2d2d3c)

ena: Avoid unnecessary mbuf collapses for LLQ condition

In case of Low-latency Queue, one small enough descriptor can be pushed
directly to the ENA hw, thus saving one fragment. Check for this
condition before performing collapse.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit c81f8c26115a64b9a97ecdb2a64e824dd839ee73)

ena: Trigger reset on ena_com_prepare_tx failure

All ena_com_prepare_tx errors other than ENA_COM_NO_MEM are fatal and
require device reset.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 36130d2979d695dd439bc607feb00dcdb9a1937b)

ena: Prevent reset after device destruction

Check for ENA_FLAG_TRIGGER_RESET inside a locked context in order to
avoid potential race conditions with ena_destroy_device. This aligns the
reset task logic with the Linux driver.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 433ab9b6987b42b3e5b25b8b5dc7e5178c7ef9bb)

ena: Add extra log messages

Stay aligned with the Linux driver by adding the following logs:
* inform the user about retrying queue creation
* warn on non-empty ena_tx_buffer.mbuf prior to ena_tx_map_mbuf

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 77160654a162b5faa8ad7a02e18d2bef2589f868)

ena: Add locking assertions

ENA silently assumed that ena_up, ena_down and ena_start_xmit routines
should be called within locked context. Driver's logic heavily assumes
on concurrent access to those routines, so for safety and better
documentation about this assumption, the locking assertions were added
to the above functions.

The assertion was added only for the main steps (skipping the helper
functions) which can be called from multiple places including the kernel
and the driver itself.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit cb98c439d66c303353a9f4abbbe9ddb51559c638)

ena: Move RSS logic into its own source files

Delegate RSS related functionality into separate .c/.h files in
preparation for the full RSS support.

While at it, reorder functions and remove prototypes for ones with
internal linkage.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 986e7b9227668caf9620f207e3c1d708c87b634d)

ena: Disable meta descriptor caching for netmap

If LLQ is being used, `ena_tx_ctx.meta_valid` must stay enabled. This
fixes netmap support on latest generation ENA HW and aligns it with the
core driver behavior.

As netmap doesn't support any csum offloads, the
`adapter->disable_meta_caching` value can be simply passed to the HW.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit a831466830de6ab55fc03170290b313157196e81)

ena: Share ena_global_lock between driver instances

In order to use `ena_global_lock` in sysctl context, it must be kept
outside the driver instance's software context, as sysctls can be called
before attach and after detach, leading to lock use before sx_init and
after sx_destroy otherwise.
Solve this issue by turning `ena_global_lock` into a file scope
variable, shared between all instances of the driver and associated
sysctl context, and in turn initialized/destroyed in dedicated
SYSINIT/SYSUNINIT functions.
As a side effect, this change also fixes existing race in the reset
routine, when simultaneously accessing sysctl exposed properties.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 07aff471c0de2de9a1dc5c7749c46b525bdd0201)

ena: Add missing statistics

Provide the following sysctl statistics in order to stay aligned with
the Linux driver:
* rx_ring.csum_good
* tx_ring.unmask_interrupt_num

Also rename the 'bad_csum' statistic name to 'csum_bad' for alignment.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 223c8cb12e951c63807300a0cbdc4a1569520b4b)

ena: Implement full RSS reconfiguration

Bind RX/TX queues and MSI-X vectors to matching CPUs based on the RSS
bucket entries.

Introduce sysctls for the following RSS functionality:
- rss.indir_table:      indirection table mapping
- rss.indir_table_size: indirection table size
- rss.key:              RSS hash key (if Toeplitz used)

Said sysctls are only available when compiled without `option RSS`, as
kernel-side RSS support currently doesn't offer RSS reconfiguration.

Migrate the hash algorithm from CRC32 to Toeplitz and change the initial
hash value to 0x0 in order to match the standard Toeplitz implementation.
Provide helpers for hash key inversion required for HW operations.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 6d1ef2abd330fac4057f092abbbdc28a568b4327)

ena: fix building in-kernel driver

When building ENA as compiled into the kernel, the driver would fail to
build. Resolve the problem by introducing the following changes:
1. Add missing `ena_rss.c` entry in `sys/conf/files`.
2. Prevent SYSCTL_ADD_INT from throwing an assert due to an extra
CTLTYPE_INT flag.

Fixes: 986e7b92276 ("ena: Move RSS logic into its own source files")
Fixes: 6d1ef2abd33 ("ena: Implement full RSS reconfiguration")
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
MFC after: 1 week

(cherry picked from commit a3f0d18237bdcf272461d3b4b682de384c572144)

ena: Update driver version to v2.4.1

Some of the changes in this release:
* Hardware RSS hash key reconfiguration and indirection table
reconfiguration support.
* Full kernel RSS support.
* Extra statistic counters.
* Netmap support for ENAv3.
* Locking assertions.
* Extra log messages.
* Reset handling fixes.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 42c7760be3ea420668f625f2064ae347aa7e818e)

2 years agoUpgrade ENA to v2.4.0
Marcin Wojtas [Mon, 14 Jun 2021 08:57:45 +0000 (10:57 +0200)]
Upgrade ENA to v2.4.0

ena: change ENA C++-style comment into C-style

According to man style(9), only C-style comments should be used.

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

(cherry picked from commit 438c9e3cf89403628ec237cfecdd0538f208087b)

ena: add support for the large LLQ headers in ENA

Default LLQ (Low-latency queue) maximum header size is 96 bytes and can
be too small for some types of packets - like IPv6 packets with multiple
extension. This can be fixed, by using large LLQ headers.

If the device supports larger LLQ headers, the user can activate this
feature by setting sysctl tunable 'hw.ena.force_large_llq_header' to '1'
in the /boot/loader.conf file.

In case the device isn't supporting this feature, the default value (96B)
will be used.

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

(cherry picked from commit beaadec9eaec8e6b266faff3b0880a141728fcef)

ena: remove surplus NULL checks when freeing ENA resources

Calling free on a NULL pointer is valid, as appropriate check is already
done internally:

/* free(NULL, ...) does nothing */
if (addr == NULL)
    return;

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit ddec69e6a796283497ebada0569f34bd41bbdf37)

ena: hide sysctl nodes for unused ENA queues

IO queue related attributes are registered statically at driver attach
with the rest of the ENA specific sysctl nodes. However, the number of
queues can be changed at runtime via the `ena_sysctl_io_queues_nb`
request, leading to a potential exposure of attributes for non-existing
queues.

Introduce a new `ena_sysctl_update_queue_node_nb` function, which
updates the sysctl nodes after the number of queues is altered.
This happens by either registering or unregistering node specific oids,
based on a delta between the previous and current queue count.

NOTE: All unregistered oids must be registered again before the driver
detach, e.g. by another call to this function.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 0e7d31f63b9db869c91228d8ed1e984bdee2b931)

Merge tag 'vendor/ena-com/2.4.0'

Update the driver in order not to break its compilation
and make use of the new ENA logging system

Migrate platform code to the new logging system provided by ena_com
layer.

Make ENA_INFO the new default log level.

Remove all explicit use of `device_printf`, all new logs requiring one
of the log macros to be used.

(cherry picked from commit 3fc5d816f8831d6fc2816ac97bd78dc486cd080c)

Update ENA driver man page

Bring the obsolete man page up to date:
* update diagnostic error messages
* add documentation of loader tunables
* document netmap support
* add a driver history section
* update the contact information

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit e34856a2c44a45512463aed0d1794f34258c66ee)

Update ENA version to v2.4.0

Some of the changes in this release:
* Large LLQ headers,
* Bug/stability fixes,
* Change of the README/Documentation.

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

(cherry picked from commit 93f0df457bf1d0e5f71839ab969c94d1f95813fb)

2 years agommc_fdt_helper: correct typo in DT property name
Marcin Wojtas [Thu, 15 Jul 2021 15:08:16 +0000 (17:08 +0200)]
mmc_fdt_helper: correct typo in DT property name

'no-1-8-v' is a proper name according to the DT binding
documentation
(https://www.kernel.org/doc/Documentation/devicetree/bindings/mmc/mmc-controller.yaml).

Fixes: e63fbd7bb7a25
Submitted by: Bartlomiej Grzesik <bag@semihalf.com>
Sponsored by: Semihalf

(cherry picked from commit d8789cd0ae278a86f92247a87d98bb54f15b5592)

2 years agohpen(4): removed leftover hpen_final_digi_cb declaration
Mateusz Guzik [Sun, 5 Sep 2021 17:30:51 +0000 (17:30 +0000)]
hpen(4): removed leftover hpen_final_digi_cb declaration

(cherry picked from commit 007724cbca6f6d91b8c3450bd4a11f3ea2bb647a)

2 years agosocket: Avoid clearing SS_ISCONNECTING if soconnect() fails
Mark Johnston [Tue, 7 Sep 2021 18:51:54 +0000 (14:51 -0400)]
socket: Avoid clearing SS_ISCONNECTING if soconnect() fails

This behaviour appears to date from the 4.4 BSD import.  It has two
problems:

1. The update to so_state is not protected by the socket lock, so
   concurrent updates to so_state may be lost.
2. Suppose two threads race to call connect(2) on a socket, and one
   succeeds while the other fails.  Then the failing thread may
   incorrectly clear SS_ISCONNECTING, confusing the state machine.

Simply remove the update.  It does not appear to be necessary:
pru_connect implementations which call soisconnecting() only do so after
all failure modes have been handled.  For instance, tcp_connect() and
tcp6_connect() will never return an error after calling soisconnected().
However, we cannot correctly assert that SS_ISCONNECTED is not set after
an error from soconnect() since the socket lock is not held across the
pru_connect call, so a concurrent connect(2) may have set the flag.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a8aa6f1f784b91acb4ef9387a28c78311493eb66)

2 years agosocket: Rename sb(un)lock() and interlock with listen(2)
Mark Johnston [Tue, 7 Sep 2021 18:49:31 +0000 (14:49 -0400)]
socket: Rename sb(un)lock() and interlock with listen(2)

In preparation for moving sockbuf locks into the containing socket,
provide alternative macros for the sockbuf I/O locks:
SOCK_IO_SEND_(UN)LOCK() and SOCK_IO_RECV_(UN)LOCK().  These operate on a
socket rather than a socket buffer.  Note that these locks are used only
to prevent concurrent readers and writters from interleaving I/O.

When locking for I/O, return an error if the socket is a listening
socket.  Currently the check is racy since the sockbuf sx locks are
destroyed during the transition to a listening socket, but that will no
longer be true after some follow-up changes.

Modify a few places to check for errors from
sblock()/SOCK_IO_(SEND|RECV)_LOCK() where they were not before.  In
particular, add checks to sendfile() and sorflush().

Reviewed by: tuexen, gallatin
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f94acf52a408316ed61ba94705d7ec0a69ba5ec8)

2 years agosyslogd: undo regression after r326573
Eugene Grosbein [Mon, 27 Sep 2021 07:25:21 +0000 (14:25 +0700)]
syslogd: undo regression after r326573

Restore ability for our syslogd to collect pre-RFC3164 formatted
messages from remote hosts that was broken with r326573.

Note that parsing of RFC5424 format not changed.

(cherry picked from commit 3b4cc56e524ac947ba0e6571e2c455139c2839ec)

2 years agoFix busdma resource leak on usb device detach.
Ian Lepore [Tue, 28 Sep 2021 19:29:10 +0000 (13:29 -0600)]
Fix busdma resource leak on usb device detach.

When a usb device is detached, usb_pc_dmamap_destroy() called
bus_dmamap_destroy() while the map was still loaded. That's harmless on x86
architectures, but on all other platforms it causes bus_dmamap_destroy() to
return EBUSY and leak away any memory resources (including bounce buffers)
associated with the mapping, as well as any allocated map structure itself.

This change introduces a new is_loaded flag to the usb_page_cache struct to
track whether a map is loaded or not. If the map is loaded,
bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking
away resources.

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

(cherry picked from commit dc91a9715f8fda4b3633388830a28a99f73cbe59)

2 years agopf tests: Basic adaptive mode syncookie test
Kristof Provost [Sat, 25 Sep 2021 13:05:02 +0000 (15:05 +0200)]
pf tests: Basic adaptive mode syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32139

(cherry picked from commit 2f20d80692ceb584842a7642562fc9f610a5b661)

2 years agopf tests: Basic syncookie test
Kristof Provost [Sat, 10 Jul 2021 11:20:44 +0000 (13:20 +0200)]
pf tests: Basic syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32138

(cherry picked from commit dc0636636bb1937283d4f218732ac2357f4ec4f1)

2 years agopf.conf: document syncookies
Kristof Provost [Sat, 14 Aug 2021 08:42:03 +0000 (10:42 +0200)]
pf.conf: document syncookies

Reviewed by: bcr
Obtained from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32137

(cherry picked from commit 20f015f08d66d0d953e49245cb95c81c118b9ee9)

2 years agopfctl: userspace adaptive syncookies configration
Kristof Provost [Fri, 13 Aug 2021 11:42:59 +0000 (13:42 +0200)]
pfctl: userspace adaptive syncookies configration

Hook up the userspace bits to configure syncookies in adaptive mode.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32136

(cherry picked from commit 5062afff9de7e67da96e3f0dcb9d8bbd5a4e1c5b)

2 years agopf: hook up adaptive mode configuration
Kristof Provost [Sat, 24 Jul 2021 12:23:59 +0000 (14:23 +0200)]
pf: hook up adaptive mode configuration

The kernel side of pf syncookie adaptive mode configuration.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32135

(cherry picked from commit 955460d41e99031906841870e02063ffdf227f09)

2 years agopf: implement adaptive mode
Kristof Provost [Sat, 24 Jul 2021 11:59:34 +0000 (13:59 +0200)]
pf: implement adaptive mode

Use atomic counters to ensure that we correctly track the number of half
open states and syncookie responses in-flight.
This determines if we activate or deactivate syncookies in adaptive
mode.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32134

(cherry picked from commit bf8637181a2bb81206ff8c685f1632d07b8feb13)

2 years agotcp_wrappers: get rid of duplicate fgets declarations
Kyle Evans [Thu, 30 Sep 2021 04:21:24 +0000 (23:21 -0500)]
tcp_wrappers: get rid of duplicate fgets declarations

This is declared in stdio.h, no need for this one.

(cherry picked from commit 4dbd8c72d3030b8f111fdac86ba45ff596595497)

2 years agolibc: ssp: sprinkle around some __dead2
Kyle Evans [Wed, 29 Sep 2021 21:48:20 +0000 (16:48 -0500)]
libc: ssp: sprinkle around some __dead2

This is consistent with, e.g., NetBSD's implementation, which declares
these as noreturn in ssp/ssp.h.

(cherry picked from commit 5487294d79f9ebe72a847d0855adb4df85e0d66e)

2 years agobootp: remove the USE_BFUNCS knob
Kyle Evans [Thu, 30 Sep 2021 03:01:34 +0000 (22:01 -0500)]
bootp: remove the USE_BFUNCS knob

We'd likely be better served by converting these to the equivalent mem*
calls, but just kill the knob for now. The b* macros being defined get
in the way of _FORTIFY_SOURCE.

(cherry picked from commit cfb9be506285cd65120f9686d532130a3757ce56)

2 years agojail(3lua): add jail.attach()/jail.remove() methods
Kyle Evans [Fri, 23 Oct 2020 17:52:31 +0000 (12:52 -0500)]
jail(3lua): add jail.attach()/jail.remove() methods

These aren't a part of or use libjail(3), but rather are direct
syscalls.  Still, they seem like good additions, allowing us to attach
to already-running jails.

(cherry picked from commit a6499c56ab6ca54f01dca44b7e34a0fc6a680e90)

2 years agojail(3lua): add a jail.list() method
Kyle Evans [Tue, 13 Oct 2020 02:11:14 +0000 (21:11 -0500)]
jail(3lua): add a jail.list() method

This is implemented as an iterator, reusing parts of the earlier logic
to populate jailparams from a passed in table.

The user may request any number of parameters to pull in while we're
searching, but we'll force jid and name to appear at a minimum.

(cherry picked from commit 6a7647eccd3ef35189c63a61b0ec8865fd559839)

2 years agomodules: iichid: needs opt_acpi.h
Kyle Evans [Thu, 30 Sep 2021 03:47:15 +0000 (22:47 -0500)]
modules: iichid: needs opt_acpi.h

This fixes the standalone build.

(cherry picked from commit 335c4f8edb3a02ea101b0f833c22182594e63c9e)

2 years agomodules: netflow: need opt_inet.h
Kyle Evans [Thu, 30 Sep 2021 04:04:18 +0000 (23:04 -0500)]
modules: netflow: need opt_inet.h

This fixes the standalone build.

(cherry picked from commit 6caae81d93e2a14fa42cb831506c3a60c25d9791)

2 years agomodules: acpi_video: need opt_evdev.h
Kyle Evans [Thu, 30 Sep 2021 04:04:00 +0000 (23:04 -0500)]
modules: acpi_video: need opt_evdev.h

This fixes the standalone build.

(cherry picked from commit 58ca99d11648f0b1749a4b29f534e87b0d88b83a)

2 years agokqueue: document how timers with low/past timeouts are handled
Kyle Evans [Thu, 30 Sep 2021 18:19:05 +0000 (13:19 -0500)]
kqueue: document how timers with low/past timeouts are handled

(cherry picked from commit 4b5554cebb66020f59dc869b835aebbd66e4bb8c)

2 years agokqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME
Kyle Evans [Wed, 29 Sep 2021 19:55:59 +0000 (14:55 -0500)]
kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected.  We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

(cherry picked from commit 9c999a259f00b35f0467acd351fea9157ed7e1e4)
(cherry picked from commit 2f4dbe279f6b5eb87ec493d96f6943ffdb603ba0)

2 years agokern: random: collect ~16x less from fast-entropy sources
Kyle Evans [Mon, 20 Sep 2021 05:46:21 +0000 (00:46 -0500)]
kern: random: collect ~16x less from fast-entropy sources

Previously, we were collecting at a base rate of:

64 bits x 32 pools x 10 Hz = 2.5 kB/s

This change drops it to closer to 64-ish bits per pool per second, to
work a little better with entropy providers in virtualized environments
without compromising the security goals of Fortuna.

(cherry picked from commit 5e79bba562bc303eed669dbd0d391b6c6a9c289b)

2 years agokern: random: drop read_rate and associated functionality
Kyle Evans [Mon, 20 Sep 2021 04:59:09 +0000 (23:59 -0500)]
kern: random: drop read_rate and associated functionality

Refer to discussion in PR 230808 for a less incomplete discussion, but
the gist of this change is that we currently collect orders of magnitude
more entropy than we need.

The excess comes from bytes being read out of /dev/*random.  The default
rate at which we collect entropy without the read_rate increase is
already more than we need to recover from a compromise of an internal
state.

For stable/13, the read_rate_increment symbol remains as a stub to avoid
breaking loadable random modules.

(cherry picked from commit 6895cade9421238abf541f24fb9327ebd19e94ff)

2 years agocam: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:48:43 +0000 (10:48 +0200)]
cam: Fix a typo in a comment

- s/perorming/performing/

(cherry picked from commit 15c5f657a0107c7c1a3c954252a9ac6bb80f2535)

2 years agosmsc(4): Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:45:58 +0000 (10:45 +0200)]
smsc(4): Fix a typo in a comment

- s/setings/settings/

(cherry picked from commit 9599d8141f79aa721e47d7fd91e7b9bcfef3a7d5)

2 years agovnic: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:47:21 +0000 (10:47 +0200)]
vnic: Fix a typo in a comment

- s/setings/settings/

(cherry picked from commit fafb1c574d43b8c3acb510d925f599fee461c039)

2 years agoevdev: Fix a typo in a commit
Gordon Bergling [Sat, 2 Oct 2021 08:43:41 +0000 (10:43 +0200)]
evdev: Fix a typo in a commit

- s/prefered/preferred/

(cherry picked from commit efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc)

2 years agonetvsc: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:42:18 +0000 (10:42 +0200)]
netvsc: Fix a typo in a comment

- s/prefered/preferred/

(cherry picked from commit 9ebd651b58502f0572a7832d088f53f7a2ad00a5)

2 years agowpa: Fix EAP/PEAP MSCHAPv2 authentication SIGSEGV
Cy Schubert [Tue, 5 Oct 2021 21:54:06 +0000 (14:54 -0700)]
wpa: Fix EAP/PEAP MSCHAPv2 authentication SIGSEGV

25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 (MFCed by
13f32ff71eeb7213bb9f34bdfa88c7ccecf451bc) introduced a link error
causing a SIGSEGV when using EAP/PEAP MSCHAPv2 authentication. It was
subsequently addressed by c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5,
discovered by build time link errors not experienced during testing of
25ecdc7d52770caf1c9b44b5ec11f468f6b636f3. This commit MFCs a portion
of c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 addressing only the
SIGSEGV. The rest of c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 will
be MFCed in November 2021.

This is a direct commit to stable/13.

PR: 258527
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>

2 years agomgb: sync with version in main
Ed Maste [Fri, 13 Aug 2021 20:57:04 +0000 (16:57 -0400)]
mgb: sync with version in main

This is a combination of 7 commits.

mgb: update Microchip URLs

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6b25b4a73fbe56e15d094895b4c7acdb424ee80d)

mgb: enable multicast in mgb_init

Receive Filtering Engine (RFE) configuration is not yet implemented,
and mgb intended to enable all broadcast, multicast, and unicast.
However, MGB_RFE_ALLOW_MULTICAST was missed (MGB_RFE_ALLOW_UNICAST was
included twice).

MFC after: 1 week
Fixes: 8890ab7758b8 ("Introduce if_mgb driver...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit ecac5c2928eead57c05ee7d376ff58de0a575d49)

mgb: Do not KASSERT on error in mgb_init

There's not much we can do if mii_mediachg() fails, but KASSERT is not
appropriate.

MFC after: 1 week
Fixes: 8890ab7758b8 ("Introduce if_mgb driver...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8b889b8953828fe22e5de68647a35610dd87ff8f)

mgb: Staticize devclass and iflib structs (as is typical)

MFC after: 1 week
Fixes: 8890ab7758b8 ("Introduce if_mgb driver...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c83ae596f3c2ce8c4ef2bacfb63100aaf8d48bb7)

mgb: Apply some style(9)

Add parens around return values, rewrap lines

MFC after: 1 week
Fixes: 8890ab7758b8 ("Introduce if_mgb driver...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 820da5820e60f538d3598d8cb226f51a01bdf01c)

mgb: Fix DEBUG (and LINT) build

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5f07d7fe408bbca5c2f6755c363128107916c08d)

mgb: Fix nop admin interrupt handling

Previously mgb_admin_intr printed a diagnostic message if no interrupt
status bits were set, but it's not valid to call device_printf() from a
filter.  Just drop the message as it has no user-facing value.

Also return FILTER_STRAY in this case - there is nothing further for
the driver to do.

Reviewed by: kbowling
MFC after: 1 week
Fixes: 8890ab7758b8 ("Introduce if_mgb driver...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32231

(cherry picked from commit 1ad2d87778970582854082bcedd2df0394fd4933)

2 years agosched_ule(4): Fix interactive threads stealing.
Alexander Motin [Tue, 21 Sep 2021 19:56:49 +0000 (15:56 -0400)]
sched_ule(4): Fix interactive threads stealing.

In scenarios when first thread in the queue can migrate to specified
CPU, but later ones can't runq_steal_from() incorrectly returned NULL.

MFC after: 2 weeks

(cherry picked from commit bd84094a51c4648a7c97ececdaccfb30bc832096)

2 years agoboot(9): update to match reality
Mitchell Horne [Tue, 28 Sep 2021 14:36:09 +0000 (11:36 -0300)]
boot(9): update to match reality

This function was renamed to kern_reboot() in 2010, but the man page has
failed to keep in sync. Bring it up to date on the rename, add the
shutdown hooks to the synopsis, and document the (obvious) fact that
kern_reboot() does not return.

Fix an outdated reference to the old name in kern_reboot(), and leave a
reference to the man page so future readers might find it before any
large changes.

Reviewed by: imp, markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32085

(cherry picked from commit 800e74955d4e5f90e7258956ba42228350f71049)

2 years agorman: fix overflow in rman_reserve_resource_bound()
Elliott Mitchell [Mon, 27 Sep 2021 17:13:19 +0000 (14:13 -0300)]
rman: fix overflow in rman_reserve_resource_bound()

If the default range of [0, ~0] is given, then (~0 - 0) + 1 == 0. This
in turn will cause any allocation of non-zero size to fail. Zero-sized
allocations are prohibited, so add a KASSERT to this effect.

History indicates it is part of the original rman code.  This bug may in
fact be older than some contributors.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30280

(cherry picked from commit bcddaadbef5850ed9f040836d3f25ff57138ae28)

2 years agontb_hw_intel: fix xeon NTB gen3 bar disable logic
David Bright [Mon, 27 Sep 2021 13:18:46 +0000 (06:18 -0700)]
ntb_hw_intel: fix xeon NTB gen3 bar disable logic

In NTB gen3 driver, it was supposed to disable NTB bar access by
default, but due to incorrect register access method, the bar disable
logic does not work as expected. Those registers should be modified
through NTB bar0 rather than PCI configuration space.

Besides, we'd better to protect ourselves from a bad buddy node so
ingress disable logic should be implemented together.

Submitted by:   Austin Zhang (austin.zhang@dell.com)
Sponsored by:   Dell EMC

(cherry picked from commit e3cf7ebc1d36d068f1d1a83ea73ce2eed547e3cb)

2 years agoDisable stack gap for ntpd during build.
Marcin Wojtas [Fri, 21 May 2021 09:29:22 +0000 (11:29 +0200)]
Disable stack gap for ntpd during build.

When starting, ntpd calls setrlimit(2) to limit maximum size of its
stack. The stack limit chosen by ntpd is 200K, so when stack gap
is enabled, the stack gap is larger than this limit, which results
in ntpd crashing.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: cy, imp
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29553

(cherry picked from commit af949c590bd8a00a5973b5875d7e0fa6832ea64a)

2 years agoipfilter: Print the correct TCP sequence index number
Cy Schubert [Sat, 25 Sep 2021 00:00:20 +0000 (17:00 -0700)]
ipfilter: Print the correct TCP sequence index number

TCP sequence numbers in the FTP proxy are maintained in a two dimensional
array. The debug message prints the same seq[N] for both. Fix that.

(cherry picked from commit df38343e71304169ebca0e4c4fa24b339982d7be)

2 years agoipfilter: Correct a comment
Cy Schubert [Sat, 25 Sep 2021 06:41:22 +0000 (23:41 -0700)]
ipfilter: Correct a comment

Correct a comment's grammar and while at it clarify its meaining.

(cherry picked from commit aa6cfcc820b438cec58fbe0af408d4457f8daf9d)

2 years agoipfilter: Locking sysctls here is not required
Cy Schubert [Fri, 24 Sep 2021 18:18:42 +0000 (11:18 -0700)]
ipfilter: Locking sysctls here is not required

Locking of data structures touched by sysctls is more finely locked
in ipflter therefore higher level locks are redundant.

(cherry picked from commit 1605eaa6d23ea5161b5ab8461e83ab32a591a4fc)

2 years agoipfilter: Avoid a null if-then-else blocks
Cy Schubert [Wed, 22 Sep 2021 04:58:08 +0000 (21:58 -0700)]
ipfilter: Avoid a null if-then-else blocks

When WITHOUT_INET6 is selected we generate a null if-then-else blocks
due to incorrect placment of #if statments. Move the #if statements
reducing unnecessary runtime comparisons WITHOUT_INET6.

(cherry picked from commit 73db3b64f167972db3ee3f780cecb439b09492b1)

2 years agovt: call driver's postswitch when panicking on ttyv0
Greg V [Sat, 24 Apr 2021 11:53:34 +0000 (14:53 +0300)]
vt: call driver's postswitch when panicking on ttyv0

In vt_kms, the postswitch callback restores fbdev mode when
panicking or entering the debugger. This ensures that even when
a graphical applicatino was running on the first tty, simple framebuffer
mode would be restored and the panic would be visible instead
of the frozen GUI. But vt wouldn't call the postswitch callback
when we're already on the first tty, so running a GUI on it
would prevent you from reading any panics.

Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D29961

(cherry picked from commit c937a405bdce2fd12c534446a8cc9e5548dd27eb)

2 years agoUnify console output.
Alexander Motin [Sat, 4 Sep 2021 03:13:42 +0000 (23:13 -0400)]
Unify console output.

Without this change when virtual console enabled depending on buffer
presence and state different parts of output go to different consoles.

MFC after: 1 month

(cherry picked from commit a264594d4ff19fd13f7c39a56c8d131296db480d)

2 years agoRe-implement virtual console (constty).
Alexander Motin [Sat, 4 Sep 2021 02:18:51 +0000 (22:18 -0400)]
Re-implement virtual console (constty).

Protect conscallout with tty lock instead of Giant.  In addition to
Giant removal it also closes race on console unset.

Introduce additional lock to protect against concurrent console sets.

Remove consbuf free on console unset as unsafe, making impossible to
change buffer size after first allocation.  Instead increase default
buffer size from 8KB to 64KB and processing rate from 5Hz to 10-15Hz
to make the output more smooth.

MFC after: 1 month

(cherry picked from commit bd6085c6ae28fb1cc81cca325656332fbd2cebd8)

2 years agoioat(4): Remove Giant from ioat_test enable/disable.
Alexander Motin [Sat, 4 Sep 2021 19:53:28 +0000 (15:53 -0400)]
ioat(4): Remove Giant from ioat_test enable/disable.

MFC after: 1 month

(cherry picked from commit 71bf3900b7827643830dfd9aa1db81bc2926eadb)

2 years agopcib(4): Switch from callout to timeout_task.
Alexander Motin [Fri, 3 Sep 2021 19:00:21 +0000 (15:00 -0400)]
pcib(4): Switch from callout to timeout_task.

This allows to avoid blocking on Giant in callout context, moving to
already existing dedicated taskqueue_pci_hp thread.

MFC after: 1 month

(cherry picked from commit fa3b03d378546b74582613431bab537d3488d81f)

2 years agovt(4): Mark callouts MP-safe.
Alexander Motin [Fri, 3 Sep 2021 19:42:46 +0000 (15:42 -0400)]
vt(4): Mark callouts MP-safe.

The code explicitly takes Giant when it accesses keyboard, and I see
no reason to take it globally by callout(9).

MFC after: 1 month

(cherry picked from commit da69c6752674e29eb5d8f82161ca7bc6d1866051)

2 years agobnxt(4): Mark sysctls MP-safe.
Alexander Motin [Fri, 3 Sep 2021 17:51:08 +0000 (13:51 -0400)]
bnxt(4):  Mark sysctls MP-safe.

MFC after: 1 month

(cherry picked from commit 9895a2073f98be927041f5a73d0d3ff5e8844bfb)

2 years agobxe(4): Mark sysctls and callout MP-safe.
Alexander Motin [Fri, 3 Sep 2021 16:25:32 +0000 (12:25 -0400)]
bxe(4): Mark sysctls and callout MP-safe.

MFC after: 1 month

(cherry picked from commit 4081c895e5ce28d3b0e672055271c8d7cc31cc1f)

2 years agomge(4): Mark sysctls and callout MP-safe.
Alexander Motin [Fri, 3 Sep 2021 16:13:56 +0000 (12:13 -0400)]
mge(4): Mark sysctls and callout MP-safe.

MFC after: 1 month

(cherry picked from commit 6b2ff27cb952048527ba13023a8354112fe1d410)

2 years agonfscl: Add vfs.nfs.maxalloclen to limit Allocate RPC RTT
Rick Macklem [Thu, 16 Sep 2021 00:29:45 +0000 (17:29 -0700)]
nfscl: Add vfs.nfs.maxalloclen to limit Allocate RPC RTT

Unlike Copy, the NFSv4.2 Allocate operation does not
allow a reply with partial completion.  As such, the only way to
limit the time the operation takes to provide a reasonable RPC RTT
is to limit the size of the allocation in the NFSv4.2
client.

This patch adds a sysctl called vfs.nfs.maxalloclen to set
the limit on the size of the Allocate operation.
There is no way to know how long a server will take to do an
allocate operation, but 64Mbytes results in a reasonable
RPC RTT for the slow hardware I test on, so that is what
the default value for vfs.nfs.maxalloclen is set to.

For an 8Gbyte allocation, the elapsed time for doing it in 64Mbyte
chunks was the same as the elapsed time taken for a single large
allocation operation for a FreeBSD server with a UFS file system.

(cherry picked from commit 9ebe4b8c67bf823e62617ba9fbd3c9c1768c8b3b)

2 years agoUPDATING: Add entry for commit a599f9f7620b
Rick Macklem [Sun, 3 Oct 2021 22:54:33 +0000 (15:54 -0700)]
UPDATING: Add entry for commit a599f9f7620b

2 years agoparam.h: Bump __FreeBSD_version for commit a599f9f7620b
Rick Macklem [Sun, 3 Oct 2021 22:50:46 +0000 (15:50 -0700)]
param.h: Bump __FreeBSD_version for commit a599f9f7620b

Commit a599f9f7620b deleted the variable called nfs_maxcopyrange
from nfscommon.ko, since it no longer needs to be global.  As such,
the other nfs modules must be rebuilt from up to date sources.
Bump __FreeBSD_version to 1300516.

2 years agonfscl: Make vfs.nfs.maxcopyrange larger by default
Rick Macklem [Sat, 11 Sep 2021 22:36:32 +0000 (15:36 -0700)]
nfscl: Make vfs.nfs.maxcopyrange larger by default

As of commit 103b207536f9, the NFSv4.2 server will limit the size
of a Copy operation based upon a 1 second timeout.  The Linux 5.2
kernel server also limits Copy operation size to 4Mbytes.
As such, the NFSv4.2 client can attempt a large Copy without
resulting in a long RPC RTT for these servers.

This patch changes vfs.nfs.maxcopyrange to 64bits and sets
the default to the maximum possible size of SSIZE_MAX, since
a larger size makes the Copy operation more efficient and
allows for copying to complete with fewer RPCs.
The sysctl may be need to be made smaller for other non-FreeBSD
NFSv4.2 servers.

(cherry picked from commit 55089ef4f8bb7c4d18ee964b4214024e35ae4b0e)

2 years agocmp: add -b, --print-bytes
Kyle Evans [Thu, 23 Sep 2021 05:46:30 +0000 (00:46 -0500)]
cmp: add -b, --print-bytes

This is compatible with GNU cmp.

Reviewed by: bapt, markj (earlier version)
Sponsored by: Klara, Inc.

(cherry picked from commit f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac)

2 years agocmp: add -i, --ignore-initial, an alternative to skip1/skip2 args
Kyle Evans [Thu, 23 Sep 2021 05:43:32 +0000 (00:43 -0500)]
cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.

(cherry picked from commit 8d546b6832eea031f95f30eaec3232ec1256a281)