]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agosmp_topo: dynamically allocate group array
Konstantin Belousov [Fri, 5 May 2023 20:24:22 +0000 (23:24 +0300)]
smp_topo: dynamically allocate group array

(cherry picked from commit 9801e7c275f6ec42a44b98a2e2e1a8ac4674a096)

14 months agoquiesce_cpus(): do not overallocate generation array
Konstantin Belousov [Fri, 5 May 2023 20:21:38 +0000 (23:21 +0300)]
quiesce_cpus(): do not overallocate generation array

(cherry picked from commit ccc6b87b3825a235991d978e43d29431e012461f)

14 months agonfsd: Fix initialization broken by 7344856e3a6d
Rick Macklem [Sun, 12 Feb 2023 17:16:56 +0000 (09:16 -0800)]
nfsd: Fix initialization broken by 7344856e3a6d

Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d did change where things are initialized
and one of the initialization functions was not being called
early enough.  This patch moves nfsrvd_init(0) to the
function called via (VNET_)SYSINIT() to fix this.

(cherry picked from commit fcfdb76e12fb3cdf584e6f06e56e7c48ec475cc6)

14 months agonfsd: Delete nfsrv_prison_cleanup() until vneting enabled
Rick Macklem [Sun, 12 Feb 2023 02:27:59 +0000 (18:27 -0800)]
nfsd: Delete nfsrv_prison_cleanup() until vneting enabled

Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d enabled the prison cleanup function, that
would get called and crash the system when a jail was terminated.

This patch gets rid of nfsrv_prison_cleanup() for now.
It can go in when the vnet macros are enabled as
front ends to the vnet macros.

(cherry picked from commit 4d68605f31fb536722529dc90f16cc47d964882e)

14 months agonfsd: Prepare the NFS server code to run in a vnet prison
Rick Macklem [Sat, 11 Feb 2023 23:51:19 +0000 (15:51 -0800)]
nfsd: Prepare the NFS server code to run in a vnet prison

This patch defines null macros that can be used to apply
the vnet macros for global variables and SYSCTL flags.
It also applies these macros to many of the global variables
and some of the SYSCTLs.  Since the macros do nothing, these
changes should not result in semantics changes, although the
changes are large in number.

The patch does change several global variables that were
arrays or structures to pointers to same.  For these variables,
modified initialization and cleanup code malloc's and free's
the arrays/structures.  This was done so that the vnet footprint
would be about 300bytes when the macros are defined as vnet macros,
allowing nfsd.ko to load dynamically.

I believe the comments in D37519 have been addressed, although
it has never been reviewed, due in part to the large size of the patch.
This is the first of a series of patches that will put D37519 in main.

Once everything is in main, the macros will be defined as front
end macros to the vnet ones.

(cherry picked from commit 7e44856e3a6deb194c2c376e886854b256360c40)

14 months agoMake SMCCC usable by device drivers
Andrew Turner [Sat, 4 Jun 2022 11:13:51 +0000 (12:13 +0100)]
Make SMCCC usable by device drivers

To allow device drivers to call into SMCCC we need to initialise it
earlier. As it depends on PSCI, and that is detected via ACPI or FDT
move the call to smccc_init to the PSCI driver.

Add a function for drivers to read the smccc version, or 0 if smccc
is not present.

(cherry picked from commit 0600af1ff16041f15633b2263a8ad9525eecd2f1)
(cherry picked from commit 7ca55fcc541b375c83eaf75f0658b79f250c82fd)

14 months agoAdd the fixed memory type to the pci ecam driver
Andrew Turner [Wed, 18 Jan 2023 09:30:46 +0000 (09:30 +0000)]
Add the fixed memory type to the pci ecam driver

Add ACPI_RESOURCE_TYPE_FIXED_MEMORY32 to the PCI ECAM driver. This is
used on the Microsoft Dev Kit 2023 and reportedly the Lenovo x13s.

Reviewed by: Robert Clausecker <fuz@fuz.su> (Earlier version)
Tested by: Robert Clausecker <fuz@fuz.su> (Earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38031

(cherry picked from commit 896f556205c8d87ef842dc844752daa7d2385336)

14 months agoReduce an arm64 VFP critical section
Andrew Turner [Wed, 18 Jan 2023 09:30:36 +0000 (09:30 +0000)]
Reduce an arm64 VFP critical section

In set_fpcontext we only need a critical section around vfp_discard.
The remainder of the code can run without it.

While here add an assert to check the passed in thread is the
current thread as the code already this.

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

(cherry picked from commit a85cf421d1bfec7e753bfee781355785b00d89d4)

14 months agoAlways store the arm64 VFP context
Andrew Turner [Wed, 18 Jan 2023 09:30:32 +0000 (09:30 +0000)]
Always store the arm64 VFP context

If a thread enters a kernel FP context the PCB_FP_STARTED may be
unset when calling get_fpcontext even if the VFP unit has been used
by the current thread.

Reduce the use of this flag to just decide when to store the VFP state.

While here add an assert to check the assumption that the passed in
thread is the current thread and remove the unneeded critical section.
The latter is unneeded as the only place we would need it is in
vfp_save_state and this already has a critical section when needed.

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

(cherry picked from commit 61f5462fde6c38c1f4f5c34a05fab506b6869375)

14 months agoAlways read the VFP regs in the arm64 fill_fpregs
Andrew Turner [Wed, 18 Jan 2023 09:30:20 +0000 (09:30 +0000)]
Always read the VFP regs in the arm64 fill_fpregs

The PCB_FP_STARTED is used to indicate that the current VFP context
has been used since either 1. the start of the thread, or 2. exiting
a kernel FP context.

When case 2 was added to the kernel this could cause incorrect results
to be returned when a thread exits the kernel FP context and fill_fpregs
is called before it has restored the VFP state, e.g. by trappin on a
userspace VFP instruction.

In both of the cases the base save area is still valid so reduce the
use of the PCB_FP_STARTED flag check to help decide if we need to
store the current threads VFP state.

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

(cherry picked from commit 95dd6974b591ce76bf8d29adcc0dd01b4b281ffd)

14 months agoStop using the rid as an index in the arm timer
Andrew Turner [Wed, 15 Mar 2023 13:35:04 +0000 (13:35 +0000)]
Stop using the rid as an index in the arm timer

The order of the interrupt array doesn't matter. Store the described
interrupts at the start of the array to simplify iterating over them.

Reviewed by: imp, kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39094

(cherry picked from commit 5c4bd8756fbc23a48ddd8976df0b8429311fba83)

14 months agoKeep per-timer interrupt data together
Andrew Turner [Tue, 14 Mar 2023 09:27:23 +0000 (09:27 +0000)]
Keep per-timer interrupt data together

Eliminate a redundant resource array allow possible use by bhyve later.

Reviewed by: kevans
Sponsored by: Arm Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37424

(cherry picked from commit b71ef90ec28fdb731733afde495ac74ae59d6196)

14 months agoAlways enable the virtual timer for userspace
Andrew Turner [Fri, 10 Mar 2023 12:43:59 +0000 (12:43 +0000)]
Always enable the virtual timer for userspace

We always have it, some languages assume it's present, e.g. go
before 1.20. Enable it by default on arm and arm64.

PR: 269070
Reviewed by: kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39059

(cherry picked from commit 93d574ea957decec1c95dea9bfa8bc72457cc60d)

14 months agoarm: generic_timer: use interrupt-names when available
Kyle Evans [Sun, 5 Mar 2023 00:49:04 +0000 (18:49 -0600)]
arm: generic_timer: use interrupt-names when available

Offsets for all of thse can be a bit complicated as not all interrupts
will be present, only phys and virt are actually required, and sec-phys
could optionally be specified before phys.  Push idx/name pairs into
a new config struct and maintain the old indices while still getting the
correct timers.

Split fdt/acpi attach out independently and allocate interrupts before
we head into the common attach().  The secure physical timer is also
optional there, so mark it so to avoid erroring out if we run into
problems.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D38911

(cherry picked from commit 91b2da13702fb3cfb40a3219feed6e5af651039d)

14 months agoLimit where we disable the Arm generic timer
Andrew Turner [Thu, 2 Feb 2023 16:26:25 +0000 (16:26 +0000)]
Limit where we disable the Arm generic timer

Only disable the Arm generic timer on arm64 when entering the kernel
through EL2. There is no guarantee it will be enabled if we are running
under a hypervisor.

Sponsored by: Arm Ltd

(cherry picked from commit 22e4897422a055b7a15be5984fbc4bb97f432e79)

14 months agoDisable the arm physical timer when an irq exists
Andrew Turner [Sat, 28 Jan 2023 17:36:24 +0000 (17:36 +0000)]
Disable the arm physical timer when an irq exists

Some firmware leaves the timers enabled. Ensure they are disabled if
there are any physical timer interrupt resources to ensure we don't
receive any unexpected interrupts from them.

(cherry picked from commit c57694ce94712ce1fe0341ae51d70446a7dbbfa2)

14 months agoarm64: Fix a typo in a source code comment
Gordon Bergling [Fri, 12 May 2023 08:45:46 +0000 (10:45 +0200)]
arm64: Fix a typo in a source code comment

- s/inferface/interface/

(cherry picked from commit cbe88c6f3c47e3d7731b6ec30bfc201970b20602)

14 months agoe1000: fix VLAN 0
Kristof Provost [Wed, 10 May 2023 16:26:29 +0000 (18:26 +0200)]
e1000: fix VLAN 0

VLAN 0 essentially means "Treat as untagged, but with priority bits",
and is used by some ISPs.

On igb/em interfaces we did not receive packets with VLAN tag 0 unless
vlanhwfilter was disabled.

This can be fixed by explicitly listing VLAN 0 in the hardware VLAN
filter (VFTA). Do this from em_setup_vlan_hw_support(), where we already
(re-)write the VFTA.

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

(cherry picked from commit 0229fab2fe0eed843ebec98fd31b7d49bb2e8438)

14 months agoamd64 MINIMAL: SysV IPC syscalls are loadable
Konstantin Belousov [Sat, 6 May 2023 20:03:07 +0000 (23:03 +0300)]
amd64 MINIMAL: SysV IPC syscalls are loadable

(cherry picked from commit bf864c3ed5830785cbc4dcc8b832c14fdc7110e4)

14 months agoamd64 MINIMAL: remove UFS from compiled-in list
Konstantin Belousov [Sat, 6 May 2023 20:02:34 +0000 (23:02 +0300)]
amd64 MINIMAL: remove UFS from compiled-in list

(cherry picked from commit 0c1c5e36ebbb7e30a5e57a044a20ea2c4f7cf793)

14 months agoamd64 MINIMAL config: remove statements about UFS module
Konstantin Belousov [Sat, 6 May 2023 20:01:45 +0000 (23:01 +0300)]
amd64 MINIMAL config: remove statements about UFS module

(cherry picked from commit bba6249ae9848b97d351ce04061c06d5e8ad8f9d)

14 months agoamd64: add MINIMALUP config
Konstantin Belousov [Sat, 6 May 2023 11:22:58 +0000 (14:22 +0300)]
amd64: add MINIMALUP config

(cherry picked from commit 38843fe0f27cb93dc50a3b0d7ba9a958c0581de7)

14 months agoamd64 MINIMAL config: remove sentence about acpi
Konstantin Belousov [Sat, 6 May 2023 11:21:13 +0000 (14:21 +0300)]
amd64 MINIMAL config: remove sentence about acpi

(cherry picked from commit 3a8c69c1ff56b8f55a3ca87b1cb2513b5072a150)

14 months agonet/pfkeyv2.h: fix typo, meNber
Konstantin Belousov [Wed, 10 May 2023 23:52:39 +0000 (02:52 +0300)]
net/pfkeyv2.h: fix typo, meNber

(cherry picked from commit b6d3a9644d5c73a1903dc39f79fe306b42b86b35)

14 months agoktls.4: Mention mb_use_ext_pgs in the "sysctl nodes" section
Mark Johnston [Wed, 26 May 2021 14:20:37 +0000 (10:20 -0400)]
ktls.4: Mention mb_use_ext_pgs in the "sysctl nodes" section

Reviewed by: rmacklem, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30403

(cherry picked from commit 27130028a583273071a14a3256f8ea0a131f2dd4)

14 months agoktls.4: Remove an obsolete statement
Mark Johnston [Sat, 22 May 2021 16:12:30 +0000 (12:12 -0400)]
ktls.4: Remove an obsolete statement

The default mb_use_ext_pgs value was toggled in commit 52cd25eb1aa.

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

(cherry picked from commit c235059bb7e600b7bb88234836102fa9911addc2)

14 months agogeom.8: Fix typos and wordsmith
Mateusz Piotrowski [Tue, 9 May 2023 13:46:00 +0000 (15:46 +0200)]
geom.8: Fix typos and wordsmith

MFC after: 3 days

(cherry picked from commit 794f5122bb0c9bad1c3dfedbf373a728b6689297)

14 months agovmm: Fix casts around kmem_malloc/free() calls
Mark Johnston [Thu, 11 May 2023 15:00:53 +0000 (11:00 -0400)]
vmm: Fix casts around kmem_malloc/free() calls

This is a direct commit to stable/13.

Reported by: Jenkins

14 months agocap_net tests: Skip tests if there is no connectivity
Mark Johnston [Thu, 11 May 2023 13:31:30 +0000 (09:31 -0400)]
cap_net tests: Skip tests if there is no connectivity

When testing cap_connect() and name/addr lookup functions, skip tests if
we fail and the error is not ENOTCAPABLE.  This makes the tests amenable
to running in CI without Internet connectivity.

Reviewed by: oshogbo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39242

(cherry picked from commit 7ee4066db1295fe3660964c2561bef87da7431f8)

14 months agobuf: Dynamically allocate per-CPU buffer queues
Mark Johnston [Wed, 10 May 2023 14:05:32 +0000 (10:05 -0400)]
buf: Dynamically allocate per-CPU buffer queues

To reduce static bloat.  No functional change intended.

PR: 269572
Reviewed by: mjg, kib, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39808

(cherry picked from commit e72f7ed43eefaf305c33c232bc2c33d997427f58)

14 months agovmm: don't free unallocated memory
Corvin Köhne [Wed, 10 May 2023 13:19:25 +0000 (09:19 -0400)]
vmm: don't free unallocated memory

If vmx or svm is disabled in BIOS or the device isn't supported by vmm,
modinit won't allocate these state save areas. As kmem_free panics when
passing a NULL pointer to it, loading the vmm kernel module causes a
panic too.

PR: 271251
Reviewed by: markj
Fixes: 74ac712f72cfd6d7b3db3c9d3b72ccf2824aa183 ("vmm: Dynamically allocate a couple of per-CPU state save areas")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39974

(cherry picked from commit b10e100d1696782cfebef09b5870dfc6d1b3217b)

14 months agovmm: Dynamically allocate a couple of per-CPU state save areas
Mark Johnston [Wed, 10 May 2023 13:19:09 +0000 (09:19 -0400)]
vmm: Dynamically allocate a couple of per-CPU state save areas

This avoids bloating the BSS when MAXCPU is large.

No functional change intended.

PR: 269572
Reviewed by: corvink, rew
Tested by: rew
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39805

(cherry picked from commit 74ac712f72cfd6d7b3db3c9d3b72ccf2824aa183)

14 months agounix: Fix locking in uipc_peeraddr()
Mark Johnston [Wed, 10 May 2023 13:18:16 +0000 (09:18 -0400)]
unix: Fix locking in uipc_peeraddr()

After the locking protocol changed in commit 75a67bf3d00d ("AF_UNIX:
make unix socket locking finer grained"), uipc_peeraddr() was not
updated accordingly.

The link lock now only protects global socket lists.  The PCB lock is
used to protect the link between connected PCBs, so use that.  Remove an
old comment which appears to be noting that unp_conn is not set for
connected SOCK_DGRAM sockets (in one direction anyway).

Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39855

(cherry picked from commit e8f6e5b2d969fdf7e8f0a9a0a87eede357618fe9)

14 months agotwe: Add deprecation notice
Warner Losh [Thu, 11 May 2023 04:09:10 +0000 (22:09 -0600)]
twe: Add deprecation notice

This was flagged for removal in 14 over a year ago. Add deprecation to
man page.

MFC After: 3 days

(cherry picked from commit f710a4de92c142fddde636e3610d525bc237ff6d)

14 months agonetmap: pkt-gen: sync with upstream
Vincenzo Maffione [Wed, 26 Apr 2023 20:32:24 +0000 (20:32 +0000)]
netmap: pkt-gen: sync with upstream

Keep in sync with the recent upstream changes:

Fix compilation on 32-bit architectures
Update IP length, UDP length/checksum when size changes
Man page fixes

Submitted by: jlduran@gmail.com
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D39760

(cherry picked from commit 8c3b8c838674239538682b914bc1d7059255f116)

14 months agoRevert "uart(4): add Sunrise Point UART controllers"
Kyle Evans [Tue, 9 May 2023 06:38:32 +0000 (01:38 -0500)]
Revert "uart(4): add Sunrise Point UART controllers"

This reverts commit d1b6271118188dd25a18f2372ab1d3004335ea3c.

I've received multiple reports of machines failing to boot with
this hardware; back it out for now until we can fix it.

PR: 271147

(cherry picked from commit 20d8d9809a8c0a3ddd1d0156e77ec53a1ed95747)

14 months agoCirrus-CI: use llvm15 toolchain packages
Ed Maste [Mon, 13 Feb 2023 14:28:35 +0000 (09:28 -0500)]
Cirrus-CI: use llvm15 toolchain packages

As of commit 50d7464c3fe6 we use llvm15 as the system toolchain, and
commit eca005d8531f added compiler options incompatible with earlier
versions.  Switch to llvm15 packages.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 67fca20eb2cea55fb2eaacc22807ee4741894796)

14 months agoCirrus-CI: switch GCC job to GCC 12
Ed Maste [Fri, 27 Jan 2023 17:15:01 +0000 (12:15 -0500)]
Cirrus-CI: switch GCC job to GCC 12

We need a C++20 or later compiler.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e7f9bdb4a6fb976770c0d2bbe31d34e964dc167f)

14 months agoCirrus-CI: Switch to llvm14 toolchain package
Ed Maste [Tue, 24 May 2022 20:12:48 +0000 (16:12 -0400)]
Cirrus-CI: Switch to llvm14 toolchain package

Follow base system update to LLVM 14

Sponsored by: The FreeBSD Foundation

(cherry picked from commit daed785d6fe0a6cfdbfab92af9ee9afd7451c7aa)

14 months agovmrun.sh: mention new edk2 package
Christos Margiolis [Tue, 2 May 2023 19:19:08 +0000 (19:19 +0000)]
vmrun.sh: mention new edk2 package

uefi-edk2-bhyve no longer exists.

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

(cherry picked from commit 0ebc92bf3db1685fbcd023e42b683f4b10464095)

14 months agodtrace: Sync dis_tables.c with illumos
Mark Johnston [Tue, 21 Mar 2023 13:36:58 +0000 (09:36 -0400)]
dtrace: Sync dis_tables.c with illumos

This brings in the following commits:

    commit 584b574a3b16c6772c8204ec1d1c957c56f22a87
    12174 i86pc: variable may be used uninitialized
    Author: Toomas Soome <tsoome@me.com>
    Reviewed by: John Levon <john.levon@joyent.com>
    Reviewed by: Andrew Stormont <astormont@racktopsystems.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit a25e615d76804404e5fc63897a9196d4f92c3f5e
    12371 dis x86 EVEX prefix mishandled
    12372 dis EVEX encoding SIB mishandled
    12373 dis support for EVEX vaes instructions
    12374 dis support for EVEX vpclmulqdq instructions
    12375 dis support for gfni instructions
    Author: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

    commit c1e9bf00765d7ac9cf1986575e4489dd8710d9b1
    12369 dis WBNOINVD support
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit e4f6ce7088a7dd335b9edf4774325f888692e5fb
    10893 Need support for new Cascade Lake Instructions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Gordon Ross <gwr@nexenta.com>

    commit cff040f3ef42d16ae655969398f5a5e6e700b85e
    10226 Need support for new EPYC ISA extensions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jason King <jason.king@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit d242cdf5288b86d9070d88791c8ee696612becdc
    8492 AVX512 dis - legacy logical instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 81b505b772ab015c588c56bb116239ee549b6eee
    8384 AVX512 dis - EVEX prefix support
    8385 32-bit avx dis test mishandles EVEX prefix
    8386 32-bit bound dis is incorrect
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 92381362ae635a3bea638d87b7119f1623b6212e
    8319 dis support for new xsave instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit a4e73d5d60e566669c550027fae2b1d87b4be2b4
    8240 AVX512 dis - opmask instruction support
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

    959b2dfd39979fe8a9a315a52741d009eb168822
    7825 want avx dis tests
    7826 PCLMULQDQ psuedo-ops aren't properly described in dis
    7827 dis tests for f16c, movbe, cpuid, msr, tsc, fence instrs
    7828 sysenter and sysexit dis should be allowed in 64-bit x86
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

MFC after: 2 weeks

(cherry picked from commit 722b2e2f9aa64e6ff4dec346951bd4b56cd27a8d)

14 months agovmm: Expose some more AVX512 CPUID bits to guests
Mark Johnston [Tue, 25 Apr 2023 17:33:08 +0000 (13:33 -0400)]
vmm: Expose some more AVX512 CPUID bits to guests

This is required to announce support for some accelerated AES
operations.  AVX512BW indicates support for the AVX512-FP16 extension
and AVX512VL indicates support for the use of AVX512 instructions with
vector lengths smaller than 512 bits.

VAES and VPCLMULQDQ extensions indicate that VEX-prefixed AES-NI and
pclmulqdq instructions are supported.

All of these bits are needed for OpenSSL to use VAES to accelerate
AES-GCM transforms.

Reviewed by: corvink, kib, jhb
MFC after: 2 weeks
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39781

(cherry picked from commit 47cf1b37f42d2acb24fa3a1e6106374dddb3edbf)

14 months agohwpmc: Fix a typo
Mark Johnston [Mon, 1 May 2023 15:19:25 +0000 (11:19 -0400)]
hwpmc: Fix a typo

MFC after: 1 week

(cherry picked from commit 56da525b535f8537205bccd1f4b25b3ce354ca62)

14 months agofbt: get rid of redundant defines
Christos Margiolis [Mon, 1 May 2023 15:20:34 +0000 (15:20 +0000)]
fbt: get rid of redundant defines

No functional change intended.

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

(cherry picked from commit aad1685066fc2430d6ee9b3025369ba6bd513333)

14 months agofsck_ffs: fix the previous change that skipped pass 5 in some cases
Chuck Silvers [Wed, 3 May 2023 20:21:19 +0000 (13:21 -0700)]
fsck_ffs: fix the previous change that skipped pass 5 in some cases

The previous change involved calling check_cgmagic() twice in a row
for the same CG in order to differentiate when the CG was already ok vs.
when the CG was rebuilt, but that doesn't work because the second call
(which was supposed to rebuild the CG) returns 0 (indicating that
the CG was not rebuilt) due to the prevfailcg check causing an early
failure return.  Fix this by moving the rebuild part of check_cgmagic()
out into a separate function which is called by pass1() when it wants to
rebuild a CG.

Fixes: da86e7a20dc4a4b17e8d9e7630ed9b675cf71702
Reported by: pho
Discussed with: mckusick
Sponsored by: Netflix

(cherry picked from commit 406475581246360faa7af9891dc8ad2423284e18)

14 months agontpd: Support IPv6-only hosts
Mina Galic [Fri, 5 May 2023 04:33:18 +0000 (21:33 -0700)]
ntpd: Support IPv6-only hosts

0.pool.* returns only IPv4 addresses.
2.pool.* returns both, IPv6 and IPv4 addresses.

conservatively extend our IPv4 only pool configuration by adding a
second pool, which also returns IPv6 addresses.

PR: 270536
Reported by: Lapo Luchini <lapo@lapo.it>
Pull Request: https://github.com/freebsd/freebsd-src/pull/731
Differential Revision: https://reviews.freebsd.org/D39954

(cherry picked from commit fff1551c0357cc43f6138fecfad1d79d8d8baa15)

14 months agoApply libc++ fix for compiling <type_traits> with gcc 13
Dimitry Andric [Fri, 5 May 2023 16:19:40 +0000 (18:19 +0200)]
Apply libc++ fix for compiling <type_traits> with gcc 13

Merge commit 484e64f7e7b2 from llvm-project (by Roland McGrath):

  [libc++] Use __is_convertible built-in when available

  https://github.com/llvm/llvm-project/issues/62396 reports that
  GCC 13 barfs on parsing <type_traits> because of the declarations
  of `struct __is_convertible`.  In GCC 13, `__is_convertible` is a
  built-in, but `__is_convertible_to` is not.  Clang has both, so
  using either should be fine.

  Reviewed By: #libc, philnik

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

Reported by: Mark Millard <marklmi@yahoo.com>
MFC after: 3 days

(cherry picked from commit 2df58f190731634be67e90b7c453dee587b4ea27)

14 months agoriscv: remove unused string from swtch.S
Mitchell Horne [Mon, 23 Jan 2023 17:11:16 +0000 (13:11 -0400)]
riscv: remove unused string from swtch.S

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f5d39047b094d5164b85ae7e2a6a9a8342269815)

14 months agovmm: fix HLT loop while vcpu has requested virtual interrupts
Vitaliy Gusev [Wed, 26 Apr 2023 08:17:50 +0000 (10:17 +0200)]
vmm: fix HLT loop while vcpu has requested virtual interrupts

This fixes the detection of pending interrupts when pirval is 0 and the
pending bit is set

More information how this situation occurs, can be found here:
https://github.com/freebsd/freebsd-src/blob/c5b5f2d8086f540fefe4826da013dd31d4e45fe8/sys/amd64/vmm/intel/vmx.c#L4016-L4031

Reviewed by: corvink, markj
Fixes: 02cc877968bbcd57695035c67114a67427f54549 ("Recognize a pending virtual interrupt while emulating the halt instruction.")
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D39620

(cherry picked from commit 0912408a281f203c43d0b3f73c38117336588342)

14 months agobhyve: pass E820 table to guest
Corvin Köhne [Thu, 9 Sep 2021 09:37:04 +0000 (11:37 +0200)]
bhyve: pass E820 table to guest

E820 table will be used to report valid RAM ranges and reserve special
memory areas like graphics memory for GPU passthrough.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39550

(cherry picked from commit 16f23f75432915e64a34357e7d5f26bca82f8219)

14 months agobhyve: add E820 dump function
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add E820 dump function

For debugging purposes it is helpful to dump the E820 table.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39549

(cherry picked from commit a8a8e9af574c63fbecf4719e3bf184795dc98c51)

14 months agobhyve: add allocation function to E820
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add allocation function to E820

This function makes it easy to allocate new E820 entries. It will be
used to allocate graphics memory for Intel integrated graphic devices.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39547

(cherry picked from commit 5597f564870e94d56111dec638b8859423c936a9)

14 months agobhyve: add common memory holes to E820 table
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add common memory holes to E820 table

The VGA and the ROM memory ranges can't be used as system memory. For
that reason, remove them from the E820 table.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39546

(cherry picked from commit 059af92a300f76653048c042559f7d7d8fd8f99c)

14 months agobhyve: add basic E820 implementation
Corvin Köhne [Thu, 9 Sep 2021 09:37:03 +0000 (11:37 +0200)]
bhyve: add basic E820 implementation

There are some use cases where bhyve has to prepare some special memory
regions. E.g. GPU passthrough for Intel integrated graphic devices needs
to reserve some memory for the graphic device. So, bhyve has to inform
the guest about those memory regions. This information can be passed by
the qemu fwcfg interface. As qemu creates an E820 table, we can reuse
the existing fwcfg item "etc/e820".

This commit is the first one of a series. It only adds a basic
implementation for the creation of the E820 table. Some subsequent
commits will add more items to the E820 table and register it as fwcfg
item.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39545

(cherry picked from commit 9180daa1e34577aaccf3ff64cc63a5179c4f09d8)

14 months agobhyve: make use of qemus acpi table loader
Corvin Köhne [Wed, 6 Apr 2022 09:10:37 +0000 (11:10 +0200)]
bhyve: make use of qemus acpi table loader

Add all acpi tables to qemus acpi table loader. This passes the acpi
tables by fwcfg to the guest.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38439

(cherry picked from commit 7959d80d99ae06ba06cbe7a206ef9bc513e4109b)

14 months agobhyve: add helper struct for qemus acpi table loader
Corvin Köhne [Wed, 6 Apr 2022 09:10:36 +0000 (11:10 +0200)]
bhyve: add helper struct for qemus acpi table loader

The hypervisor is aware of all system properties. For the guest bios
it's hard and complex to detect all system properties. For that reason,
it would be better if the hypervisor creates acpi tables instead of the
guest. Therefore, the hypervisor has to send the acpi tables to the
guest. At the moment, bhyve just copies the acpi tables into the guest
memory. This approach has some restrictions. You have to keep sure that
the guest doesn't overwrite them accidentally. Additionally, the size of
acpi tables is limited.

Providing a plain copy of all acpi tables by fwcfg isn't possible. Acpi
tables have to point to each other. So, if the guest copies the acpi
tables into memory by it's own, it has to patch the tables. Due to
different layouts for different acpi tables, there's no generic way to
do that.  For that reason, qemu created a table loader interface. It
contains commands for the guest for loading specific blobs into guest
memory and patching those blobs.

This commit adds a qemu_loader class which handles the creation of qemu
loader commands. At the moment, the WRITE_POINTER command isn't
implement. It won't be required by bhyve's acpi table generation yet.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38438

(cherry picked from commit f565b4d6303f4798a2cb0dc51ef88de9e4a24047)

14 months agoObsoleteFiles: Complete 20201025: Remove cal data files
Li-Wen Hsu [Thu, 4 May 2023 04:28:52 +0000 (12:28 +0800)]
ObsoleteFiles: Complete 20201025: Remove cal data files

Fixes: d20d6550187a calendar: remove all datafiles except freebsd one
MFC after: 3 days

(cherry picked from commit 5282ada06bbc6727b467d6f6530fa19114143c61)

14 months agoshare/mk/bsd.cpu.mk: add AltiVec / VSX to powerpc*'s MACHINE_CPU
Piotr Kubaj [Fri, 5 May 2023 14:19:19 +0000 (16:19 +0200)]
share/mk/bsd.cpu.mk: add AltiVec / VSX to powerpc*'s MACHINE_CPU

MFC after: 3 days
Approved by: jhibbits
Differential revision: https://reviews.freebsd.org/D39240

(cherry picked from commit 448045e4a7873f4733cebda56df002acabb2aef1)

14 months agotests: Add ATF_REQUIRE_SYSCTL_BOOL
Mark Johnston [Tue, 25 Apr 2023 13:54:23 +0000 (09:54 -0400)]
tests: Add ATF_REQUIRE_SYSCTL_BOOL

Modify a capability mode test to use it for kern.trap_enotcap, to avoid
false positives.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8a271827e7b5d5310e06df1f9f49ba0ef9efd263)

14 months agoriscv: Implement bus_describe_intr() for nexus
Mark Johnston [Sun, 23 Apr 2023 17:31:01 +0000 (13:31 -0400)]
riscv: Implement bus_describe_intr() for nexus

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39750

(cherry picked from commit ff13b924751489efed1c6a42dbca8f236902d6fb)

14 months agoarm64: Implement bus_describe_intr() for nexus
Mark Johnston [Sun, 23 Apr 2023 17:30:44 +0000 (13:30 -0400)]
arm64: Implement bus_describe_intr() for nexus

Prompted by a compiler warning introduced by
e582d4a2b09e ("arm64: nexus code tidy-up").

Reviewed by: mhorne, andrew
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39749

(cherry picked from commit 7623cc8f65ab1b28690d4a6580ae87b7926ed008)

14 months agoriscv: Compile instr_size.c into the kernel when DTrace is configured
Mark Johnston [Fri, 21 Apr 2023 13:26:17 +0000 (09:26 -0400)]
riscv: Compile instr_size.c into the kernel when DTrace is configured

Reported by: Jenkins
Fixes: 080e56a6c98c ("dtrace: expose dtrace_instr_size() to userland and implement it for riscv")

(cherry picked from commit 92fa22c6a5c41303e3ad98096c9ebe8202418d81)

14 months agodtrace: add register bindings for RISC-V
Christos Margiolis [Thu, 20 Apr 2023 16:25:37 +0000 (16:25 +0000)]
dtrace: add register bindings for RISC-V

Reviewed by: mhorne, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39611

(cherry picked from commit 1fef7abdc76bd6f0c93775bd0c1b62b523abd20d)

14 months agodtrace: use dtrace_instr_size() in the riscv dtrace_subr.c
Christos Margiolis [Thu, 20 Apr 2023 16:24:03 +0000 (16:24 +0000)]
dtrace: use dtrace_instr_size() in the riscv dtrace_subr.c

No functional change intended.

Reviewed by: mhorne, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39652

(cherry picked from commit 75081b9ed8e67c8443551828f1b5ccf3d449b41b)

14 months agodtrace: expose dtrace_instr_size() to userland and implement it for riscv
Christos Margiolis [Thu, 20 Apr 2023 16:21:46 +0000 (16:21 +0000)]
dtrace: expose dtrace_instr_size() to userland and implement it for riscv

dtrace_instr_size() is needed by the forthcoming RISC-V port of kinst,
as well as by libdtrace in D38825 for both amd64 and RISC-V.

Reviewed by: markj, mhorne
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39489

(cherry picked from commit 080e56a6c98c7e7a241a4260d4c19d3cad5b22af)

14 months agodtrace: get rid of uchar_t types
Christos Margiolis [Thu, 20 Apr 2023 16:19:42 +0000 (16:19 +0000)]
dtrace: get rid of uchar_t types

Callers are specifying uint8_t anyway and this slightly reduces
dependencies on compatibility typedefs.  No functional change intended.

Reviewed by: markj, mhorne
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39490

(cherry picked from commit 1a149d65baed31b90a0b8abe2d6c5a568122a5ec)

14 months agosrc.conf: add WITH_TOOLCHAIN description
Ed Maste [Tue, 2 May 2023 17:27:18 +0000 (13:27 -0400)]
src.conf: add WITH_TOOLCHAIN description

It is not used by the in-tree default configuration, but adding it
allows downstream projects with different defaults to make use of
Cirrus-CI (as the makeman test added in 85e8c2a03490 requires that
there are no missing option descriptions).

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39936

(cherry picked from commit fc2e2c950d97166ab32ca24134a37986ccaf94ab)

14 months agorelease: Report disk image filename
Ed Maste [Mon, 16 May 2022 18:37:21 +0000 (14:37 -0400)]
release: Report disk image filename

For someone new to the release bits it's not always clear what files are
being created. Report the disk image name explicitly.

Reviewed by: gjb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39953

(cherry picked from commit 4194bbb34c60a5bf0fd0ba28f7bfa20b7842ba3f)

14 months agorenice: Avoid segfault if -n flag is given without argument.
Dag-Erling Smørgrav [Mon, 17 Apr 2023 19:49:13 +0000 (19:49 +0000)]
renice: Avoid segfault if -n flag is given without argument.

Fixes: 65ee0a8495538
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39623

(cherry picked from commit b03311cadd3a6f931e176f97b97bd72be3ef96d4)

renice: Clean up the tests.

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

(cherry picked from commit d59dd30cf19bb6df5635b3c896c7c4262917a9b6)

renice: Factor out common code in tests.

Furthermore, prefer test -eq (which ignores whitespace) over a strict string equality test when comparing numerical values.

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

(cherry picked from commit 1bc6dcc287fa80af74768c4e2b2a1d7511ba1729)

14 months agoIntel DMAR: remove parsing of 6-level paging capability
Jason A. Harmening [Mon, 1 May 2023 16:22:39 +0000 (11:22 -0500)]
Intel DMAR: remove parsing of 6-level paging capability

Early versions of the VT-d spec mentioned 6-level paging support as a
possible value for the SAGAW capability, but later versions removed it
and SAGAW=0x10 is currently listed as a reserved value.

The 6-level (agaw=64) entry in sagaw_bits is furthermore problematic
with clang15 because the attempted comparison against 1ULL << 64 in
dmar_maxaddr2mgaw() causes the compiler to elide the last iteration
of the initial loop, which bypasses the subsequent logic to find the
greatest HW-supported address width.  This results in 5-level paging
always being selected regardless of whether the hardware supports it,
which can result address translation failure due to invalid context-
entry programming.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39896

(cherry picked from commit 6f378116e9bf982b8246d033d81cb64d52b24462)

14 months agoauthpf: do not sprintf to a null pointer
Ed Maste [Wed, 3 May 2023 13:26:42 +0000 (09:26 -0400)]
authpf: do not sprintf to a null pointer

The fgetln loop will terminate with buf = NULL at EOF.

Reported by: GCC
Reviewed by: kp
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39947

(cherry picked from commit 81f964e2ffb7cd5d30df0a5c3877900cca4fdd07)

14 months agovfs: Rename vfs_emptydir() to vn_dir_check_empty()
Olivier Certner [Fri, 28 Apr 2023 09:00:11 +0000 (11:00 +0200)]
vfs: Rename vfs_emptydir() to vn_dir_check_empty()

(cherry picked from commit 2544b8e00ca1afea64b00a6ddaf7b584244ade90)

14 months agovfs: vn_dir_next_dirent(): Adapt comments to style(9)
Olivier Certner [Fri, 28 Apr 2023 09:04:16 +0000 (11:04 +0200)]
vfs: vn_dir_next_dirent(): Adapt comments to style(9)

(cherry picked from commit c21d87a88c72804bc4fb86d7b0e8a846230e4ad0)

14 months agovfs: Fix "emptydir" mount option
Olivier Certner [Sat, 22 Apr 2023 16:07:07 +0000 (18:07 +0200)]
vfs: Fix "emptydir" mount option

PR: 270988

(cherry picked from commit 6450e7bbad0c68176f28b51773a3af5d6022c7dd)

14 months agovfs: vn_dir_next_dirent(): Simplify interface and harden
Olivier Certner [Mon, 24 Apr 2023 08:25:15 +0000 (10:25 +0200)]
vfs: vn_dir_next_dirent(): Simplify interface and harden

(cherry picked from commit 3d8450db4c603d18aa45422159170e133c95214d)

14 months agovfs: Export get_next_dirent() as vn_dir_next_dirent()
Olivier Certner [Sun, 23 Apr 2023 07:47:58 +0000 (09:47 +0200)]
vfs: Export get_next_dirent() as vn_dir_next_dirent()

(cherry picked from commit 6bce3f23d0aa045d61c0ec8d27100eb186a33375)

14 months agojedec_dimm(4): Refactor offset adjustment and page0 reset
Ravi Pokala [Thu, 27 Apr 2023 05:03:48 +0000 (22:03 -0700)]
jedec_dimm(4): Refactor offset adjustment and page0 reset

Offsets greater than 255 bytes reside on page1 of the SPD device.
Accessing them requires switching to page1, and adjusting the absolute
offset to be relative to the start of page1. After the access, the page
must be set back to page0. These operations are performed in several
places, so break them out into their own functions.

Also, replace a pair of default cases, which should be impossible due to
earlier checks, with __assert_unreachable().

Reviewed by: imp
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D39842

(cherry picked from commit 15d69c840d860a8c0decb063f768ad695427a0d4)

14 months agojedec_dimm(4): Add manufacturing year and week.
Ravi Pokala [Tue, 25 Apr 2023 06:07:39 +0000 (23:07 -0700)]
jedec_dimm(4): Add manufacturing year and week.

DDR3 and DDR4 encode the week and year that the DIMM was manufactured,
as a pair of two-digit binary-coded decimal values. Read the values, and
report them as (uint8_t)s.

Reviewed by: imp, jhb
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D39795

(cherry picked from commit de57e0ef5a15c75231191e643d4d1949ddbca92d)

14 months agopkgbase: hide duplicate METALOG directory warnings under verbose
Ed Maste [Mon, 1 May 2023 17:25:18 +0000 (13:25 -0400)]
pkgbase: hide duplicate METALOG directory warnings under verbose

Creating directories multiple times is an inherent side effect of the
way installation is done.  Hide warnings from duplicate directory
entries (with identical metadata) under metalog_reader's verbose mode.

Duplicate file entries are always reported.  They currently generate
warnings but will be switched to errors once the few instances currently
in the tree are fixed.

PR: 244596, 271178
Reviewed by: kevans
Sponsored By: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39898

(cherry picked from commit 2a3bd0870869819354b5ea65761d13e5e2987697)

14 months agoCirrus-CI: set PKG_FORMAT via top level `env:`
Ed Maste [Mon, 1 May 2023 16:45:36 +0000 (12:45 -0400)]
Cirrus-CI: set PKG_FORMAT via top level `env:`

This ensures consistency among different CI scripts, including future
ones for pkgbase work.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 75baf3765c686547e8e4a5510858f45c23ccdec3)

14 months agologger(1): MFC: fix timestamps in case of long run
Eugene Grosbein [Thu, 27 Apr 2023 16:43:16 +0000 (23:43 +0700)]
logger(1): MFC: fix timestamps in case of long run

An example:

( echo test; sleep 2; echo test2 ) | logger -h /var/run/log

Before fix, logger assigned same timestamp to both records.

Fixes: 65547fb33db901a9f352aacb0ed45ce68b0bd275
Reported by: Vadim Goncharov

(cherry picked from commit 83fd35b3f3fa580d2b99874abd1f67ee61dcb659)

14 months agoCirrus-CI: update stable/13 CI image to 13.1
Ed Maste [Wed, 3 May 2023 20:31:22 +0000 (16:31 -0400)]
Cirrus-CI: update stable/13 CI image to 13.1

We want to ensure that stable/13 still builds on the oldest supported
13.x release, so not updating directly to 13.2.

Sponsored by: The FreeBSD Foundation

14 months agoboolean_t: change to unsigned int to avoid signed bitfield warnings
Dimitry Andric [Tue, 25 Apr 2023 17:52:40 +0000 (19:52 +0200)]
boolean_t: change to unsigned int to avoid signed bitfield warnings

This is the final part, which actually makes boolean_t unsigned. Note
that we do not change its size, nor do we try to change it directly to
bool, since that results in a lot of regressions.

Converting the remaining instances of boolean_t to plain C99 bool can
now be done in a piecemeal fashion, after which boolean_t may hopefully
be retired.

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

(cherry picked from commit 3029b0b0e9d68eb54e3bdd9e3e49e0f0d2d57835)

14 months agovm: fix a number of functions to match the expected prototypes
Dimitry Andric [Tue, 25 Apr 2023 17:52:26 +0000 (19:52 +0200)]
vm: fix a number of functions to match the expected prototypes

Noticed while attempting to make boolean_t unsigned: some vm-related
function declarations and defintions were using boolean_t where they
should have used int, and vice versa.

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

(cherry picked from commit f74be55e3045793a507d98127faf9aabd918e1ce)

14 months agozfs: make zfs_vfs_held() definition consistent with declaration
Dimitry Andric [Tue, 25 Apr 2023 17:43:48 +0000 (19:43 +0200)]
zfs: make zfs_vfs_held() definition consistent with declaration

Noticed while attempting to change boolean_t into an actual bool: in
include/sys/zfs_ioctl_impl.h, zfs_vfs_held() is declared to return a
boolean_t, but in module/os/freebsd/zfs/zfs_ioctl_os.c it is defined to
return an int. Make the definition match the declaration.

Obtained from: https://github.com/openzfs/zfs/commit/62cc9d4f6
Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39753

(cherry picked from commit 64b5d74fffc8882d915e6e8de7e5fc893c606213)

14 months agoApply clang fix for assertion building emulators/rpcs3
Dimitry Andric [Fri, 28 Apr 2023 14:08:42 +0000 (16:08 +0200)]
Apply clang fix for assertion building emulators/rpcs3

Merge commit a5e1a93ea10f from llvm-project (by Mariya Podchishchaeva):

  [clang] Fix crash when handling nested immediate invocations

  Before this patch it was expected that if there was several immediate
  invocations they all belong to the same expression evaluation context.
  During parsing of non local variable initializer a new evaluation context is
  pushed, so code like this
  ```
  namespace scope {
  struct channel {
      consteval channel(const char* name) noexcept { }
  };
  consteval const char* make_channel_name(const char* name) { return name;}

  channel rsx_log(make_channel_name("rsx_log"));
  }
  ```
  produced a nested immediate invocation whose subexpressions are attached
  to different expression evaluation contexts. The constructor call
  belongs to TU context and `make_channel_name` call to context of
  variable initializer.

  This patch removes this assumption and adds tracking of previously
  failed immediate invocations, so it is possible when handling an
  immediate invocation th check that its subexpressions from possibly another
  evaluation context contains errors and not produce duplicate
  diagnostics.

  Fixes https://github.com/llvm/llvm-project/issues/58207

  Reviewed By: aaron.ballman, shafik

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

PR: 269489
MFC after: 3 days

(cherry picked from commit 56f2446575c78d962b6dda5e3310bec078622f3d)

14 months agosys: Retire OPENZFS_CWARNFLAGS now that it is empty.
John Baldwin [Wed, 22 Mar 2023 19:35:30 +0000 (12:35 -0700)]
sys: Retire OPENZFS_CWARNFLAGS now that it is empty.

Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D39217

(cherry picked from commit dddb1aec4d54ba949201f4a2e3146cfab4a5870f)

14 months agoFix spelling of NO_WINFINITE_RECURSION.
John Baldwin [Wed, 21 Dec 2022 22:45:29 +0000 (14:45 -0800)]
Fix spelling of NO_WINFINITE_RECURSION.

Reported by: dim
Fixes: 2e08e4b75ea1 zfs: Fix build with GCC 12.

(cherry picked from commit 3266131908914b3a359571dae75194fe6d330c1d)

14 months agozfs: Fix build with GCC 12.
John Baldwin [Wed, 21 Dec 2022 18:49:23 +0000 (10:49 -0800)]
zfs: Fix build with GCC 12.

Silence -Winfinite-recursion for ldo.c in lua and -Wstringop-overread
for nvpair.c.

Reviewed by: mm
Differential Revision: https://reviews.freebsd.org/D37631

(cherry picked from commit 2e08e4b75ea1080c224a33baf62199d893dc322d)

14 months agoatp: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:33:56 +0000 (12:33 -0800)]
atp: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37552

(cherry picked from commit 4eda35b6360762b4a256c33321a917d4b3a5d625)

14 months agoif_rsu: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:33:41 +0000 (12:33 -0800)]
if_rsu: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37551

(cherry picked from commit 183783d34a6b453137f39eac8a7b42b338c9af60)

14 months agortwn: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:33:21 +0000 (12:33 -0800)]
rtwn: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37550

(cherry picked from commit 8bc615f5919f027cdf09825764276ab41a38375e)

14 months agoipfilter: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:32:38 +0000 (12:32 -0800)]
ipfilter: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, cy, emaste
Differential Revision: https://reviews.freebsd.org/D37548

(cherry picked from commit 415ccf51122eab7b55978a1db00b484a06ffc84b)

14 months agoaesni: Remove misleading array bounds for aesni_decryt_ecb.
John Baldwin [Wed, 7 Dec 2022 20:32:19 +0000 (12:32 -0800)]
aesni: Remove misleading array bounds for aesni_decryt_ecb.

All the other functions used pointers for from/to instead of
fixed-size array parameters.  More importantly, this function can
accept pointers to buffers of multiple blocks, not just a single
block.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37547

(cherry picked from commit d256a06fe8bda8120a3e22434c53fdef076001d3)

14 months agomlx5: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:32:54 +0000 (12:32 -0800)]
mlx5: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: hselasky, imp, emaste (earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37549

(cherry picked from commit 47cc457bd6c16352b47d3fb1288f745482a082af)

14 months agonet80211: Fix mismatches in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:53 +0000 (12:31 -0800)]
net80211: Fix mismatches in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D37546

(cherry picked from commit 1f078120955947c85c54a8c088782ea5e4451eb5)

14 months agosys: Stop enabling -Wnested-externs.
John Baldwin [Wed, 22 Mar 2023 19:35:09 +0000 (12:35 -0700)]
sys: Stop enabling -Wnested-externs.

clang doesn't implement this warning, so violations are only caught by
GCC.  It is also no longer a common practice to use this as it was in
the original BSD code, so the need for the warning is not as important
as when it was used to do cleanups 20 years ago.  A recent commit
(c3179891f897d840f578a5139839fcacb587c96d) triggers this warning on
GCC, but that commit uses nested externs purposefully.

Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D39214

(cherry picked from commit 4ffeb3b88ed228e72e13abe1be888c77c6ede95d)

14 months agoocs: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:33 +0000 (12:31 -0800)]
ocs: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37545

(cherry picked from commit fb4a86164dc5ded5b42b7511d3bf48ae11ec891e)

14 months agoocs: Remove unused variable.
John Baldwin [Fri, 8 Apr 2022 00:01:27 +0000 (17:01 -0700)]
ocs: Remove unused variable.

(cherry picked from commit afda855350685d994f3fa5702079ce782563ee8f)

14 months agomalo: Fix mismatch in array bounds.
John Baldwin [Wed, 7 Dec 2022 20:31:16 +0000 (12:31 -0800)]
malo: Fix mismatch in array bounds.

Reported by: GCC -Warray-parameter
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37544

(cherry picked from commit 8b45e0c180114e1059767d0920ad6e6bfdeb37ce)