]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 months agodpaa2: defer link_state updates until we are up
Bjoern A. Zeeb [Fri, 17 Nov 2023 00:47:11 +0000 (00:47 +0000)]
dpaa2: defer link_state updates until we are up

dpaa2_ni_media_change() was called in early setup stages, before we
were fully setup.  That lead to internal driver state being all synched
and fine but hardware state was lost/never setup corrently.

Introduce dpaa2_ni_media_change_locked() so we can avoid reccursive
locking and call "dpaa2_ni_media_change()" instead of mii_mediachg()
as the latter does not setup our state there either.

In order for this all to work, call if_setdrvflagbits() just before
rather than after the above.

Also remove an unecessary direct call to dpaa2_ni_miibus_statchg()
which mii_mediachg() will trigger anyway.

This all fixes a problem [1] that one had to lose the link (either
unplugging/replugging the cable or using ifconfig media none;
ifconfig media auto) to re-trigger the all updates and get the
full state programmed when hardware expected.

MFC after: 3 days
GH-Issue: https://github.com/mcusim/freebsd-src/issues/21 [1]
Reviewed by: dsl, dch
Differential Revision: https://reviews.freebsd.org/D42643

9 months agodpaa2: make software VLANs usable on dpni
Bjoern A. Zeeb [Wed, 15 Nov 2023 11:46:44 +0000 (11:46 +0000)]
dpaa2: make software VLANs usable on dpni

dpni announces IFCAP_VLAN_MTU but internally does not increase the
maximum frame length.  Createing a vlan interface on top of a dpni
interface will result in full-sized frames not passing.
Extend the maximum frame length by ETHER_VLAN_ENCAP_LEN to allow at
least for one layer of (software) vlans for now

MFC after: 3 days
GH-Issue: https://github.com/mcusim/freebsd-src/issues/22
Reviewed by: dsl
Differential Revision: https://reviews.freebsd.org/D42645

9 months ago[tcp] add PRR 6937bis heuristic and retire prr_conservative sysctl
Richard Scheffenegger [Wed, 15 Nov 2023 21:37:42 +0000 (22:37 +0100)]
[tcp] add PRR 6937bis heuristic and retire prr_conservative sysctl

Improve Proportional Rate Reduction (RFC6937) by using a
heuristic, which automatically chooses between
conservative CRB and more aggressive SSRB modes.
Only when snd_una advances (a partial ACK), SSRB may be
used. Also, that ACK must not have any indication of
ongoing loss - using the addition of new holes into the
scoreboard as proxy for such an event.

MFC after: 4 weeks
Reviewed By: #transport, kbowling, rrs
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28822

9 months agozfs: update zfs_config.h and zfs_gitrev.h missed in 47bb16f8f0
Martin Matuska [Fri, 17 Nov 2023 09:00:16 +0000 (10:00 +0100)]
zfs: update zfs_config.h and zfs_gitrev.h missed in 47bb16f8f0

9 months agozfs: merge openzfs/zfs@03e9caaec
Martin Matuska [Fri, 17 Nov 2023 08:39:42 +0000 (09:39 +0100)]
zfs: merge openzfs/zfs@03e9caaec

Notable upstream pull request merges:
 #15516 da51bd17e Fix snap_obj_array memory leak in check_filesystem()
 #15519 35da34516 L2ARC: Restrict write size to 1/4 of the device
 #15529 03e9caaec Add a tunable to disable BRT support

Obtained from: OpenZFS
OpenZFS commit: 03e9caaec006134b3db9d02ac40fe9369ee78b03

9 months agotcp: remove extraneous network epoch entry
Gleb Smirnoff [Fri, 17 Nov 2023 02:30:35 +0000 (18:30 -0800)]
tcp: remove extraneous network epoch entry

accept(2) on IPv6 TCP doesn't need epoch.  Some leaf functions may
need it, but they will enter accordingly, see sa6_recoverscope().

Reviewed by: rscheff, tuexen (implicitly, see deleted XXXMT)
Differential Revision: https://reviews.freebsd.org/D42634

9 months agovn_lock_pair(): reasonably handle vp1 == vp2 case
Konstantin Belousov [Thu, 16 Nov 2023 22:42:25 +0000 (00:42 +0200)]
vn_lock_pair(): reasonably handle vp1 == vp2 case

Lock the vnode in the most exclusive lock mode requested, once.
All callers already ensure that vp1 != vp2 or are careful enough to only
unlock once otherwise.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42642

9 months agokernel: add missed FEATUREs compat_freebsd 8-14
Konstantin Belousov [Thu, 16 Nov 2023 20:47:18 +0000 (22:47 +0200)]
kernel: add missed FEATUREs compat_freebsd 8-14

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 months agoarm64: do not register elf32 brand if hardware cannot exec aarch32
Konstantin Belousov [Thu, 16 Nov 2023 19:45:52 +0000 (21:45 +0200)]
arm64: do not register elf32 brand if hardware cannot exec aarch32

Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42639

9 months agofuse_vnop_copy_file_range(): add safety
Konstantin Belousov [Tue, 14 Nov 2023 22:49:35 +0000 (00:49 +0200)]
fuse_vnop_copy_file_range(): add safety

v_mount for unlocked vnode could be NULL, check for it.  Explain why it
is safe to access fs-specific data for mp if it is read as non-NULL.

Reviewed by: asomers, jah
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42625

9 months agofuse_vnop_copy_file_range(): use vn_lock_pair()
Konstantin Belousov [Tue, 14 Nov 2023 22:48:47 +0000 (00:48 +0200)]
fuse_vnop_copy_file_range(): use vn_lock_pair()

Reviewed by: asomers, jah
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42625

9 months agoAdd a tunable to disable BRT support.
Rich Ercolani [Thu, 16 Nov 2023 19:35:22 +0000 (14:35 -0500)]
Add a tunable to disable BRT support.

Copy the disable parameter that FreeBSD implemented, and extend it to
work on Linux as well, until we're sure this is stable.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #15529

9 months agogenoffset.sh: fix build break on MacOS
Jonathan T. Looney [Thu, 16 Nov 2023 17:45:02 +0000 (17:45 +0000)]
genoffset.sh: fix build break on MacOS

Switch from using the shell's builtin echo command to using the
builtin printf command to print the asserts.

Reported by: jrtc27
Suggested by: imp
Fixes: accfb4cc9346
Sponsored by: Netflix

9 months agoPackaging: Auto-generate changelog during configure (#15528)
Umer Saleem [Thu, 16 Nov 2023 16:58:47 +0000 (21:58 +0500)]
Packaging: Auto-generate changelog during configure (#15528)

Auto-generate changelog based off on @VERSION@ during configure,
so that it is not needed to be update with new releases / version
updates.

Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
9 months agosocket tests: add socket_accept
Gleb Smirnoff [Thu, 16 Nov 2023 16:23:48 +0000 (08:23 -0800)]
socket tests: add socket_accept

Start with most basic functionality on a TCP socket.

9 months agogenoffset.sh: stop using a temporary file
Jonathan T. Looney [Thu, 16 Nov 2023 15:02:32 +0000 (15:02 +0000)]
genoffset.sh: stop using a temporary file

Instead, use a here document for the input. This allows us to run the
while loop in the main script so we can build the list of asserts in
a shell variable. We then print out the list of asserts at the end of
the loop.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42407

9 months agomlx5_core: fix deadlock when using RXTLS
Martin Matuska [Mon, 13 Nov 2023 13:29:27 +0000 (14:29 +0100)]
mlx5_core: fix deadlock when using RXTLS

If removing a node of type FS_TYPE_FLOW_DEST we lock the flow group too
late. This can lead to a deadlock with fs_add_dst_fg().

PR: 274715
MFC after: 1 week
Reviewed by: kib
Tested by: mm
Differential Revision: https://reviews.freebsd.org/D42368

9 months agoFix /root permissions after 'make installworld'
Thomas Eberhardt [Thu, 16 Nov 2023 09:59:38 +0000 (10:59 +0100)]
Fix /root permissions after 'make installworld'

According to /etc/mtree/BSD.root.dist /root should have
0750 permissions, but the build target 'make installworld'
changes these to 0755.

This is caused by the installation of the configuration
files of sh(1) and csh(1).

Correct this by specifying the correct default /root permissions.

PR: 273342
Reviewed by: jilles
Approved by: jilles
MFC after: 2 weeks
Differential Revision:https://reviews.freebsd.org/D42395

9 months agoDocument library types in the intro(3) manual page
Gordon Bergling [Thu, 16 Nov 2023 09:48:09 +0000 (10:48 +0100)]
Document library types in the intro(3) manual page

Add a paragraph about library types to the intro(3)
manual page. Document library types, locations
and versioning.

Reviewed by: emaste, jilles, mhorne, pauamma_gundo.com
Obtained from: OpenBSD (partial)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36594

9 months agoAdd tests for gunion(8)
Yan-Hao Wang [Thu, 16 Nov 2023 07:58:49 +0000 (15:58 +0800)]
Add tests for gunion(8)

Reviewed by: mckusick (earlier version)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41645

9 months agoiostat: Restore lost spaces after tout
Alexander Motin [Thu, 16 Nov 2023 04:45:22 +0000 (23:45 -0500)]
iostat: Restore lost spaces after tout

MFC after: 2 weeks

9 months agoAdd interface NVME to devstat
Alexander Motin [Thu, 16 Nov 2023 04:03:40 +0000 (23:03 -0500)]
Add interface NVME to devstat

This allows to list only NVMe devices in systat, iostat, vmstat, etc.
Previously those were counted as OTHER.

9 months agovmstat: Make disks reporting some more reasonable
Alexander Motin [Thu, 16 Nov 2023 03:56:51 +0000 (22:56 -0500)]
vmstat: Make disks reporting some more reasonable

MFC after: 1 month

9 months agopkg: Allocate a suitably-sized string for the local ABI
John Baldwin [Thu, 16 Nov 2023 00:53:53 +0000 (16:53 -0800)]
pkg: Allocate a suitably-sized string for the local ABI

Previously the local ABI string was written to an on-stack buffer and
the pointer to that buffer was saved in a global before the function
returned.  This had two issues: c[ABI].val pointed to a
no-longer-valid on-stack buffer after config_init returned, and the
string could potentially be truncated.  Fix both of those by changing
pkg_get_myabi to return a pointer to a string allocated by asprintf.

Note that the allocated string is left in the global config array
until it is implicitly freed on process exit.

Reported by: GCC 13 -Wdangling-pointer
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42623

9 months agoig4(4): Add an EMAG device type
Andrew Gallatin [Thu, 16 Nov 2023 00:51:28 +0000 (19:51 -0500)]
ig4(4): Add an EMAG device type

Sponsored by: Ampere Computing LLC, Netflix
Submitted by: allanjude
Differential Revision: https://reviews.freebsd.org/D28746
Reviewed by: imp

9 months agolibc: remove unused stub vdso timecounter implementations
Brooks Davis [Wed, 15 Nov 2023 23:43:56 +0000 (23:43 +0000)]
libc: remove unused stub vdso timecounter implementations

All supported architectures have shared page support so remove this
unused stub.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D42619

9 months agolibc: centralize a few numeric symbols
Brooks Davis [Wed, 15 Nov 2023 23:42:37 +0000 (23:42 +0000)]
libc: centralize a few numeric symbols

fabs, __infinity, and __nan are universally implemented so declare them
in gen/Symbol.map.

We would also include __flt_rounds, but  it's under FBSD_1.3 on arm so
until that's gone we're stuck with it.  Likewise, everyone but i386
implements fp[gs]etmask.

Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D42618

9 months agolibc: centralize makecontext symbols
Brooks Davis [Wed, 15 Nov 2023 23:42:18 +0000 (23:42 +0000)]
libc: centralize makecontext symbols

Declare makecontext() and __makecontext() symbols centrally as they are
always implemented.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D42617

9 months agolibc: centralize {_,sig,}{set,long}jmp symbols
Brooks Davis [Wed, 15 Nov 2023 23:41:35 +0000 (23:41 +0000)]
libc: centralize {_,sig,}{set,long}jmp symbols

These symbols are universally exposed and documented so declare them
centrally.  Double- and triple-underscore versions exist on some
platforms, but leave those alone for now.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D42616

9 months agolibc: centralize ntoh symbols
Brooks Davis [Wed, 15 Nov 2023 23:40:54 +0000 (23:40 +0000)]
libc: centralize ntoh symbols

These are implemented by net/ntoh.c via headers and compiler intrinsics
so declare them in net/Symbol.map.

Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D42615

9 months agolibc: further centralize syscall symbols
Brooks Davis [Wed, 15 Nov 2023 23:40:33 +0000 (23:40 +0000)]
libc: further centralize syscall symbols

All architectures necessarily implement _exit(2) and vfork(2) so
declare them in sys/Symbol.map.

Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D42614

9 months agolib{c,lzma,z}: remove -DSYMBOL_VERSIONING from CFLAGS
Brooks Davis [Wed, 15 Nov 2023 23:39:46 +0000 (23:39 +0000)]
lib{c,lzma,z}: remove -DSYMBOL_VERSIONING from CFLAGS

This was part of a libkse and libpthread transition aide when libc
gained symbol versions in e62165c8b0f7d6452c0033127a0fd8ad1d9e34d3
(March 2006).  The code that cared about this macro was removed in
commit 00fb440c1a145b56b6c75fd405d80071aef2aab1 (May 2007) when symbol
versioning was enabled by default and libthr became the default
threading library.  For unknown reasons, it stayed in libc (which
seemingly never used it) and seems to have been copied to liblzma and
libz.

Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D42613

9 months agolib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees
Alan Somers [Fri, 10 Nov 2023 17:28:32 +0000 (10:28 -0700)]
lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees

This saves oodles of memory, especially when "ulimit -n" is large.  It
also prevents a buffer overflow if getrlimit should fail.

Also replace per-fd condvars with mutexes to simplify the code.

PR: 274968
MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42597

9 months agolibc/libc/rpc: refactor some global variables
Alan Somers [Thu, 9 Nov 2023 22:58:56 +0000 (15:58 -0700)]
libc/libc/rpc: refactor some global variables

* Combine dg_fd_locks and dg_cv into one array.
* Similarly for vc_fd_locks and vc_cv
* Turn some macros into inline functions

This is a mostly cosmetic change to make refactoring these strutures in
a future commit easier.

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

9 months agomlx5_core: add new files to the static files list
Konstantin Belousov [Mon, 13 Nov 2023 00:09:57 +0000 (02:09 +0200)]
mlx5_core: add new files to the static files list

Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5core: add linux/bitops.h include for mlx5_ifc.h use of BIT()
Konstantin Belousov [Mon, 13 Nov 2023 00:17:09 +0000 (02:17 +0200)]
mlx5core: add linux/bitops.h include for mlx5_ifc.h use of BIT()

Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Introduce new destination type TABLE_TYPE
Patrisious Haddad [Tue, 4 Apr 2023 06:01:24 +0000 (09:01 +0300)]
mlx5: Introduce new destination type TABLE_TYPE

This new destination type supports flow transition between different
table types, e.g. from NIC_RX to RDMA_RX or from RDMA_TX to NIC_TX.

In addition add driver support to be able to query the capability for
this new destination type.

Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5ib: adjust for the mlx5_create_auto_grouped_flow_table() interface change
Konstantin Belousov [Mon, 13 Nov 2023 00:16:51 +0000 (02:16 +0200)]
mlx5ib: adjust for the mlx5_create_auto_grouped_flow_table() interface change

Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: add ability to attach flow counter to steering rule
Mark Bloch [Wed, 22 Feb 2023 05:44:56 +0000 (05:44 +0000)]
mlx5: add ability to attach flow counter to steering rule

Expose a way to attach a counter to a flow rule.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: add fs_counters
Raed Salem [Mon, 20 Feb 2023 16:10:29 +0000 (16:10 +0000)]
mlx5: add fs_counters

Signed-off-by: Raed Salem <raeds@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Add a no-append flow insertion mode
Mark Bloch [Mon, 20 Feb 2023 15:46:42 +0000 (15:46 +0000)]
mlx5: Add a no-append flow insertion mode

This allows to insert a rule and make sure it doesn't get
combined by the steering layer with any other rule.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agonet/mlx5: Allow creating autogroups with reserved entries
Mark Bloch [Sun, 19 Feb 2023 14:16:43 +0000 (14:16 +0000)]
net/mlx5: Allow creating autogroups with reserved entries

Exclude the last n entries for an autogrouped flow table.

Reserving entries at the end of the FT will ensure that this FG will be
the last to be evaluated. This will be used in the next patch to create

Linux upstream commit: 79cdb0aaea8b5478db34afa1d4d5ecc808689a67
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agonet/mlx5: Fix auto group size calculation
Mark Bloch [Sun, 19 Feb 2023 14:05:16 +0000 (14:05 +0000)]
net/mlx5: Fix auto group size calculation

Once all the large flow groups (defined by the user when the flow table
is created - max_num_groups) were created, then all the following new
flow groups will have only one flow table entry, even though the flow table
has place to larger groups.
Fix the condition to prefer large flow group.

Upstream Linux commit: 97fd8da281f80e7e69e0114bc906575734d4dfaf
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Use software enum in APIs instead of PRM
Mark Bloch [Sun, 19 Feb 2023 12:25:10 +0000 (12:25 +0000)]
mlx5: Use software enum in APIs instead of PRM

Users of the steering APIs shouldn't use the PRM directly.
Create an software enum to be used instead.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Add packet reformat support to flow rules
Mark Bloch [Sun, 19 Feb 2023 11:27:30 +0000 (11:27 +0000)]
mlx5: Add packet reformat support to flow rules

Allow attaching a packet reformat action to a flow rule.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Add modify header support to flow rules
Mark Bloch [Sun, 19 Feb 2023 11:15:00 +0000 (11:15 +0000)]
mlx5: Add modify header support to flow rules

Allow attaching a modify header to a flow rule.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Refactor flow actions into a struct
Mark Bloch [Sun, 19 Feb 2023 10:47:50 +0000 (10:47 +0000)]
mlx5: Refactor flow actions into a struct

Create a struct to hold flow actions to be used when creating
a flow rule.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Add packet reformat allocation support
Mark Bloch [Sun, 19 Feb 2023 09:36:07 +0000 (09:36 +0000)]
mlx5: Add packet reformat allocation support

Add support to allocating a packet reformat context.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agomlx5: Add modify header support
Mark Bloch [Sun, 19 Feb 2023 08:41:24 +0000 (08:41 +0000)]
mlx5: Add modify header support

Add support to allocating a modify header context.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Sponsored by: NVidia networking
MFC after: 1 week

9 months agoRevert "awk: Merge upstream 2nd Edition Awk Book"
Warner Losh [Wed, 15 Nov 2023 22:28:05 +0000 (15:28 -0700)]
Revert "awk: Merge upstream 2nd Edition Awk Book"

The pre-push testing I did turned out to be testing the old version with
the old testsuite (for reasons I don't understnad). There's issues with
the new version, the new test in the suite or (likely) both. Revert
until they can be chased down.

This should also fix the github CI that's gone red since this commit.

This reverts commit 3fd60a6b73ac01a72df89751f173970fae4cae73, reversing
changes made to 194df014feebd8b169b41ecd75ae73d63a792d6b.

Sponsored by: Netflix

9 months agoacpi: Add workaround for Altra I2C memory resource
Andrew Gallatin [Wed, 15 Nov 2023 21:22:00 +0000 (16:22 -0500)]
acpi: Add workaround for Altra I2C memory resource

Submitted by: allanjude
Sponsored by: Ampere Computing LLC
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D28741

9 months agoarm64: Correct a comment in locore.S
Andrew Turner [Wed, 15 Nov 2023 18:13:39 +0000 (18:13 +0000)]
arm64: Correct a comment in locore.S

We now use the physical address of get_load_phys_addr. Use it in a
comment rather than the old symbol.

Sponsored by: Arm Ltd

9 months agoAdd an Armv8 rndr random number provider
Andrew Turner [Wed, 15 Nov 2023 17:42:02 +0000 (17:42 +0000)]
Add an Armv8 rndr random number provider

Armv8.5 adds an optional random number generator. This is implemented
as two special registers one to read a random number, the other to
re-seed the entropy pool before reading a random number. Both registers
will set the condition flags to tell the caller they can't produce a
random number in a reasonable amount of time.

Without a signal to reseed the entropy pool use the latter register
to provide random numbers to the kernel pool. If at a later time we
had a way to tell the provider if it needs to reseed or not we could
use the former.

On an Amazon AWS Graviton3 VM this never failed, however this may not
be the case on low end CPUs so retry reading the random number 10 times
before returning an error.

Reviewed by: imp, delphij (csprng)
Sponsored by: The FreeBSD Foundation
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D35411

9 months agoarm64: Clean up finding our load address
Andrew Turner [Mon, 13 Nov 2023 15:39:06 +0000 (15:39 +0000)]
arm64: Clean up finding our load address

Use the linker to pre-calculate the offset of a known symbol from
KERNBASE, and use this to find the physical address KERNBASE should
map to.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42568

9 months agoarm64: Make kern_delta unneeded in the boot params
Andrew Turner [Mon, 13 Nov 2023 15:29:30 +0000 (15:29 +0000)]
arm64: Make kern_delta unneeded in the boot params

Use pmap_early_vtophys to translate from a virtual to physical where
we were previously using the calculated delta. This means that, while
we still calculate it, we don't need to pass it to initarm or either
pmap bootstrap functions.

While here remove an unneeded printf that indirectly used it or was
related to the previous printf.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42567

9 months agoarm64: Use pmap_early_vtophys in pmap_bootstrap_san
Andrew Turner [Mon, 13 Nov 2023 16:34:56 +0000 (16:34 +0000)]
arm64: Use pmap_early_vtophys in pmap_bootstrap_san

Use pmap_early_vtophys to find the physical address of the kernel base
rather than using the calculated offset as it will be removed in a
latter commit.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42566

9 months agoarm64: Use adrp + :lo12: to load globals from asm
Andrew Turner [Sat, 11 Nov 2023 09:27:30 +0000 (09:27 +0000)]
arm64: Use adrp + :lo12: to load globals from asm

When loading a global variable we can use a pseudo-instruction similar
to "ldr, xn, =global" to load the address of the symbol. As this is
unlikely to be supported by a mov instruction a pc-relative load is
used, with the absolute address written at the end of the function so
it will be loaded.

This load can be partially replaced with an adrp instruction. This
generates the address, aligned to a 4k boundary, using a pc-relative
addition. Because the address is 4k-aligned we then update reading the
global variable using a load with the offset of the load the low
12-bits of the global. Arm64 assemblers have :lo12: to support this,
e.g. "ldr xn, [xn, :lo12:global]".

The only remaining users of "ldr, xn, =global" that I can find are
executed from the physical address space the kernel was loaded in and
need an address in the kernels virtual address space. Because of this
they can't use adrp.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42565

9 months agolibc: Remove empty comments in Symbol.map
Brooks Davis [Wed, 15 Nov 2023 17:51:03 +0000 (17:51 +0000)]
libc: Remove empty comments in Symbol.map

These were left over from $FreeBSD$ removal.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42612

9 months agolibc/<arch>/sys/Makefile.inc: remove cruft
Brooks Davis [Wed, 15 Nov 2023 17:50:53 +0000 (17:50 +0000)]
libc/<arch>/sys/Makefile.inc: remove cruft

Remove stray blank lines left over from $FreeBSD$ removal as well as
some CVS-era (perhaps pre-repocopy) version comments.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42611

9 months agogit-blame-ignore-revs: OptionalObsoleteFiles.inc sorting commits
Brooks Davis [Wed, 15 Nov 2023 17:47:02 +0000 (17:47 +0000)]
git-blame-ignore-revs: OptionalObsoleteFiles.inc sorting commits

Add sorting commits.  This causes (suitably configured) git blame to
ignore the moving of blocks, correcting the associated commit for ~300
lines.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42602

9 months agoSort .git-blame-ignore-revs by commit order
Brooks Davis [Wed, 15 Nov 2023 17:46:57 +0000 (17:46 +0000)]
Sort .git-blame-ignore-revs by commit order

This makes it easier to add blocks of commits such as
4ca5df80393e1f2..c90d0600ee000e78 which do a single thing over the
course of multiple commits.  Sorting by hash would require manually
inserting each one with a comment.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42601

9 months agosmbios: handle smbios3 for arm64
Andrew Gallatin [Wed, 15 Nov 2023 16:11:53 +0000 (11:11 -0500)]
smbios: handle smbios3 for arm64

Get smbios working on arm64 where it seems to be
exclusively smbios version 3.x

The "interesting" thing here is that the smbios table seems to be
RAM in the EFI runtime services table. This makes it owned by "ram0",
and not io memory. That prevents bus_alloc_resource() from being able
to claim it, since ram0 already owns it. According to jhb, this is
how things are supposed to work.  Eg, bus_alloc_resource() is meant
to be used with IO memory, not physical memory.  Following his
suggestion, I converted the driver to simply use pmap_mapbios().

This is a prerequisite for getting IPMI to attach via the SSIF
attachment on arm64 servers, where all IPMI that I've seen
uses SSIF.

Note that this change is based on initial work by Allan Jude in
https://reviews.freebsd.org/D28739.

Reviewed by: imp
Sponsored by: Netflix, Ampere Computing LLC (D28739)
Differential Revision: https://reviews.freebsd.org/D42592

9 months agovm_phys: fix freelist_contig
Doug Moore [Wed, 15 Nov 2023 09:25:45 +0000 (03:25 -0600)]
vm_phys: fix freelist_contig

vm_phys_find_freelist_contig is called to search a list of max-sized
free page blocks and find one that, when joined with adjacent blocks
in memory, can satisfy a request for a memory allocation bigger than
any single max-sized free page block. In commit
fa8a6585c7522b7de6d29802967bd5eba2f2dcf1, I defined this function in
order to offer two improvements: 1) reduce the worst-case search time,
and 2) allow solutions that include less-than max-sized free page
blocks at the front or back of the giant allocation. However, it turns
out that this change introduced an error, reported in In Bug
274592. That error concerns failing to check segment boundaries. This
change fixes an error in vm_phys_find_freelist_config that resolves
that bug. It also abandons improvement 2), because the value of that
improvement is small and because preserving it would require more
testing than I am able to do.

PR: 274592
Reported by: shafaisal.us@gmail.com
Reviewed by: alc, markj
Tested by: shafaisal.us@gmail.com
Fixes: fa8a6585c752 vm_phys: avoid waste in multipage allocation
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D42509

9 months agosys: Disable -Walloc-size-larger-than for GCC 9+
John Baldwin [Wed, 15 Nov 2023 02:37:25 +0000 (18:37 -0800)]
sys: Disable -Walloc-size-larger-than for GCC 9+

By default this warns about sizes larger than PTRDIFF_MAX passed to
malloc (rather than SIZE_MAX).  This doesn't trigger
deterministically, but it does trigger for kmalloc() of struct_size()
in iwlwifi's iwl_configure_rxq even when struct_size() is changed to
use PTRDIFF_MAX.  NB: struct_size() in Linux caps the size at
SIZE_MAX, not PTRDIFF_MAX via size_mul().

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42587

9 months agoqlnx: Fix a couple of type mismatches in function declarations
John Baldwin [Wed, 15 Nov 2023 02:37:06 +0000 (18:37 -0800)]
qlnx: Fix a couple of type mismatches in function declarations

Reported by: GCC 13 via -Wenum-int-mismatch
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42586

9 months agoocs: Fix a couple of type mismatches in function prototypes
John Baldwin [Wed, 15 Nov 2023 02:36:48 +0000 (18:36 -0800)]
ocs: Fix a couple of type mismatches in function prototypes

Reported by: GCC 13 via -Wenum-int-mismatch
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42585

9 months agoath_hal: Fix a couple of type mismatches in function prototypes
John Baldwin [Wed, 15 Nov 2023 02:36:32 +0000 (18:36 -0800)]
ath_hal: Fix a couple of type mismatches in function prototypes

Reported by: GCC 13 via -Wenum-int-mismatch
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42584

9 months agosnmp_wlan: Fix a couple of type mismatches in function prototypes
John Baldwin [Wed, 15 Nov 2023 02:36:03 +0000 (18:36 -0800)]
snmp_wlan: Fix a couple of type mismatches in function prototypes

Reported by: GCC 13 via -Wenum-int-mismatch
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42582

9 months agomakefs: Quiet a -Wdangling-pointer warning in cd9660_generate_path_table
John Baldwin [Wed, 15 Nov 2023 02:35:44 +0000 (18:35 -0800)]
makefs: Quiet a -Wdangling-pointer warning in cd9660_generate_path_table

This function temporarily stores a pointer to an on-stack variable (a
TAILQ_HEAD of a temporary list) into a global variable (*n).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42581

9 months agomakefs cd9660: Unexpand a few TAILQ macros
John Baldwin [Wed, 15 Nov 2023 02:35:27 +0000 (18:35 -0800)]
makefs cd9660: Unexpand a few TAILQ macros

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42580

9 months agobsd.sys.mk: Disable -Wdangling-reference for GCC 13+
John Baldwin [Wed, 15 Nov 2023 02:35:04 +0000 (18:35 -0800)]
bsd.sys.mk: Disable -Wdangling-reference for GCC 13+

GCC raises this warning for libc++'s istream.  It raises false
positives in other cases as well (GCC bugs 109640, 109642, 109671).

Warning from <istream>:

/usr/include/c++/v1/istream:1464:34: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
 1464 |             const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
      |                                  ^~~~
/usr/include/c++/v1/istream:1464:71: note: the temporary was destroyed at the end of the full expression 'std::__1::use_facet<ctype<char> >(std::__1::ios_base::getloc() const())'
 1464 |             const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42579

9 months agoMerge commit 3537338d1ab9 from llvm git (by Nikolas Klauser):
John Baldwin [Wed, 15 Nov 2023 02:34:45 +0000 (18:34 -0800)]
Merge commit 3537338d1ab9 from llvm git (by Nikolas Klauser):

    [libc++][libunwind] Fixes to allow GCC 13 to compile libunwind/libc++abi/libc++

    These are changes to allow GCC 13 to successfully compile the runtimes stack.

    Reviewed By: ldionne, #libc, #libunwind, MaskRay

    Spies: MaskRay, zibi, SeanP, power-llvm-team, mstorsjo, arichardson, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D151387

Reviewed by: imp, dim, emaste
Differential Revision: https://reviews.freebsd.org/D42578

9 months agolibgpio: Fix type mismatch for gpio_pin_[gs]et
John Baldwin [Wed, 15 Nov 2023 02:34:21 +0000 (18:34 -0800)]
libgpio: Fix type mismatch for gpio_pin_[gs]et

Reported by: GCC 13 via -Wenum-int-mismatch
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42577

9 months agolibcasper: Neuter false positive -Wuse-after-free warnings from GCC 13
John Baldwin [Wed, 15 Nov 2023 02:34:01 +0000 (18:34 -0800)]
libcasper: Neuter false positive -Wuse-after-free warnings from GCC 13

GCC 13 incorrectly thinks a call to free after a failed realloc is a
use after free.

lib/libcasper/services/cap_grp/cap_grp.c: In function 'group_resize':
lib/libcasper/services/cap_grp/cap_grp.c:65:17: error: pointer 'buf' may be used after 'realloc' [-Werror=use-after-free]
   65 |                 free(buf);
      |                 ^~~~~~~~~
lib/libcasper/services/cap_grp/cap_grp.c:63:19: note: call to 'realloc' here
   63 |         gbuffer = realloc(buf, gbufsize);
      |                   ^~~~~~~~~~~~~~~~~~~~~~

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D42576

9 months agolibevent: Import libevent 2.1.12
Cy Schubert [Tue, 14 Nov 2023 23:04:28 +0000 (15:04 -0800)]
libevent: Import libevent 2.1.12

MFC after: 2 weeks

Merge commit '5223d1d95fddcef6f9a36e264a5800bd907ade8b' into main

9 months agozoneinfo: fix makefile rules script
Stephen J. Kiernan [Wed, 15 Nov 2023 00:38:47 +0000 (19:38 -0500)]
zoneinfo: fix makefile rules script

In make target rules, one needs to use subshell if there are
change directory commands that should only have an effect on the
other commands in the same line. Otherwise, if make is not running in
compatibility mode (for example, when -j flag is specified), commands
would be executed in a single shell and lines following the "cd" might
not work as expected.

Adjust the target script lines that use "cd" to run in a subshell
by adding appropriate parenthesis.

Reviewed by: sjg
Differential Revision:        https://reviews.freebsd.org/D42608

9 months agolibevent: Import libevent 2.1.12
Cy Schubert [Tue, 14 Nov 2023 23:02:42 +0000 (15:02 -0800)]
libevent: Import libevent 2.1.12

9 months agoL2ARC: Restrict write size to 1/4 of the device
Alexander Motin [Tue, 14 Nov 2023 21:47:57 +0000 (16:47 -0500)]
L2ARC: Restrict write size to 1/4 of the device

PR #15457 exposed weird logic in L2ARC write sizing. If it appeared
bigger than device size, instead of liming write it reset all the
system-wide tunables to their default.  Aside of being excessive,
it did not actually help with the problem, still allowing infinite
loop to happen.

This patch removes the tunables reverting logic, but instead limits
L2ARC writes (or at least eviction/trim) to 1/4 of the capacity.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Amanakis <gamanakis@gmail.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15519

9 months agobcm2835/spi: Support SPI_FLAG_KEEP_CS
Justin Hibbits [Thu, 2 Nov 2023 20:09:14 +0000 (16:09 -0400)]
bcm2835/spi: Support SPI_FLAG_KEEP_CS

Summary:
3c08673438 brought in SPI_FLAG_KEEP_CS to keep the SPI chip select held
post-transfer completion.  Add this support to bcm2835 SPI for SPI
devices that need it.  As part of this, the owner thread needed carried
through so that no other thread can take over the SPI bus until the
owner releases the chip select.

Reviewed by: manu
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D42599

9 months agoAddress review feedback on a typo.
George V. Neville-Neil [Tue, 14 Nov 2023 21:09:18 +0000 (16:09 -0500)]
Address review feedback on a typo.

Reviewed by: jhb, gbe
Differential Revision: <https://reviews.freebsd.org/D42096>

9 months agoA skeleton kernel module suitable for creating new such modules.
George V. Neville-Neil [Thu, 5 Oct 2023 20:05:31 +0000 (16:05 -0400)]
A skeleton kernel module suitable for creating new such modules.

9 months agoFix snap_obj_array memory leak in check_filesystem()
Chunwei Chen [Tue, 14 Nov 2023 20:59:02 +0000 (12:59 -0800)]
Fix snap_obj_array memory leak in check_filesystem()

Use goto out instead of return for early exit to make sure
snap_obj_array is freed.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #15516

9 months agoLinux 6.6 compat: META
Tony Hutter [Tue, 14 Nov 2023 17:55:28 +0000 (09:55 -0800)]
Linux 6.6 compat: META

Update the META file to reflect compatibility with the 6.6 kernel.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Umer Saleem <usaleem@ixsystems.com>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #15520

9 months agolib/libc/tests/string: add extended unit tests for strcmp()
Robert Clausecker [Fri, 22 Sep 2023 20:42:00 +0000 (16:42 -0400)]
lib/libc/tests/string: add extended unit tests for strcmp()

This changeset add a new set of tests that comprehensively test strcmp() on
various alignments of the input. This made it easy to smoke out many
exciting new bugs in the new SSE strcmp() implementation from D41971.

MFC after: 1 week
Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41970

9 months agoOptionalObsoleteFiles.inc: document block order
Brooks Davis [Mon, 13 Nov 2023 23:13:03 +0000 (23:13 +0000)]
OptionalObsoleteFiles.inc: document block order

Options should be in sort(1) order by primary option (usually, but not
always, first in the if statement).

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoSort MK_NETLINK option
Brooks Davis [Thu, 9 Nov 2023 01:03:46 +0000 (01:03 +0000)]
Sort MK_NETLINK option

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoSort MK_GNU_DIFF option
Brooks Davis [Thu, 9 Nov 2023 01:01:44 +0000 (01:01 +0000)]
Sort MK_GNU_DIFF option

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoCombine and sort MK_LLVM_COV
Brooks Davis [Thu, 9 Nov 2023 01:00:36 +0000 (01:00 +0000)]
Combine and sort MK_LLVM_COV

These used to be grouped with MK_GCOV option or the like.

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoSort MK_EFI and MK_FTP options
Brooks Davis [Thu, 9 Nov 2023 00:59:43 +0000 (00:59 +0000)]
Sort MK_EFI and MK_FTP options

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoSort MK_DTRACE and MK_ZFS options
Brooks Davis [Thu, 9 Nov 2023 00:55:59 +0000 (00:55 +0000)]
Sort MK_DTRACE and MK_ZFS options

Presumably these were under MK_CDDL at some point, but these days
src.opts.mk takes care of setting them to "no" when MK_CDDL is.

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoSort MK_HYPERV option
Brooks Davis [Thu, 9 Nov 2023 01:08:20 +0000 (01:08 +0000)]
Sort MK_HYPERV option

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agoSort MK_BSD_CPIO before MK_BSDINSTALL
Brooks Davis [Thu, 9 Nov 2023 00:54:22 +0000 (00:54 +0000)]
Sort MK_BSD_CPIO before MK_BSDINSTALL

Using sort(1) order makes verification of the sort easier.

Reviewed by: emaste, imp, netchild
Pull Request: https://github.com/freebsd/freebsd-src/pull/896

9 months agong_ipfw: allow use of 32 bits wide cookies
Eugene Grosbein [Tue, 14 Nov 2023 09:36:08 +0000 (16:36 +0700)]
ng_ipfw: allow use of 32 bits wide cookies

There is no reason in truncating 32 bits cookie value to 16 bits.

Reviewed by: glebius
MFC after: 2 weeks

9 months agopkgbase: create package with SRCRELDATE not OSRELDATE as OSVERSION
Baptiste Daroussin [Tue, 14 Nov 2023 07:41:47 +0000 (08:41 +0100)]
pkgbase: create package with SRCRELDATE not OSRELDATE as OSVERSION

In 188fe88ec50eac7c10e1d8350bf1180f8c16e463 OSVERSION has been set
to OSRELDATE which is the RELDATE of the building OS while we wanted
to use SRCRELDATE which is the RELDATE of the target system

9 months agopkgbase: set the prefix of debug files and macros to /usr/src
Baptiste Daroussin [Mon, 13 Nov 2023 17:18:58 +0000 (18:18 +0100)]
pkgbase: set the prefix of debug files and macros to /usr/src

When the macro PACKAGE_BUILDING is set, then consider we are building package
for pkgbase, this has already been used in Makefile.inc1 and reuse the
PACKAGE_BUILDING macros already used for that purpose in the ports tree

In the future this should be tied to REPRODUCIBLE_BUILD

MFC After: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42569

9 months agoawk: Merge upstream 2nd Edition Awk Book
Warner Losh [Thu, 2 Nov 2023 16:32:01 +0000 (10:32 -0600)]
awk: Merge upstream 2nd Edition Awk Book

Merge in the November 2nd, 2023 version of one true awk.

This brings in Unicode support, CSV support and a number of bug fixes.

Sponsored by: Netflix
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D42447

9 months agoipfw: fix copy&paste bug for number:array tables
Andrey V. Elsukov [Tue, 14 Nov 2023 04:37:04 +0000 (07:37 +0300)]
ipfw: fix copy&paste bug for number:array tables

Use compare_numarray() method for binary search. This fixes
table lookups for keys greater than UINT16_MAX.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

10 months agoabort2: Generate a core dump
John Baldwin [Tue, 14 Nov 2023 01:00:52 +0000 (17:00 -0800)]
abort2: Generate a core dump

Call sigexit rather than exit1 so that a core is generated.

If running the SIGABRT handler is desired, this would need to use
kern_psignal() instead.  In that case a userspace wrapper in libc
would be needed to force an exit if the handler doesn't exit.  Given
that abort2(2)'s intended use case is when userland is in a
sufficiently bad state such that it can't safely call syslog(3) before
abort(3), a userspace abort2(3) wrapper in libc might be dubious.

Reviewed by: Olivier Certner <olce.freebsd@certner.fr>, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42163

10 months agoipmi_ssif: Fix typo in debug print
Andrew Gallatin [Tue, 14 Nov 2023 00:44:27 +0000 (19:44 -0500)]
ipmi_ssif: Fix typo in debug print

Fix a typo in a debug print that prevents compilation.

Sponsored by: Netflix

10 months agoUnbound: Manually update version strings
Cy Schubert [Tue, 14 Nov 2023 00:39:10 +0000 (16:39 -0800)]
Unbound: Manually update version strings

This was missed earlier today.

Reported by: "Herbert J. Skuhra" <herbert@gojira.at>
Fixes: 16fd0b249104
MFC: 2 weeks