]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 months agoriscv: MMU detection
Mitchell Horne [Mon, 22 May 2023 23:53:43 +0000 (20:53 -0300)]
riscv: MMU detection

Detect and report the supported MMU for each CPU. Export the
capabilities to the rest of the kernel and use it in pmap_bootstrap() to
check for Sv48 support.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39814

13 months agoriscv: Print ISA extensions
Mitchell Horne [Mon, 22 May 2023 23:52:28 +0000 (20:52 -0300)]
riscv: Print ISA extensions

Report the CPU's single-letter ISA extensions in printcpuinfo().

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39813

13 months agoriscv: Rework CPU identification (second part)
Mitchell Horne [Mon, 22 May 2023 23:51:44 +0000 (20:51 -0300)]
riscv: Rework CPU identification (second part)

Modify when and how we perform parsing and reporting. Most notably,
everything now executes on CPU 0.

The de-facto standard way to enumerate CPU features (ISA extensions) on
RISC-V is by parsing each CPU's ISA string. We currently obtain this
information from the device tree, and in the future will be able to pull
it from ACPI tables.

Eliminate the SYSINIT from identcpu.c. We still need to walk the /cpus
list in the device tree, but now do this one CPU at a time, as a step in
the identify_cpu() procedure. This is slightly less error prone, and
allows us to parse ISA features for CPU 0 much earlier.

Make use of the SMP hooks cpu_mp_start() and cpu_mp_announce() to
identify and print secondary CPU info, respectively. This causes
secondary processor identification to be printed much earlier in boot;
everything is done by SI_SUB_CPU, SI_ORDER_THIRD. Adjust some other
printf() calls so that we get enough useful info to debug under
bootverbose.

Reviewed by: markj (slightly earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39811

13 months agoriscv: Call identify_cpu() earlier for CPU 0
Mitchell Horne [Mon, 22 May 2023 23:50:09 +0000 (20:50 -0300)]
riscv: Call identify_cpu() earlier for CPU 0

It is advantageous to have knowledge of ISA features as early as
possible. For example, the presence of newer virtual memory extensions
may be useful to pmap_bootstrap().

To achieve this, split out the printf() parts of identify_cpu() into a
separate function, printcpuinfo(). This latter function will be called
later in boot after the console has been initialized.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39810

13 months agoriscv: Rework CPU identification (first part)
Mitchell Horne [Mon, 22 May 2023 23:48:41 +0000 (20:48 -0300)]
riscv: Rework CPU identification (first part)

Make better use of the RISC-V identification CSRs: mvendorid, marchid,
and mimpid. This code was written before these registers were
well-specified, or even available to the kernel. It currently fails to
recognize any CPU or platform.

Per the privileged specification, mvendorid contains the JEDEC vendor ID,
or zero.

The marchid register denotes the CPU microarchitecture. This is either
one of the globally allocated open-source implementation IDs, or the
field has a custom encoding. Therefore, for known vendors (SiFive) we
can also maintain a list of known marchid values. If we can not give a
name to the CPU but marchid is non-zero, then just print its value in
the report.

The mimpid (implementation ID) could be used in the future to more
uniquely identify the micro-architecture, but it really remains to be
seen how it gets used. For now we just print its value.

Thank you to Danjel Qyteza <danq1222@gmail.com> who submitted an early
version of this change to me, although it has been almost entirely
rewritten.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39809

13 months agolibdtrace: get rid of illumos ifdefs in dt_module_update(), fix dm_file and dm_modid
Christos Margiolis [Tue, 23 May 2023 12:54:58 +0000 (15:54 +0300)]
libdtrace: get rid of illumos ifdefs in dt_module_update(), fix dm_file and dm_modid

Because dt_module_update() is highly OS-specific, the ifdefs make it
hard to read and follow what is going on. Also handle dm_modid, and
remove handling of the ".filename" section, since we can easily fetch
the filename from the module's pathname (k_stat->pathname).

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39177

13 months agopwd.1: replace /home with /sys in example
Mike Karels [Tue, 23 May 2023 12:21:50 +0000 (07:21 -0500)]
pwd.1: replace /home with /sys in example

The default location for home directories is moving from /usr/home
to /home, and the /home symlink will no longer exist.  Switch to
another example that is in base, /sys.

Reviewed by: fernape
Differential Revision: <https://reviews.freebsd.org/D40204

13 months agohier.7: update /home
Mike Karels [Tue, 23 May 2023 12:21:12 +0000 (07:21 -0500)]
hier.7: update /home

The default for home directories is changing from /usr/home to
/home; update the corresponding entries.  Also move /home into
alphabetical order.

Reviewed by: mhorne, manpages(bcr)
Differential Revision: https://reviews.freebsd.org/D40203

13 months agorelease/tools/vmimage.subr: switch zfs dataset from /usr/home to /home
Mike Karels [Tue, 23 May 2023 12:18:58 +0000 (07:18 -0500)]
release/tools/vmimage.subr: switch zfs dataset from /usr/home to /home

Change the vmimage script for zfs to create /home as a dataset
rather than /usr/home, ala change to bsdinstall's zfs script.

Reviewed by: markj
Differential Revision: <https://reviews.freebsd.org/D40111

13 months agobsdinstall on zfs: create dataset for /home rather than /usr/home
Mike Karels [Tue, 23 May 2023 12:18:27 +0000 (07:18 -0500)]
bsdinstall on zfs: create dataset for /home rather than /usr/home

Now that pw (hence adduser and the initial install) use /home for
user home directories rather than /usr/home, create a dataset for
/home rather than /usr/home.  Update the man page to match.

Reviewed by: rgrimes, markj
Differential Revision: https://reviews.freebsd.org/D40086

13 months agopw: do not move /home/$user to /usr/home
Mike Karels [Tue, 23 May 2023 12:17:42 +0000 (07:17 -0500)]
pw: do not move /home/$user to /usr/home

When adding a user, pw will create the path to the home directory
if needed.  However, if creating a path with just one component,
i.e.  that appears to be in the root directory, pw would create the
directory in /usr, and create a symlink from the root directory.
Most commonly, this meant that the default of /home/$user would turn
into /usr/home/$user.  This was added in a self-described kludge 26
years ago.  It made (some) sense when root was generally a small
partition, with most of the space in /usr.  However, the default is
now one large partition.  /home really doesn't belong under /usr,
and anyone who wants to use /usr/home can specify it explicitly.
Remove the kludge to move /home under /usr and create the symlink,
and just use the specified path.  Note that this operation was
done only on the first invocation for a path, and this happened most
commonly when adding a user during the install.

Modify the test that checked for the creation of the symlink to
verify that the symlink is *not* made, but rather a directory.
Add a test that intermediate directories are still created.

Reviewed by: rgrimes, bapt
Differential Revision: https://reviews.freebsd.org/D40085

13 months agozfs: merge openzfs/zfs@ad0a55461
Martin Matuska [Tue, 23 May 2023 09:50:17 +0000 (11:50 +0200)]
zfs: merge openzfs/zfs@ad0a55461

Notable upstream pull request merges:
  #12355 Teach zpool scrub to scrub only blocks in error log
  #14811 Refine special_small_blocks property validation
  #14854 zil: Some micro-optimizations
  #14855 zil: Free lwb_buf after write completion
  #14860 Fixes for issues identified by recent Coverity defect reports
  #14861 Probe vdevs before marking removed
  #14873 Add the ability to uninitialize a zpool
  #14875 Hold db_mtx when updating db_state

Obtained from: OpenZFS
OpenZFS commit: ad0a554614b096698d9969340c4c593690042d5b

13 months ago/etc/rc.d/motd: Update to accommodate changes in uname(1) and newvers.sh
Xin LI [Tue, 23 May 2023 04:23:57 +0000 (21:23 -0700)]
/etc/rc.d/motd: Update to accommodate changes in uname(1) and newvers.sh

The recent changes to the uname(1) command removed trailing spaces for
better POSIX conformance, but it broke the regular expression used by
the motd script which expected it.  This commit addresses this by removing
the requirement, as it is no longer present.

Additionally, a recent change in newvers.sh introduced a new format for
uname -v, which omited the build number and build dates to improve
reproducible build support.  This commit adds support for this new format.

Reported-by: Jamie Landeg-Jones <jamie@catflap.org>
Reviewed-by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40225

13 months agoCorrect size parameter to strncmp
Rose [Mon, 8 May 2023 23:08:18 +0000 (19:08 -0400)]
Correct size parameter to strncmp

The wrong value passed to strncmp meant that only enable and disable were being
accepted. This change corrects the logic so enabled and disabled are also
accepted.

Pull Request: https://github.com/freebsd/freebsd-src/pull/739
MFC after: 1 week
Reviewed by: delphij, ngie

13 months agodtrace: export dtrace_dis_get_byte()
Christos Margiolis [Mon, 22 May 2023 20:21:25 +0000 (23:21 +0300)]
dtrace: export dtrace_dis_get_byte()

kinst uses this function as well, but because it is not exported, it
implements its own copy of it. The patch also exposes the function to
userland, so programs that need to use dtrace_disx86() can use this
function instead of rolling their own copies.

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39871

13 months agoriscv: do not duplicate sd of tp
Christos Margiolis [Mon, 22 May 2023 20:03:06 +0000 (23:03 +0300)]
riscv: do not duplicate sd of tp

Reviewed by: jhb
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39894

13 months agoarm64: use PSR_DAIF instead of each individual flag
Christos Margiolis [Mon, 22 May 2023 19:49:33 +0000 (22:49 +0300)]
arm64: use PSR_DAIF instead of each individual flag

No functional change intended.

Reviewed by: mhorne, andrew
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D40165

13 months agoAdd christos as a src committer and markj as mentor
Christos Margiolis [Mon, 22 May 2023 19:49:32 +0000 (22:49 +0300)]
Add christos as a src committer and markj as mentor

Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D40210

13 months agogit-arc: mention creation of separate reviews in man page
Christos Margiolis [Mon, 22 May 2023 19:49:32 +0000 (22:49 +0300)]
git-arc: mention creation of separate reviews in man page

Reviewed by: imp
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D39963

13 months agogit-arc: fix spelling error in -s option
Christos Margiolis [Mon, 22 May 2023 19:49:32 +0000 (22:49 +0300)]
git-arc: fix spelling error in -s option

Reviewed by: imp
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D39962

13 months agoarm64: gicv3: setup PPIs on all APs after they're online
Kyle Evans [Mon, 15 May 2023 17:21:45 +0000 (12:21 -0500)]
arm64: gicv3: setup PPIs on all APs after they're online

For all PPIs setup earlier than SI_SUB_SMP, PIC_INIT_SECONDARY ends up
cleaning these up for each AP as it comes online.  Once they're online,
we don't currently do anything to make sure they're configured for other
APs.  Fix it by using smp_rendezvous for the meaty bits of configuring a
PPI, which will just do single-thread behavior before APs are online but
do the right thing for other CPUs after.

While we're here, make sure redistributor config is correct for other
APs as they come online in gic_v3_init_secondary.

Reported/Tested by: Souradeep Chakrabarti (Microsoft/Hyper-V)
Reviewed by: andrew (before slight refactor)
Differential Revision: https://reviews.freebsd.org/D40112

13 months agoRevert "ifconfig: switch IPv4/IPv6 address manipulations to Netlink"
Alexander V. Chernikov [Mon, 22 May 2023 15:17:57 +0000 (15:17 +0000)]
Revert "ifconfig: switch IPv4/IPv6 address manipulations to Netlink"

Revert the change as 2 non-expected issues have been reported.

This reverts commit 54418f79fd292e14abf121f87a3c790a17447971.

13 months agoRevert "ifconfig: Fix the build"
Alexander V. Chernikov [Mon, 22 May 2023 15:17:45 +0000 (15:17 +0000)]
Revert "ifconfig: Fix the build"

This reverts commit 5b8ce85e1a72d2c9541cb344b4e157f38f6a5d6c.

13 months agoifconfig: Fix the build
Mark Johnston [Mon, 22 May 2023 14:53:38 +0000 (10:53 -0400)]
ifconfig: Fix the build

Fix indentation in warn_nomask() while here.

Fixes: 54418f79fd29 ("ifconfig: switch IPv4/IPv6 address manipulations to Netlink")

13 months agoprepare-commit-msg: add 'Event'
Kristof Provost [Sat, 20 May 2023 14:52:38 +0000 (16:52 +0200)]
prepare-commit-msg: add 'Event'

Add 'Event' to the pre-commit template.

The key word is already documented at
https://docs.freebsd.org/en/articles/committers-guide/#_include_appropriate_metadata_in_a_footer

Suggested by: imp@
Event: BSDCan 2023
Differential Revision: https://reviews.freebsd.org/D40184

13 months agolibthr rtld locks: do not leak URWLOCK_READ_WAITERS into child
Konstantin Belousov [Sat, 20 May 2023 08:11:54 +0000 (11:11 +0300)]
libthr rtld locks: do not leak URWLOCK_READ_WAITERS into child

Since there is only the current thread in the child, no pending readers
exist.  Clear the bit, since it confuses future attempts to acquire
write ownership of the rtld locks, due to URWLOCK_PREFER_READERS flag.

To be future-proof, clear all state about pending writers and readers.

PR: 271490
Reported and tested by: KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40178

13 months agoifconfig: switch IPv4/IPv6 address manipulations to Netlink
Alexander V. Chernikov [Sat, 20 May 2023 11:53:46 +0000 (11:53 +0000)]
ifconfig: switch IPv4/IPv6 address manipulations to Netlink

Subscribers: imp

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

13 months agonetlink: call IPv6 hook when adding IPv4 addresses.
Alexander V. Chernikov [Mon, 22 May 2023 13:41:34 +0000 (13:41 +0000)]
netlink: call IPv6 hook when adding IPv4 addresses.

This provides compatibility with ifioctl() version of SIOCAIFADDR.
This change is temporary until the IPv4/IPv6 address handling code
 is moved to netinet[6].

13 months agofusefs: Remove an unused pbuf zone
Mark Johnston [Mon, 22 May 2023 13:33:57 +0000 (09:33 -0400)]
fusefs: Remove an unused pbuf zone

The zone has been dead ever since commit
b9e20197551d ("fusefs: rewrite vop_getpages and vop_putpages")

No functional change intended.

Reviewed by: asomers
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40143

13 months agoRevert "mlx4: Move DEFINE_MUTEX() outside function body."
Hans Petter Selasky [Mon, 22 May 2023 10:52:10 +0000 (12:52 +0200)]
Revert "mlx4: Move DEFINE_MUTEX() outside function body."

Requested by: jrtc27@

This reverts commit 805d759338a2be939fffc8bf3f25cfaab981a9be.

13 months agopam_tacplus: Mention nss_tacplus in the manual page.
Dag-Erling Smørgrav [Mon, 22 May 2023 10:00:52 +0000 (10:00 +0000)]
pam_tacplus: Mention nss_tacplus in the manual page.

MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D40135

13 months agoAdd nss_tacplus, a TACACS+ NSS module.
Dag-Erling Smørgrav [Mon, 22 May 2023 10:00:48 +0000 (10:00 +0000)]
Add nss_tacplus, a TACACS+ NSS module.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40133

13 months agotaclib: 0 (not set) is a valid auth type in authorization requests.
Dag-Erling Smørgrav [Mon, 22 May 2023 10:00:42 +0000 (10:00 +0000)]
taclib: 0 (not set) is a valid auth type in authorization requests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: rew
Differential Revision: https://reviews.freebsd.org/D40132

13 months agostress2: Added a faster test of fsck_ffs by omitting mount(8) and umount(8)
Peter Holm [Mon, 22 May 2023 08:07:40 +0000 (10:07 +0200)]
stress2: Added a faster test of fsck_ffs by omitting mount(8) and umount(8)

13 months agostress2: Occasionally modify 8 bits
Peter Holm [Mon, 22 May 2023 08:05:34 +0000 (10:05 +0200)]
stress2: Occasionally modify 8 bits

13 months agoLinuxKPI: fix WRITE_ONCE(), remove ACCESS_ONCE()
Bjoern A. Zeeb [Sat, 13 May 2023 15:17:47 +0000 (15:17 +0000)]
LinuxKPI: fix WRITE_ONCE(), remove ACCESS_ONCE()

Fix a gcc warning: "to be safe all intermediate pointers in cast from
'...' to '...' must be 'const' qualified [-Wcast-qual]".
Doing what is essentially a __DECONST() adding the uintptr_t gets
rid of the massive amount of warnings we get in LinuxKPI and lets
us see the actual problems a lot better.
This is a follow-up to 74e908b3c63b28de1d590dc42502fbe959a6da2e which
fixed READ_ONCE().
ACCESS_ONCE() seems to be an obsolete KPI these days in Linux and
FreeBSD does not use it either directly so we can entirely remove
it now.

Sponsored by: The FreeBSD Foundation
Suggested by: jhb
Reviewed by: hselasky
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D40084

13 months agomlx4: Move DEFINE_MUTEX() outside function body.
Hans Petter Selasky [Sun, 21 May 2023 11:25:28 +0000 (13:25 +0200)]
mlx4: Move DEFINE_MUTEX() outside function body.

Move static mutex declaration outside function body, to avoid global
variables being declared on the stack, when using SYSINITs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

13 months agoifconfig: simplify ifconfig() by factoring out ifa add/del logic
Alexander V. Chernikov [Sat, 20 May 2023 11:23:04 +0000 (11:23 +0000)]
ifconfig: simplify ifconfig() by factoring out ifa add/del logic

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40180

13 months agoifconfig: split argument parsing
Alexander V. Chernikov [Sat, 20 May 2023 11:14:39 +0000 (11:14 +0000)]
ifconfig: split argument parsing

Simplify main() by factoring out argument parsing code.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40179

13 months agoext2fs: Add large sectorsize disks support
Fedor Uporov [Mon, 8 May 2023 16:14:02 +0000 (19:14 +0300)]
ext2fs: Add large sectorsize disks support

The ext2fs does not support disks with sectorsize more 512 bytes.
The main issue is in reading/writing superblock, which is not aligned
with 4k value. Reimplement the superblock reading logic to make it
indifferent to disk logical sector size. The logical sector size
more then page size is not supported, like it is doing on Linux side.

PR:             271105
Reported by:    k(at)vodka.home.kg
Reviewed by:    pfg
MFC after:      2 week
Differential Revision:  https://reviews.freebsd.org/D40047

13 months agoLinuxKPI: implement pci_rescan_bus()
Bjoern A. Zeeb [Tue, 16 May 2023 20:59:30 +0000 (20:59 +0000)]
LinuxKPI: implement pci_rescan_bus()

Try to implement pci_rescan_bus().  pci_rescan_method() is already
doing most of the job.  We only have to do the count for the return
value again ourselves.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D40122

13 months agoRevert "Require the OpenSSL 1.1 APIs when compiling ldns"
Enji Cooper [Sat, 20 May 2023 19:00:34 +0000 (12:00 -0700)]
Revert "Require the OpenSSL 1.1 APIs when compiling ldns"

This particular change appears to have broken the build; the change
needs some massaging to work with OpenSSL 1.1.

This reverts commit c6750ddec9177b67bb4883717933e87ac24a3a44.

13 months agoRequire the OpenSSL 1.1 APIs when compiling ldns
Enji Cooper [Sat, 13 May 2023 02:38:18 +0000 (19:38 -0700)]
Require the OpenSSL 1.1 APIs when compiling ldns

Moving the APIs from OpenSSL 1.1 supporting APIs to 3.x supporting APIs
is a non-trivial effort. Require 1.1 API compatibility to unblock
updating OpenSSL in base to 3.x.

This mirrors what upstream has done in their configure.ac file.

Submitted by: Pierre Pronchery <pierre@freebsdfoundation.org>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40082

13 months agocxgbe: Move ethofld_transmit under #ifdef INET || INET.
John Baldwin [Sat, 20 May 2023 16:27:40 +0000 (09:27 -0700)]
cxgbe: Move ethofld_transmit under #ifdef INET || INET.

This fixes a -Wunused-function warning when building LINT-NOIP.

Reported by: rpokala

13 months agonetlink: Move an INET-only variable under #if.
John Baldwin [Sat, 20 May 2023 16:26:46 +0000 (09:26 -0700)]
netlink: Move an INET-only variable under #if.

This fixes the LINT-NOIP build.

13 months agotd: line up with other clean up in thread_reap_domain
Mateusz Guzik [Fri, 19 Aug 2022 19:51:53 +0000 (19:51 +0000)]
td: line up with other clean up in thread_reap_domain

NFC

13 months agorlimit: line up with other clean up in thread_reap_domain
Mateusz Guzik [Fri, 19 Aug 2022 19:37:33 +0000 (19:37 +0000)]
rlimit: line up with other clean up in thread_reap_domain

NFC

13 months agofwget: remove logging redirects
Bjoern A. Zeeb [Fri, 12 May 2023 11:47:49 +0000 (11:47 +0000)]
fwget: remove logging redirects

After adding addpkg() in 10aa369afd9946da18ae51b07aeadc3314fba56d
the redirects are no longer needed.  We can now log directly so
simplify the code.

Reported by: manu
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D40077

13 months agofwget: add support for various WiFi NICs
Bjoern A. Zeeb [Thu, 11 May 2023 20:41:40 +0000 (20:41 +0000)]
fwget: add support for various WiFi NICs

Add support for Realtek, QCA, and Mediatek WiFi NIC cards.
We group the matching entries by driver in sub-functions in order
to semi-automatically create the lists for now.

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

13 months agofwget: improve the pci base script
Bjoern A. Zeeb [Thu, 11 May 2023 20:36:50 +0000 (20:36 +0000)]
fwget: improve the pci base script

When matching "class" only match the class byte and not subclass and
programming interface.
Extend the list of supported classes by network, old, and misc (for no
better names on the latter two).
Extend the list of known vendors for various WiFi NICs.
Add a "pci_fixup_class" as some wireless cards have unexpected PCI
classes set.  In case we cannot find a matching file for the original
try to see if a "fixed up" version exists.  This allows us to avoid
duplicate matching files for the same vendor/driver but different
chipsets.

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

13 months agofwget: simplify adding firmware images to pkg to install
Bjoern A. Zeeb [Thu, 11 May 2023 20:30:44 +0000 (20:30 +0000)]
fwget: simplify adding firmware images to pkg to install

Rather than using echo to return the firmware package name, call a
new function (addpkg) which will also deal with (i) no leading space
and (ii) remove duplicates (as some devices have dual-wifi-cards).
In addition we won't have a line break when having multiple packages.

While here also do not call pkg(8) anymore if there is no package to
install and use the correct variable to install all and not just the
last found package.

Reviewed by: manu, bapt
Differential Revision: https://reviews.freebsd.org/D40071

13 months agoLinuxKPI: add put_unaligned_le16() and get_unaligned_be64()
Bjoern A. Zeeb [Sat, 20 May 2023 00:52:27 +0000 (00:52 +0000)]
LinuxKPI: add put_unaligned_le16() and get_unaligned_be64()

Add the two new functions needed by wireless drivers by the same
implementation pattern we did for different sizes.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40174

13 months agonetlink: automatically generate broadcast for IPv4 ifa if not set.
Alexander V. Chernikov [Sat, 20 May 2023 10:42:08 +0000 (10:42 +0000)]
netlink: automatically generate broadcast for IPv4 ifa if not set.

MFC after: 2 weeks

13 months agoifconfig: simplify carp vhid setup.
Alexander V. Chernikov [Fri, 19 May 2023 10:18:43 +0000 (10:18 +0000)]
ifconfig: simplify carp vhid setup.

Currently carp implementation peeks into the opaque 'afp->af_addreq'
 buffer, assumes it knows the af-specific layout and assigns vhid
 directly.
Simplify the code and remove abstraction leak by introducing per-afp
 callback for setting vhid.
This change is a pre-requisite to set addresses via Netlink,
 as Netlink implementiation uses different structure layout.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40160
MFC after: 2 weeks

13 months agoLinuxKPI: add further dummy header files
Bjoern A. Zeeb [Sat, 20 May 2023 00:41:45 +0000 (00:41 +0000)]
LinuxKPI: add further dummy header files

Wireless drivers try to include these files.  Add them empty for no
better reason yet.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoLinuxKPI: skbuff: add skb_get_hash()
Bjoern A. Zeeb [Sat, 20 May 2023 00:47:05 +0000 (00:47 +0000)]
LinuxKPI: skbuff: add skb_get_hash()

Add a dummy implementation of skb_get_hash() until we'll hit and
implement it.  It'll help to keep an upcoming wireless driver to
compile.

MFC after: 10 days

13 months agoLinuxKPI: qcom: update qmi and mhi
Bjoern A. Zeeb [Sat, 20 May 2023 00:50:10 +0000 (00:50 +0000)]
LinuxKPI: qcom: update qmi and mhi

Update qcom QMI and MHI bits in order to keep an upcoming driver
compiling.

MFC after: 10 days

13 months agoLinuxKPI: netdevice: add dev_set_threaded()
Bjoern A. Zeeb [Sat, 20 May 2023 00:51:01 +0000 (00:51 +0000)]
LinuxKPI: netdevice: add dev_set_threaded()

Add dev_set_threaded() to the dummy functions of netdevice.h in order
to keep an upcoming wireless driver compiling.
While here also update the name of a function argument for consistency.

MFC after: 10 days

13 months agonet80211: Radiotap: update for defines
Bjoern A. Zeeb [Sat, 20 May 2023 00:39:08 +0000 (00:39 +0000)]
net80211: Radiotap: update for defines

ath1xk drivers require further HE defines.  Some of those we had
already predicted as comments in the past.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoHold db_mtx when updating db_state
Brian Atkinson [Fri, 19 May 2023 20:05:53 +0000 (16:05 -0400)]
Hold db_mtx when updating db_state

Commit 555ef90 did some general code refactoring for
dmu_buf_will_not_fill() and dmu_buf_will_fill(). However, the db_mtx was
not held when update db->db_state in those code block. The rest of the
dbuf code always holds the db_mtx when updating db_state. This is
important because cv_wait() db_changed is used to check for db_state
changes.

Updating dmu_buf_will_not_fill() and dmu_buf_will_fill() to hold the
db_mtx when updating db_state.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #14875

13 months agoProbe vdevs before marking removed
Brian Behlendorf [Fri, 19 May 2023 20:05:09 +0000 (13:05 -0700)]
Probe vdevs before marking removed

Before allowing the ZED to mark a vdev as REMOVED due to a
hotplug event confirm that it is non-responsive with probe.
Any device which can be successfully probed should be left
ONLINE to prevent a healthy pool from being incorrectly
SUSPENDED.  This may occur for at least the following two
scenarios.

1) Drive expansion (zpool online -e) in VMware environments.
   If, during the partition resize operation, a partition is
   removed and re-created then udev will send a removed event.

2) Re-scanning the namespaces of an NVMe device (nvme ns-rescan)
   may result in a udev remove and add event being delivered.

Finally, update the ZED to only kick in a spare when the
removal was successful.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #14859
Closes #14861

13 months agoAdd a comment to the new tcp_get_srtt method to clarify that ticks
Randall Stewart [Fri, 19 May 2023 19:53:26 +0000 (15:53 -0400)]
Add a comment to the new tcp_get_srtt method to clarify that ticks
are kept in a shifted form and need to be un-shifted before use.

Suggested by: rpokala@

13 months agodate: add -z output_zone option
Baptiste Daroussin [Fri, 19 May 2023 09:08:11 +0000 (11:08 +0200)]
date: add -z output_zone option

Inpired by OpenBSD date(1), this option allows to do timezone conversion
via the date(1) command.

For example, to determine when the BSDCan livestream begins for me:

$ env -i TZ=EST5EDT date -z Europe/Paris -j 0900

MFC After: 1 week
Reviewed by: kib, bcr (manpage)
Differential Revision: https://reviews.freebsd.org/D40159

13 months agoThere are congestion control algorithms will that pull in srtt, and this can cause...
Randall Stewart [Fri, 19 May 2023 15:16:28 +0000 (11:16 -0400)]
There are congestion control algorithms will that pull in srtt, and this can cause issues with rack.

When using rack, cubic and htcp will grab the srtt, but they think it is in ticks. For rack
it is in micro-seconds (which we should probably move all stacks to actually). This causes
issues so instead lets make a new interface so that any CC module can pull the srtt in
whatever granularity they want.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D40146

13 months agoCirrus-CI: switch to -lite LLVM package for native run
Ed Maste [Wed, 17 May 2023 18:16:06 +0000 (14:16 -0400)]
Cirrus-CI: switch to -lite LLVM package for native run

This reduces CI cycle time (a small amount).

Suggested by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40136

13 months agomi_startup: Instrument the bubblesort with TSLOG
Colin Percival [Fri, 19 May 2023 13:46:42 +0000 (06:46 -0700)]
mi_startup: Instrument the bubblesort with TSLOG

The bubblesort of SYSINITs is currently responsible for 7% of the
kernel boot time when booting a 1 CPU / 128 MB VM under Firecracker.

It needs to be replaced with a faster sort, but until that happens
at least instrumenting it with TSLOG makes it show up in flamecharts.

13 months agoif_bridge: fix potential panic
Kristof Provost [Thu, 18 May 2023 18:04:45 +0000 (20:04 +0200)]
if_bridge: fix potential panic

When a new bridge_rtnode is added it is added with a NULL brt_dst. The
brt_dst is set after the entry is added. This means there's a small
window where another core could also attempt to add this node, leading
to the code attempting to log that the MAC addresses moved to a new
interface.
Aside from that being a spurious log entry it also panics, because
obif is NULL (and we attempt to dereference it).

Avoid this by settings brt_dst before we insert the bridge_rtnode.
Assert that obif is non-NULL, as an extra precaution.

Reported by: olivier@
Reviewed by: zlei@
Differential Revision: https://reviews.freebsd.org/D40147

13 months agonetlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
Alexander V. Chernikov [Fri, 19 May 2023 09:44:21 +0000 (09:44 +0000)]
netlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
sockaddrs.

MFC after: 2 weeks

13 months agocarp test: improve jail names for unicast_ll_v6 test
Kristof Provost [Thu, 18 May 2023 20:06:37 +0000 (22:06 +0200)]
carp test: improve jail names for unicast_ll_v6 test

Rename the jails used in the unicast_ll_v6 test, to ensure the jail
names are unique to this test.
That is one of the requirements for running these tests in parallel.

13 months agopfsync tests: check for the correct IP address
Kristof Provost [Thu, 18 May 2023 19:37:48 +0000 (21:37 +0200)]
pfsync tests: check for the correct IP address

When checking if the state synced over we should look for
198.51.100.254, not 198.51.100.2. The test worked because the incorrect
address is a substring of the correct one, but we should fix it anyway.

Reported by: Naman Sood <naman@freebsdfoundation.org>
MFC after: 1 week

13 months agoproc: s/short/int lock-related counters
Mateusz Guzik [Thu, 18 May 2023 19:45:33 +0000 (19:45 +0000)]
proc: s/short/int lock-related counters

short is small enough that it can overflow in practice for certain cases
and then trigger wrong asserts.

One known example is vfs namecache resize which grabs all locks at once.

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

13 months agoproc: s/short/u_char for td_stopsched
Mateusz Guzik [Thu, 18 May 2023 19:44:29 +0000 (19:44 +0000)]
proc: s/short/u_char for td_stopsched

bool is not used because of massive header mess

While here move it into a gap.

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

13 months agoTeach zpool scrub to scrub only blocks in error log
George Amanakis [Fri, 17 Dec 2021 20:35:28 +0000 (21:35 +0100)]
Teach zpool scrub to scrub only blocks in error log

Added a flag '-e' in zpool scrub to scrub only blocks in error log. A
user can pause, resume and cancel the error scrub by passing additional
command line arguments -p -s just like a regular scrub. This involves
adding a new flag, creating new libzfs interfaces, a new ioctl, and the
actual iteration and read-issuing logic. Error scrubbing is executed in
multiple txg to make sure pool performance is not affected.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Co-authored-by: TulsiJain tulsi.jain@delphix.com
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #8995
Closes #12355

13 months agoAdd the ability to uninitialize
Brian Behlendorf [Thu, 18 May 2023 17:02:20 +0000 (10:02 -0700)]
Add the ability to uninitialize

zpool initialize functions well for touching every free byte...once.
But if we want to do it again, we're currently out of luck.

So let's add zpool initialize -u to clear it.

Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12451
Closes #14873

13 months agoUnder RSS, assign a TCP flow's inp_flowid anyway.
Cheng Cui [Thu, 11 May 2023 09:06:04 +0000 (05:06 -0400)]
Under RSS, assign a TCP flow's inp_flowid anyway.

Summary:
This brings some benefit of a tcp flow identification for some kernel
modules, such as siftr.

Reviewers: rrs, rscheff, tuexen, #transport!
Approved by: tuexen (mentor), rrs
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40061

13 months agolibc: Update copyright text to match current templates.
Peter Wemm [Thu, 18 May 2023 18:30:10 +0000 (11:30 -0700)]
libc: Update copyright text to match current templates.

13 months agotraceroute.8: Document TOS as DiffServ and ECN
Jesse Rosenstock [Thu, 18 May 2023 17:10:13 +0000 (11:10 -0600)]
traceroute.8: Document TOS as DiffServ and ECN

Reviewed by: imp,karels
Pull Request: https://github.com/freebsd/freebsd-src/pull/744

13 months agolinux(4): Implement ptrace_pokeusr for x86_64
Dmitry Chagin [Thu, 18 May 2023 17:02:35 +0000 (20:02 +0300)]
linux(4): Implement ptrace_pokeusr for x86_64

Differential Revision: https://reviews.freebsd.org/D40097
MFC after: 1 week

13 months agolinux(4): Make ptrace_pokeusr machine dependent
Dmitry Chagin [Thu, 18 May 2023 17:01:12 +0000 (20:01 +0300)]
linux(4): Make ptrace_pokeusr machine dependent

Differential Revision: https://reviews.freebsd.org/D40096
MFC after: 1 week

13 months agolinux(4): Make ptrace_peekusr machine dependend
Dmitry Chagin [Thu, 18 May 2023 17:00:12 +0000 (20:00 +0300)]
linux(4): Make ptrace_peekusr machine dependend

And partially implement it for x86_64.

Differential Revision: https://reviews.freebsd.org/D40095
MFC after: 1 week

13 months agolinux(4): Move linux_debug decalration to linux_util.h
Dmitry Chagin [Thu, 18 May 2023 16:58:23 +0000 (19:58 +0300)]
linux(4): Move linux_debug decalration to linux_util.h

To avoid inclusion of linux_mib.h with linux_util.h in cases where
we need rate limiting macro.

MFC after: 1 week

13 months agocarp tests: test unicast carp via link-local addresses
Kristof Provost [Thu, 18 May 2023 14:43:46 +0000 (16:43 +0200)]
carp tests: test unicast carp via link-local addresses

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

13 months agocarp: fix unicast link-local
Kristof Provost [Thu, 18 May 2023 15:30:39 +0000 (17:30 +0200)]
carp: fix unicast link-local

If the peer6 address is a link-local address we have to embed the
scopeid, much like we have to for IPv6 multicast as well.

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

13 months agoifconfig: improve error checking for carp peer6
Kristof Provost [Wed, 17 May 2023 19:39:42 +0000 (21:39 +0200)]
ifconfig: improve error checking for carp peer6

getaddrinfo() returns 0 if it succeeded, but it's not guaranteed to
return 1 on error. Check for success rather than for one specific error.

Without this fix commands such as `ifconfig bnxt1 inet6 add vhid 1 peer6
2001:db8::1/64` would segfault ifconfig.

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

13 months agoifconfig: improve trimming off interface number at end
Bjoern A. Zeeb [Wed, 17 May 2023 20:40:47 +0000 (20:40 +0000)]
ifconfig: improve trimming off interface number at end

When trying to auto-load a module, we trim the interface number off
the end.  Currently we stop at the first digit.  For interfaces which
have numbers in the driver name this does not work well.
In the current example ifconfig ath10k0 would load ath(4) instead of
ath10k(4).  For module/interface names like rtw88[0] we never guess
correctly.
To improve for the case we can, start trimming off digits from the
end rather than the front.

Sponsored by: The FreeBSD Foundation
Reported by: thierry
MFC after: 20 days
Reviewed by: melifaro, thierry
Differential Revision: https://reviews.freebsd.org/D40137

13 months agorc.d/netif: Don't DAD if lo0 is the only IPv6 IF
Colin Percival [Thu, 18 May 2023 03:17:24 +0000 (20:17 -0700)]
rc.d/netif: Don't DAD if lo0 is the only IPv6 IF

The code in rc.d/netif waiting for IPv6 Duplicate Address Detection if
any network interfaces support IPv6.  Unfortunately, since lo0 *always*
has IPv6 enabled, this means unconditionally sleeping, even on systems
which have no external IPv6 interfaces.

Since we presume that there is little risk of a duplicate address being
assigned on lo0, amend the test to wait only if there is an interface
*other than lo0* which supports IPv6.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D40141

13 months agolinux(4): Check fd passed to unlockpt()
Dmitry Chagin [Thu, 18 May 2023 07:55:39 +0000 (10:55 +0300)]
linux(4): Check fd passed to unlockpt()

In our implementation, grantpt() and unlockpt() don't actually have
any use, because PTY's are created on the fly and already have proper
permissions upon creation.
Atleast check that a proper fd passed to unlockpt(). For grantpt()
Glibc calls TIOCGPTN ioctl which would fail if fd is not a master.

Differential Revision: https://reviews.freebsd.org/D40100
MFC after: 1 week

13 months agoktls: don't try to unlock pcb if tcp_drop() already did
Gleb Smirnoff [Wed, 17 May 2023 17:25:28 +0000 (10:25 -0700)]
ktls: don't try to unlock pcb if tcp_drop() already did

Reviewed by: rrs, gallatin

13 months agopf: Standardize rtableid
Kajetan Staszkiewicz [Wed, 17 May 2023 13:57:42 +0000 (15:57 +0200)]
pf: Standardize rtableid

Prepare for rtableid being included in struct pfsync_state where it will
be int32_t. Make variables which will be set to and from it the same
width.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40013

13 months agobhyve: error out if fwcfg user file isn't read completely
Corvin Köhne [Fri, 12 May 2023 05:37:32 +0000 (07:37 +0200)]
bhyve: error out if fwcfg user file isn't read completely

At the moment, fwcfg reads the file once at startup and passes these
data to the guest. Therefore, we should always read the whole file.
Otherwise we should error out.

Additionally, GCC12 complains that the comparison whether
fwcfg_file->size is lower than 0 is always false due to the limited
range of data type.

Reviewed by: markj
Fixes: ca14781c8170f3517ae79e198c0c880dbc3142dd ("bhyve: add cmdline option for user defined fw_cfg items")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40076

13 months agopf: release rules lock before passing the packet to dummynet
Kristof Provost [Thu, 11 May 2023 16:10:33 +0000 (18:10 +0200)]
pf: release rules lock before passing the packet to dummynet

In the Ethernet rules we held the PF_RULES lock while we called
ip_dn_io_ptr() (i.e. dummynet). That meant that we could end up back in
pf while still holding the PF_RULES lock.
That's not immediately fatal, because that lock is recursive, but still
not ideal.

There also appear to be scenarios where this can actually trigger
deadlocks.

We don't need to hold the PF_RULES lock, as long as we make a local copy
of the data we need from the rule (in this case, the action and
bridge_to target). It's safe to keep the struct ifnet pointer around,
because we remain in NET_EPOCH.

See also: https://redmine.pfsense.org/issues/14373
MFC after: 1 week
Reviewed by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40067

13 months agoMove the arm64 sigcode to .rodata
Andrew Turner [Wed, 17 May 2023 11:00:12 +0000 (12:00 +0100)]
Move the arm64 sigcode to .rodata

The kernel doesn't execute this code, it's only ever copied to
userspace. Move it to .rodata as we don't need to modify it.

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

13 months agoLinuxKPI: add ns_to_timespec64()
Bjoern A. Zeeb [Tue, 16 May 2023 21:00:45 +0000 (21:00 +0000)]
LinuxKPI: add ns_to_timespec64()

Add ns_to_timespec64() which does not seem to require anything from
us given timespec64 is aliases to timespec.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40123

13 months agoix(4): correct max MTU
Piotr Kubaj [Wed, 17 May 2023 10:16:22 +0000 (12:16 +0200)]
ix(4): correct max MTU

The max MTU for the ix(4) is 9710.

Differential revision: https://reviews.freebsd.org/D40003
Approved by: erj, bcr

13 months agoem: sync platform detection with Linux
Piotr Kubaj [Wed, 17 May 2023 10:14:02 +0000 (12:14 +0200)]
em: sync platform detection with Linux

Switch 16 and 23 adapters from tgp to adp.

PR: 270929
Differential revision: https://reviews.freebsd.org/D39977
Approved by: erj, kbowling

13 months agorouting: plug mbuf leak for the packets hitting IPv6 blackhole route
Alexander V. Chernikov [Wed, 17 May 2023 09:06:04 +0000 (09:06 +0000)]
routing: plug mbuf leak for the packets hitting IPv6 blackhole route

Reported by: Dmitriy Smirnov <fox@sage.su>
Tested by: Dmitriy Smirnov <fox@sage.su>
MFC after: 1 day

13 months agorouting: fix panic triggered by the 'gr_idx != 0' assert in nhg code
Alexander V. Chernikov [Wed, 17 May 2023 08:24:05 +0000 (08:24 +0000)]
routing: fix panic triggered by the 'gr_idx != 0' assert in nhg code

Nexthop groups can be referenced by the external code. The reference
 can be released after the VNET destruction. Furthermore, nexthop
 groups use a single per-rib lock, which is destroyed during the
 VNET desctruction. To eliminate use-after-free problem, each nhg
 is marked as "unlinked" during the VNET destruction stage, leaving
 nhg_idx intact. Normally there should not be such nexthops, but if
 there are any, the kernel will panic on 'gr_idx != 0' when the
 last nhg reference is released.

Address this by using the assert checks only when the nexthop group
 is destroyed during "valid" VNET lifetime.

MFC after: 3 days

13 months agonet/if_var.h: consistently use if_t over struct ifnet *
Konstantin Belousov [Wed, 17 May 2023 01:22:36 +0000 (04:22 +0300)]
net/if_var.h: consistently use if_t over struct ifnet *

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125

13 months agonet/if.h: fix style of if_t definition
Konstantin Belousov [Wed, 17 May 2023 01:21:57 +0000 (04:21 +0300)]
net/if.h: fix style of if_t definition

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125

13 months agopfsync: Remove deletion of states using the full pfsync_state struct
Kajetan Staszkiewicz [Mon, 15 May 2023 19:43:06 +0000 (21:43 +0200)]
pfsync: Remove deletion of states using the full pfsync_state struct

State deletions are sent over pfsync using struct pfsync_del_c.

Remove the code for receiving state deletions using struct pfsync_state
as such deletions are never sent. Rename functions and constants so that
only the "compressed" versions remain.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40004