]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 months agostand/efi/eficom: Free comc_port if we can't find the serial port
Warner Losh [Wed, 24 May 2023 22:34:51 +0000 (16:34 -0600)]
stand/efi/eficom: Free comc_port if we can't find the serial port

If we can't find the serial port, free comc_port and return early. The
serial port just isn't there.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40223

13 months agostand/efi/eficom: Make aarch64 compat code probe correctly
Warner Losh [Wed, 24 May 2023 22:34:44 +0000 (16:34 -0600)]
stand/efi/eficom: Make aarch64 compat code probe correctly

Make the compat code more correct by probing using the eficom console
structure, not the comconsole one.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40222

13 months agostand/efi/eficom: Don't allow this for !HYPERV machines
Warner Losh [Wed, 24 May 2023 22:34:37 +0000 (16:34 -0600)]
stand/efi/eficom: Don't allow this for !HYPERV machines

If the machine isn't hyperv on amd64, then this driver fails the probe
and will do nothing further now, even if explicitly listed in a config.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40221

13 months agostand/efi/eficom: better handling of absent device
Warner Losh [Wed, 24 May 2023 22:34:31 +0000 (16:34 -0600)]
stand/efi/eficom: better handling of absent device

Don't even have a comc_port when the port doesn't exist: always free it
if we probe that it's not there. Also, when it's not present, clear the
flags indicating presence to avoid disturbing other flags.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D40220

13 months agostand/efi/smbios: Move detection of smbios earlier.
Warner Losh [Wed, 24 May 2023 22:34:21 +0000 (16:34 -0600)]
stand/efi/smbios: Move detection of smbios earlier.

It would be nice to make decisions early in boot, about maybe consoles,
based on smbios variables. Set them just after we setup the archsw so we
can use them everywhere.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D40219

13 months agobectl.8: update /home
Mike Karels [Thu, 25 May 2023 03:08:39 +0000 (22:08 -0500)]
bectl.8: update /home

The default location for home directories is moving from /usr/home
to /home, including the default zfs datasets.  Update accordingly.
Add zroot/usr/src as replacement example of nested datasets.

While here, mark zroot/var as "canmount off" as per current setup.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40206

13 months agoldns: specify OpenSSL 1.1 APIs
Pierre Pronchery [Sat, 13 May 2023 02:38:18 +0000 (19:38 -0700)]
ldns: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future ldns update should migrate to use the OpenSSL 3.0 APIs.

This is a recommit of c6750ddec917 after the ldns update in
5afab0e5e56f.

PR: 271615
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40082

13 months agotcpdump: specify OpenSSL 1.1 APIs
Pierre Pronchery [Tue, 9 May 2023 13:04:45 +0000 (15:04 +0200)]
tcpdump: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agoice(4): Update to 1.37.11-k
Eric Joyner [Wed, 24 May 2023 23:38:02 +0000 (16:38 -0700)]
ice(4): Update to 1.37.11-k

This driver update has no corresponding ice_ddp update, and doesn't
contain very many functional changes:
- Some refactoring for future SR-IOV PF support
- Various minor fixes

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D39821

13 months agoixgbe: Change if condition for RSS and rxcsum
Przemyslaw Lewandowski [Wed, 24 May 2023 23:24:54 +0000 (16:24 -0700)]
ixgbe: Change if condition for RSS and rxcsum

This patch fixes TCP connection hangs for 1 rxq and 1 txq without rxcsum
enabled. Documentation for 10G cards and other drivers suggest enabling
rxcsum for RSS and disabling otherwise. When PCSD bit is not set then
fragment checksum and IP identification are reported in the rx
descriptor. When PCSD bit is set then RSS hash value is reported in the
rx descriptor. RSS and RX IPP checksum are mutually exclusive.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
PR: 268910
Reviewed by: erj@
Tested by: jeffrey.e.pieper@intel.com
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D38621

13 months agodelete-old: add two files left behind in certs/blacklisted
Peter Wemm [Wed, 24 May 2023 19:46:51 +0000 (12:46 -0700)]
delete-old: add two files left behind in certs/blacklisted

The untrusted certs directory was renamed a while ago and these
files were moved to the new location.  Various upgrade paths cause
these files to be missed and prevent deletion of the directory.

13 months agoppp: specify OpenSSL 1.1 APIs
Pierre Pronchery [Tue, 9 May 2023 13:01:40 +0000 (15:01 +0200)]
ppp: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agolibtelnet: specify OpenSSL 1.1 APIs
Ed Maste [Wed, 24 May 2023 18:14:28 +0000 (14:14 -0400)]
libtelnet: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs, or just
remove libtelnet.

PR: 271615
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agorelease/oci.conf: add missing vm_extra_pre_umount() steps
Ed Maste [Wed, 24 May 2023 15:45:29 +0000 (11:45 -0400)]
release/oci.conf: add missing vm_extra_pre_umount() steps

vm.subr's default vm_extra_pre_umount removes /qemu and
/etc/resolv.conf.  When vm_extra_pre_umount is overridden these steps
need to be performed in the cloud-specific conf file.

PR: 271602
Reviewed by: dch, lwhsu
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40257

13 months agoif_ovpn: atomic_set -> atomic_store
Kristof Provost [Wed, 24 May 2023 16:27:53 +0000 (18:27 +0200)]
if_ovpn: atomic_set -> atomic_store

The intent is to set the value to UINT32_MAX, not to |= UINT32_MAX.
Happily the intent (ensure that we do not send further packets) is
achieved either way.

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

13 months agoarm64: Print the spinlock count on panic
Andrew Turner [Wed, 24 May 2023 14:40:30 +0000 (15:40 +0100)]
arm64: Print the spinlock count on panic

When the spinlock count is non-zero while taking a data abort we panic.
Print this count to help debugging.

Sponsored by: Arm Ltd

13 months agoPrint registers on an arm64 spinlock data abort
Andrew Turner [Tue, 23 May 2023 09:21:39 +0000 (10:21 +0100)]
Print registers on an arm64 spinlock data abort

When checking if the spinlock count is correct in a data abort we can
panic without printing the registers. These are useful to debug the
abort, e.g. by giving the fault address register.

Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D40228

13 months agoDon't print leading 0's in the arm64 esr
Andrew Turner [Tue, 16 May 2023 09:42:45 +0000 (10:42 +0100)]
Don't print leading 0's in the arm64 esr

We don't print leading zeros for other registers, so do the same with
ESR_EL1.

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

13 months agoarm64: Remove CNTHCTL_EL2 from arm64.h
Andrew Turner [Wed, 24 May 2023 14:22:41 +0000 (15:22 +0100)]
arm64: Remove CNTHCTL_EL2 from arm64.h

It is also in hypervisor.h where it belongs.

Sponsored by: Arm Ltd

13 months agoldns: Upgrade to 1.8.3.
Dag-Erling Smørgrav [Wed, 24 May 2023 15:50:18 +0000 (15:50 +0000)]
ldns: Upgrade to 1.8.3.

Merge commit 'cf3e3d5bd0a1fae39c74c7db5a4e8b10732d0766'

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

13 months agoifconfig: fix interface address ordering with Netlink.
Alexander V. Chernikov [Wed, 24 May 2023 15:34:21 +0000 (15:34 +0000)]
ifconfig: fix interface address ordering with Netlink.

13 months agoRELNOTES: add note about moving /usr/home to /home
Mike Karels [Wed, 24 May 2023 12:03:35 +0000 (07:03 -0500)]
RELNOTES: add note about moving /usr/home to /home

Document change to pw and hence bsdinstall.

13 months agomksnap_ffs.8: update /home examples
Mike Karels [Wed, 24 May 2023 15:31:50 +0000 (10:31 -0500)]
mksnap_ffs.8: update /home examples

The default location for home directories is moving from /usr/home
to /home.  Update the examples accordingly.

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

13 months agocpuset: increase userland maximum size to 1024
Ed Maste [Tue, 2 May 2023 20:57:12 +0000 (16:57 -0400)]
cpuset: increase userland maximum size to 1024

Hardware with more than 256 CPU cores is now available and will become
increasingly common.  Bump CPU_MAXSIZE (used for userland cpuset_t
sizing) to 1024 to define the ABI for FreeBSD 14.

This change is reapplied after a change to decouple cpuset from bhyve:
commit e17eca327633 ("vmm: Avoid embedding cpuset_t ioctl ABIs").

PR: 269572, 271213 [exp-run]
Reviewed by: mjg, jhb
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39941

(cherry picked from commit 76887e84be975698b14699d7d0dfb157d73e9990)

13 months agotcp: request tracking is not http specific.
Randall Stewart [Wed, 24 May 2023 10:35:36 +0000 (06:35 -0400)]
tcp: request tracking is not http specific.

This change is a name change only. TCP Request tracking can track sendfile and even non-sendfile requests. The
names however in the current code use http, and they should not. The feature is not http specific. Lets change the
name so they more properly reflect whats going on. This also fixes conflicts with http_req which caused application pain.

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

13 months agoofw_cpu: quiet secondary CPU devices
Mitchell Horne [Wed, 24 May 2023 13:27:55 +0000 (10:27 -0300)]
ofw_cpu: quiet secondary CPU devices

We already do plenty to announce the different CPUs in dmesg. Follow the
ACPI CPU strategy of reporting the first CPU device, but quieting the
rest for non-verbose boot. This cuts down slightly on dmesg output.

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

13 months agoofw_cpu: whitespace cleanup
Mitchell Horne [Wed, 24 May 2023 13:27:34 +0000 (10:27 -0300)]
ofw_cpu: whitespace cleanup

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

13 months agobhyvectl: Update usage of vm_run()
Mark Johnston [Wed, 24 May 2023 12:17:49 +0000 (08:17 -0400)]
bhyvectl: Update usage of vm_run()

Fixes: e17eca327633 ("vmm: Avoid embedding cpuset_t ioctl ABIs")

13 months agoExport arm64 VFP handling functions
Andrew Turner [Tue, 16 May 2023 10:08:03 +0000 (11:08 +0100)]
Export arm64 VFP handling functions

These will be used by bhyve to manage the host VFP registers, e.g.
saving the host state before entering a guest.

Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D40130

13 months agoAdd more arm64 special registers
Andrew Turner [Thu, 4 May 2023 10:30:57 +0000 (11:30 +0100)]
Add more arm64 special registers

These will be used by bhyve

Reviewed by: markj
Sponsored by: Arm Ltd
Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40128

13 months agoarm64 pmap: introduce PHYS_TO_PTE macro
Zachary Leaf [Wed, 26 Apr 2023 11:10:00 +0000 (12:10 +0100)]
arm64 pmap: introduce PHYS_TO_PTE macro

Introduce macro for PHYS_TO_PTE, setting the groundwork for future
support of various Arm VMSA extensions.

For extensions such as 52-bit VA/PA (FEAT_LPA2), the representation of
an address between a PTE and PA are not equivalent. This macro will
allow converting between the different representations.

Currently PHYS_TO_PTE is a NOP. Replace all instances where we go from
PA to PTE with new PHYS_TO_PTE macro.

Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39828

13 months agoarm64 pmap: introduce PTE_TO_PHYS macro
Zachary Leaf [Mon, 24 Apr 2023 12:51:00 +0000 (13:51 +0100)]
arm64 pmap: introduce PTE_TO_PHYS macro

Introduce macro for PTE_TO_PHYS, setting the groundwork for future
support of various Arm VMSA extensions.

For extensions such as 52-bit VA/PA (FEAT_LPA2), the representation of
an address between a PTE and PA are not equivalent. This macro will
allow converting between the different representations.

Currently going from PTE to PA is achieved by masking off the upper and
lower attributes. Retain this behaviour but replace all instances with
the new macro instead.

Reviewed by: alc, markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39827

13 months agoifconfig: introduce `ifconfig_context` to store current global state.
Alexander V. Chernikov [Tue, 23 May 2023 17:02:12 +0000 (17:02 +0000)]
ifconfig: introduce `ifconfig_context` to store current global state.

The structure consists of all current context - arguments,
open sockets, current family and so on.

Pass this structure as a first argument to most of the af_ menthods.
This allows to propagate and update shared data without using
 global variables.

The diff is pretty large, but de-facto mechanical. All changes
 except the structure setup in ifconfig[_netlink].c are one-line
 mechanical changes.

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

13 months agoifconfig: cleanup warnings #1
Alexander V. Chernikov [Tue, 23 May 2023 11:04:09 +0000 (11:04 +0000)]
ifconfig: cleanup warnings #1

Cleanup compiler warnings in preparation to set Wextra and remove WARNS?=2

Differential Revision: https://reviews.freebsd.org/D40238
MFC after: 2 weeks

13 months agoLinuxKPI: add utsname for init_utsname() with release
Bjoern A. Zeeb [Tue, 23 May 2023 23:12:47 +0000 (23:12 +0000)]
LinuxKPI: add utsname for init_utsname() with release

A wireless dirver is requesting release from the result of
init_utsname().  Populate the field on startup.

MFC after: 10 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40248

13 months agoLinuxKPI: uuid: add guid_gen() and guid_copy()
Bjoern A. Zeeb [Tue, 23 May 2023 23:15:12 +0000 (23:15 +0000)]
LinuxKPI: uuid: add guid_gen() and guid_copy()

Add function used by a wireless driver.

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

13 months agobhyve: Remove the exitcode stats structure
Mark Johnston [Wed, 24 May 2023 01:14:36 +0000 (21:14 -0400)]
bhyve: Remove the exitcode stats structure

This structure isn't used for anything, and only counts a subset of
vmexit types.  Moreover, it is not accurate since there is no
synchronization between vcpu threads.  Simply remove it.

No functional change intended.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40245

13 months agovmm: Avoid embedding cpuset_t ioctl ABIs
Mark Johnston [Wed, 24 May 2023 01:13:33 +0000 (21:13 -0400)]
vmm: Avoid embedding cpuset_t ioctl ABIs

Commit 0bda8d3e9f7a ("vmm: permit some IPIs to be handled by userspace")
embedded cpuset_t into the vmm(4) ioctl ABI.  This was a mistake since
we otherwise have some leeway to change the cpuset_t for the whole
system, but we want to keep the vmm ioctl ABI stable.

Rework IPI reporting to avoid this problem.  Along the way, make VM_RUN
a bit more efficient:
- Split vmexit metadata out of the main VM_RUN structure.  This data is
  only written by the kernel.
- Have userspace pass a cpuset_t pointer and cpusetsize in the VM_RUN
  structure, as is done for cpuset syscalls.
- Have the destination CPU mask for VM_EXITCODE_IPIs live outside the
  vmexit info structure, and make VM_RUN copy it out separately.  Zero
  out any extra bytes in the CPU mask, like cpuset syscalls do.
- Modify the vmexit handler prototype to take a full VM_RUN structure.

PR: 271330
Reviewed by: corvink, jhb (previous versions)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40113

13 months agofwget: update pci_network_mediatek for mt7996
Bjoern A. Zeeb [Tue, 23 May 2023 23:40:05 +0000 (23:40 +0000)]
fwget: update pci_network_mediatek for mt7996

Add support for another chipset and fix mt7915 to not match on
all IDs.

13 months agoLinuxKPI: add thermal.h to dummy files for now
Bjoern A. Zeeb [Tue, 23 May 2023 23:04:44 +0000 (23:04 +0000)]
LinuxKPI: add thermal.h to dummy files for now

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoLinuxKPI: skbuff: add napi_build_skb() and skb_mark_for_recycle()
Bjoern A. Zeeb [Tue, 23 May 2023 23:07:31 +0000 (23:07 +0000)]
LinuxKPI: skbuff: add napi_build_skb() and skb_mark_for_recycle()

Add more (skeleton) functions used by wireless drivers.

MFC after: 10 days

13 months agoifconfig(8): Teach ifconfig to attach and run itself in a jail
Yan Ka Chiu [Tue, 23 May 2023 20:39:22 +0000 (16:39 -0400)]
ifconfig(8): Teach ifconfig to attach and run itself in a jail

Add -j <jail> flag to ifconfig to allow ifconfig to attach and run inside a
jail. This allow parent to configure network interfaces of its children
even if ifconfig is not available in child's tree (e.g. Linux Jails)

Reviewed by: emaste, khng, melifaro
Event: Kitchener-Waterloo Hackathon 202305
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40213

13 months agoFix typo in sys/conf/kern.mk's InitAll warning message
Dimitry Andric [Tue, 23 May 2023 17:56:41 +0000 (19:56 +0200)]
Fix typo in sys/conf/kern.mk's InitAll warning message

I missed this one in commit 3006f6df025f.

Fixes: 3006f6df025f
MFC after: 3 days

13 months agoEnable -ftrivial-auto-var-init flags for gcc >= 12
Dimitry Andric [Tue, 23 May 2023 17:43:12 +0000 (19:43 +0200)]
Enable -ftrivial-auto-var-init flags for gcc >= 12

Now that gcc >= 12 supports -ftrivial-auto-var-init, add it to
bsd.compiler.mk's "init-all" feature.

PR: 271047
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40208

13 months agoUpdate -ftrivial-auto-var-init flags for clang >= 16
Dimitry Andric [Tue, 23 May 2023 17:40:36 +0000 (19:40 +0200)]
Update -ftrivial-auto-var-init flags for clang >= 16

As of clang 16, the -ftrivial-auto-var-init=zero option no longer needs
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
to enable the option. Only add it for older clang versions.

PR: 271047
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40208

13 months agolibsecureboot ensure correct BUILD_UTC
Simon J. Gerraty [Tue, 23 May 2023 16:02:00 +0000 (09:02 -0700)]
libsecureboot ensure correct BUILD_UTC

If using stat(1) on BUILD_UTC_FILE we should use -L incase
it is a symlink.

If we have new enough bmake though we can just use ${BUILD_UTC_FILE:mtime}

13 months agoctags: Error out if writing to stdout failed.
Dag-Erling Smørgrav [Tue, 23 May 2023 15:31:28 +0000 (17:31 +0200)]
ctags: Error out if writing to stdout failed.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: cracauer, allanjude
Differential Revision: https://reviews.freebsd.org/D40200

13 months agorc.resume: remove obsolete comment
Christos Margiolis [Tue, 23 May 2023 15:26:56 +0000 (18:26 +0300)]
rc.resume: remove obsolete comment

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

13 months agokinst: use dtrace_dis_get_byte() instead of own copy
Christos Margiolis [Tue, 23 May 2023 15:12:18 +0000 (18:12 +0300)]
kinst: use dtrace_dis_get_byte() instead of own copy

No functional change intended.

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

13 months agorc.suspend: execute rc-scripts with suspend keyword
Johannes Totz [Tue, 23 May 2023 15:11:31 +0000 (18:11 +0300)]
rc.suspend: execute rc-scripts with suspend keyword

For symmetry with rc.resume, give rc.suspend the ability to execute
rc-scripts. Use the suspend keyword for that.

Use-case is for setting a wake-up time, e.g. via efiwake.

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

13 months agodtrace: rename rp to frame in dtrace_getreg()
Christos Margiolis [Tue, 23 May 2023 14:40:07 +0000 (17:40 +0300)]
dtrace: rename rp to frame in dtrace_getreg()

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

13 months agodtrace.1: fix mandoc -Tlint
Christos Margiolis [Tue, 23 May 2023 14:29:19 +0000 (17:29 +0300)]
dtrace.1: fix mandoc -Tlint

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

13 months agomd: Get rid of the pbuf zone
Mark Johnston [Tue, 23 May 2023 14:14:06 +0000 (10:14 -0400)]
md: Get rid of the pbuf zone

The zone is used solely to provide KVA for mapping BIOs so that we can
pass mapped buffers to VOP_READ and VOP_WRITE.  Currently we preallocate
nswbuf/10 bufs for this purpose during boot.

The intent was to limit KVA usage on 32-bit systems, but the
preallocation means that we in fact consumed more KVA than needed unless
one has more than nswbuf/10 (typically 25) vnode-backed MD devices
in existence, which I would argue is the uncommon case.

Meanwhile, all I/O to an MD is handled by a dedicated thread, so we can
instead simply preallocate the KVA region at MD device creation time.

Event: BSDCan 2023
Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40215

13 months agodtrace: add register bindings for arm64
Christos Margiolis [Tue, 23 May 2023 14:19:25 +0000 (17:19 +0300)]
dtrace: add register bindings for arm64

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

13 months agodtrace: implement dtrace_instr_size() for arm64
Christos Margiolis [Tue, 23 May 2023 14:19:15 +0000 (17:19 +0300)]
dtrace: implement dtrace_instr_size() for arm64

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

13 months agodtrace: remove ifdef around dtrace_instr_size()
Christos Margiolis [Tue, 23 May 2023 14:19:04 +0000 (17:19 +0300)]
dtrace: remove ifdef around dtrace_instr_size()

Architectures that are not included in the #ifdef won't be able to
compile libdtrace. This was tested on an ARM64 build. If the ifdef is
removed, libdtrace can be compiled with no problems, otherwise it fails
at libdtrace.

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

13 months agodtrace(1): add -d flag to dump D script post-dt_sugar
Christos Margiolis [Tue, 23 May 2023 14:18:39 +0000 (17:18 +0300)]
dtrace(1): add -d flag to dump D script post-dt_sugar

By specifying the -d flag, libdtrace will dump the D script after it has
applied syntactical sugar transformations (e.g if/else). This is useful
for both understanding what dt_sugar does, as well as debugging it.

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

13 months agoif_ovpn: ensure we never re-use sequence numbers
Kristof Provost [Sat, 20 May 2023 17:43:49 +0000 (19:43 +0200)]
if_ovpn: ensure we never re-use sequence numbers

if_ovpn already notified userpsace when there was a risk of sequence
number re-use, but it trusted userspace to actually rotate the key.

Convert the internal sequence number counter to 64 bits so we can detect
overflows and then refuse to send packets.

Event: BSDCan 2023
Reviewed by: Leon Dang <ldang@netgate.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40187

13 months agopf: remove the use of caddr_t
Kristof Provost [Fri, 19 May 2023 18:56:46 +0000 (20:56 +0200)]
pf: remove the use of caddr_t

Replace caddr_t with void *, or more accurate types.

Suggested by: glebius
Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D40186

13 months agokinst: replace KINST_TRAMP_INIT
Christos Margiolis [Tue, 23 May 2023 13:58:36 +0000 (16:58 +0300)]
kinst: replace KINST_TRAMP_INIT

The current implementation of KINST_TRAMP_INIT is working only on amd64,
where the breakpoint instruction is one byte long, which might not be
the case for other architectures (e.g in RISC-V it's either 2 or 4
bytes). This patch introduces two machine-dependent constants,
KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE, which hold the fill
instruction and the size of that instruction in bytes respectively.

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

13 months agoriscv: Print less CPU info
Mitchell Horne [Mon, 22 May 2023 23:54:36 +0000 (20:54 -0300)]
riscv: Print less CPU info

Change the reporting strategy to more closely follow what arm64
implements:
 - Always print the one-line CPU summary when a core comes online
 - Only print the additional fields (e.g. ISA) when they differ from the
   CPU before it

In the common case of identical CPUs this results in informative but
non-repetitive output. For example, in QEMU:

  CPU 0  : Vendor=Unspecified Core=Unknown (Hart 0)
    marchid=0x80032, mimpid=0x80032
    MMU: 0x7<Sv39,Sv48,Sv57>
    ISA: 0x112d<Atomic,Compressed,Double,Float,Mult/Div>
  real memory  = 8589934592 (8192 MB)
  avail memory = 8332300288 (7946 MB)
  FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs
  CPU 1  : Vendor=Unspecified Core=Unknown (Hart 1)
  CPU 2  : Vendor=Unspecified Core=Unknown (Hart 2)
  CPU 3  : Vendor=Unspecified Core=Unknown (Hart 3)

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

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