]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agofind.1: small language fix after previous change
Eugene Grosbein [Fri, 22 Jul 2022 11:46:38 +0000 (18:46 +0700)]
find.1: small language fix after previous change

collate -> collation

(cherry picked from commit d6054ee652a56466277f87bb4bcb757105393c8c)

2 years agofind.1: explain why "find -s" may differ from "find | sort"
Eugene Grosbein [Fri, 22 Jul 2022 11:39:47 +0000 (18:39 +0700)]
find.1: explain why "find -s" may differ from "find | sort"

In short, that's because a directory name may end
with a character that goes before slash (/).

MFC after: 1 week

(cherry picked from commit 26a329f49fb4537d598e93f16054fd9e16f7e677)

2 years agonfsd: Fix CreateSession for an established ClientID
Rick Macklem [Wed, 13 Jul 2022 23:28:56 +0000 (16:28 -0700)]
nfsd: Fix CreateSession for an established ClientID

I mis-read the RFC w.r.t. handling of the sequenceid
when a CreateSession is done after the initial one
that confirms the ClientID.  Fortunately this does
not affect most extant NFSv4.1/4.2 clients, since
they only acquire a single session for TCP for a
ClientID (Solaris might be an exception?).

This patch fixes the server to handle this case,
where the RFC requires the sequenceid be incremented
for each CreateSession and is required to reply to
a retried CreateSession with a cached reply.
It adds a field to nfsclient called lc_prevsess,
which caches the sessionid, which is the only field
in a CreateSession reply that will change for a
retry, to implement this reply cache.

The recent commits up to d4a11b3e3bdd that mark
session slots bad when "intr" and/or "soft" mounts
are used by the client needs this server patch.
Without this patch, the client will do a full
recovery, including a new ClientID, losing all
byte range locks.  However, prior to the recent
client commits, the client would hang when all
session slots were bad, so even without this
patch it is not a regression.

PR: 260011
(cherry picked from commit 088ba4356a114416b1d68bf5ae3b3e0accf6d0df)

2 years agonfscl: Fix CreateSession for an established ClientID
Rick Macklem [Mon, 11 Jul 2022 23:50:34 +0000 (16:50 -0700)]
nfscl: Fix CreateSession for an established ClientID

Commit 981ef32230b2 added optional use of the session
slots marked bad to recover a new session when all
slots are marked bad.  The recovery worked against
a FreeBSD NFSv4.1/4.2 server, but not a Linux one.
It turns out that it was a bug in the FreeBSD client
and not the Linux server.

This patch fixes the client so that DeleteSession
followed by CreateSession after receiving a
NFSERR_BADSESSION error reply works against the
Linux server (and conforms to the RFC).

This also implies that the FreeBSD NFSv4.1/4.2
server needs to be fixed in a future commit.
Without the fix, the FreeBSD server does a full
recovery, including creation of a new ClientID,
but since "intr" mounts were broken, this does
not result in a regression.

This patch only affects the case where a CreateSession
is done for an already confirmed ClientID, which was
not being done prior to commit 981ef32230b2.

PR: 260011
(cherry picked from commit d4a11b3e3bddb1fa3bdd101e12aea6f5937356fa)

2 years agonfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2
Rick Macklem [Sun, 10 Jul 2022 20:56:38 +0000 (13:56 -0700)]
nfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2

Commit 981ef32230b2 enabled marking of potentially bad
session slots when an RPC is interrupted if the "intr"
mount option is used.  As such, it no longer makes
sense to call nfscl_hasexpired() for I/O operations that
reply NFSERR_BADSTATEID for NFSv4.1/4.2, which does a full
recovery of NFSv4 open state, destroying all byte range locks.
Recovery of open state should not be usually needed, since
the session slot has been marked potentially bad and,
although opens for the process that has been terminated via
a signal may be broken, locks for other processes will still
be valid.

This patch disables calls to nfscl_hasexpired for NFSv4.1/4.2
mounts, when I/O RPCs receive NFSERR_BADSTATEID replies.
It does not affect the behaviour of NFSv4.0 mounts nor
hard (non "intr") mounts.

PR: 260011
(cherry picked from commit 8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58)

2 years agonfscl: Enable detection of bad session slots
Rick Macklem [Sun, 10 Jul 2022 20:33:19 +0000 (13:33 -0700)]
nfscl: Enable detection of bad session slots

To deal with broken session slots caused by the use of the
"soft" and/or "intr" mount options, nfsv4_sequencelookup()
has been modified to track the potentially broken session
slots (commit 40ada74ee1da).  Then, when all session slots
are potentially broken, nfsv4_sequencelookup() does a
DeleteSession operation, so that the NFSv4.1/4.2 server will
reply NFSERR_BADSESSION to uses of the session.
The client will then recover by doing a CreateSession to
acquire a new session.

This patch adds the code that marks potentially bad
slots, so that the above semantics become functional.
It has been successfully tested against a FreeBSD
NFSv4.1/4.2 server, but does not work against a Linux 5.15
NFSv4.1/4.2 server. (The Linux 5.15 server creates
a new session with the same sessionid as the destroyed
one and, as such, keeps returning NFSERR_BADSESSION.
I believe this is a bug in the Linux server.)

However, this should not cause a regression and will
make "intr" mounts fairly usable against the NFSv4.1/4.2
servers where it works.

PR: 260011
(cherry picked from commit 981ef32230b2fe46969c90b53864bdca4f1c3ae5)

2 years agonfscl: Replace "cred" with NULL to cleanup code
Rick Macklem [Mon, 11 Jul 2022 22:51:27 +0000 (15:51 -0700)]
nfscl: Replace "cred" with NULL to cleanup code

Commit 326bcf9394c7 added a new "cred" argument to nfscl_reqstart().
Fsinfo is a NFSv3 RPC and since the "cred" argument is not
used for NFSv3, it does not matter what is passed in.
However, to be consistent with the rest of the patch, change the
argument to NULL.

This patch should not result in a semantics change.

PR: 260011

(cherry picked from commit 2adb30740b12d4b80b8a1eb04b58ce0f6eb51de1)

2 years agonfscl: Initialize nfsess_badslots to zero
Rick Macklem [Sat, 9 Jul 2022 23:12:31 +0000 (16:12 -0700)]
nfscl: Initialize nfsess_badslots to zero

Commit 40ada74ee1da added a field to mark bad session slots.
This patch ensures that the field is initialized to 0.

PR: 260011
(cherry picked from commit 627f1555f571b5328637dbfbe441ed89c84db20c)

2 years agonfscl: Add optional support for slots marked bad
Rick Macklem [Sat, 9 Jul 2022 21:43:16 +0000 (14:43 -0700)]
nfscl: Add optional support for slots marked bad

This patch adds support for session slots marked bad
to nfsv4_sequencelookup().  An additional boolean
argument indicates if the check for slots marked bad
should be done.

The "cred" argument added to nfscl_reqstart() by
commit 326bcf9394c7 is now passed into nfsv4_setquence()
so that it can optionally set the boolean argument
for nfsv4_sequencelookup().  When optionally enabled,
nfsv4_setsequence() will do a DestroySession when all
slots are marked bad.

Since the code that marks slots bad is not yet committed,
this patch should not result in a semantics change.

PR: 260011
(cherry picked from commit 40ada74ee1dade637675cc22d50da8254046a197)

2 years agoAdjust local_rpcb() definition to avoid clang 15 warning
Dimitry Andric [Sun, 24 Jul 2022 21:28:43 +0000 (23:28 +0200)]
Adjust local_rpcb() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/rpc/rpcb_clnt.c:439:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    local_rpcb()
              ^
               void

This is because local_rpcb() is declared with a (void) argument list,
but defined with an empty argument list. Make the definition match the
declaration.

MFC after: 3 days

(cherry picked from commit e87d90a9dce22003d79ae895bac5ce2d0ca029fe)

2 years agoAdjust linux_vdso_{cpu,tsc}_selector_idx() definitions to avoid clang 15 warnings
Dimitry Andric [Sun, 24 Jul 2022 21:53:22 +0000 (23:53 +0200)]
Adjust linux_vdso_{cpu,tsc}_selector_idx() definitions to avoid clang 15 warnings

With clang 15, the following -Werror warnings are produced:

    sys/x86/linux/linux_vdso_selector_x86.c:44:28: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    linux_vdso_tsc_selector_idx()
                               ^
                                void
    sys/x86/linux/linux_vdso_selector_x86.c:62:28: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    linux_vdso_cpu_selector_idx()
                               ^
                                void

This is because linux_vdso_tsc_selector_idx() and
linux_vdso_cpu_selector_idx are declared with (void) argument lists, but
defined with empty argument lists. Make the definitions match the
declarations.

MFC after: 3 days

(cherry picked from commit eadef926b0593f18beb225f46b3d8a8d4fb44c8e)

2 years agoAdjust linux_get_char_devices() definition to avoid clang 15 warning
Dimitry Andric [Sun, 24 Jul 2022 21:46:54 +0000 (23:46 +0200)]
Adjust linux_get_char_devices() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/compat/linux/linux_util.c:243:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    linux_get_char_devices()
                          ^
                           void

This is because linux_get_char_devices() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit e90d1b57487759e076b16cd3903a7b69565452b9)

2 years agoFix unused variable warning in mlx5_ib_devx.c
Dimitry Andric [Sun, 24 Jul 2022 22:22:05 +0000 (00:22 +0200)]
Fix unused variable warning in mlx5_ib_devx.c

With clang 15, the following -Werror warning is produced:

    sys/dev/mthca/mthca_cmd.c:662:23: error: variable 'tc' set but not used [-Werror,-Wunused-but-set-variable]
            int ts __unused = 0, tc = 0;
                                 ^

The 'ts' and 'tc' variables are eventually used only in mthca_dbg()
macros, if CONFIG_INFINIBAND_MTHCA_DEBUG is defined. Ensure 'ts' and
'tc' are only declared and used when CONFIG_INFINIBAND_MTHCA_DEBUG is
defined.

MFC after: 3 days

(cherry picked from commit 5ae3710aeb2a984344fbe36de71612fc1a3d1a71)

2 years agoAdjust authnone_create() definition to avoid clang 15 warning
Dimitry Andric [Sun, 24 Jul 2022 21:40:20 +0000 (23:40 +0200)]
Adjust authnone_create() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/rpc/auth_none.c:106:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    authnone_create()
                   ^
                    void

This is because authnone_create() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 90529847cf079d3b7250ae3d3ecd79e843df7973)

2 years agoFix unused variable warning in icl_soft.c
Dimitry Andric [Sun, 24 Jul 2022 20:54:08 +0000 (22:54 +0200)]
Fix unused variable warning in icl_soft.c

With clang 15, the following -Werror warning is produced:

    sys/dev/iscsi//icl_soft.c:886:6: error: variable 'coalesced' set but not used [-Werror,-Wunused-but-set-variable]
            int coalesced, error;
                ^

The 'coalesced' variable is eventually used only in an #if 0'd block,
obviously meant for debugging. Ensure that 'coalesced' is only declared
and used when DEBUG_COALESCED is defined, so the debugging can be easily
turned on later, if desired.

MFC after: 3 days

(cherry picked from commit f4f847018048ac7699b55bc1915a393eb65e4c53)

2 years agoFix unused variable warning in mlx5_fs_tree.c
Dimitry Andric [Sun, 24 Jul 2022 22:09:33 +0000 (00:09 +0200)]
Fix unused variable warning in mlx5_fs_tree.c

With clang 15, the following -Werror warning is produced:

    sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c:1408:15: error: variable 'candidate_group_num' set but not used [-Werror,-Wunused-but-set-variable]
            unsigned int candidate_group_num = 0;
                         ^

The 'candidate_group_num' variable appears to have been a debugging aid
that has never been used for anything, so remove it.

MFC after: 3 days

(cherry picked from commit 6332ad8673fb108dcb8af0aaa42d75ea845748d7)

2 years agoAdjust svc_vc_null() definition to avoid clang 15 warning
Dimitry Andric [Sun, 24 Jul 2022 21:38:46 +0000 (23:38 +0200)]
Adjust svc_vc_null() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/rpc/svc_vc.c:1078:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    svc_vc_null()
               ^
                void

This is because svc_vc_null() is declared with a (void) argument list,
but defined with an empty argument list. Make the definition match the
declaration.

MFC after: 3 days

(cherry picked from commit 87d18efef7e3df5f4475cfe1a8f6d6782b7c1527)

2 years agovm_mmap: Remove obsolete code and comments from vm_mmap()
Mark Johnston [Wed, 13 Jul 2022 13:39:26 +0000 (09:39 -0400)]
vm_mmap: Remove obsolete code and comments from vm_mmap()

In preparation for removing OBJT_DEFAULT, eliminate some stale/unhelpful
comments from vm_mmap(), and remove an unused case.  In particular, the
remaining callers of vm_mmap() in the tree do not specify OBJT_DEFAULT.

It's much more common to use vm_map_find() to map an object into user
memory, so rather than adjusting vm_mmap() to handle OBJT_SWAP objects,
let's further discourage its use and simply remove OBJT_DEFAULT
handling.

Reviewed by: dougm, alc, kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit eee9aab9cb5adfbf39ab5622b441d0021c13efea)

2 years agonewfs_msdos: fix type of kern.maxphys
Eric van Gyzen [Mon, 31 Jan 2022 20:34:17 +0000 (14:34 -0600)]
newfs_msdos: fix type of kern.maxphys

The type of the kern.maxphys sysctl OID is now ulong.  Change the
local variable type to match.

Reviewed by: delphij, emaste
Sponsored by: Dell EMC Isilon

(cherry picked from commit 9990450e17f79ca6e59866397b979a8a344cd5d4)

2 years agovm_object: Modify various drivers to allocate OBJT_SWAP objects
Mark Johnston [Tue, 12 Jul 2022 12:51:02 +0000 (08:51 -0400)]
vm_object: Modify various drivers to allocate OBJT_SWAP objects

This is in preparation for removal of OBJT_DEFAULT.  In particular, it
is now cheap to check whether an OBJT_SWAP object has any swap blocks
allocated, so the benefit of having a separate OBJT_DEFAULT type is
quite marginal, and the OBJT_DEFAULT->SWAP transition is a source of
bugs.

Reviewed by: alc, hselasky, kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6b38974085215bcd787be0d138411ec57cf0096e)

2 years agocuse(3): Make some clarifications in the manual page.
Hans Petter Selasky [Wed, 13 Jul 2022 14:30:36 +0000 (16:30 +0200)]
cuse(3): Make some clarifications in the manual page.

Sponsored by: NVIDIA Networking

(cherry picked from commit 280f34c37cc8947527da23e2612d436f1873fce5)

2 years agocuse(3): Allow allocating a memory buffer of exactly 2 GBytes.
Hans Petter Selasky [Mon, 18 Jul 2022 15:13:27 +0000 (17:13 +0200)]
cuse(3): Allow allocating a memory buffer of exactly 2 GBytes.

The manual page date will be bumped separately.

Sponsored by: NVIDIA Networking

(cherry picked from commit 58a8f6e9ecabba975f2cda8416bcc36c2073a7a8)

2 years agocuse(3): Allow shared memory allocations up to, but excluding 2 GBytes.
Hans Petter Selasky [Wed, 13 Jul 2022 16:17:40 +0000 (18:17 +0200)]
cuse(3): Allow shared memory allocations up to, but excluding 2 GBytes.

Currently the cuse(3) mmap(2) offset is split into 128 banks of 16 Mbytes.
Allow cuse(3) to make allocations that span multiple banks at the expense
of any fragmentation issues that may arise. Typically mmap(2) buffers are
well below 16 Mbytes. This allows 8K video resolution to work using webcamd.

Reviewed by: markj @
Differential Revision: https://reviews.freebsd.org/D35830
Sponsored by: NVIDIA Networking

(cherry picked from commit d14b53ee31ca06933a4f8ef2e48ce33cf3dd5ec9)

2 years agocuse(3): Make cuse_vmfree() NULL safe.
Hans Petter Selasky [Wed, 13 Jul 2022 15:54:24 +0000 (17:54 +0200)]
cuse(3): Make cuse_vmfree() NULL safe.

Sponsored by: NVIDIA Networking

(cherry picked from commit 2ca43c3dba1b818db9245027c87fddfc9d4be0a6)

2 years agocuse(3): Fix an off-by-one.
Hans Petter Selasky [Wed, 13 Jul 2022 13:53:49 +0000 (15:53 +0200)]
cuse(3): Fix an off-by-one.

The page allocation limit is inclusive and not exclusive.

Sponsored by: NVIDIA Networking

(cherry picked from commit 0996dd7df688921bd41b255e4cdcc155fda8461a)

2 years agocuse(3): Remove PAGE_SIZE from libcuse.
Hans Petter Selasky [Thu, 23 Jun 2022 20:34:45 +0000 (22:34 +0200)]
cuse(3): Remove PAGE_SIZE from libcuse.

To allow for a dynamic page size on arm64 remove the static value from libcuse.

Differential Revision: https://reviews.freebsd.org/D35585
Sponsored by: NVIDIA Networking

(cherry picked from commit 2c28cd09d9f7ac266a8c7b283384712aba0af93a)

2 years agoarm64, qoriq_therm: fix handling sites on version 1 and 2
Bjoern A. Zeeb [Sun, 10 Jul 2022 13:38:56 +0000 (13:38 +0000)]
arm64, qoriq_therm: fix handling sites on version 1 and 2

For version 2 extend the TMUV2_TMSAR() write loop over all site_ids
registered for a particular SoC and actually use the site_id rather
than always just the first [0] (which for the LX2080 would be a
problem given there is no site0).

Later, while version 2 adds the SITEs to enable to TMSR in bits 0..<n>,
version 1 (e.g., LS1028, LS1046, LS1088) add MSITEs to TMR
bits 16..31 or rather 15..0(16-<n>).  Adjust the loops to only enable
the site_ids listed for the particular SoC for monitoring.  This now
also deals with sparse site_ids (not starting at 0, or not being
contiguous).

Sponsored by: Traverse Technologies (providing Ten64 HW for testing)
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D35764

(cherry picked from commit fe88072dc69fcd64b42d8512ad214c0fe009ad8e)

2 years agoarm64, qoriq_therm: configure the number of sites base don SoC
Bjoern A. Zeeb [Sat, 9 Jul 2022 00:30:17 +0000 (00:30 +0000)]
arm64, qoriq_therm: configure the number of sites base don SoC

Configure the number of sites (sensors) based on SoC.
This avoids timeouts reading non-existent sensors.

The changes are based on mmel's initial work at:
https://github.com/strejda/freebsd/commit/914e3f0098b090cb5c1492b0d24992012c5c553b

Sponsored by: Traverse Technologies (providing Ten64 HW for testing)
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D35759

(cherry picked from commit 394453302bca7a5147db126ce01a3497eb3415f7)

2 years agoena: Update driver version to v2.6.1
Michal Krawczyk [Mon, 4 Jul 2022 07:12:57 +0000 (09:12 +0200)]
ena: Update driver version to v2.6.1

Minor version update which improves styling of a printouts, fixes
the KASAN and KMSAN kernel builds and LLQ reconfiguration after the
device reset.

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

(cherry picked from commit 25b64933a48c47baef698a302fa2dc5c6e3013ea)

2 years agoena: Fix LLQ descriptor reconfiguration
Michal Krawczyk [Tue, 5 Jul 2022 10:59:25 +0000 (12:59 +0200)]
ena: Fix LLQ descriptor reconfiguration

After the device reset, the LLQ configuration descriptor wasn't passed
to the hardware. On a 6-generation AWS instances (like C6gn), it is
required to pass the LLQ descriptor after the device reset, otherwise
the hardware will be missing the LLQ configuration resulting in
performance degradation.

This patch reconfigures the LLQ each time the ena_device_init() is
called. This means that the LLQ descriptor will be passed during the
initial configuration and after a reset.

The ena_map_llq_mem_bar() function call was moved before the
ena_device_init() call, to make sure that the mem bar is available.

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

(cherry picked from commit 3324e304c14d121dc04338a38c7f3277cbfba58b)

2 years agoena: Align req_id and qid print order
Michal Krawczyk [Mon, 4 Jul 2022 07:03:54 +0000 (09:03 +0200)]
ena: Align req_id and qid print order

In most places, the req_id is printed first, and the qid is printed as a
second. To align the driver, one printout was reworked and the print
order of those variables was changed.

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

(cherry picked from commit 38d036e91a8c29bf97b86d441a9d627c5cef2aea)

2 years agoena: Make first_interrupt a uint8_t
Mark Johnston [Thu, 30 Jun 2022 18:49:46 +0000 (14:49 -0400)]
ena: Make first_interrupt a uint8_t

We do not have atomic(9) routines for bools, and it is not guaranteed
that sizeof(bool) is 1.

This fixes the KASAN and KMSAN kernel builds, which fail because the
compiler refuses to silently cast a _Bool * to a uint8_t * when calling
the atomic(9) sanitizer interceptors.

Reviewed by: Dawid Górecki <dgr@semihalf.com>
MFC after: 2 weeks
Fixes: 0ac122c388d9 ("ena: Use atomic_load/store functions for first_interrupt variable")
Differential Revision: https://reviews.freebsd.org/D35683

(cherry picked from commit b72f1f4516896ad6da0ea74d146a56045de171f7)

2 years agoena: Update driver version to v2.6.0
Michal Krawczyk [Fri, 10 Jun 2022 09:18:14 +0000 (11:18 +0200)]
ena: Update driver version to v2.6.0

Some of the changes in this release:
* Style fixes
* Fix ENI stats probing
* Add trace for the last Tx cleanup call
* Prevent LLQ initialization if member isn't exposed
* Improve logging

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

(cherry picked from commit 79e1500276a993c8be857a6e32f0c05ec8f3cdc8)

2 years agoena: Fix invalid KASSERT test in netmap code
Michal Krawczyk [Fri, 10 Jun 2022 09:18:13 +0000 (11:18 +0200)]
ena: Fix invalid KASSERT test in netmap code

The KASSERT was originally added to ensure that the netmap Rx ring is
not NULL, however, it was checking for the opposite.

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

(cherry picked from commit 79770fdad6c18d968cc122c4294820931cc542e0)

2 years agoena: Align names of constants
Dawid Gorecki [Fri, 10 Jun 2022 09:18:13 +0000 (11:18 +0200)]
ena: Align names of constants

Most of the constants in ena.h file were prefixed with ENA_*, while
others did not have this prefix. Align the constants by prefixing the
remaining constants with ENA.

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

(cherry picked from commit 8f15f8a72b5474b81c5951d4039d203b2d80e2e3)

2 years agoena: Remove write-only datapath variable
Michal Krawczyk [Fri, 10 Jun 2022 09:18:11 +0000 (11:18 +0200)]
ena: Remove write-only datapath variable

The ena_qid variable value is never used. It can be safely removed.
That also silences the compilation warning.

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

(cherry picked from commit d5d5ea87236d8f839cad84296f23d285a696195c)

2 years agoena: Fix styling issues
Dawid Gorecki [Fri, 10 Jun 2022 09:18:11 +0000 (11:18 +0200)]
ena: Fix styling issues

Align code style with FreeBSD style(9) guidelines.

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

(cherry picked from commit 82e558eacf222ac497bc11fa9f2c7778e97fbc7a)

2 years agoena: Use device_set_desc in probe
Dawid Gorecki [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Use device_set_desc in probe

During probe the driver created a temporary buffer to which the value of
DEVICE_DESC constant was printed. This buffer was then copied to the
device structure using device_set_desc_copy. Since the value of this
string is exactly the same for every device using the ENA driver, using
sprintf is unnecessary, and device_set_desc can be used instead.

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

(cherry picked from commit 755e60ca046390bdcfc097b6a8f1a032d47a7b65)

2 years agoena: Move ena_copy_eni_metrics into separate task
Dawid Gorecki [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Move ena_copy_eni_metrics into separate task

Copying ENI metrics was done in callout context, this caused the driver
to panic when sample_interval was set to a value other than 0, as the
admin queue call which was executed could sleep while waiting on
a condition variable. Taskqueue, unlike callout, allows for sleeping, so
moving the function to a separate taskqueue fixes the problem.
ena_timer_service is still responsible for scheduling the taskqueue.

Stop draining the callout during ena_up/ena_down. This was done to
prevent a race between ena_up/down and ena_copy_eni_metrics admin queue
calls. Since ena_metrics_task is protected by ENA_LOCK there is no
possibility of a race between ena_up/down and ena_metrics_task.

Remove a comment about locking in ena_timer_service. With ENI metrics
in a separate task this comment became obsolete.

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

(cherry picked from commit b899a02ad7330cae3c9bb08ad7975601dc3b9551)

2 years agoena: Use atomic_load/store functions for first_interrupt variable
Dawid Gorecki [Fri, 10 Jun 2022 09:18:09 +0000 (11:18 +0200)]
ena: Use atomic_load/store functions for first_interrupt variable

Surround cases of possible simultaneous access to the first_interrupt
variable with atomic_load/store functions.

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

(cherry picked from commit 0ac122c388d9a5e189e60378f1950b82a22bbdd1)

2 years agoena: Store ticks of last Tx cleanup
Dawid Gorecki [Fri, 10 Jun 2022 09:18:09 +0000 (11:18 +0200)]
ena: Store ticks of last Tx cleanup

Store timestamp of last cleanup in Tx ring structure. This does not
change anything during normal operation of the driver but could be
useful when the device fails for some reason.

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

(cherry picked from commit d8aba82b5ca75f1a5bff609af141844c4fc9de70)

2 years agoena: Prevent LLQ initialization when membar isn't exposed
Dawid Gorecki [Fri, 10 Jun 2022 09:18:08 +0000 (11:18 +0200)]
ena: Prevent LLQ initialization when membar isn't exposed

The ena_com_config_dev_mode() function performs many LLQ related
calculations and sends an admin command to configure LLQ in the device.

All the LLQ related operations are unnecessary if the driver fails to
find LLQ memory bar.

Move LLQ memory bar allocation to separate helper function
ena_map_llq_mem_bar and execute this function before LLQ configuration.
If the LLQ memory bar cannot be allocated, then LLQ configuration is
skipped.

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

(cherry picked from commit 90232d18ca4f7a5a3073a8279a9b9d3228df5f87)

2 years agoena: Extend debug prints for invalid req_id resets
Dawid Gorecki [Fri, 10 Jun 2022 09:18:07 +0000 (11:18 +0200)]
ena: Extend debug prints for invalid req_id resets

Print information about qid if req_id is invalid. Add information about
qid and req_id if mbuf is invalid.

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

(cherry picked from commit a9c39b031fe89a6414174e3db82da6548d7fff0f)

2 years agoena: Move reset completion logging to the reset function
Dawid Gorecki [Fri, 10 Jun 2022 09:17:53 +0000 (11:17 +0200)]
ena: Move reset completion logging to the reset function

While ena_restore_device is called from the reset task, it can also be
called from other locations in the driver, for example in netmap
specific code. Move the reset completion logging to reset task, so it
better represents when the reset actually happened.

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

(cherry picked from commit d209ffee155dd5e505f174a356c8f50c96ebf57e)

2 years agoena: Add ena_ring_tx_doorbell() function
Dawid Gorecki [Fri, 10 Jun 2022 09:17:52 +0000 (11:17 +0200)]
ena: Add ena_ring_tx_doorbell() function

Add ena_ring_tx_doorbell function to remove code duplication.

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

(cherry picked from commit 3501d4f17e8cc0350b8deff671f9991cc7ac280c)

2 years agoconsole: add U+276E and U+276F glyphs
Ed Maste [Tue, 19 Jul 2022 15:48:29 +0000 (11:48 -0400)]
console: add U+276E and U+276F glyphs

U+276E Heavy Left-Pointing Angle Quotation Mark Ornament
U+276F Heavy Right-Pointing Angle Quotation Mark Ornament

U+276F is used by zprezto (zsh config package).

For the normal font I used the bold font glyphs for U+003C < and
U+003E >.  The bold font glyphs are new.

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

(cherry picked from commit f7d5459ece7a9210023b515fed4fb6d527d4dab3)

2 years agoUpdate Terminus console font to 4.49
Ed Maste [Mon, 18 Jul 2022 17:44:42 +0000 (13:44 -0400)]
Update Terminus console font to 4.49

As in the past Dimitar Zhekov provided a copy of Terminus under a BSD
license for use by our console.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

(cherry picked from commit cd8401dbdeb7ed4ea5fbf3897c775667eb536cb7)

2 years agovtfontcvt: improve hex font format validation
Ed Maste [Tue, 19 Jul 2022 15:20:10 +0000 (11:20 -0400)]
vtfontcvt: improve hex font format validation

Previously an EOF would result in sscanf returning -1 leading to a
crash.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agovtfontcvt: correct usage
Ed Maste [Mon, 18 Jul 2022 17:21:22 +0000 (13:21 -0400)]
vtfontcvt: correct usage

Commit e7fd9688ea97 changed vtfontcvt's command line parsing, but did
not correctly update the usage (it omitted the new -o flag).

Fixes: e7fd9688ea97 ("Move font related data structured to...")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit df777aeb9813cc37883fb6d4e1a4d502254b3193)

2 years agobacklight(8): Update usage() to match the manual page
Mateusz Piotrowski [Tue, 19 Jul 2022 14:56:27 +0000 (16:56 +0200)]
backlight(8): Update usage() to match the manual page

MFC after: 1 week

(cherry picked from commit f4b00609ec081f42af07168c7caa6766512749bd)

2 years agobacklight.8: Show all possible modes in synopsis
Mateusz Piotrowski [Tue, 19 Jul 2022 14:55:25 +0000 (16:55 +0200)]
backlight.8: Show all possible modes in synopsis

MFC after: 1 week

(cherry picked from commit 64a231b90b03037c63bd2c7e51f1c67591016350)

2 years agobacklight.8: Standardize synopsis and improve examples
Mateusz Piotrowski [Tue, 19 Jul 2022 14:49:50 +0000 (16:49 +0200)]
backlight.8: Standardize synopsis and improve examples

MFC after: 1 week

(cherry picked from commit 5c3e4249589dc5452b738aea13a32e8b11082808)

2 years agonfscl: Move nfsrpc_destroysession into nfscommon
Rick Macklem [Sat, 9 Jul 2022 15:02:14 +0000 (08:02 -0700)]
nfscl: Move nfsrpc_destroysession into nfscommon

This patch moves nfsrpc_destroysession() into nfscommon.ko
and also modifies its arguments slightly.  This will allow
the function to be called from nfsv4_sequencelookup() in
a future commit.

This patch should not result in a semantics change.

PR: 260011
(cherry picked from commit dff31ae1c59cab9437e88bfd0f2abd35ddaa98f1)

2 years agonfscl: Change the cred argument to non-NULL for pNFS proxies
Rick Macklem [Sat, 9 Jul 2022 00:27:23 +0000 (17:27 -0700)]
nfscl: Change the cred argument to non-NULL for pNFS proxies

Commit 326bcf9394c7 added a "cred" argument to nfscl_reqstart().
For the pNFS proxy calls on the server, the argument
should be "cred" instead of NULL.
This patch fixes this.

Since the argument is not yet used, this patch
should not result in a semantics change.

PR: 260011
(cherry picked from commit 2b766d5e5a73fce7120131d56bffc1715f71e7c9)

2 years agotmpfs.5: Fix typos and linter warnings
Mateusz Piotrowski [Thu, 21 Jul 2022 18:01:49 +0000 (20:01 +0200)]
tmpfs.5: Fix typos and linter warnings

MFC after: 3 days

(cherry picked from commit 2b693e4829265e1e9f73b628c139701e1c259b24)

2 years agotmpfs.5: Add fstab line example
Mateusz Piotrowski [Thu, 21 Jul 2022 18:06:32 +0000 (20:06 +0200)]
tmpfs.5: Add fstab line example

MFC after: 3 days

(cherry picked from commit 7c2ec6cdf575de11d5ed33109d92e757dd3d072c)

2 years agobeinstall.8: Update example distsites for BSDINSTALL_DISTSITE
Mateusz Piotrowski [Mon, 18 Jul 2022 10:22:42 +0000 (12:22 +0200)]
beinstall.8: Update example distsites for BSDINSTALL_DISTSITE

MFC after: 1 week

(cherry picked from commit aa35037ba565bf9f6d5946515ecdcc61a5b22ebb)

2 years agoblacklistd: Handle 0 sized messages
Ed Maste [Mon, 18 Jul 2022 00:43:52 +0000 (20:43 -0400)]
blacklistd: Handle 0 sized messages

Patch obtained from https://github.com/zoulasc/blocklist commit
ada75856bc6fcabbdd25ffbe08fbad5cf2a2c08a

PR: 264599
MFC after: 1 week

(cherry picked from commit b1e81e6ddee42efb0f0d49cfc6cebb48d52e3f08)

2 years agoeventtimer: Fix several races in the timer reload code
Mark Johnston [Thu, 30 Jun 2022 18:27:07 +0000 (14:27 -0400)]
eventtimer: Fix several races in the timer reload code

In handleevents(), lock the timer state before fetching the time for the
next event.  A concurrent callout_cc_add() call might be changing the
next event time, and the race can cause handleevents() to program an
out-of-date time, causing the callout to run later (by an unbounded
period, up to the idle hardclock period of 1s) than requested.

In cpu_idleclock(), call getnextcpuevent() with the timer state mutex
held, for similar reasons.  In particular, cpu_idleclock() runs with
interrupts enabled, so an untimely timer interrupt can result in a stale
next event time being programmed.  Further, an interrupt can cause
cpu_idleclock() to use a stale value for "now".

In cpu_activeclock(), disable interrupts before loading "now", so as to
avoid going backwards in time when calling handleevents().  It's ok to
leave interrupts enabled when checking "state->idle", since the race at
worst will cause handleevents() to be called unnecessarily.  But use an
atomic load to indicate that the test is racy.

PR: 264867
Reviewed by: mav, jhb, kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a889a65ba36985dfb31111ac1607be35ca2b2c8c)

2 years agocallout: Simplify the inner loop in callout_process() a bit
Mark Johnston [Fri, 1 Jul 2022 00:16:33 +0000 (20:16 -0400)]
callout: Simplify the inner loop in callout_process() a bit

- Use LIST_FOREACH_SAFE.
- Simplify control flow.

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 46eab86035a1d5d2b8bfd5aae3581e2604d3ae68)

2 years agocallout: Remove a redundant parameter to callout_cc_add()
Mark Johnston [Thu, 30 Jun 2022 17:31:57 +0000 (13:31 -0400)]
callout: Remove a redundant parameter to callout_cc_add()

The passed cpuid is always equal to the one stored in the callout
structure.  No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit aac7c7ac545804889d3bc28fae4efbcc07bcb6d3)

2 years agovm_fault: Fix some nits in vm_fault_copy_entry()
Mark Johnston [Mon, 11 Jul 2022 19:27:54 +0000 (15:27 -0400)]
vm_fault: Fix some nits in vm_fault_copy_entry()

- Correct the description (vm_fault_copy_entry() does not create a
  shadow object).
- Move some initialization and assertions out of the scope of the object
  locks, when doing so makes sense.
- Merge a pair of conditional blocks.
- Use __unused when appropriate.

No functional change intended.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b57be759d079d40aa6ec75207faadce5ae1484a2)

2 years agouma: Use a taskqueue to execute uma_timeout()
Mark Johnston [Mon, 11 Jul 2022 19:45:36 +0000 (15:45 -0400)]
uma: Use a taskqueue to execute uma_timeout()

uma_timeout() has several responsibilities; it visits every UMA zone and
as of recently will drain underutilized caches, so is rather expensive
(>1ms in some cases).  Currently it is executed by softclock threads
and so will preempt most other CPU activity.  None of this work requires
a high scheduling priority, though, so defer it to a taskqueue so as to
avoid stalling higher-priority work.

Reviewed by: rlibby, alc, mav, kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 93cd28ea82bb7b5e9489c8febfe1ae7ed2c044fb)

2 years agonfscl: Add a cred argument to nfscl_reqstart()
Rick Macklem [Fri, 8 Jul 2022 23:58:06 +0000 (16:58 -0700)]
nfscl: Add a cred argument to nfscl_reqstart()

To deal with broken session slots caused by the use of the
"soft" and/or "intr" mount options, nfsv4_sequencelookup()
will be modified to track the potentially broken session
slots.  Then, when all session slots are potentially
broken, do a DeleteSession operation, so that the NFSv4
server will reply NFSERR_BADSESSION to uses of the session.
These changes will be done in future commits.  However,
to do the DeleteSession RPC, a "cred" argument is needed
for nfscl_reqstart().  This patch adds this argument,
which is unused at this time.  If the argument is NULL,
it indicates that DeleteSession should not be done
(usually because the RPC does not use sessions).

This patch should not cause any semantics change.

PR: 260011
MFC after: 2 weeks

(cherry picked from commit 326bcf9394c74ac19afda7c741b3521d91b46b10)

2 years agoses: don't panic if disk elements have really weird descriptors
Alan Somers [Fri, 10 Jun 2022 22:44:59 +0000 (16:44 -0600)]
ses: don't panic if disk elements have really weird descriptors

SES allows element descriptors to contain characters like spaces and
quotes that devfs does not allow to appear in device aliases.  Since SES
element descriptors are outside of the kernel's control, we should
gracefully handle a failure to create a device physical path alias.

PR: 264513
Reported by: Yuri <yuri@aetern.org>
Reviewed by: imp, mav
Sponsored by: Axcient

(cherry picked from commit 5f438dd3acba47e54e63b13bfff31a49bcc6ddea)

2 years agobsdinstall: allow an install script to access packages on the DVD
Alan Somers [Thu, 26 May 2022 21:39:20 +0000 (15:39 -0600)]
bsdinstall: allow an install script to access packages on the DVD

If installing from the DVD, mount its packages in the chroot at
/dist/packages.  That way they'll be accessible to an install script.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D35330

(cherry picked from commit 6a02539959cb36c4777f962d3d7ef4a76fbe0c24)

2 years agoReplace subversion with git in the installation DVD
Alan Somers [Thu, 26 May 2022 19:08:34 +0000 (13:08 -0600)]
Replace subversion with git in the installation DVD

I assume the original reason for Subversion's inclusion was to checkout
the base system.  But now we use git for that.

Reviewed by: gjb
Sponsored by: Axcient
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35329

(cherry picked from commit 55c8093f733242cd72341ba1126637047cf16ca3)

2 years agobsdinstall: fix prepopulating the ZFS disk menu with ZFSBOOT_DISKS
Alan Somers [Thu, 26 May 2022 22:20:03 +0000 (16:20 -0600)]
bsdinstall: fix prepopulating the ZFS disk menu with ZFSBOOT_DISKS

If the ZFSBOOT_DISKS variable is set to one or more disk names, then
those disks should be preselected in the disk menu.  However, the code
wasn't correctly setting the variable, leaving all disks unselected.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: dteske
Differential Revision: https://reviews.freebsd.org/D35331

(cherry picked from commit caf73e58579343fc1661f43554b30115bb940535)

Fix a memory leak from caf73e58579

Don't shadow an already-local variable with another local declaration.

Reported by: dteske
MFC after: 13 days
MFC with: caf73e58579343fc1661f43554b30115bb940535
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D35331

(cherry picked from commit 77d678b7a4075a056be621b46be50377f08bfc9e)

2 years agobsdinstall: use gpt/efiboot0 label in /etc/fstab
Alan Somers [Tue, 24 May 2022 18:24:12 +0000 (12:24 -0600)]
bsdinstall: use gpt/efiboot0 label in /etc/fstab

Otherwise, boot will hang if the numbering of disks has changed since
initial install.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: brd
Differential Revision: https://reviews.freebsd.org/D35309

(cherry picked from commit 7919c76dbdd20161247d1bfb647110d87ca5ee0f)

2 years agoAdjust iface_khandler_register() definition to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 19:28:03 +0000 (21:28 +0200)]
Adjust iface_khandler_register() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/netpfil/ipfw/ip_fw_iface.c:128:24: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    iface_khandler_register()
                           ^
                            void

This is because iface_khandler_register() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit edf1e1f78da8c2a19bcee90fe0f72cac2eb18e30)

2 years agoFix unused variable warning in fwohci.c
Dimitry Andric [Thu, 21 Jul 2022 17:59:08 +0000 (19:59 +0200)]
Fix unused variable warning in fwohci.c

With clang 15, the following -Werror warning is produced:

    sys/dev/firewire/fwohci.c:2762:23: error: variable 'pcnt' set but not used [-Werror,-Wunused-but-set-variable]
            int len, plen, hlen, pcnt, offset;
                                 ^

The 'pcnt' variable is eventually used only in an #if 0'd block,
obviously meant for debugging. Ensure that 'pcnt' is only declared and
used when COUNT_PACKETS is defined, so the debugging can be easily
turned on later, if desired.

MFC after: 3 days

(cherry picked from commit d7e0d962f39877b997454992a980f4122c6316e7)

2 years agoFix unused variable warning in if_re_netmap.h
Dimitry Andric [Thu, 21 Jul 2022 19:52:29 +0000 (21:52 +0200)]
Fix unused variable warning in if_re_netmap.h

With clang 15, the following -Werror warning is produced:

    sys/dev/netmap/if_re_netmap.h:179:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
            u_int n;
                  ^

The 'n' variable appears to have been a debugging aid that has never
been used for anything, so remove it.

MFC after: 3 days

(cherry picked from commit 8bfedf5852bcb846bfdd2a54989d65cdbb16f7ef)

2 years agoAdjust ipfw_iface_{init,destroy}() definitions to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 19:37:09 +0000 (21:37 +0200)]
Adjust ipfw_iface_{init,destroy}() definitions to avoid clang 15 warning

With clang 15, the following -Werror warnings are produced:

    sys/netpfil/ipfw/ip_fw_iface.c:206:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_iface_init()
                   ^
                    void
    sys/netpfil/ipfw/ip_fw_iface.c:219:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_iface_destroy()
                      ^
                       void

This is because ipfw_iface_init() and ipfw_iface_destroy() are declared
with (void) argument lists, but defined with empty argument lists. Make
the definitions match the declarations.

MFC after: 3 days

(cherry picked from commit 1eea6b9097834484f2238298f550bb418901c313)

2 years agoFix unused variable warning in iflib.c
Dimitry Andric [Thu, 21 Jul 2022 19:19:28 +0000 (21:19 +0200)]
Fix unused variable warning in iflib.c

With clang 15, the following -Werror warning is produced:

    sys/net/iflib.c:993:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
            u_int n;
                  ^

The 'n' variable appears to have been a debugging aid that has never
been used for anything, so remove it.

MFC after: 3 days

(cherry picked from commit 0294e95da4aa272906d4472137b1235d8d8a7180)

2 years agoFix unused variable warning in if_lagg.c
Dimitry Andric [Thu, 21 Jul 2022 18:51:23 +0000 (20:51 +0200)]
Fix unused variable warning in if_lagg.c

With clang 15, the following -Werror warning is produced:

    sys/net/if_lagg.c:2413:6: error: variable 'active_ports' set but not used [-Werror,-Wunused-but-set-variable]
            int active_ports = 0;
                ^

The 'active_ports' variable appears to have been a debugging aid that
has never been used for anything (ref https://reviews.freebsd.org/D549),
so remove it.

MFC after: 3 days

(cherry picked from commit fa267a329ffa3d0e02c3c3a52dd5df5231d92cba)

2 years agoAdjust ipfw_{init,destroy}_*() definitions to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 19:23:13 +0000 (21:23 +0200)]
Adjust ipfw_{init,destroy}_*() definitions to avoid clang 15 warning

With clang 15, the following -Werror warnings are produced:

    sys/netpfil/ipfw/ip_fw_sockopt.c:187:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_init_counters()
                      ^
                       void
    sys/netpfil/ipfw/ip_fw_sockopt.c:196:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_destroy_counters()
                         ^
                          void
    sys/netpfil/ipfw/ip_fw_sockopt.c:3241:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_init_obj_rewriter()
                          ^
                           void
    sys/netpfil/ipfw/ip_fw_sockopt.c:3249:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_destroy_obj_rewriter()
                             ^
                              void

This is because ipfw_init_counters(), ipfw_destroy_counters(),
ipfw_init_obj_rewriter(), and ipfw_destroy_obj_rewriter() are declared
with (void) argument lists, but defined with empty argument lists. Make
the definitions match the declarations.

MFC after: 3 days

(cherry picked from commit 62030bb8538cb3775f6259c81c2c30a533f3ab10)

2 years agoAdjust iface_khandler_deregister() definition to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 19:32:16 +0000 (21:32 +0200)]
Adjust iface_khandler_deregister() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/netpfil/ipfw/ip_fw_iface.c:159:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    iface_khandler_deregister()
                             ^
                              void

This is because iface_khandler_deregister() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit 4100dc46c78cef408369c0fc8dcfd1f87783a1ca)

2 years agoAdjust pmc_thread_descriptor_pool_drain() definition to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 18:31:56 +0000 (20:31 +0200)]
Adjust pmc_thread_descriptor_pool_drain() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/hwpmc/hwpmc_mod.c:2462:33: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmc_thread_descriptor_pool_drain()
                                    ^
                                     void

This is because pmc_thread_descriptor_pool_drain() is declared with a
(void) argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit 555d2c9394fa673241fd26a95152adfb9d20952e)

2 years agoAdjust fbt_unload() definition to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 17:40:38 +0000 (19:40 +0200)]
Adjust fbt_unload() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/fbt/fbt.c:1273:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    fbt_unload()
              ^
               void

This is because fbt_unload() is declared with a (void) argument list,
but defined with an empty argument list. Make the definition match the
declaration.

MFC after: 3 days

(cherry picked from commit 6339314c737f44477c1168819353087c2f4816eb)

2 years agoAdjust pcm_md_initialize() definition to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 18:23:19 +0000 (20:23 +0200)]
Adjust pcm_md_initialize() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/hwpmc/hwpmc_x86.c:245:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pcm_md_initialize()
                     ^
                      void

This is because pcm_md_initialize() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit dc0cde7a21a6aab0a5e876d8f890764e32718932)

2 years agoAdjust ipfw_{init,destroy}_sopt_handler() definitions to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 19:30:05 +0000 (21:30 +0200)]
Adjust ipfw_{init,destroy}_sopt_handler() definitions to avoid clang 15 warning

With clang 15, the following -Werror warning are produced:

    sys/netpfil/ipfw/ip_fw_sockopt.c:3477:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_init_sopt_handler()
                          ^
                           void
    sys/netpfil/ipfw/ip_fw_sockopt.c:3485:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ipfw_destroy_sopt_handler()
                             ^
                              void

This is because ipfw_init_sopt_handler() and ipfw_destroy_sopt_handler()
are declared with (void) argument lists, but defined with empty argument
lists. Make the definitions match the declarations.

MFC after: 3 days

(cherry picked from commit d62830c5e493133b0212f39c7efdab4232f87abf)

2 years agoFix unused variable warning in ocs_cam.c
Dimitry Andric [Wed, 20 Jul 2022 19:36:20 +0000 (21:36 +0200)]
Fix unused variable warning in ocs_cam.c

With clang 15, the following -Werror warning is produced:

    sys/dev/ocs_fc/ocs_cam.c:2556:11: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
            uint32_t        count;
                            ^

The 'count' variable seems to be a left-over from some debugging code
that no longer exists, and can be removed without any functional change.

MFC after: 3 days

(cherry picked from commit 8d9e29284627f5e860b7fc194e9fedd6b21f7783)

2 years agoFix unused variable warnings in hwpmc_mod.c
Dimitry Andric [Thu, 21 Jul 2022 18:35:41 +0000 (20:35 +0200)]
Fix unused variable warnings in hwpmc_mod.c

With clang 15, the following -Werror warnings are produced:

    sys/dev/hwpmc/hwpmc_mod.c:4805:6: error: variable 'nfree' set but not used [-Werror,-Wunused-but-set-variable]
            int nfree;
                ^
    sys/dev/hwpmc/hwpmc_mod.c:4804:6: error: variable 'ncallchains' set but not used [-Werror,-Wunused-but-set-variable]
            int ncallchains;
                ^

The 'nfree' and 'ncallchains' variables were used in KASSERTs, but these
were removed due to refactoring in d9f1b8dbf29d. Remove the variables
since they no longer serve any purpose.

MFC after:      3 days

(cherry picked from commit 38a9b8a00ce933e99b4a643cdcc3220be82e7d62)

2 years agoAdjust tdsaContext_t::NvmdResponseSet declaration to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 19:49:47 +0000 (21:49 +0200)]
Adjust tdsaContext_t::NvmdResponseSet declaration to avoid clang 15 warning

With clang 15, the following -Werror warnings are produced:

    In file included from sys/dev/pms/freebsd/driver/ini/src/agtiapi.c:70:
    sys/dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h:346:13: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      volatile  NvmdResponseSet;
      ~~~~~~~~  ^
      int

The NvmdResponseSet member is effectively only used as a boolean in the
pms(4) driver, so it could be a single bit. But to avoid changing the
semantics at all in this unmaintained driver, simply declare it as a
volatile int.

MFC after: 3 days

(cherry picked from commit 95204d7a6368990e216db0ad51ef3e6018aed27c)

2 years agoAdjust pcmlog_{initialize,shutdown}() definitions to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 18:20:56 +0000 (20:20 +0200)]
Adjust pcmlog_{initialize,shutdown}() definitions to avoid clang 15 warning

With clang 15, the following -Werror warnings are produced:

    sys/dev/hwpmc/hwpmc_logging.c:1228:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmclog_initialize()
                     ^
                      void
    sys/dev/hwpmc/hwpmc_logging.c:1277:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmclog_shutdown()
                   ^
                    void

This is because pcmlog_{initialize,shutdown}() are declared with (void)
argument lists, but defined with empty argument lists. Make the
definitions match the declarations.

MFC after: 3 days

(cherry picked from commit ba95c556029357800d18a5bc5abd02a2b7d0c9de)

2 years agoAdjust vt_mouse_paste() definition to avoid clang 15 warning
Dimitry Andric [Thu, 21 Jul 2022 20:10:22 +0000 (22:10 +0200)]
Adjust vt_mouse_paste() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/vt/vt_core.c:2129:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    vt_mouse_paste()
                  ^
                   void

This is because vt_mouse_paste() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit b77a5e5f5835620ce27114fad9a211d960ed60aa)

2 years agoFix unused variable warning in ipsec_mbuf.c
Dimitry Andric [Thu, 21 Jul 2022 20:03:50 +0000 (22:03 +0200)]
Fix unused variable warning in ipsec_mbuf.c

With clang 15, the following -Werror warning is produced:

    sys/netipsec/ipsec_mbuf.c:93:24: error: variable 'alloc' set but not used [-Werror,-Wunused-but-set-variable]
                    int todo, len, done, alloc;
                                         ^

The 'alloc' variable appears to have been a debugging aid that has never
been used for anything, so remove it.

MFC after: 3 days

(cherry picked from commit df5d2841d507589af0de7301f6cee3d2b98a35be)

2 years agolibproc: replace home grown crc32 with zlib implementation.
Xin LI [Sun, 10 Jul 2022 23:31:35 +0000 (16:31 -0700)]
libproc: replace home grown crc32 with zlib implementation.

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

(cherry picked from commit 0bbf2702963a2fe6f7bb025d5d07ee4195856b8f)

2 years agonfscl: Fix setting of nfsess_defunct for nfscl_hasexpired()
Rick Macklem [Fri, 8 Jul 2022 14:37:36 +0000 (07:37 -0700)]
nfscl: Fix setting of nfsess_defunct for nfscl_hasexpired()

Commit a7bb120f8b87 added a printf for the case where recovery
has not marked the session defunct by setting nfsess_defunct
to 1.  It turns out that nfscl_hasexpired() calls
nfsrpc_setclient() directly, without setting nfsess_defunct.
This patch replaces the printf with code that sets
nfsess_defunct to 1 to handle this case.

If SIGTERM is issued to a process when it is doing I/O on
an "intr" mount, the NFSv4 server may reply NFSERR_BADSTATEID,
due to the Open being prematurely closed.
This can result in a call to nfscl_hasexpired() to do a
recovery.

This would explain at least one hang described in the PR.

PR: 260011
MFC after: 2 weeks

(cherry picked from commit be7b87de16ffbabb81989e13a4b19a178e3ab8ee)

2 years agoSuppress unused variable warning in if_mwl.c
Dimitry Andric [Tue, 19 Jul 2022 19:45:54 +0000 (21:45 +0200)]
Suppress unused variable warning in if_mwl.c

With clang 15, the following -Werror warning is produced:

    sys/dev/mwl/if_mwl.c:3445:8: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
            u_int ix;
                  ^

Here, 'ix' is a variable that is only used when debugging. Mark the
variable as potentially unused, to suppress the warning.

MFC after: 3 days

(cherry picked from commit 52c80d495a1b9dc756452ebcbb945906ea3cf23a)

2 years agoAdjust nvd_{load,unload}() definitions to avoid clang 15 warnings
Dimitry Andric [Tue, 19 Jul 2022 20:05:42 +0000 (22:05 +0200)]
Adjust nvd_{load,unload}() definitions to avoid clang 15 warnings

With clang 15, the following -Werror warnings are produced:

    sys/dev/nvd/nvd.c:150:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    nvd_load()
            ^
             void
    sys/dev/nvd/nvd.c:166:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    nvd_unload()
              ^
               void

This is because nvd_load() and nvd_unload() are declared with a (void)
argument list, but defined with an empty argument list. Make the
definitions match the declarations.

MFC after: 3 days

(cherry picked from commit c46c9b3f5f1eb5575a5e42f52872dbea9cf7516f)

2 years agoFix unused variable warning in if_alc.c
Dimitry Andric [Sat, 16 Jul 2022 15:06:31 +0000 (17:06 +0200)]
Fix unused variable warning in if_alc.c

With clang 15, the following -Werror warning is produced:

    sys/dev/alc/if_alc.c:3441:6: error: variable 'prog' set but not used [-Werror,-Wunused-but-set-variable]
            int prog;
                ^

The 'prog' variable seems to be a left-over from some debugging code
that no longer exists, and can be removed without any functional change.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35831

(cherry picked from commit 64741244fc4588eefd954948b77ddf2706448ecd)

2 years agoSuppress unused variable warning in ip_dummynet.c
Dimitry Andric [Tue, 19 Jul 2022 19:43:46 +0000 (21:43 +0200)]
Suppress unused variable warning in ip_dummynet.c

With clang 15, the following -Werror warning is produced:

    sys/netpfil/ipfw/ip_dummynet.c:802:6: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
            int n = 0; /* only for stats */
                ^

Here, 'n' is a variable that is only used when debugging. Mark the
variable as potentially unused, to suppress the warning.

MFC after: 3 days

(cherry picked from commit 5c329f0a4d32cec54250ec2d3f61455e85137a6f)

2 years agoFix unused variable warning in acpica's nsaccess.c
Dimitry Andric [Wed, 20 Jul 2022 19:10:43 +0000 (21:10 +0200)]
Fix unused variable warning in acpica's nsaccess.c

With clang 15, the following -Werror warning is produced:

    sys/contrib/dev/acpica/components/namespace/nsaccess.c:452:29: error: variable 'NumCarats' set but not used [-Werror,-Wunused-but-set-variable]
        UINT32                  NumCarats;
                                ^

Here, 'NumCarats' is a variable that is only used when debugging. Since
acpica is contributed code, suppress the warning with a compile flag.

MFC after: 3 days

(cherry picked from commit 3c9a0112bae6408892123b04a6ba5c6ee0780937)

2 years agoSuppress unused variable warning in if_malo.c
Dimitry Andric [Tue, 19 Jul 2022 19:17:03 +0000 (21:17 +0200)]
Suppress unused variable warning in if_malo.c

With clang 15, the following -Werror warning is produced:

    sys/dev/malo/if_malo.c:1573:8: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
            u_int ix;
                  ^

Here, 'ix' is a variable that is only used when MALO_DEBUG is defined.
Mark the variable as potentially unused, to suppress the warning.

MFC after: 3 days

(cherry picked from commit 218634014374de0032fcdd56656ed6b3650634d2)

2 years agoSuppress unused variable warning in mfi.c
Dimitry Andric [Tue, 19 Jul 2022 19:38:41 +0000 (21:38 +0200)]
Suppress unused variable warning in mfi.c

With clang 15, the following -Werror warnings are produced:

    sys/dev/mfi/mfi.c:3698:6: error: variable 'timedout' set but not used [-Werror,-Wunused-but-set-variable]
            int timedout;
                ^
    sys/dev/mfi/mfi.c:3742:6: error: variable 'timedout' set but not used [-Werror,-Wunused-but-set-variable]
            int timedout = 0;
                ^

Here, 'timedout' are variables that are only used when debugging,
requiring #if 0 statements to be modified. Mark the variables as
potentially unused, to suppress the warnings.

MFC after: 3 days

(cherry picked from commit 3dbe05f61b65a73582aefdc2ee5a50ad2b4390ef)

2 years agoAdjust prototype_unload() definition to avoid clang 15 warning
Dimitry Andric [Tue, 19 Jul 2022 20:10:03 +0000 (22:10 +0200)]
Adjust prototype_unload() definition to avoid clang 15 warning

With clang 15, the following -Werror warnings is produced:

    sys/cddl/dev/prototype.c:99:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    prototype_unload()
                    ^
                     void

This is because prototype_unload() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 9a979788832e1c31d58923e4c780a6c4b05335d0)

2 years agoAdjust t4_tracer_mod{load,unload}() definitions to avoid clang 15 warnings
Dimitry Andric [Tue, 19 Jul 2022 18:20:21 +0000 (20:20 +0200)]
Adjust t4_tracer_mod{load,unload}() definitions to avoid clang 15 warnings

With clang 15, the following -Werror warnings are produced:

    sys/dev/cxgbe/t4_tracer.c:234:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    t4_tracer_modload()
                     ^
                      void
    sys/dev/cxgbe/t4_tracer.c:243:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    t4_tracer_modunload()
                       ^
                        void

This is because t4_tracer_modload() and t4_tracer_modunload() are
declared with a (void) argument list, but defined with an empty argument
list. Make the definitions match the declarations.

MFC after: 3 days

(cherry picked from commit 54e5efb2643ec5f4bf40fef2a1937cd5449a58a0)

2 years agoAdjust db_flush_line() definition to avoid clang 15 warning
Dimitry Andric [Tue, 19 Jul 2022 18:31:08 +0000 (20:31 +0200)]
Adjust db_flush_line() definition to avoid clang 15 warning

With clang 15, the following -Werror warnings is produced:

    sys/ddb/db_lex.c:94:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    db_flush_line()
                 ^
                  void

This is because db_flush_line() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 939cb349b2ca4d3fcdc72ab1258eadee5e54881c)

2 years agoAdjust profile_unload() definition to avoid clang 15 warning
Dimitry Andric [Tue, 19 Jul 2022 18:42:52 +0000 (20:42 +0200)]
Adjust profile_unload() definition to avoid clang 15 warning

With clang 15, the following -Werror warnings is produced:

    sys/cddl/dev/profile/profile.c:640:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    profile_unload()
                  ^
                   void

This is because profile_unload() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 2d03b58f9a3d5ec1deb35de594fcee22d06bfbb2)