freebsd.git
2 years agozfs: merge openzfs/zfs@a86e08941 (master) into main
Martin Matuska [Tue, 8 Mar 2022 17:52:10 +0000 (18:52 +0100)]
zfs: merge openzfs/zfs@a86e08941 (master) into main

Notable upstream pull request merges:
  #9078:  log xattr=sa create/remove/update to ZIL
  #11919: Cross-platform xattr user namespace compatibility
  #13014: Report dnodes with faulty bonuslen
  #13016: FreeBSD: Fix zvol_cdev_open locking
  #13019: spl: Don't check FreeBSD rwlocks for double initialization
  #13027: Fix clearing set-uid and set-gid bits on a file when
          replying a write
  #13031: Add enumerated vdev names to 'zpool iostat -v' and
          'zpool list -v'
  #13074: Enable encrypted raw sending to pools with greater ashift
  #13076: Receive checks should allow unencrypted child datasets
  #13098: Avoid dirtying the final TXGs when exporting a pool
  #13172: Fix ENOSPC when unlinking multiple files from full pool

Obtained from: OpenZFS
OpenZFS commit: a86e089415679cf1b98eb424a159bb36aa2c19e3

2 years agolibzfs_core: lzc_send_wraper: maximise pipe buffer for existing pipes
наб [Mon, 21 Feb 2022 18:51:48 +0000 (19:51 +0100)]
libzfs_core: lzc_send_wraper: maximise pipe buffer for existing pipes

This reduces scheduler overhead by letting the reader consume bigger
chunks (64k => 128k at full throttle)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoZTS: /dev/null: accept no substitutes
Rich Ercolani [Fri, 17 Dec 2021 04:19:22 +0000 (23:19 -0500)]
ZTS: /dev/null: accept no substitutes

Instead of writing to "devnull" and rming it later, just
> /dev/null to not have to cleanup later.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoRevert "ZTS: Avoid piping send directly to /dev/null"
наб [Mon, 21 Feb 2022 01:43:49 +0000 (02:43 +0100)]
Revert "ZTS: Avoid piping send directly to /dev/null"

This reverts commit 1a79f7e86021c5de33d3518dd9a0f14f924ee345.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoRevert "Added error for writing to /dev/ on Linux"
наб [Sun, 20 Feb 2022 13:41:10 +0000 (14:41 +0100)]
Revert "Added error for writing to /dev/ on Linux"

This reverts commit 860051f1d1ef7ee995188b852d8da36bce85b1dc.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agolibzfs, libzfs_core: send: always write to pipe
наб [Mon, 21 Feb 2022 01:31:32 +0000 (02:31 +0100)]
libzfs, libzfs_core: send: always write to pipe

By introducing lzc_send_wrapper() and routing all ZFS_IOC_SEND*
users through it, we fix a Linux 5.10-introduced bug (see comment)

This is all /transparent/ to the users API, ABI, and usage-wise,
and disabled on FreeBSD and if the output is already a pipe,
and transparently nestable (i.e. zfs_send_one() is wrapped,
but so is lzc_send_redacted() it calls to ‒ this wouldn't be strictly
necessary if ZFS_IOC_SEND_PROGRESS wasn't strictly denominational w.r.t.
the descriptor the send is happening on)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11445
Closes #13133

2 years agolibzfs_core: simplify max_pipe_buffer(), return new max
наб [Sun, 20 Feb 2022 19:17:22 +0000 (20:17 +0100)]
libzfs_core: simplify max_pipe_buffer(), return new max

We do still check and only optionally set because all F_SETPIPE_SZ
directives reallocate the pipe buffer

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agolibzfs: migrate single-use libzfs_set_pipe_max() to libzfs_core
наб [Sun, 20 Feb 2022 14:04:49 +0000 (15:04 +0100)]
libzfs: migrate single-use libzfs_set_pipe_max() to libzfs_core

Notably, this also means that the pipe is expanded before each
dataset is received, so updates to /p/s/f/pipe-max-size are reflected
for each new dataset

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13133

2 years agoCleaning up a couple of ZTS tests setup scripts
Brian Atkinson [Mon, 7 Mar 2022 23:22:01 +0000 (16:22 -0700)]
Cleaning up a couple of ZTS tests setup scripts

With the zfs_destroy ZTS test case the setup script needed to call
default_setup_noexit so compression could be turned off. Also, added
log_must to setting compression off in the reservation setup script for
turning off compression.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #13173

2 years agoAdded noexit variant for Raidz setup in ZTS tests
Brian Atkinson [Fri, 4 Mar 2022 01:18:07 +0000 (18:18 -0700)]
Added noexit variant for Raidz setup in ZTS tests

The regular default_raidz_setup function in the ZFS test suite called
log_pass after creating the zpool. However, with compression now being
on by default 56fa4aa, there is no way to turn compression off in the
setup.ksh scripts when creating a raidz VDEV. The addition of the
function default_raidz_setup_noexit allows for a raidz VDEV to be
created, additional zfs property settings to be applied and for the
setup.ksh script itself to call log_pass.

With the addition of default_raidz_setup_noexit some stray log_pass
calls were removed from any setup.ksh scripts that call
default_raidz_setup.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #13173

2 years agoFix ENOSPC when unlinking multiple files from full pool
Brian Behlendorf [Tue, 8 Mar 2022 17:16:35 +0000 (09:16 -0800)]
Fix ENOSPC when unlinking multiple files from full pool

When unlinking multiple files from a pool at 100% capacity, it was
possible for ENOSPC to be returned after the first unlink.  e.g.

    rm -f /mnt/fs/test1.0.0 /mnt/fs/test1.1.0 /mnt/fs/test1.2.0
    rm: cannot remove '/mnt/fs/test1.1.0': No space left on device
    rm: cannot remove '/mnt/fs/test1.2.0': No space left on device

After waiting for the pending deferred frees from the first unlink to
be processed the remaining files can then be unlinked.  This is caused
by the quota limit in dsl_dir_tempreserve_impl() being temporarily
decreased to the allocatable pool capacity less any deferred free
space.

This is resolved using the existing mechanism of returning ERESTART
when over quota as long as we know enough space will shortly be
available after processing the pending deferred frees.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ryan Moeller <freqlabs@FreeBSD.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13172

2 years agogeom: Allow "load" command for already loaded modules.
Alexander Motin [Tue, 8 Mar 2022 17:04:42 +0000 (12:04 -0500)]
geom: Allow "load" command for already loaded modules.

I see more user-friendly to do nothing if the module is already
loaded, rather than returning quite confusing error message.

As side effect it allows to avoid std_list_available() call, using
quite expensive on large systems geom_gettree().

MFC after: 1 month

2 years agogpioths(4): Correct the sysctl names in manual page
Juraj Lutter [Sun, 6 Mar 2022 21:33:29 +0000 (22:33 +0100)]
gpioths(4): Correct the sysctl names in manual page

Temperature is exposed via 'temperature' leaf, humidity via 'humidity'
leaf. Align the manual page with the actual variable names.

Approved by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34460

2 years agopfctl: remove unused variable
Kristof Provost [Tue, 8 Mar 2022 11:22:50 +0000 (12:22 +0100)]
pfctl: remove unused variable

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

2 years agolibpfct: factor out pfctl_get_rules_info()
Kristof Provost [Fri, 4 Mar 2022 16:12:01 +0000 (17:12 +0100)]
libpfct: factor out pfctl_get_rules_info()

Introduce pfctl_get_rules_info(), similar to pfctl_get_eth_rules_info()
to retrieve rules information (ticket and total number of rules).

Use the new function in pfctl.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34443

2 years agolibpfctl: support flushing rules/nat/eth
Kristof Provost [Fri, 4 Mar 2022 14:50:43 +0000 (15:50 +0100)]
libpfctl: support flushing rules/nat/eth

Move the code to flush regular rules, nat rules and Ethernet rules into
libpfctl for easier re-use.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34442

2 years agobcm5974(4): set mode again on resume
Greg V [Tue, 8 Mar 2022 12:51:07 +0000 (15:51 +0300)]
bcm5974(4): set mode again on resume

This is necessary to not break SPI devices on suspend-resume.

Reviewed by:    wulf
MFC with:       5aa839c9e2c373275091b8bf529c1311d0b84d76
Differential revision:  https://reviews.freebsd.org/D34434

2 years agobcm5974(4): fix endian conversion signedness bug
Greg V [Tue, 8 Mar 2022 12:51:06 +0000 (15:51 +0300)]
bcm5974(4): fix endian conversion signedness bug

This fixes wrong coordinates resulting in weird behavior.

Reviewed by: wulf
MFC with: 5aa839c9e2c373275091b8bf529c1311d0b84d76
Differential revision: https://reviews.freebsd.org/D34433

2 years agomlx5/mlx4: Bump driver version to 3.7.1
Hans Petter Selasky [Tue, 8 Mar 2022 11:16:00 +0000 (12:16 +0100)]
mlx5/mlx4: Bump driver version to 3.7.1

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoMake the arm64 get_pcpu a function again
Andrew Turner [Tue, 8 Mar 2022 11:38:51 +0000 (11:38 +0000)]
Make the arm64 get_pcpu a function again

We assume the pointer returned from get_pcpu will be consistent even
if the thread is moved to a new CPU. Fix this by partially reverting
63c858a04d565 to make get_pcpu a function again.

Sponsored by: The FreeBSD Foundation

2 years agoPrint the instruction for the unknown exception
Andrew Turner [Tue, 8 Mar 2022 11:02:02 +0000 (11:02 +0000)]
Print the instruction for the unknown exception

The arm64 unknown exception will be raised when we execute an
instruction that id invalid or disabled. To help debug these print
the instruction that failed.

Sponsored by: The FreeBSD Foundation

2 years agopfctl: support recursive printing of nat rules
Kristof Provost [Sat, 5 Mar 2022 16:55:48 +0000 (17:55 +0100)]
pfctl: support recursive printing of nat rules

PR: 252617
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34455

2 years agostress2: Fix typo in exclude names
Peter Holm [Tue, 8 Mar 2022 10:29:17 +0000 (11:29 +0100)]
stress2: Fix typo in exclude names

2 years agostress2: Exclude a few test.
Peter Holm [Tue, 8 Mar 2022 10:20:51 +0000 (11:20 +0100)]
stress2: Exclude a few test.

2 years agoSkip sys.geom.class.multipath.failloop.failloop if dtrace fails to run
Li-Wen Hsu [Tue, 8 Mar 2022 10:12:40 +0000 (18:12 +0800)]
Skip sys.geom.class.multipath.failloop.failloop if dtrace fails to run

This test case depends on dtrace and sometimes gets affected if dtrace
has issues.  Make it report skipped instead of failure when dtrace fails
to run.

Sponsored by: The FreeBSD Foundation

2 years agou3g(4): Add new USB IDs.
Hans Petter Selasky [Tue, 8 Mar 2022 10:02:52 +0000 (11:02 +0100)]
u3g(4): Add new USB IDs.

Submitted by: Matthew Luckie <mjl@luckie.org.nz>
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoperiodic: remove obsolete news.expire
Nils Johannsen [Tue, 8 Mar 2022 04:29:26 +0000 (19:29 -0900)]
periodic: remove obsolete news.expire

With the initial import of 386BSD 0.1 in 1993, the daily execution of
/etc/news.expire was introduced (see commit 1bf9d5d9518e).

In 1997, this was brought into periodic resulting in daily/330.news
(see commit 28dce04d1975). But as far as I see, /etc/news.expire has
never existed.

PR:         256238
MFC after:  1 week
Differential Revision: https://reviews.freebsd.org/D30631

2 years agoExpose additional file level attributes
Umer Saleem [Tue, 8 Mar 2022 01:52:03 +0000 (06:52 +0500)]
Expose additional file level attributes

ZFS allows to update and retrieve additional file level attributes for
FreeBSD. This commit allows additional file level attributes to be
updated and retrieved for Linux. These include the flags stored in the
upper half of z_pflags only.

Two new IOCTLs have been added for this purpose. ZFS_IOC_GETDOSFLAGS
can be used to retrieve the attributes, while ZFS_IOC_SETDOSFLAGS can
be used to update the attributes.

Attributes that are allowed to be updated include ZFS_IMMUTABLE,
ZFS_APPENDONLY, ZFS_NOUNLINK, ZFS_ARCHIVE, ZFS_NODUMP, ZFS_SYSTEM,
ZFS_HIDDEN, ZFS_READONLY, ZFS_REPARSE, ZFS_OFFLINE and ZFS_SPARSE.
Flags can be or'd together while calling ZFS_IOC_SETDOSFLAGS.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #13118

2 years agoHandle aarch64 defines seperate from arm
Windel Bouwman [Tue, 8 Mar 2022 01:49:34 +0000 (02:49 +0100)]
Handle aarch64 defines seperate from arm

aarch64 is a different architecture than arm. Some
compilers might choke when both __arm__ and __aarch64__
are defined.

This change separates the checks for arm and for
aarch64 in the isa_defs.h header files.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Windel Bouwman <windel@windel.nl>
Closes #10335
Closes #13151

2 years agocontrib/bc: update to version 5.2.3
Stefan Eßer [Mon, 7 Mar 2022 22:23:56 +0000 (23:23 +0100)]
contrib/bc: update to version 5.2.3

This version fixes a parse error when passing a file to bc using -f
if that file has a multiline comment or string in it.

Merge commit '3673adf1ee311d6f83176d3e43cf0efb314764e4'

MFC after: 3 days

2 years agovendor/bc: import version 5.2.3
Stefan Eßer [Mon, 7 Mar 2022 22:08:20 +0000 (23:08 +0100)]
vendor/bc: import version 5.2.3

This version fixes a parse error when passing a file to bc using -f
if that file has a multiline comment or string in it.

MFC after: 3 days

2 years agocxgbe(4): dump_devlog should never fail silently.
Navdeep Parhar [Mon, 7 Mar 2022 19:17:05 +0000 (11:17 -0800)]
cxgbe(4): dump_devlog should never fail silently.

Do the same thing as dump_cimla and log a warning on failure.

MFC after: 3 days
Sponsored by: Chelsio Communications

2 years agoffs_mount(): return early if namei() fails to lookup disk device
Robert Wing [Mon, 7 Mar 2022 19:18:03 +0000 (10:18 -0900)]
ffs_mount(): return early if namei() fails to lookup disk device

With soft updates enabled, an INVARIANTS panic is hit in ffs_unmount().

The problem occurs in ffs_mount() when upgrading a mount from ro->rw.
During a mount update, the soft update code gets set up but doesn't get
cleaned up if namei() fails when looking up the disk device.

Avoid this scenario by looking up the disk device first and bail early
if the namei() lookup fails.

PR:             256511
MFC After:      2 weeks
Reviewed by: mckusick, kib
Differential Revision: https://reviews.freebsd.org/D30870

2 years agoGEOM: Make G_F_CTLDUMP also dump result.
Alexander Motin [Mon, 7 Mar 2022 19:40:28 +0000 (14:40 -0500)]
GEOM: Make G_F_CTLDUMP also dump result.

MFC after: 1 month

2 years agoRevert "sdhci: extend bus_dma_tag boundary to 64-bit space"
Marcin Wojtas [Mon, 7 Mar 2022 16:40:51 +0000 (17:40 +0100)]
Revert "sdhci: extend bus_dma_tag boundary to 64-bit space"

This reverts commit 7d8700bc291b4b3be1a592cae539f9e682592d9d.

Reason for revert: the patch is incomplete. 64-bit operation
is supported fully in SDHCI v4.0, v3.0 does it only for ADMA mode.
This differentiation is missing and should be taken into consideration
in case the reverted code is re-introduced.

Reported by: mmel

2 years agoctf: Avoid passing a caddr_t to roundup2()
Mark Johnston [Mon, 7 Mar 2022 16:18:40 +0000 (11:18 -0500)]
ctf: Avoid passing a caddr_t to roundup2()

For some reason I can't reproduce this locally, but Jenkins complains.

Reported by: Jenkins
Fixes: bdf290cd3e1a ("ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}")

2 years agoGEOM: Introduce gctl_add_param() API.
Alexander Motin [Mon, 7 Mar 2022 16:06:11 +0000 (11:06 -0500)]
GEOM: Introduce gctl_add_param() API.

Make gctl_add_param() API public, allowing more precise control over
parameter flags.  Previously it was impossible to properly declare
write-only ASCII parameters, used for result reporting, they were
declared as read-write binary instead, that was not nice.

MFC after: 1 month

2 years agoGEOM: Skip copyin() for GCTL_PARAM_WR parameters.
Alexander Motin [Mon, 7 Mar 2022 15:57:56 +0000 (10:57 -0500)]
GEOM: Skip copyin() for GCTL_PARAM_WR parameters.

Kernel does not read those parameters, so copyin is pointless.

While there, replace some KASSERT()s with CTASSERT()s.

MFC after: 1 month

2 years agokcov: use __func__ in KASSERT instead of old function name
Ed Maste [Mon, 7 Mar 2022 14:48:38 +0000 (09:48 -0500)]
kcov: use __func__ in KASSERT instead of old function name

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agormlock: Temporarily revert commit c84bb8cd771c
Mark Johnston [Mon, 7 Mar 2022 15:35:59 +0000 (10:35 -0500)]
rmlock: Temporarily revert commit c84bb8cd771c

It appears to have introduced a regression on arm64, possibly due to the
fact that the pcpu pointer is reloaded outside of the critical section
in _rm_rlock().  Until this is resolved one way or another, let's
revert.

Reported by: Ronald Klop <ronald-lists@klop.ws>
Sponsored by: The FreeBSD Foundation

2 years agoctf: Fix a -Wunused-but-set-variable warning
Mark Johnston [Mon, 7 Mar 2022 15:34:11 +0000 (10:34 -0500)]
ctf: Fix a -Wunused-but-set-variable warning

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

2 years agogmultipath tests: Re-enable the failloop test in CI
Mark Johnston [Mon, 7 Mar 2022 13:54:57 +0000 (08:54 -0500)]
gmultipath tests: Re-enable the failloop test in CI

Sponsored by: The FreeBSD Foundation

2 years agoctf: Add v3 support to CTF tools, ctf{convert,dump,merge}
Mark Johnston [Mon, 7 Mar 2022 13:54:18 +0000 (08:54 -0500)]
ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}

ctfdump handles v2 and v3.  ctfconvert now emits only CTFv3, whereas
ctfmerge can merge v2 and v3 containers into v3 containers.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34364

2 years agolibctf: Handle CTFv3 containers
Mark Johnston [Mon, 7 Mar 2022 13:53:27 +0000 (08:53 -0500)]
libctf: Handle CTFv3 containers

In general, the patch adds indirection to minimize the amount of code
that needs to know about differences between v2 and v3.  Specifically,
some new ctf_get_ctt_* functions are added, and new LCTF_* macros are
added to use the underlying container's version to do the right thing.

CTF containers can have parent/child relationships, wherein a type ID in
one container refers to a type in the parent.  It is permitted for the
parent and child to have different versions.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34363

2 years agolinker: Permit CTFv3 containers
Mark Johnston [Mon, 7 Mar 2022 13:53:05 +0000 (08:53 -0500)]
linker: Permit CTFv3 containers

Reviewed by: Domagoj Stolfa
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34362

2 years agofbt: Add support for CTFv3 containers
Mark Johnston [Mon, 7 Mar 2022 13:45:53 +0000 (08:45 -0500)]
fbt: Add support for CTFv3 containers

The general aim in this and subsequent patches is to minimize the
amount of code that directly references CTF types such as ctf_type_t,
ctf_array_t, etc.  To that end, introduce some routines similar to the
existing fbt_get_ctt_size() (which exists to deal with differences
between v1 and v2) and change ctf_lookup_by_id() to return a void
pointer.

Support for v2 containers is preserved.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34361

2 years agoctf: Add definitions for CTFv3
Mark Johnston [Mon, 7 Mar 2022 13:44:02 +0000 (08:44 -0500)]
ctf: Add definitions for CTFv3

These are based on definitions added to binutils' libctf.  Specifically:
- Type IDs are now encoded in 32 bits rather than 16, changing the
  layout of ctf_type_t, ctf_array_t, ctf_member_t and ctf_lmember_t.
- Type info is encoded in 32 bits rather than 16.  The type "kind" is
  extended from 5 bits to 6, and the type "vlen" is extended from 10
  bits to 25.

The main upside is that we remove the current limit, imposed by CTFv2,
of 2^{15} distinct types in the main kernel executable.  Other limits,
such as that on the number of elements in an enum, imposed by the vlen
limit, are also raised.

This change adds v2 and v3 flavours of macros and type definitions which
differ between the two versions.  Compatibility is preserved for now by
having generic names refer to the v2 definitions, so, e.g., ctf_type_t
is still a v2 type.

No functional change intended.

Reviewed by: Domagoj Stolfa
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34360

2 years agolinker: Simplify CTF container handling
Mark Johnston [Mon, 7 Mar 2022 13:43:42 +0000 (08:43 -0500)]
linker: Simplify CTF container handling

Use sys/ctf.h to provide various definitions required to parse the CTF
header.  No functional change intended.

Reviewed by: Domagoj Stolfa, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34359

2 years agoctf: Import ctf.h from OpenBSD
Mark Johnston [Mon, 7 Mar 2022 13:42:57 +0000 (08:42 -0500)]
ctf: Import ctf.h from OpenBSD

Use it instead of the existing ctf.h from OpenSolaris.  This makes it
easier to use CTF in the core kernel, and to extend the CTF format to
support wider type IDs.

The imported ctf.h is modified to depend only on _types.h, and also to
provide macros which use the "parent" bit of a type ID to refer to types
in a parent CTF container.

No functional change intended.

Reviewed by: Domagoj Stolfa, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34358

2 years agopowerpc: FreeBSD kernel compatibility cleanup
Alfredo Dal'Ava Junior [Mon, 7 Mar 2022 17:30:26 +0000 (14:30 -0300)]
powerpc: FreeBSD kernel compatibility cleanup

Adjust FreeBSD kernel backward compatibility list

Reviewed by: jhibbits, pkubaj
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33421

2 years agoRework the arm64 sigtramp code to be a trampoline
Andrew Turner [Wed, 29 Dec 2021 17:40:42 +0000 (17:40 +0000)]
Rework the arm64 sigtramp code to be a trampoline

To help with switching to a vdso sigtramp switch to passing through the
sigcode function when entering a signal. This ensures the return address
is within the function.

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

2 years agobsddialog: new utility for TUI dialogs and widgets
Alfonso S. Siciliano [Sun, 6 Mar 2022 21:44:17 +0000 (22:44 +0100)]
bsddialog: new utility for TUI dialogs and widgets

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34101

2 years agotests: Fix the test plan for closefrom_test
Mark Johnston [Sun, 6 Mar 2022 17:56:33 +0000 (12:56 -0500)]
tests: Fix the test plan for closefrom_test

Fixes: f3f3e3c44d3b ("fd: add close_range(..., CLOSE_RANGE_CLOEXEC)")
Reported by: Jenkins

2 years agonetmap: add a tunable for the maximum number of VALE switches
Vincenzo Maffione [Sun, 6 Mar 2022 17:28:44 +0000 (17:28 +0000)]
netmap: add a tunable for the maximum number of VALE switches

The new dev.netmap.max_bridges sysctl tunable can be set in
loader.conf(5) to change the default maximum number of VALE
switches that can be created. Current defaults is 8.

MFC after: 2 weeks

2 years agonetmap: fix refcount bug in netmap allocator
Vincenzo Maffione [Sun, 6 Mar 2022 16:39:16 +0000 (16:39 +0000)]
netmap: fix refcount bug in netmap allocator

Symptom: when a single extmem memory region is provided to netmap
multiple times, for multiple interfaces, the memory region is
never released by netmap once all the existing file descriptors
are closed.

Fix the relevant condition in netmap_mem_drop(): release the memory
when the last user of netmap_adapter is gone, rather then when
the last user of netmap_mem_d is gone.

MFC after: 2 weeks

2 years agolibc __sfvwrite(): roll back FILE buffer pointer on fflush error
Konstantin Belousov [Sun, 6 Mar 2022 08:59:39 +0000 (10:59 +0200)]
libc  __sfvwrite(): roll back FILE buffer pointer on fflush error

__sfvwrite() advances the pointer before calling fflush.  If fflush()
fails, it is not enough to roll back inside it, because we cannot know
how much was advanced by the caller.

Reported by: Peter <pmc@citylink.dinoex.sub.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Fixes: 86a16ada1ea608408cec370171d9f59353e97c77

2 years agobuf_alloc(): Stop using LK_NOWAIT, use LK_NOWITNESS
Konstantin Belousov [Wed, 16 Feb 2022 15:30:17 +0000 (17:30 +0200)]
buf_alloc(): Stop using LK_NOWAIT, use LK_NOWITNESS

Despite the buffer taken from cache or free list, it still can be
locked, due to 'lockless lookup' in getblkx() potentially operating on
the freed buffers.  The lock is transient, but prevents the use of
LK_NOWAIT there for the goal of neutralizing WITNESS.

Just use LK_NOWITNESS.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agossh: regen sk_config.h after 73104d583850
Ed Maste [Sun, 6 Mar 2022 00:59:51 +0000 (19:59 -0500)]
ssh: regen sk_config.h after 73104d583850

2 years agossh: generate SK config file using private cbor and fido2 libs
Ed Maste [Tue, 1 Mar 2022 21:39:16 +0000 (16:39 -0500)]
ssh: generate SK config file using private cbor and fido2 libs

Specify -lprivatecbor and -lprivatefido2 in OpenSSH's configure.ac, and
pass -I paths to libcbor and libfido2's contrib src location.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34440

2 years agoDelete a blank that messed up punctuation.
Jens Schweikhardt [Sat, 5 Mar 2022 21:52:52 +0000 (22:52 +0100)]
Delete a blank that messed up punctuation.

2 years ago/etc/hosts: Wording changes to better match RFC 1918
Pedro F. Giffuni [Mon, 28 Feb 2022 04:07:34 +0000 (23:07 -0500)]
/etc/hosts: Wording changes to better match RFC 1918

Summary: No functional change.

Subscribers: imp

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

2 years agoahci/siis/mvs: Fix panics after 3394d4239b.
Alexander Motin [Sat, 5 Mar 2022 01:49:05 +0000 (20:49 -0500)]
ahci/siis/mvs: Fix panics after 3394d4239b.

Full CCB header overwrites made frees go into wrong zones, causing
kernel panics.  Instead of copying full header use xpt_setup_ccb(),
since the only field I see used from all the header is target_id.

PR: 262263

2 years agolibbsddialog: Add _XOPEN_SOURCE_EXTENDED for widechar form
Alfonso S. Siciliano [Sat, 5 Mar 2022 01:20:37 +0000 (02:20 +0100)]
libbsddialog: Add _XOPEN_SOURCE_EXTENDED for widechar form

Add _XOPEN_SOURCE_EXTENDED to use curses' get_wch() and to avoid a
building error after next "bsddialog 0.2" import.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34419

2 years agox86: Defer early TSC timecounter calibration to SI_SUB_CPU
Mark Johnston [Sat, 5 Mar 2022 00:34:43 +0000 (19:34 -0500)]
x86: Defer early TSC timecounter calibration to SI_SUB_CPU

If we can't determine the TSC frequency using CPU registers, we need to
give a chance for Hyper-V drivers to register a timecounter (during
SI_SUB_HYPERVISOR) since an emulated 8254 might not be available.
Thus, split probe_tsc_freq() into early and late stages, and wait until
the latter to attempt calibration using a reference clock.

Fixes: 84369dd52369 ("x86: Probe the TSC frequency earlier")
Reported and tested by: khng, Shawn Webb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34444

2 years agoamd64: Call clock_init() after finishidentcpu()
Mark Johnston [Sat, 5 Mar 2022 00:32:39 +0000 (19:32 -0500)]
amd64: Call clock_init() after finishidentcpu()

As in commit c3d830cf7c71, we should finalize CPU identification before
probing the TSC frequency.

Fixes: 84369dd52369 ("x86: Probe the TSC frequency earlier")
Reported by: khng

2 years agoUse _Noreturn (C11; GNU89) properly
Alejandro Colomar [Sat, 5 Mar 2022 00:25:22 +0000 (01:25 +0100)]
Use _Noreturn (C11; GNU89) properly

A function that returns with no value is a different thing from a
function that doesn't return at all.  Those are two orthogonal
concepts, commonly confused.

pthread_create(3) expects a pointer to a start routine that has a
very precise prototype:

    void *(*start_routine)(void *);

However, other thread functions, such as kernel ones, expect:

    void (*start_routine)(void *);

Providing a different one is incorrect, and has only been working
because the ABIs happen to produce a compatible function.

We should use '_Noreturn void', since it's the natural type, and
then provide a '_Noreturn void *' wrapper for pthread functions.

For consistency, replace most cases of __NORETURN or
__attribute__((noreturn)) by _Noreturn.  _Noreturn is understood
by -std=gnu89, so it should be safe to use everywhere.

Ref: https://github.com/openzfs/zfs/pull/13110#discussion_r808450136
Ref: https://software.codidact.com/posts/285972
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Closes #13120

2 years agoice(4): Fix build error when ALTQ is enabled
Eric Joyner [Fri, 4 Mar 2022 22:11:14 +0000 (14:11 -0800)]
ice(4): Fix build error when ALTQ is enabled

The previous commit (56429daea2) that updated the driver included a
bug where a variable was undefined when ALTQ was enabled; this fixes
that issue to declare the missing variable. This wasn't caught before
because we don't use ALTQ, and so it fell on the Jenkins CI's LINT
builds to catch it.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reported by: Jenkins CI
MFC after: 3 days
MFC with: 56429daea2
Sponsored by: Intel Corporation

2 years agozpool: main: list: don't pay for printf
наб [Sun, 20 Feb 2022 03:06:02 +0000 (04:06 +0100)]
zpool: main: list: don't pay for printf

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13125

2 years agozpool: main: list: -v: update dash spacing for special vdevs
наб [Sun, 20 Feb 2022 03:32:07 +0000 (04:32 +0100)]
zpool: main: list: -v: update dash spacing for special vdevs

Before:
nabijaczleweli@tarta:~/store/code/zfs$ /sbin/zpool list -v file
NAME                                                    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
file                                                    118G   150K   118G        -         -     0%     0%  1.00x    ONLINE  -
  /mnt/filling/store/nabijaczleweli/code/zfs/file      39.5G      0  39.5G        -         -     0%  0.00%      -    ONLINE
dedup                                                      -      -      -        -         -      -      -      -  -
  /mnt/filling/store/nabijaczleweli/code/zfs/adedup    39.5G      0  39.5G        -         -     0%  0.00%      -    ONLINE
special                                                    -      -      -        -         -      -      -      -  -
  /mnt/filling/store/nabijaczleweli/code/zfs/aspecial  39.5G   150K  39.5G        -         -     0%  0.00%      -    ONLINE
logs                                                       -      -      -        -         -      -      -      -  -
  /mnt/filling/store/nabijaczleweli/code/zfs/alog      39.5G      0  39.5G        -         -     0%  0.00%      -    ONLINE
cache                                                      -      -      -        -         -      -      -      -  -
  /mnt/filling/store/nabijaczleweli/code/zfs/acache    40.0G  1.50K  40.0G        -         -     0%  0.00%      -    ONLINE
spare                                                      -      -      -        -         -      -      -      -  -
  /mnt/filling/store/nabijaczleweli/code/zfs/aspare        -      -      -        -         -      -      -      -     AVAIL

After:
nabijaczleweli@tarta:~/store/code/zfs$ cmd/zpool/zpool list -v file
NAME                                                    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
file                                                    118G   150K   118G        -         -     0%     0%  1.00x    ONLINE  -
  /mnt/filling/store/nabijaczleweli/code/zfs/file      39.5G      0  39.5G        -         -     0%  0.00%      -    ONLINE
dedup                                                      -      -      -        -         -      -      -      -         -
  /mnt/filling/store/nabijaczleweli/code/zfs/adedup    39.5G      0  39.5G        -         -     0%  0.00%      -    ONLINE
special                                                    -      -      -        -         -      -      -      -         -
  /mnt/filling/store/nabijaczleweli/code/zfs/aspecial  39.5G   150K  39.5G        -         -     0%  0.00%      -    ONLINE
logs                                                       -      -      -        -         -      -      -      -         -
  /mnt/filling/store/nabijaczleweli/code/zfs/alog      39.5G      0  39.5G        -         -     0%  0.00%      -    ONLINE
cache                                                      -      -      -        -         -      -      -      -         -
  /mnt/filling/store/nabijaczleweli/code/zfs/acache    40.0G  1.50K  40.0G        -         -     0%  0.00%      -    ONLINE
spare                                                      -      -      -        -         -      -      -      -         -
  /mnt/filling/store/nabijaczleweli/code/zfs/aspare        -      -      -        -         -      -      -      -     AVAIL

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13123
Closes #13125

2 years agozpool: main: use ARRAY_SIZE(class_name) instead of 3
наб [Sun, 20 Feb 2022 03:16:21 +0000 (04:16 +0100)]
zpool: main: use ARRAY_SIZE(class_name) instead of 3

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13125

2 years agolibzfs: util: don't check for allocation errors from infallible zfs_*()
наб [Sun, 20 Feb 2022 03:06:43 +0000 (04:06 +0100)]
libzfs: util: don't check for allocation errors from infallible zfs_*()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13125

2 years agoFlex non-pretty-printed properties and raw-/pretty-print remaining ones
наб [Sun, 20 Feb 2022 02:07:25 +0000 (03:07 +0100)]
Flex non-pretty-printed properties and raw-/pretty-print remaining ones

Before:
nabijaczleweli@tarta:~/store/code/zfs$ /sbin/zpool list -Td -o name,size,alloc,free,ckpoint,expandsz,guid,load_guid,frag,cap,dedup,health,altroot,guid,dedupditto,load_guid,maxblocksize,maxdnodesize 2>/dev/null
Sun 20 Feb 03:57:44 CET 2022
NAME         SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   GUID  LOAD_GUID   FRAG    CAP  DEDUP    HEALTH  ALTROOT   GUID  DEDUPDITTO  LOAD_GUID  MAXBLOCKSIZE  MAXDNODESIZE
filling     25.5T  6.52T  18.9T        -       64M  11512889483096932869  11656109927366648364     1%    25%  1.00x    ONLINE  -        11512889483096932869           0  11656109927366648364       1048576         16384
tarta-boot   240M  50.6M   189M        -         -  2372068846917849656  7752280792179633787    12%    21%  1.00x    ONLINE  -        2372068846917849656           0  7752280792179633787       1048576           512
tarta-zoot  55.5G  6.42G  49.1G        -         -  12971868889665384604  8622632123393589527    17%    11%  1.00x    ONLINE  -        12971868889665384604           0  8622632123393589527       1048576         16384

nabijaczleweli@tarta:~/store/code/zfs$ /sbin/zfs list -o name,guid,keyguid,ivsetguid,createtxg,objsetid,pbkdf2iters,refratio -r tarta-zoot
NAME                                  GUID  KEYGUID  IVSETGUID  CREATETXG  OBJSETID  PBKDF2ITERS  REFRATIO
tarta-zoot                           1110930838977259561     659P          -          1        54            0     1.03x
tarta-zoot/PAGEFILE.SYS              2202570496672997800    3.20E          -       2163      1539            0     1.07x
tarta-zoot/dupa                      16941280502417785695    9.81E          -    2274707      1322  1000000000000     1.00x
tarta-zoot/etc                       17029963068508333530    12.9E          -       3663      1087            0     1.52x
tarta-zoot/home                      3508163802370032575    8.50E          -       3664       294            0     1.00x
tarta-zoot/home/misio                7283672744014848555    13.0E          -       3665       302            0     2.28x
tarta-zoot/home/nabijaczleweli       12286744508078616303    5.15E          -       3666       200            0     2.05x
tarta-zoot/home/nabijaczleweli/tftp  13551632689932817643    5.16E          -       3667      1095            0     1.00x
tarta-zoot/home/root                 5203106193060067946    15.4E          -       3668       698            0     2.86x
tarta-zoot/home/shared-config        8866040021005142194    14.5E          -       3670      2069            0     1.20x
tarta-zoot/home/tymek                9472751824283011822    4.56E          -       3671      1202            0     1.32x
tarta-zoot/oldboot                   10460192444135730377    13.8E          -    2268398      1232            0     1.01x
tarta-zoot/opt                       9945621324983170410    5.84E          -       3672      1210            0     1.00x
tarta-zoot/opt/icecc                 13178238931846132425    9.04E          -       3673      1103            0     2.83x
tarta-zoot/opt/swtpm                 10172962421514870859    4.13E          -     825669    145132            0     1.87x
tarta-zoot/srv                       217179989022738337    3.90E          -       3674      2469            0     1.00x
tarta-zoot/usr                       12214213243060765090    15.0E          -       3675      2477            0     2.58x
tarta-zoot/usr/local                 7542700368693813134     941P          -       3676      2484            0     2.33x
tarta-zoot/var                       13414177124447929530    10.2E          -       3677      2492            0     1.57x
tarta-zoot/var/lib                   6969944550407159241    5.28E          -       3678      2499            0     2.34x
tarta-zoot/var/tmp                   6399468088048343912    1.34E          -       3679      1218            0     3.95x

After:
nabijaczleweli@tarta:~/store/code/zfs$ cmd/zpool/zpool list -Td -o name,size,alloc,free,ckpoint,expandsz,guid,load_guid,frag,cap,dedup,health,altroot,guid,dedupditto,load_guid,maxblocksize,maxdnodesize 2>/dev/null
Sun 20 Feb 03:57:42 CET 2022
NAME         SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ                  GUID             LOAD_GUID   FRAG    CAP  DEDUP    HEALTH  ALTROOT                  GUID  DEDUPDITTO             LOAD_GUID  MAXBLOCKSIZE  MAXDNODESIZE
filling     25.5T  6.52T  18.9T        -       64M  11512889483096932869  11656109927366648364     1%    25%  1.00x    ONLINE  -        11512889483096932869           0  11656109927366648364            1M           16K
tarta-boot   240M  50.6M   189M        -         -   2372068846917849656   7752280792179633787    12%    21%  1.00x    ONLINE  -         2372068846917849656           0   7752280792179633787            1M           512
tarta-zoot  55.5G  6.42G  49.1G        -         -  12971868889665384604   8622632123393589527    17%    11%  1.00x    ONLINE  -        12971868889665384604           0   8622632123393589527            1M           16K

nabijaczleweli@tarta:~/store/code/zfs$ cmd/zfs/zfs list -o name,guid,keyguid,ivsetguid,createtxg,objsetid,pbkdf2iters,refratio -r tarta-zoot
NAME                                                 GUID               KEYGUID  IVSETGUID  CREATETXG  OBJSETID    PBKDF2ITERS  REFRATIO
tarta-zoot                            1110930838977259561    741529699813639505          -          1        54              0     1.03x
tarta-zoot/PAGEFILE.SYS               2202570496672997800   3689529982640017884          -       2163      1539              0     1.07x
tarta-zoot/dupa                      16941280502417785695  11312442953423259518          -    2274707      1322  1000000000000     1.00x
tarta-zoot/etc                       17029963068508333530  14852574366795347233          -       3663      1087              0     1.52x
tarta-zoot/home                       3508163802370032575   9802810070759776956          -       3664       294              0     1.00x
tarta-zoot/home/misio                 7283672744014848555  14983161489316798151          -       3665       302              0     2.28x
tarta-zoot/home/nabijaczleweli       12286744508078616303   5937870537299886218          -       3666       200              0     2.05x
tarta-zoot/home/nabijaczleweli/tftp  13551632689932817643   5950522828900813054          -       3667      1095              0     1.00x
tarta-zoot/home/root                  5203106193060067946  17718025091255443518          -       3668       698              0     2.86x
tarta-zoot/home/shared-config         8866040021005142194  16716354482778968577          -       3670      2069              0     1.20x
tarta-zoot/home/tymek                 9472751824283011822   5251854710505749954          -       3671      1202              0     1.32x
tarta-zoot/oldboot                   10460192444135730377  15894065034622168157          -    2268398      1232              0     1.01x
tarta-zoot/opt                        9945621324983170410   6737735639539098405          -       3672      1210              0     1.00x
tarta-zoot/opt/icecc                 13178238931846132425  10425145983015238428          -       3673      1103              0     2.83x
tarta-zoot/opt/swtpm                 10172962421514870859   4764783754852521469          -     825669    145132              0     1.87x
tarta-zoot/srv                         217179989022738337   4492810461439647259          -       3674      2469              0     1.00x
tarta-zoot/usr                       12214213243060765090  17306702395865262834          -       3675      2477              0     2.58x
tarta-zoot/usr/local                  7542700368693813134   1059954157997659784          -       3676      2484              0     2.33x
tarta-zoot/var                       13414177124447929530  11764397504176937123          -       3677      2492              0     1.57x
tarta-zoot/var/lib                    6969944550407159241   6084753728494937404          -       3678      2499              0     2.34x
tarta-zoot/var/tmp                    6399468088048343912   1548692824635344277          -       3679      1218              0     3.95x

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13122
Closes #13125

2 years agomodule: zcommon: zprop: common: zprop_width: namespace exceptions
наб [Sun, 20 Feb 2022 01:58:09 +0000 (02:58 +0100)]
module: zcommon: zprop: common: zprop_width: namespace exceptions

Before this, /all/ numerical properties 1 (ZFS_PROP_CREATION,
ZPOOL_PROP_SIZE, VDEV_PROP_CAPACITY) would be non-fixed and
/all/ numerical properties 5 (ZFS_PROP_COMPRESSRATIO,
ZPOOL_PROP_HEALTH, VDEV_PROP_PSIZE) would be 8-wide

Realistically, this doesn't appear to be much of a problem

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13125

2 years agoFix indentation in usr.bin/diff/pr.c
Dimitry Andric [Mon, 28 Feb 2022 20:06:19 +0000 (21:06 +0100)]
Fix indentation in usr.bin/diff/pr.c

In commit 6fa5bf0832ef the pr(1) related code in diff was moved around,
but some part of the indentation was messed up, and one line was
duplicated. Remove the duplicated line, and fix up the indentation.

Reviewed by: bapt
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34398

2 years agoboottrace.4: Reference tslog(4)
Mateusz Piotrowski [Fri, 4 Mar 2022 19:42:27 +0000 (20:42 +0100)]
boottrace.4: Reference tslog(4)

2 years agotslog.4: Document TSLOG
Mateusz Piotrowski [Fri, 4 Mar 2022 19:33:22 +0000 (20:33 +0100)]
tslog.4: Document TSLOG

Based on commit messages and Colin Percival's presentation
from BSDCan 2018 [1].

[1]: https://papers.freebsd.org/2018/bsdcan/percival-Profiling_the_FreeBSD_kernel_boot.files/percival-Profiling_the_FreeBSD_kernel_boot.pdf

Reviewed by: cperciva, debdrup
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34430

2 years agorc.conf: Fix a typo
Mateusz Piotrowski [Fri, 4 Mar 2022 19:14:18 +0000 (20:14 +0100)]
rc.conf: Fix a typo

Reported by: Pau Amma <pauamma@gundo.com>
MFC after: 3 days
MFC with: 8719e8a951b78

2 years agotime.3: Update ERRORS section
Mateusz Piotrowski [Fri, 4 Mar 2022 14:09:32 +0000 (15:09 +0100)]
time.3: Update ERRORS section

time() is now implemented using clock_gettime(2) instead of
gettimeofday(2).

Reviewed by: debdrup
Fixes: 358ed16f7505 Use clock_gettime(CLOCK_SECOND)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34438

2 years agoix(4): Add control of 2.5/5G autonegotiation speeds
Piotr Pietruszewski [Fri, 4 Mar 2022 18:37:59 +0000 (10:37 -0800)]
ix(4): Add control of 2.5/5G autonegotiation speeds

This change enables the user to control 2.5G and 5G autonegotiation
speeds via advertise_speed sysctl for X550T devices. Due to reported
interoperability issues with switches, 2.5G and 5G speeds will not be
advertised by default.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Co-authored-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Tested by: gowtham.kumar.ks@intel.com
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D26245

2 years agoixv(4): Allow PF to control the VF link state
Piotr Pietruszewski [Fri, 4 Mar 2022 18:33:02 +0000 (10:33 -0800)]
ixv(4): Allow PF to control the VF link state

This patch adds checks of a VF link state provided by PF via mailbox
API. Such change enables the PF to disable a VF administratively.

Since command needed by the PF to control the VF is introduced in
mailbox api version 1.2, this patch also bumps supported mailbox api
version to 1.2.

Co-authored-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed By: kbowling@
Tested by: lukasz.szczepaniak@intel.com
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D32004

2 years agoice(4): Update to 1.34.2-k
Eric Joyner [Fri, 4 Mar 2022 18:25:25 +0000 (10:25 -0800)]
ice(4): Update to 1.34.2-k

- Adds FW logging support
  - Once enabled, this lets the firmware print event and error messages
    to the log, increasing the visibility into what the hardware is
    doing; this is useful for debugging
- General bug fixes
- Adds inital DCB support to the driver
  - Notably, this adds support for DCBX to the driver; now with the
    fw_lldp sysctl set to 1, the driver and adapter will adopt a DCBX
    configuration sent from a link partner
  - Adds statistcs sysctls for priority flow control frames
  - Adds new configuration sysctls for DCB-related features: (VLAN) user
    priority to TC mapping; ETS bandwidth allocation; priority flow
    control
- Remove unused SR-IOV files (until support gets added)

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
MFC after: 3 days
MFC with: 213e91399be438f0a975
Relnotes: yes
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34024

2 years agovt(4): note that VGA palette configuration is not supported
Ed Maste [Thu, 3 Mar 2022 22:01:44 +0000 (17:01 -0500)]
vt(4): note that VGA palette configuration is not supported

PR: 261311
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34431

2 years agorc.d/ggated: Simplify service script
Mateusz Piotrowski [Fri, 4 Mar 2022 14:53:01 +0000 (15:53 +0100)]
rc.d/ggated: Simplify service script

- Use the standard *_flags variable for additional flags.
- Style: do not create unnecessary variables
- Do not set the defaults in the service script. This is what
  /etc/defaults/rc.conf is for.
- Do not set additional flags via commands_args. ggated_flags are
  already included in the final invocation. See rc.subr(8) for details.
- Document the meaning of ggated_config in /etc/defaults/rc.conf.

Approved by: eugen (src)
Fixes: c068632981eb Add ggated rc script
Differential Revision: https://reviews.freebsd.org/D34439

2 years agoctime.3: Add a cross-reference to clock_gettime(2)
Mateusz Piotrowski [Fri, 4 Mar 2022 16:48:02 +0000 (17:48 +0100)]
ctime.3: Add a cross-reference to clock_gettime(2)

MFC after: 1 week

2 years agoocs_fc: Ignore flogi failure when the remote node is pt2pt winner
Ram Kishore Vegesna [Fri, 4 Mar 2022 14:40:32 +0000 (20:10 +0530)]
ocs_fc: Ignore flogi failure when the remote node is pt2pt winner

Updated commit 79c56c9af583, do not proceed with discovery
if flogi fails in pt2pt winner case.

MFC after: 3 days

2 years agostats.7: Fix a typo
Mateusz Piotrowski [Fri, 4 Mar 2022 11:35:55 +0000 (12:35 +0100)]
stats.7: Fix a typo

MFC after: 3 days

2 years agostress2: Added a new test scenario checing for a long fsck_ffs runtime
Peter Holm [Fri, 4 Mar 2022 11:06:45 +0000 (12:06 +0100)]
stress2: Added a new test scenario checing for a long fsck_ffs runtime

2 years agoocs_fc: Support persistent topology feature
Ram Kishore Vegesna [Thu, 3 Mar 2022 16:00:27 +0000 (21:30 +0530)]
ocs_fc: Support persistent topology feature

Summary: Enable persistent topology across power cycles/firmware resets.

Reviewed by: mav

MFC after: 3 days

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

2 years agoocs_fc: Do not respond to unsolicited NOP BLS command.
Ram Kishore Vegesna [Thu, 3 Mar 2022 12:46:56 +0000 (18:16 +0530)]
ocs_fc: Do not respond to unsolicited NOP BLS command.

Summary: Drop unsolicited BLS commands other than ABTS.

Reviewed by: mav

MFC after: 3 days

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

2 years agoocs_fc: Ignore flogi failure when the discovery is already done.
Ram Kishore Vegesna [Thu, 3 Mar 2022 11:44:03 +0000 (17:14 +0530)]
ocs_fc: Ignore flogi failure when the discovery is already done.

Summary:
Some targets are not responding to the FLOGI in point-to-point topology,
If the pt2pt discovery is done, Ignore the FLOGI failure.

MFC after: 3 days

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

2 years agotests: readlink: fix atf_test_case call [NFC]
Kyle Evans [Fri, 4 Mar 2022 03:48:21 +0000 (21:48 -0600)]
tests: readlink: fix atf_test_case call [NFC]

This was meant to read `basic`, rather than a duplicate of `f_flag`.  It
is largely irrelevant, though, as atf_test_case mostly just makes
sure that the proper functions are defined.

Sponsored by: Klara, Inc.

2 years agoImprove timeout precision of pthread_cond_timedwait().
Alexander Motin [Fri, 4 Mar 2022 03:03:09 +0000 (22:03 -0500)]
Improve timeout precision of pthread_cond_timedwait().

This code was not touched when all other user-space sleep functions were
switched to sbintime_t and decoupled from hardclock.  When it is possible,
convert supplied times into sbinuptime to supply directly to msleep_sbt()
with C_ABSOLUTE.  This provides the timeout resolution of few microseconds
instead of 2 milliseconds, plus avoids few clock reads and conversions.

Reviewed by: vangyzen
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D34163

2 years agoFix the size returned for NT_FPREGSET.
John Baldwin [Fri, 4 Mar 2022 01:53:06 +0000 (17:53 -0800)]
Fix the size returned for NT_FPREGSET.

Sponsored by: University of Cambridge, Google, Inc.

2 years agoUse vnsz2log directly in assertion on its relation to sizeof(struct vnode).
John Baldwin [Fri, 4 Mar 2022 01:52:07 +0000 (17:52 -0800)]
Use vnsz2log directly in assertion on its relation to sizeof(struct vnode).

This reduces the size of diffs required to support different values of
vnsz2log.  In CheriBSD, kernels for CHERI architectures have vnodes
larger than 512 bytes and require a value of 9.

Reviewed by: mjg
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34418

2 years agoAdd simple kyua tests for the mod* system calls.
John Baldwin [Fri, 4 Mar 2022 01:51:45 +0000 (17:51 -0800)]
Add simple kyua tests for the mod* system calls.

Reviewed by: markj
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34417

2 years agoiwlwifi: update man pages
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:27:00 +0000 (00:27 +0000)]
iwlwifi: update man pages

Update man pages given auto-loading is now enabled by default and
no user configuration is needed to load the driver.
Also note that the iwlwifi driver will appear the first time in 13.1-R.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Relnotes: yes

2 years agoLinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:06:34 +0000 (00:06 +0000)]
LinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO

Implement MODULE_PNP_INFO() support in LinuxKPI for the Linux
MODULE_DEVICE_TABLE.

This will allow us to auto-load LinuxKPI PCI drivers (drm-kmod do
not currently as they attach to vgapci0 which in turn grabs the PCI
to my understanding) and make any loading from loader or kld_list in
rc.conf unnecessary; see devmatch(8) for more information.

We need to ensure there is a DRIVER_MODULE() (or probably just
a DECLARE_MODULE but that makes not much difference) before the
MODULE_PNP_INFO (which we otherwise would not need).

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

2 years agoLinuxKPI: remove duplicate include
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:04:19 +0000 (00:04 +0000)]
LinuxKPI: remove duplicate include

Remove a duplicate bus.h include from pci.h.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: adjust the LinuxKPI pci return for now
Bjoern A. Zeeb [Thu, 3 Mar 2022 22:24:13 +0000 (22:24 +0000)]
iwlwifi: adjust the LinuxKPI pci return for now

Rather than having LinuxKPI return BUS_PROBE_DEFAULT, return
"one less" so that on conflict of IDs others would be preferred.

This means that iwm(4) will attach instead of iwlwifi(4) for the
chipsets iwm(4) supports and iwlwifi(4) only for the other--in iwm(4)
unsupported--chipsets.  This is done so that we can enable auto-loading
of drivers but for the upcoming 13.1-Release people with working iwm(4)
will not yet be affected by iwlwifi(4).

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: allow a driver to override the default pci probe result
Bjoern A. Zeeb [Fri, 18 Feb 2022 21:58:01 +0000 (21:58 +0000)]
LinuxKPI: allow a driver to override the default pci probe result

Add bsd_probe_return which a driver can set in their 'struct pci_driver'
definition to set a driver-sepcific LinuxKPI pci return value.
This is helpful in case of multiple drivers with overlapping IDs,
such as iwlwifi(4) and iwm(4).

Contrary to an earlier version we now assume 0 is not BUS_PROBE_SPECIFIC
(which no driver should really return these days) but the bss initialized
value (bsd_probe_return unset) and we will return BUS_PROBE_DEFAULT.

Suggested by: jhb
Reviewed by: jhb
Reviewed by: hselasky, imp (earlier versions)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC: new struct members need to go to the end for stable/13
Differential Revision: https://reviews.freebsd.org/D33915