]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
20 months agoRename the arm64 pmap_invalidate_* functions
Andrew Turner [Mon, 7 Nov 2022 13:34:30 +0000 (13:34 +0000)]
Rename the arm64 pmap_invalidate_* functions

These all work on stage 1 tables. Rename them so we can add similar
functions that operate on stage 2 tables.

Reviewed by: alc, markj, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37302

20 months agoDisable superpage use for stage 2 arm64 mappings
Andrew Turner [Mon, 7 Nov 2022 11:21:42 +0000 (11:21 +0000)]
Disable superpage use for stage 2 arm64 mappings

When modifying a stage 2 mapping we may need to call into the
hypervisor to invalidate the TLB. Until it is known if the cost of
this operation is less than the performance gains superpages offers
disable their use.

Reviewed by: kib. markj
Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37299

20 months agoRevert "Check alignment of fp in unwind_frame"
Andrew Turner [Tue, 15 Nov 2022 12:32:59 +0000 (12:32 +0000)]
Revert "Check alignment of fp in unwind_frame"

Fix the build as is_aligned doesn't exist in FreeBSD.

This reverts commit 40e0fa10f58d90744c2857b57adf0ddbce1a1e1c.

20 months agopfsync: fix memory leak
Kristof Provost [Tue, 15 Nov 2022 11:11:32 +0000 (12:11 +0100)]
pfsync: fix memory leak

The recent refactoring to prepare for pfsync over IPv6 introduced a
memory leak.
If we don't have a sync peer configured we return early (without sending
out a packet), but failed to free the newly allocated packet.

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agoproc: retire 2 unused lock annotations
Mateusz Guzik [Tue, 15 Nov 2022 10:50:39 +0000 (10:50 +0000)]
proc: retire 2 unused lock annotations

20 months agoif_ovpn: pass control packets through the socket
Kristof Provost [Wed, 9 Nov 2022 13:48:05 +0000 (14:48 +0100)]
if_ovpn: pass control packets through the socket

Rather than passing control packets through the ioctl interface allow
them to pass through the normal UDP socket flow.
This simplifies both kernel and userspace, and matches the approach
taken (or the one that will be taken) on the Linux side of things.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37317

20 months agosendmail: remove leftovers from mta_start_script and rc.sendmail
Baptiste Daroussin [Tue, 15 Nov 2022 08:08:07 +0000 (09:08 +0100)]
sendmail: remove leftovers from mta_start_script and rc.sendmail

Switch /etc/mail/Makefile to use /etc/rc.d/sendmail instead of
/etc/rc.sendmail this switch should have been done 20 years ago.

While here update the documentation to not refer anymore to
mta_start_script

Reported by: Jose Luis Duran <jlduran@gmail.com>

20 months agobhyve: add basl support for pointers
Corvin Köhne [Wed, 6 Apr 2022 09:10:39 +0000 (11:10 +0200)]
bhyve: add basl support for pointers

Some ACPI tables like XSDT contain pointers to other ACPI tables. When
an ACPI table is loaded by qemu's loader, the address in the guest
memory is unknown. For that reason, the qemu loader supports patching
those pointers. Basl keeps track of all pointers and causes the qemu
loader to patch all pointers.

The qemu ACPI table loader is unsupport yet. However, in a future commit
bhyve will use dynamic ACPI table offsets based on the size and
alignment requirements of each ACPI table. Therefore, tracking ACPI
table pointer is required too.

Reviewed by: jhb
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36991

20 months agobhyve: add basl support for checksums
Corvin Köhne [Wed, 6 Apr 2022 09:10:39 +0000 (11:10 +0200)]
bhyve: add basl support for checksums

The qemu ACPI table loader patches the ACPI tables. After patching them,
checksums aren't correct any more. It has to calculate a new checksum
for the ACPI table. For that reason, basl has to keep track of checksums
and has to cause the qemu loader to create new checksums for the tables.

The qemu ACPI table loader isn't supported yet. However, the address of
all tables is unknown as long as bhyve hasn't finished ACPI table
creation. So, the checksum of tables which include pointer to other
tables are unknown too. This requires tracking of checksums too.

Reviewed by: jhb
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36990

20 months agobhyve: add basl support for length fields
Corvin Köhne [Wed, 6 Apr 2022 09:10:39 +0000 (11:10 +0200)]
bhyve: add basl support for length fields

ACPI tables have different layouts. So, there's no common position for
the length field. When tables are build by basl, the length is unknown
at the beginning. It has to be set after building the table.

Reviewed by: jhb
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36989

20 months agobhyve: add basl support for generic addresses
Corvin Köhne [Fri, 4 Nov 2022 13:30:53 +0000 (14:30 +0100)]
bhyve: add basl support for generic addresses

In upcoming commits, bhyve will build some ACPI tables by it's own.
Therefore, it should be capable of appending GENERIC_ADDRESS structs to
ACPI tables.

Reviewed by: jhb, markj
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36988

20 months agobhyve: add basl support for int values
Corvin Köhne [Fri, 4 Nov 2022 12:48:13 +0000 (13:48 +0100)]
bhyve: add basl support for int values

In upcoming commits, bhyve will build some ACPI tables by it's own.
Therefore, it should be capable of appending int values to ACPI tables.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36987

20 months agobhyve: use basl to load ACPI tables
Corvin Köhne [Fri, 4 Nov 2022 11:30:37 +0000 (12:30 +0100)]
bhyve: use basl to load ACPI tables

Load the blobs compiled by iasl into a basl_table. The basl_table is a
temporary buffer which copies the ACPI tables into guest memory for us.
This allows us in the future to pass the blobs over the qemu fwcfg
interface to the guest.

Reviewed by: jhb, markj
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36986

20 months agobhyve: add table dump functions for basl
Corvin Köhne [Fri, 4 Nov 2022 11:26:34 +0000 (12:26 +0100)]
bhyve: add table dump functions for basl

Developing an ACPI table compiler isn't quite easy. It's helpful if you
can take a look at the ACPI tables created by the compiler.

The dump functions can either dump a ACPI table which was copied into
guest memory or a ACPI table provided for qemu's ACPI table loader.

Reviewed by: jhb, markj
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36985

20 months agobhyve: add basic basl implementation
Corvin Köhne [Fri, 4 Nov 2022 11:24:49 +0000 (12:24 +0100)]
bhyve: add basic basl implementation

Basl is the bhyve ASL compiler. At the moment, it's just a small wrapper
to call iasl, the Intel ASL compiler. As bhyve will gain support for
qemu's ACPI table loader in the future, it has to create ACPI tables on
it's own. Therefore, it makes sense to create a new file which keeps the
code for basl.

This first implementation of basl supports creating an ACPI table by
appending raw bytes to it. It's also capable of loading all tables into
guest memory.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36984

20 months agobhyve/kdblayout: add some missing keys to german layout
Corvin Köhne [Tue, 15 Nov 2022 06:46:09 +0000 (07:46 +0100)]
bhyve/kdblayout: add some missing keys to german layout

The '/' and '§' keys are missing in the german keyboard layout.

Reviewed by: markj
Approved by: manu (mentor)
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37386

20 months agobhyve: nvme controller obey async event setting when reporting critical temperature
Wanpeng Qian [Mon, 14 Nov 2022 13:08:52 +0000 (14:08 +0100)]
bhyve: nvme controller obey async event setting when reporting critical temperature

Async event report is controlled by async event configuration feature
setting. When reporting a critical temperature warning, check the async
event configuration.

Approved by: manu (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37355

20 months agobhyve: return FEATURE_NOT_CHANGEABLE for unimplemented feature of NVMe controller
Wanpeng Qian [Mon, 14 Nov 2022 13:06:34 +0000 (14:06 +0100)]
bhyve: return FEATURE_NOT_CHANGEABLE for unimplemented feature of NVMe controller

Set Feature is a feature specified function. Currently only some
features have the set procedure. For features that are not handled by
the controller, we should return a FEATURE_NOT_CHANGEABLE error message.

Approved by: manu (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32802

20 months agobhyve: abort and return FEATURE_NOT_SAVEABLE while set feature with a save flag for...
Wanpeng Qian [Mon, 14 Nov 2022 13:02:44 +0000 (14:02 +0100)]
bhyve: abort and return FEATURE_NOT_SAVEABLE while set feature with a save flag for NVMe controller.

Currently bhyve's NVMe controller cannot save feature values cross
reboot. It should return a FEATURE_NOT_SAVEABLE error when the command
specifies a save flag.

Quote from NVMe specification, page 205:

https://nvmexpress.org/wp-content/uploads/NVM-Express-1_4-2019.06.10-Ratified.pdf

If the Feature Identifier specified in the Set Features command is not
saveable by the controller and the controller receives a Set Features
command with the Save bit set to one, then the command shall be aborted
with a status of Feature Identifier Not Saveable.

Reviewed by: chuck (older version)
Approved by: manu (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32767

20 months agonvmecontrol: Fix condition when print number of Firmware Slots and Firmware Slot1...
Wanpeng Qian [Mon, 14 Nov 2022 12:59:11 +0000 (13:59 +0100)]
nvmecontrol: Fix condition when print number of Firmware Slots and Firmware Slot1 Readonly.

The Number of Firmware Slots should never be zero. So, a Firmware Slot 1
should always exist. For that reason, always print the Number of
Firmware Slots and the Firmware Slot 1 Read-Only value.

Reviewed by: imp
Approved by: manu (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34700

20 months agoCheck alignment of fp in unwind_frame
Dapeng Gao [Tue, 15 Nov 2022 00:21:38 +0000 (00:21 +0000)]
Check alignment of fp in unwind_frame

A misaligned frame pointer is certainly not a valid frame pointer and
with strict alignment enabled (as on CHERI) can cause panics when it is
loaded from later in the code.

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

20 months agossh: remove VersionAddendum from list of client side config changes
Ed Maste [Mon, 14 Nov 2022 20:28:51 +0000 (15:28 -0500)]
ssh: remove VersionAddendum from list of client side config changes

Fixes: bffe60ead024 ("ssh: retire client VersionAddendum")
Sponsored by: The FreeBSD Foundation

20 months agobhyve: Simplify control flow in the xhci device model
Mark Johnston [Mon, 14 Nov 2022 20:08:45 +0000 (15:08 -0500)]
bhyve: Simplify control flow in the xhci device model

We only need to call pci_xhci_xfer_complete() when handling a transfer
to the control endpoint, so move that code into the epid == 1 block and
eliminate a goto.  Also remove an unneeded reinitialization of
setup_trb.

No functional change intended.

MFC after: 1 week
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37287

20 months agovirtio: Silence a -Wunused warning
Mark Johnston [Mon, 14 Nov 2022 20:07:34 +0000 (15:07 -0500)]
virtio: Silence a -Wunused warning

Remove virtio_swap_endian().  htole*() are nops on little-endian
platforms.  No functional change intended.

MFC after: 1 week
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37298

20 months agodhclient(8): Verify lease-, renewal- and rebinding-time option sizes.
Hans Petter Selasky [Mon, 14 Nov 2022 14:20:09 +0000 (15:20 +0100)]
dhclient(8): Verify lease-, renewal- and rebinding-time option sizes.

Else out-of-bound reads and undefined behaviour may happen.
The current code only checked for the presence of the first of four bytes.
Make sure the fields in question have the minium size required.

No functional change intended.

Reviewed by: rrs@
MFC after: 1 week
Sponsored by: NVIDIA Networking

20 months agobhyve: Fix a typo in a comment
Mark Johnston [Mon, 14 Nov 2022 14:00:06 +0000 (09:00 -0500)]
bhyve: Fix a typo in a comment

Reported by: Mikaël Urankar <mikael.urankar@mailo.fr>
Fixes: 719e307f80c7 ("bhyve: Cast away const when fetching a config nvlist")

20 months agoipfw: Spell PFIL_PASS correctly.
Dag-Erling Smørgrav [Sat, 12 Nov 2022 13:20:06 +0000 (14:20 +0100)]
ipfw: Spell PFIL_PASS correctly.

Sponsored by: Netapp
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37375

20 months agostress2: Added a new SU+J + snapshot test scenario
Peter Holm [Mon, 14 Nov 2022 11:03:57 +0000 (12:03 +0100)]
stress2: Added a new SU+J + snapshot test scenario

20 months agostress2: Exclude two "forced detach" tests and two SUJ + snapshot tests
Peter Holm [Mon, 14 Nov 2022 11:01:30 +0000 (12:01 +0100)]
stress2: Exclude two "forced detach" tests and two SUJ + snapshot tests

20 months agoif_ovpn: ensure we're in vnet context when calling sorele()
Kristof Provost [Thu, 10 Nov 2022 12:54:09 +0000 (13:54 +0100)]
if_ovpn: ensure we're in vnet context when calling sorele()

We reference count to ensure we don't release the socket while we still
have data in flight. That means that we can end up releasing the socket
from ovpn_encrypt_tx_cb().

We must have a vnet context set when calling sorele() (which asserts
this from within sofree()), so move the CURVNET_SET()/CURVNET_RESTORE()
to ensure this is the case.

While here also add a couple of assertions to make this more obvious,
and to ease future debugging.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37326

20 months agoRELNOTE: Document the removal of mta_start_script and othermta
Baptiste Daroussin [Mon, 14 Nov 2022 08:12:33 +0000 (09:12 +0100)]
RELNOTE: Document the removal of mta_start_script and othermta

20 months agoothermta: remove leftover from 20 years ago
Baptiste Daroussin [Mon, 14 Nov 2022 08:06:10 +0000 (09:06 +0100)]
othermta: remove leftover from 20 years ago

othermta (along with mta_start_script configuration entry in rc.conf)
was a mechanism used to be able to run another mta than sendmail(8) before
"rcng" time 20 years ago.

othermta has not been used since.

20 months agognu diff3: apply patch to committed src, rather than at build time
Ed Maste [Fri, 11 Nov 2022 19:48:40 +0000 (14:48 -0500)]
gnu diff3: apply patch to committed src, rather than at build time

This appears to be a leftover from the time we used a less-capable VCS.

Reviewed by: delphij
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37368

20 months agorpcb_clnt.c: Do not force use of UDP
Rick Macklem [Sun, 13 Nov 2022 20:16:06 +0000 (12:16 -0800)]
rpcb_clnt.c: Do not force use of UDP

Without this patch, the code in the rpcbind client forces
the use of UDP.  A comment notes that some rpcbind servers
only support UDP.  This makes NFSv3 mounts to Azure servers
impossible, since they require use of TCP for rpcbind.
Since the comment is very old (imported from NetBSD in 2001)
and I do not believe any UDP only rpcbind servers will
still exist, this patch comments out the code that forces
use of UDP, so that NFSv3 mounts to Azure servers can work.

For an NFSv3 mount, the "udp" mount option will still
make mount_nfs use UDP for rpcbind so that can be used
as a workaround for any old NFSv3 server that only
supports rpcbind over UDP (if any such server still exists).

I asked if doing this change is appropriate on freebsd-fs@
and I only got one reply (off list) that supported doing
the change.

PR: 267301
MFC after: 1 month

20 months agostress2: Added a tmpfs regression test for Bug 223015
Peter Holm [Sun, 13 Nov 2022 09:15:21 +0000 (10:15 +0100)]
stress2: Added a tmpfs regression test for Bug 223015

20 months agostress2: Added more "mdconfig -o force" tests
Peter Holm [Sun, 13 Nov 2022 09:05:35 +0000 (10:05 +0100)]
stress2:  Added more "mdconfig -o force" tests

20 months agostress2: Snapshots of SU+J has been enabled
Peter Holm [Sun, 13 Nov 2022 08:58:29 +0000 (09:58 +0100)]
stress2: Snapshots of SU+J has been enabled

20 months agoEnable taking snapshots on UFS/FFS filesystems using journaled soft updates.
Kirk McKusick [Sun, 13 Nov 2022 06:56:03 +0000 (22:56 -0800)]
Enable taking snapshots on UFS/FFS filesystems using journaled soft updates.

All the needed infrastructure updates have been made to allow
snapshots to be taken on UFS/FFS filesystems that are using journaled
soft updates. The most immediate benefit is the ability to use a
snapshot to take a consistent filesystem dump on a live filesystem
using the -L option to dump(8).

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

20 months agoFix for tunefs(8) unable to add a UFS/FFS soft update journal.
Kirk McKusick [Sat, 12 Nov 2022 23:36:07 +0000 (15:36 -0800)]
Fix for tunefs(8) unable to add a UFS/FFS soft update journal.

The reported bug is UFS: bad file descriptor: soft update journaling
can not be enabled on some FreeBSD-provided disk images – failed
to write updated cg.

The UFS library (libufs(3)) failed to reopen its disk descriptor
when first attempting to update a cylinder group. The error only
occurred when trying to add journaling to a filesystem whose first
cylinder group was too full to hold the journal.

PR:           259090
MFC after:    1 week
Sponsored by: The FreeBSD Foundation

20 months agovipw.8: Add a FILES section
Gordon Bergling [Sat, 12 Nov 2022 11:56:29 +0000 (12:56 +0100)]
vipw.8: Add a FILES section

Mention passwd related files in the FILES section
of vipw(8).

Obtained from: OpenBSD
MFC after: 3 days

20 months agoascii.7: Add full names of the control character set
Gordon Bergling [Sat, 12 Nov 2022 11:22:22 +0000 (12:22 +0100)]
ascii.7: Add full names of the control character set

Extent the manual page by the full names of the
control character set.

Obtained from: NetBSD
MFC after: 3 days

20 months agoktls: Inline ktls_cleanup() into ktls_destroy().
John Baldwin [Sat, 12 Nov 2022 00:01:02 +0000 (16:01 -0800)]
ktls: Inline ktls_cleanup() into ktls_destroy().

Reviewed by: gallatin, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37353

20 months agoktls: Don't leak ktls session objects for certain errors.
John Baldwin [Sat, 12 Nov 2022 00:00:37 +0000 (16:00 -0800)]
ktls: Don't leak ktls session objects for certain errors.

ktls_cleanup() does not free ktls session objects, it merely
cleans (and frees) members of the object.

Change callers to use ktls_free() instead.

Reviewed by: gallatin, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37352

20 months agowg: Drop the compat shim for sbcreatecontrol().
John Baldwin [Fri, 11 Nov 2022 22:18:48 +0000 (14:18 -0800)]
wg: Drop the compat shim for sbcreatecontrol().

I had to make a few other changes when merging the driver to stable/13
anyway, so adjusting this as well isn't really a big deal.

MFC after: 3 days

20 months agowg.4: Update first appeared release to 13.2.
John Baldwin [Fri, 11 Nov 2022 22:11:33 +0000 (14:11 -0800)]
wg.4: Update first appeared release to 13.2.

MFC after: 3 days

20 months agorc: add a manual entry for ${name}_setup
Franco Fichtner [Fri, 11 Nov 2022 21:20:13 +0000 (22:20 +0100)]
rc: add a manual entry for ${name}_setup

${name}_prepend is suboptimal as it is prepended to the actual
command being run. Therefore the term "commandS to prepend"
is misleading and no clear separation takes place for setup tasks
that may be required like changing a config file permission or
generating a configuration file prior to service start.

The other reason is that {argument}_precmd is a service-side
variable and cannot be repurposed from the user-side.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D36210

20 months agozfs tests: stop writing to arbitrary devices
Eric van Gyzen [Thu, 3 Nov 2022 02:42:54 +0000 (21:42 -0500)]
zfs tests: stop writing to arbitrary devices

TL;DR:  Three ZFS tests created ZFS pools on all unmounted devices listed
in /etc/fstab, corrupting their contents.  Stop that.

Imagine my surprise when the ESP on my main dev/test VM would "randomly"
become corrupted, making it unbootable.  Three tests collect various devices
from the system and try to add them to a test pool.  The test expects this
to fail because it _assumes_ these devices are in use and ZFS will correctly
reject the request.

My /etc/fstab has two entries for devices in /dev:

    /dev/gpt/swap0  none        swap    sw,trimonce,late
    /dev/gpt/esp0   /boot/efi   msdosfs rw,noauto

Note the `noauto` on the ESP.  In a remarkable example of irony, I chose
this because it should keep the ESP more protected from corruption;
in fact, mounting it would have protected it from this case.

The tests added all of these devices to a test pool in a _single command_,
expecting the command to fail.  The swap device was in use, so the command
correctly failed, but the ESP was added and therefore corrupted.  However,
since the command correctly failed, the test didn't notice the ESP problem.
If each device had been added with its own command, the test _might_ have
noticed that one of them incorrectly succeeded.  However, two of these
tests would not have noticed:

hotspare_create_001_neg was incorrectly specified as needing the Solaris
dumpadm command, so it was skipped.  _Some_ of the test needs that command,
but it checks for its presence and runs fine without it.

Due to bug 241070, zpool_add_005_pos was marked as an expected failure.
Due to the coarse level of integration with ATF, this test would still
"pass" even if it failed for the wrong reason.  I wrote bug 267554 to
reconsider the use of atf_expect_fail in these tests.

Let's further consider the use of various devices found around the system.
In addition to devices in /etc/fstab, the tests also used mounted devices
listed by the `mount` command.  If ZFS behaves correctly, it will refuse
to added mounted devices and swap devices to a pool.  However, these are
unit tests used by developers to ensure that ZFS still works after they
modify it, so it's reasonable to expect ZFS to do the _wrong_ thing
sometimes.  Using random host devices is unsafe.

Fix the root problem by using only the disks provided via the "disks"
variable in kyua.conf.  Use one to create a UFS file system and mount it.
Use another as a swap device.  Use a third as a dump device, but expect
it to fail due to bug 241070.

While I'm here:

Due to commit 6b6e2954dd65, we can simply add a second dump device and
remove it in cleanup.  We no longer need to save, replace, and restore the
pre-existing dump device.

The cleanup_devices function used `camcontrol inquiry` to distinguish disks
from other devices, such as partitions.  That works fine for SCSI, but not
for ATA or VirtIO block.  Use `geom disk list` instead.

PR: 241070
PR: 267554
Reviewed by: asomers
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D37257

20 months agolinuxkpi: Define `ZERO_OR_NULL_PTR()` in <linux/slab.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 20:03:25 +0000 (21:03 +0100)]
linuxkpi: Define `ZERO_OR_NULL_PTR()` in <linux/slab.h>

On Linux, the `kmalloc()` family of functions returns a special value if
the size of the allocation is zero. This macro verifies if the pointer
is NULL (the allocation failed) or the size is 0 (the allocation was not
performed AFAIU). This special value can be passed to `kfree()`.

On FreeBSD, our `malloc(9)` functions don't return a special value for
0-size allocations. Therefore we can simply compare the result against
NULL.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37367

20 months agolinuxkpi: Define `pci_reset_function()` in <linux/pci.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 20:00:36 +0000 (21:00 +0100)]
linuxkpi: Define `pci_reset_function()` in <linux/pci.h>

Currently, it always returns an error on FreeBSD.

Reviewed by: bz manu
Approved by: bz manu
Differential Revision: https://reviews.freebsd.org/D37366

20 months agolinuxkpi: Include <linux/list.h> and <linux/kernel.h> from <linux/mutex.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 19:59:40 +0000 (20:59 +0100)]
linuxkpi: Include <linux/list.h> and <linux/kernel.h> from <linux/mutex.h>

They are not really used in this header. However they are included in
Linux and at least the DRM drivers unfortunately rely on this namespace
pollution.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37365

20 months agolinuxkpi: Add <linux/mman.h> which includes <linux/smp.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 19:57:46 +0000 (20:57 +0100)]
linuxkpi: Add <linux/mman.h> which includes <linux/smp.h>

This is used by `i915_gem.c` in the i915 DRM driver to get access to
`wbinvd_on_all_cpus()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36970

20 months agolinuxkpi: Add <linux/page-flags.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 19:56:42 +0000 (20:56 +0100)]
linuxkpi: Add <linux/page-flags.h>

It just provides a `PageHighMem()` macro stub.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36961

20 months agoarm64: add a spin-table implementation for Apple Silicon
Kyle Evans [Fri, 11 Nov 2022 19:50:29 +0000 (13:50 -0600)]
arm64: add a spin-table implementation for Apple Silicon

The M1 has no EL3, so we're limited to a spin-table implementation if we
want to eventually use bhyve on it.  Implement spin-table now, but note
that we still prefer PSCI where possible.

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D34661

20 months agonvmecontrol: fix wrong temperature unit for INTEL SSDs.
Wanpeng Qian [Fri, 11 Nov 2022 19:13:06 +0000 (12:13 -0700)]
nvmecontrol: fix wrong temperature unit for INTEL SSDs.

Although intel's specification did not tell which unit for Temperature
Statistics (Log Identifier C5h), I believe it is based on Celsius
instead of Kelvin.

here is my P3700 SSDs result(before):

Intel Temperature Log
=====================
Current:                        30 K, -243.15 C, -405.67 F
Overtemp Last Flags             0
Overtemp Lifetime Flags         0
Max Temperature                 53 K, -220.15 C, -364.27 F
Min Temperature                 17 K, -256.15 C, -429.07 F
Max Operating Temperature       63 K, -210.15 C, -346.27 F
Min Operating Temperature       0 K, -273.15 C, -459.67 F
Estimated Temperature Offset:   0 C/K
after apply the patch, result is

Intel Temperature Log
=====================
Current:                        303.15 K, 30 C, 86.00 F
Overtemp Last Flags             0
Overtemp Lifetime Flags         0
Max Temperature                 326.15 K, 53 C, 127.40 F
Min Temperature                 290.15 K, 17 C, 62.60 F
Max Operating Temperature       336.15 K, 63 C, 145.40 F
Min Operating Temperature       273.15 K, 0 C, 32.00 F
Estimated Temperature Offset:   0 C/K
I also compare to smartctl's report. it match very well.

also tested on Intel P3600, it fixed the problem.

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Reviewed by: imp (added tweak to samsung.c so it still compiles)
Differential Revision: https://reviews.freebsd.org/D32845

20 months agoFix arc_p aggressive increase
shodanshok [Fri, 11 Nov 2022 18:41:36 +0000 (19:41 +0100)]
Fix arc_p aggressive increase

The original ARC paper called for an initial 50/50 MRU/MFU split
and this is accounted in various places where arc_p = arc_c >> 1,
with further adjustment based on ghost lists size/hit. However, in
current code both arc_adapt() and arc_get_data_impl() aggressively
grow arc_p until arc_c is reached, causing unneeded pressure on
MFU and greatly reducing its scan-resistance until ghost list
adjustments kick in.

This patch restores the original behavior of initially having arc_p
as 1/2 of total ARC, without preventing MRU to use up to 100% total
ARC when MFU is empty.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Gionatan Danti <g.danti@assyoma.it>
Closes #14137
Closes #14120

20 months agoddb: don't limit pindex output in 'show vmopag'
Mitchell Horne [Fri, 11 Nov 2022 18:23:11 +0000 (14:23 -0400)]
ddb: don't limit pindex output in 'show vmopag'

This command already prints a tremendous amount of output, and properly
obeys the pager. It no longer makes sense to arbitrarily limit the pages
that are printed, as the reader will not be aware that this has
happened.

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

20 months agoddb(4): document some missing commands
Mitchell Horne [Fri, 11 Nov 2022 18:22:29 +0000 (14:22 -0400)]
ddb(4): document some missing commands

This is not exhaustive, just what I collected while working on
mac_ddb(4).

Reviewed by: pauamma, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation (in part)
Differential Revision: https://reviews.freebsd.org/D37333

20 months agoddb(4): misc updates
Mitchell Horne [Fri, 11 Nov 2022 18:21:29 +0000 (14:21 -0400)]
ddb(4): misc updates

 - Describe optional 'addr' argument to many show commands
 - Remove obsolete commands (show cbstat)
 - 'show jails' was renamed to 'show prison'
 - Remove superfluous commentary about sleepqueues
 - Fix an xref to gdb(4)
 - Fix issues reported by mandoc -Tlint
 - Plus a couple other inaccuracies/inconsistencies

Reviewed by: pauamma, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation (in part)
Differential Revision: https://reviews.freebsd.org/D37332

20 months agonetdump(4): document all kernel options required
Mitchell Horne [Fri, 11 Nov 2022 18:20:58 +0000 (14:20 -0400)]
netdump(4): document all kernel options required

This means INET and DEBUGNET in addition to NETDUMP.

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

20 months agonetgdb(4): update list of required kernel options
Mitchell Horne [Fri, 11 Nov 2022 18:20:31 +0000 (14:20 -0400)]
netgdb(4): update list of required kernel options

The man page claims that netgdb will be enabled automatically with the
presence of the DDB, GDB, and INET options. Based on the logic in
conf/files, this is not the case. Update the manpage to list all
of the options required to include netgdb.

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

20 months agolinuxkpi: Define `boot_cpu_data.x86_max_cores`
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:43:07 +0000 (18:43 +0100)]
linuxkpi: Define `boot_cpu_data.x86_max_cores`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36971

20 months agolinuxkpi: Add `dev_warn_once()` in <linux/device.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:42:31 +0000 (18:42 +0100)]
linuxkpi: Add `dev_warn_once()` in <linux/device.h>

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36968

20 months agolinuxkpi: Add `list_for_each_entry_from_rcu()` in <linux/rculist.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:42:10 +0000 (18:42 +0100)]
linuxkpi: Add `list_for_each_entry_from_rcu()` in <linux/rculist.h>

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36967

20 months agolinuxkpi: Define `typeof_member()` in <linux/kernel.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:41:36 +0000 (18:41 +0100)]
linuxkpi: Define `typeof_member()` in <linux/kernel.h>

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36964

20 months agolinuxkpi: Add <linux/dma-buf-map.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:40:57 +0000 (18:40 +0100)]
linuxkpi: Add <linux/dma-buf-map.h>

I took the implementation from OpenBSD, commit
d55ef580b1748517027c3eabdb715316ca5b1442.

The only difference is the addition of `dma_buf_map_is_equal()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36963

20 months agolinuxkpi: Add <linux/mmzone.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:39:48 +0000 (18:39 +0100)]
linuxkpi: Add <linux/mmzone.h>

It provides the `MAX_ORDER` constant.

Reviewed by: emaste manu
Approved by: emaste manu
Differential Revision: https://reviews.freebsd.org/D36962

20 months agolinuxkpi: Add <acpi/actbl.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:38:06 +0000 (18:38 +0100)]
linuxkpi: Add <acpi/actbl.h>

It simply includes the same header in FreeBSD (which is located
elsewhere).

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36960

20 months agolinuxkpi: Add `krealloc_array()`
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:37:34 +0000 (18:37 +0100)]
linuxkpi: Add `krealloc_array()`

In FreeBSD, this is a wrapper on top of `realloc()`.

V2: Check if `n * size` would overflow and return `NULL` if that's the
    case. Suggested by hselasky@ and emaste@.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36959

20 months agolinuxkpi: Introduce module_param() of type `hexint`
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:36:46 +0000 (18:36 +0100)]
linuxkpi: Introduce module_param() of type `hexint`

In Linux, this affects how the value is formatted. In FreeBSD, this
remains an unsigned integer.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36958

20 months agolinuxkpi: Introduce `vma_set_file()`
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:36:00 +0000 (18:36 +0100)]
linuxkpi: Introduce `vma_set_file()`

This code was moved from the i915 driver in Linux 5.11.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36957

20 months agolinuxkpi: Include <linux/shinker.h> in <linux/mm.h>
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:34:19 +0000 (18:34 +0100)]
linuxkpi: Include <linux/shinker.h> in <linux/mm.h>

This is done like this in Linux.

Reviewed by: emaste manu
Approved by: emaste manu
Differential Revision: https://reviews.freebsd.org/D36956

20 months agolinuxkpi: Update `struct irq_work`
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:32:58 +0000 (18:32 +0100)]
linuxkpi: Update `struct irq_work`

The previous `llnode` field is moved inside another field `node`.

This `node` field is a `struct __call_single_node` in Linux. Here, we
simply add an anonymous struct with the `llnode` field inside. That
field's new name is `llist` now.

V2: Use an anonymous union to keep the structure backward compatible
    with drivers using the previous `llnode` field. This was suggested
    by wufl@ and hselasky@. Thank you!

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36955

20 months agolinuxkpi: Add `__GFP_NOMEMALLOC` kmalloc flag
Jean-Sébastien Pédron [Fri, 11 Nov 2022 17:30:31 +0000 (18:30 +0100)]
linuxkpi: Add `__GFP_NOMEMALLOC` kmalloc flag

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36954

20 months agoRemove dead code in the cscope target
Konrad Witaszczyk [Wed, 31 Aug 2022 10:57:50 +0000 (10:57 +0000)]
Remove dead code in the cscope target

arm64 is the only currently supported architecture that has
${MACHINE_CPUARCH} set to a different value (aarch64) than ${MACHINE}
(arm64), as described in arch(7). However, there is no source directory
associated with arm64 that has a name set to ${MACHINE_CPUARCH}.

Remove the dead code that adds a directory with a name set to
${MACHINE_CPUARCH} to a list of directories indexed with cscope.
This change allows to use the cscope target on arm64.

Discussed with: jhb
Reviewed by: imp jhb
Approved by: oshogbo (mentor)
Differential Revision: https://reviews.freebsd.org/D36402

20 months agolib/libsecureboot: Fix some typos
Elyes HAOUAS [Mon, 22 Mar 2021 17:16:06 +0000 (18:16 +0100)]
lib/libsecureboot: Fix some typos

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/544

20 months agobhyve: Cast away const when fetching a config nvlist
Mark Johnston [Fri, 11 Nov 2022 15:02:42 +0000 (10:02 -0500)]
bhyve: Cast away const when fetching a config nvlist

Silence a warning from the compiler about "const" being discarded.  The
warning is correct: nvlist values are supposed to be immutable.
However, fixing this properly will require some contortions on behalf of
consumers who look up a subtree of the config and modify it.  Per a
discussion on freebsd-virtualization@, the solution will probably be to
outright replace the use of nvlists for VM configuration, but until that
happens let's document the problem and silence the warning.

No functional change intended.

MFC after: 2 weeks
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37293

20 months agobhyve: Drop volatile qualifiers from snapshot code
Mark Johnston [Fri, 11 Nov 2022 15:02:26 +0000 (10:02 -0500)]
bhyve: Drop volatile qualifiers from snapshot code

They accomplish nothing since the qualifier is casted away in calls to
memcpy() and copyin()/copyout().  No functional change intended.

MFC after: 2 weeks
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37292

20 months agobhyve: Drop volatile qualifiers from virtio rings
Mark Johnston [Fri, 11 Nov 2022 15:02:10 +0000 (10:02 -0500)]
bhyve: Drop volatile qualifiers from virtio rings

The qualifiers are there presumably because these rings are mapped into
the guest, but they do not appear to be required for correctness, and
bhyve generally doesn't qualify accesses to guest memory this way.
Moreover, the qualifiers are discarded by snapshot code, causing clang
to emit warnings.  Just stop using volatile here.

MFC after: 2 weeks
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37291

20 months agobhyve: Drop volatile qualifiers from xhci hw struct fields
Mark Johnston [Fri, 11 Nov 2022 15:01:52 +0000 (10:01 -0500)]
bhyve: Drop volatile qualifiers from xhci hw struct fields

This fixes a warning raised by the removal of the volatile qualifier
from &trb->qwTrb0 in the following snippet:

xfer_block = usb_data_xfer_append(xfer,
     (void *)(trbflags & XHCI_TRB_3_IDT_BIT ?
 &trb->qwTrb0 : XHCI_GADDR(sc, trb->qwTrb0)),
     trb->dwTrb2 & 0x1FFFF, (void *)addr, ccs);

The use of volatile appears to be inherited from the kernel driver's
definitions of the same structures.  It makes some sense, since USB TRBs
and related structures live in guest memory, but bhyve device models
generally don't volatile-qualify accesses to guest memory and I can't
see how they are required for correctness here.  Moreover, XHCI_GADDR
does not return volatile pointers so we're already being inconsistent.
Just drop the qualifiers to address the warning.

MFC after: 2 weeks
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37290

20 months agobhyve: Define an accessor for net backend private data
Mark Johnston [Fri, 11 Nov 2022 15:01:40 +0000 (10:01 -0500)]
bhyve: Define an accessor for net backend private data

Use it to silence warnings about potential unaligned accesses.  No
functional change intended.

MFC after: 1 week
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37289

20 months agobhyve: Address warnings about potential unaligned accesses in fwctl.c
Mark Johnston [Fri, 11 Nov 2022 15:01:27 +0000 (10:01 -0500)]
bhyve: Address warnings about potential unaligned accesses in fwctl.c

This silences some warning about potential unaligned accesses.  No
functional change intended.

MFC after: 1 week
Reviewed by: corvink, jhb
Differential Revision: https://reviews.freebsd.org/D37288

20 months agonetpfil tests: add dummynet fq_codel test case
Kristof Provost [Fri, 11 Nov 2022 10:55:59 +0000 (11:55 +0100)]
netpfil tests: add dummynet fq_codel test case

fq_codel was broken due to a missing m_rcvif_serialize() in the enqueue
path.
Add a simple test case to ensure it at least passes traffic.

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agodummynet: fix codel
Kristof Provost [Wed, 9 Nov 2022 16:11:26 +0000 (17:11 +0100)]
dummynet: fix codel

Serialize rcvif when enqueing packets for codel. We already tried to
restore the serialized rcvif in fq_codel_extract_head(), but that
doesn't work when we fail to serialize it first, so we ended up dropping
all packets passed through codel.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37318

20 months agoif_ovpn tests: add aes-128-gcm test case
Kristof Provost [Fri, 11 Nov 2022 09:42:02 +0000 (10:42 +0100)]
if_ovpn tests: add aes-128-gcm test case

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agoif_ovpn: fix AES-128-GCM support
Kristof Provost [Fri, 11 Nov 2022 09:40:21 +0000 (10:40 +0100)]
if_ovpn: fix AES-128-GCM support

We need to explicitly list AES-128-GCM as an allowed cipher for that
mode to work. While here also add AES-192-GCM. That brings our supported
cipher list in line with other openvpn/dco platforms.

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agortld: add support for the $LIB token
Konstantin Belousov [Thu, 10 Nov 2022 16:35:00 +0000 (18:35 +0200)]
rtld: add support for the $LIB token

similar to the same token in glibc.

Requested and reviewed by: bapt
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37329

20 months agoFix a rk356x pinctrl register offset
Andrew Turner [Fri, 11 Nov 2022 08:25:57 +0000 (08:25 +0000)]
Fix a rk356x pinctrl register offset

The pull-up/pull-down register offset was wrong on the Rockchip rk356x.
It was set such that the driver would modify the IOMUX control registers.

This seems to work with the current device tree files, but fails with
upstream files. Fix the offset so the later calculation has the correct
offset for the pull-up/pull-down control register.

Sponsored by: The FreeBSD Foundation

20 months agoAdd ability to recompress send streams with new compression algorithm
Paul Dagnelie [Thu, 10 Nov 2022 23:23:46 +0000 (15:23 -0800)]
Add ability to recompress send streams with new compression algorithm

As new compression algorithms are added to ZFS, it could be useful for
people to recompress data with new algorithms. There is currently no
mechanism to do this aside from copying the data manually into a new
filesystem with the new algorithm enabled. This tool allows the
transformation to happen through zfs send, allowing it to be done
efficiently to remote systems and in an incremental fashion.

A new zstream command is added that decompresses WRITE records and
then recompresses them with a provided algorithm, and then re-emits
the modified send stream. It may also be possible to re-compress
embedded block pointers, but that was not attempted for the initial
version.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #14106

20 months agoZTS: random_readwrite test doesn't run correctly
John Wren Kennedy [Thu, 10 Nov 2022 22:00:04 +0000 (15:00 -0700)]
ZTS: random_readwrite test doesn't run correctly

This test uses fio's bssplit mechanism to choose io sizes for the test,
leaving the PERF_IOSIZES variable empty. Because that variable is
empty, the innermost loop in do_fio_run_impl is never executed, and as
a result, this test does the setup but collects no data. Setting the
variable to "bssplit" allows performance data to be gathered.

Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: John Wren Kennedy <john.kennedy@delphix.com>
Closes #14163

20 months agoCleanup: Suppress Coverity dereference before/after NULL check reports
Richard Yao [Thu, 10 Nov 2022 14:09:35 +0000 (09:09 -0500)]
Cleanup: Suppress Coverity dereference before/after NULL check reports

f224eddf922a33ca4b86d83148e9e6fa155fc290 began dereferencing a NULL
checked pointer in zpl_vap_init(), which made Coverity complain because
either the dereference is unsafe or the NULL check is unnecessary. Upon
inspection, this pointer is guaranteed to never be NULL because it is
from the Linux kernel VFS. The calls into ZFS simply would not make
sense if this pointer were NULL, so the NULL check is unnecessary.

Reported-by: Coverity (CID 1527260)
Reported-by: Coverity (CID 1527262)
Reviewed-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com>
Reviewed-by: Youzhong Yang <yyang@mathworks.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14170

20 months agoFix potential NULL pointer dereference regression
Richard Yao [Thu, 10 Nov 2022 14:01:58 +0000 (09:01 -0500)]
Fix potential NULL pointer dereference regression

945b407486a0072ec7dd117a0bde2f72d52eb445 neglected to `NULL` check
`tx->tx_objset`, which is already done in the function. This upset
Coverity, which complained about a "dereference after null check".

Upon inspection, it was found that whenever `dmu_tx_create_dd()` is
called followed by `dmu_tx_assign()`, such as in
`dsl_sync_task_common()`, `tx->tx_objset` will be `NULL`.

Reported-by: Coverity (CID 1527261)
Reviewed-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com>
Reviewed-by: Youzhong Yang <yyang@mathworks.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14170

20 months agoAllow to control failfast
Mariusz Zaborski [Thu, 10 Nov 2022 21:37:12 +0000 (22:37 +0100)]
Allow to control failfast

Linux defaults to setting "failfast" on BIOs, so that the OS will not
retry IOs that fail, and instead report the error to ZFS.

In some cases, such as errors reported by the HBA driver, not
the device itself, we would wish to retry rather than generating
vdev errors in ZFS. This new property allows that.

This introduces a per vdev option to disable the failfast option.
This also introduces a global module parameter to define the failfast
mask value.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com>
Sponsored-by: Seagate Technology LLC
Submitted-by: Klara, Inc.
Closes #14056

20 months agoman4: if_bridge and if_vlan do support ALTQ
Kristof Provost [Thu, 10 Nov 2022 15:39:47 +0000 (16:39 +0100)]
man4: if_bridge and if_vlan do support ALTQ

if_vlan(4) has supported ALTQ since 2e5ff01d0a, and if_bridge since
eb680a63de.

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agoman4: cxgbe(4) does not support ALTQ
Kristof Provost [Thu, 10 Nov 2022 15:30:55 +0000 (16:30 +0100)]
man4: cxgbe(4) does not support ALTQ

It hasn't supported it since 65d43cc6e7 (so February 2012).

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agoif_ovpn tests: fix typo in test description
Kristof Provost [Thu, 10 Nov 2022 13:02:23 +0000 (14:02 +0100)]
if_ovpn tests: fix typo in test description

Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agoObsoleteFiles: add missing '+'
Baptiste Daroussin [Thu, 10 Nov 2022 13:04:54 +0000 (14:04 +0100)]
ObsoleteFiles: add missing '+'

Reported by: antoine

20 months agoObsoleteFiles: fix typo
Baptiste Daroussin [Thu, 10 Nov 2022 12:45:38 +0000 (13:45 +0100)]
ObsoleteFiles: fix typo

Reported by: marck

20 months agolinuxkpi: Move cpu_relax out of ifdef for x86
Emmanuel Vadot [Thu, 10 Nov 2022 11:50:51 +0000 (12:50 +0100)]
linuxkpi: Move cpu_relax out of ifdef for x86

It's needed by drm-kmod and this allow building on arm64 and powerpc.

Reported by: jhibbits
Sponsored by: Beckhoff Automation GmbH & Co. KG

20 months agotcp: account sent/received IP ECN markings independently
Richard Scheffenegger [Thu, 10 Nov 2022 10:35:02 +0000 (11:35 +0100)]
tcp: account sent/received IP ECN markings independently

Have tcpstats (netstat -s) differentiate between received and sent
ECN-marked packets. Also account for IP ECN bits (on TCP packets)
even when the tcp session has not negotiated ECN support.

Event: IETF 115 Hackathon
Reviewed By: glebius, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37314

20 months agoixgbe: workaround errata about UDP frames with zero checksum
Andrey V. Elsukov [Thu, 10 Nov 2022 09:34:40 +0000 (12:34 +0300)]
ixgbe: workaround errata about UDP frames with zero checksum

Intel 82599 has errata related to IPv4 UDP frames with zero checksum.
It reports such datagrams with L4 integrity errors in IXGBE_XEC
register. And after afb1aa4e6df2 commit such errors are reported
via IFCOUNTER_IERRORS. This confuses users, since actually all frames
are handled correctly by the system.
To workaround the problem, let's ignore the XEC register value for
82599 cards for now.

PR: 266048
Discussed with: erj
MFC after: 1 week
Sponsored by: Yandex LLC