freebsd.git
2 years agossh: remove 11.x from FREEBSD-upgrade instructions
Ed Maste [Wed, 23 Feb 2022 18:34:39 +0000 (13:34 -0500)]
ssh: remove 11.x from FREEBSD-upgrade instructions

11.x is no longer supported.

2 years agosendto: don't clear transient errors for atomic protocols
Gleb Smirnoff [Thu, 17 Feb 2022 17:07:31 +0000 (09:07 -0800)]
sendto: don't clear transient errors for atomic protocols

The changeset 65572cade35 uncovered the fact that top layer of sendto(2)
would clear a transient error code if some data was copied out of uio.
The clearing of the error makes sense for non-atomic protocols, since
they have sent some data.  The atomic protocols send all or nothing.

The current implementation of unix/dgram uses sosend_generic(), which
would always copyout and only then it may fail to deliver a message.
The sosend_dgram(), currently used by UDP only, also has same behavior.

Reported by: pho
Reviewed by: pho, markj
Differential revision: https://reviews.freebsd.org/D34309

2 years agobhyve nvme: Advertise Namespace changed AEN
Chuck Tuffli [Wed, 23 Feb 2022 15:18:54 +0000 (07:18 -0800)]
bhyve nvme: Advertise Namespace changed AEN

Advertise Namespace Attribute Notices events in the Optional
Asynchronous Events Supported (OAES) field of the Identify Controller
data structure. Additionally, rename the enums and macros to clarify
these are AEN's related to Notices and not generic information.

Reported by: andy@omniosce.org

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

2 years agolibdtrace: Add a missing newline to an error message
Mark Johnston [Wed, 23 Feb 2022 16:31:51 +0000 (11:31 -0500)]
libdtrace: Add a missing newline to an error message

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agofbt: Remove handling for CTFv1
Mark Johnston [Wed, 23 Feb 2022 14:58:35 +0000 (09:58 -0500)]
fbt: Remove handling for CTFv1

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agolibctf: Remove checks for CTFv1
Mark Johnston [Wed, 23 Feb 2022 14:57:41 +0000 (09:57 -0500)]
libctf: Remove checks for CTFv1

Per commit 7db423d69273 ("libctf: Rip out CTFv1 support") this support
is obsolete.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agodtc.1: Mention the existence of -i flag
Jose Luis Duran [Sat, 19 Feb 2022 13:43:18 +0000 (10:43 -0300)]
dtc.1: Mention the existence of -i flag

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/570

2 years agodtc.1: Appease mandoc -T lint
Jose Luis Duran [Sat, 19 Feb 2022 13:47:31 +0000 (10:47 -0300)]
dtc.1: Appease mandoc -T lint

Prefer .Fx to bare FreeBSD

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/579

2 years agolibefivar: Correct the string expression of UTF8 vendor device path
Jose Luis Duran [Tue, 22 Feb 2022 11:39:03 +0000 (08:39 -0300)]
libefivar: Correct the string expression of UTF8 vendor device path

According to UEFI spec, the string expression of UTF8 vendor
device node should be displayed as: VenUtf8(). Current code
display it as: VenUft8() by mistake when convert device
path node to text.

This commit is to fix this bug.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1225
Obtained from: https://github.com/tianocore/edk2/commit/959be180e185869b71db9dad34c3f4bba660d724
Pull Request: https://github.com/freebsd/freebsd-src/pull/580

2 years agovt: fix double-click word selection for last word on line
Ed Maste [Mon, 21 Feb 2022 04:09:36 +0000 (23:09 -0500)]
vt: fix double-click word selection for last word on line

Previously when double-clicking on the last word on a line we would
select from the beginning of the word to the cursor position, because
we searched forward for a space character to find the end of a word.
Now, use the end of the line if we do not find a space.

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

2 years agoiicbus: Add missing dependency for iicbus module.
Michal Meloun [Wed, 23 Feb 2022 15:24:01 +0000 (16:24 +0100)]
iicbus: Add missing dependency for iicbus module.

Reported by: rpokala, mjg
MFC with:       1bd3e8ba696633ccd7525030d951b58ade167814

2 years agotcp_wrappers: remove duplicate errno declarations
Piotr Pawel Stefaniak [Sun, 13 Feb 2022 18:19:25 +0000 (19:19 +0100)]
tcp_wrappers: remove duplicate errno declarations

2 years agotcp_wrappers: include <unistd.h>
Piotr Pawel Stefaniak [Sun, 13 Feb 2022 18:14:55 +0000 (19:14 +0100)]
tcp_wrappers: include <unistd.h>

This is for getdomainname(3).

2 years agoFix the sanitizer header checks on arm64
Andrew Turner [Wed, 12 Jan 2022 16:03:41 +0000 (16:03 +0000)]
Fix the sanitizer header checks on arm64

We need to not include the MI _san.h files when builing some parts of
the kernel. Fix these checks in the arm64 header files.

Sponsored by: The FreeBSD Foundation

2 years agoBuilt all KCSAN atomic interceptors on arm64
Andrew Turner [Wed, 12 Jan 2022 16:09:38 +0000 (16:09 +0000)]
Built all KCSAN atomic interceptors on arm64

These atomic functions are now supported. Add them to KCSAN.

Sponsored by: The FreeBSD Foundation

2 years agoAdd the char and short atomic operations on arm64
Andrew Turner [Wed, 12 Jan 2022 15:44:36 +0000 (15:44 +0000)]
Add the char and short atomic operations on arm64

Sponsored by: The FreeBSD Foundation

2 years agoarm: Add extres pseudo devices to some kernel
Emmanuel Vadot [Wed, 23 Feb 2022 07:44:16 +0000 (08:44 +0100)]
arm: Add extres pseudo devices to some kernel

All the pseudo devices and framework are required by drivers.

Reported by: mjg

2 years agofiles: Make mmc_fdt_helper and sdhci depends on clk and regulator
Emmanuel Vadot [Wed, 23 Feb 2022 07:43:45 +0000 (08:43 +0100)]
files: Make mmc_fdt_helper and sdhci depends on clk and regulator

Those two frameworks are needed.

2 years agoiwlwifi: fix the build
Bjoern A. Zeeb [Wed, 23 Feb 2022 01:09:26 +0000 (01:09 +0000)]
iwlwifi: fix the build

Pull in a case statement from the upcoming iwlwifi update to
unbreak the build after d875aa1587ce7d1651cabe395ed991f2384795cd .

Reported by: cy
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC with: d875aa1587ce7d1651cabe395ed991f2384795cd

2 years agobsdinstall/distfetch: fix main bar percentage with errors
Alfonso S. Siciliano [Wed, 23 Feb 2022 00:54:51 +0000 (01:54 +0100)]
bsdinstall/distfetch: fix main bar percentage with errors

UI fix not related to the real fetching process, use 'nfiles'
(instead of 'total files size') to compute main bar percentage
if an error occurs:

 - fix: main bar greater than 100%, if an error occurs before fetching
 - fix: main bar less than 100%, if an error occurs during fetching
 - add: last mixedgauge, at least one dialog if a total failure occurs

PR: 164094, 169748
Approved by: bapt (mentor)
Review: https://reviews.freebsd.org/D33978

2 years agoLinuxKPI: update 802.11 headers
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:57:31 +0000 (22:57 +0000)]
LinuxKPI: update 802.11 headers

Add new defines, struct members, and (stub) functions needed for an
updated iwlwifi.  Most of the defines are for rfkill or HE.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: skbuff.h add skb_postpush_rcsum()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:54:48 +0000 (22:54 +0000)]
LinuxKPI: skbuff.h add skb_postpush_rcsum()

Add a stub for skb_postpush_rcsum() needed by an updated iwlwifi.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agonfscl: Fix a use after free in nfscl_cleanupkext()
Rick Macklem [Tue, 22 Feb 2022 22:21:43 +0000 (14:21 -0800)]
nfscl: Fix a use after free in nfscl_cleanupkext()

ler@, markj@ reported a use after free in nfscl_cleanupkext().
They also provided two possible causes:
- In nfscl_cleanup_common(), "own" is the owner string
  owp->nfsow_owner.  If we free that particular
  owner structure, than in subsequent comparisons
  "own" will point to freed memory.
- nfscl_cleanup_common() can free more than one owner, so the use
  of LIST_FOREACH_SAFE() in nfscl_cleanupkext() is not sufficient.

I also believe there is a 3rd:
- If nfscl_freeopenowner() or nfscl_freelockowner() is called
  without the NFSCLSTATE mutex held, this could race with
  nfscl_cleanupkext().
  This could happen when the exclusive lock is held
  on the client, such as when delegations are being returned.

This patch fixes them as follows:
1 - Copy the owner string to a local variable before the
    nfscl_cleanup_common() call.
2 - Modify nfscl_cleanup_common() to return whether or not a
    free was done.
    When a free was done, do a goto to restart the loop, instead
    of using FOREACH_SAFE, which was not safe in this case.
3 - Acquire the NFSCLSTATE mutex in nfscl_freeopenowner()
    and nfscl_freelockowner(), if it not already held.
    This serializes all of these calls with the ones done in
    nfscl_cleanup_common().

Reported by: ler
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34334

2 years agocp: fix -R with links
Kyle Evans [Thu, 27 Jan 2022 18:02:17 +0000 (12:02 -0600)]
cp: fix -R with links

The traversal was previously not properly honoring -H/-L/-P.  Notably,
we should not have been resolving symlinks encountered during traversal
when either -H or -P are specified.

Sponsored by: Klara, Inc.
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D34063

2 years agokeymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards
Alfredo Dal'Ava Junior [Wed, 23 Feb 2022 00:35:09 +0000 (21:35 -0300)]
keymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards

This adds missing Alt Gr mappings for the keys "q", "w", "e" an "c" to
conform with ABNT2 standard.

PR: 256416
Submitted by: Neebz <vpguyrhpjltta@logicstreak.com>
Reviewed by: emaste
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D33801

2 years agocamcontrol fwdownload minor improvements
Warner Losh [Tue, 22 Feb 2022 21:25:32 +0000 (14:25 -0700)]
camcontrol fwdownload minor improvements

Minor improvements to the fwdownload code suggested by chs@:
o Print the path_id/target we're rescanning so it's not invisible
o No need for XPT_GDEVLIST, all the info is filled in. Remove sending it
  as well as a comment related to it from a mistaken observation. libcam
  always fills these in properly, so use those for the ccb path/target.
o Don't leak /dev/xpt fd in success cases.
o Rename fw_rescan_lun to fw_rescan_target and pass sim_mode to
  only print path_id and target_id info.

Reviewed by: chs@
Fixes: 9835900cb95bcd068774934961fb1419719d595b
Sponsored by: Netflix
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D34348

2 years agovt: whitespace and style(9) updates
Ed Maste [Tue, 22 Feb 2022 21:30:27 +0000 (16:30 -0500)]
vt: whitespace and style(9) updates

2 years agosrc.libnames.mk: add a comment explaining libssp_nonshared
Ed Maste [Tue, 22 Feb 2022 21:22:03 +0000 (16:22 -0500)]
src.libnames.mk: add a comment explaining libssp_nonshared

libssp_nonshared is a special case for (only) i386 and power*.  Add a
comment explaining why, based on the original commit message that added
it.

MFC after: 1 week
Fixes: 0f61170882cb ("libssp_nonshared: use only on i386 and ppc")
Sponsored by: The FreeBSD Foundation

2 years agomps/mpr: Add missing newlines in error messages.
Alexander Motin [Tue, 22 Feb 2022 20:06:48 +0000 (15:06 -0500)]
mps/mpr: Add missing newlines in error messages.

MFC after: 1 week

2 years agoreadelf: add Arm address mask note type NT_ARM_ADDR_MASK
Ed Maste [Tue, 22 Feb 2022 17:40:39 +0000 (12:40 -0500)]
readelf: add Arm address mask note type NT_ARM_ADDR_MASK

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

2 years agofd: rename fget*_locked to fget*_noref
Mateusz Guzik [Tue, 22 Feb 2022 15:54:17 +0000 (16:54 +0100)]
fd: rename fget*_locked to fget*_noref

This gets rid of the error prone naming where fget_unlocked returns with
a ref held, while fget_locked requires a lock but provides nothing in
terms of making sure the file lives past unlock.

No functional changes.

2 years agotty: fix a panic with INVARIANTS
Robert Wing [Tue, 22 Feb 2022 18:22:18 +0000 (09:22 -0900)]
tty: fix a panic with INVARIANTS

watch'ing a tty triggers a refcount wraparound panic, take a reference
on fp after fget_cap_locked() to fix.

Reported by:    Michael Jung <mikej_at_paymentallianceintl.com>
Reviewed by: hselasky, mjg
Fixes:          f40dd6c8034b ("tty: switch ttyhook_register to use fget_cap_locked")
Differential Revision: https://reviews.freebsd.org/D34335

2 years agopowerpc: enable initial-exec TLS
Piotr Kubaj [Fri, 18 Feb 2022 13:22:14 +0000 (14:22 +0100)]
powerpc: enable initial-exec TLS

Summary:
Use initial-exec, like other architectures.

While here, switch MACHINE_ARCH in lib/libc/Makefile to LIBC_ARCH and consistently use powerpc.

Subscribers: imp, #contributor_reviews_base

Differential Revision: https://reviews.freebsd.org/D34315
Reviewed by: luporl
MFC after: 2 weeks

2 years agocamcontrol: Force a rescan of the lun after firmware download.
Warner Losh [Tue, 22 Feb 2022 17:34:36 +0000 (10:34 -0700)]
camcontrol: Force a rescan of the lun after firmware download.

After downloading the firmware to a device, it's inquiry data likely
will change. Force a rescan of the target with the CAM_EXPECT_INQ_CHANGE
flag to get it to record the new inqury data as being expected. This
avoids the need for a 'camcontrol rescan' on the device which detaches
and re-attaches the disk (da, ada) device. This brings fwdownload up to
nvmecontrol's ability to do the same thing w/o changing the exposed
nvme/nvd/nda device. We scan the target and not the LUN because dual
actuator drives have multiple LUNs, but the firmware is global across
many vendors' drives (and the so far theoretical ones that aren't won't
be harmed by the rescan).

Since the underlying struct disk is now preserved accross this
operation, it's now possible to upgrade firmware of a root device w/o
crashing the system.  On systems that are quite busy, the worst that
happens is that certain operaions are reported cancelled when the new
firmware is activated. These operations are retried with the normal CAM
recovery mechanisms and will work on the retry. The only visible hiccup
is the time that new firmware is flashing / initializing. One should not
consider this operation completely risk free, however, since not all
drives are well behaved after a firmware download.

MFC After: 1 week
Relnotes: yes
Sponsored by: Netflix
Feedback by: mav
Differential Revision: https://reviews.freebsd.org/D34325

2 years agoAdd NT_ARM_ADDR_MASK
Andrew Turner [Mon, 30 Aug 2021 16:43:22 +0000 (17:43 +0100)]
Add NT_ARM_ADDR_MASK

This can be used by debuggers to find which bits in a virtual address
should be masked off to get a canonical address. This is currently used
by the Pointer Authentication Code support to get its mask. It could also
be used if we support Top Byte Ignore for the same purpose.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34302

2 years agoriscv: Fix another race in pmap_pinit()
Mark Johnston [Tue, 22 Feb 2022 14:26:33 +0000 (09:26 -0500)]
riscv: Fix another race in pmap_pinit()

Commit c862d5f2a789 ("riscv: Fix a race in pmap_pinit()") did not really
fix the race.  Alan writes,

 Suppose that N entries in the L1 tables are in use, and we are in the
 middle of the memcpy().  Specifically, we have read the zero-filled
 (N+1)st entry from the kernel L1 table.  Then, we are preempted.  Now,
 another core/thread does pmap_growkernel(), which fills the (N+1)st
 entry.  Finally, we return to the original core/thread, and overwrite
 the valid entry with the zero that we earlier read.

Try to fix the race properly, by copying kernel L1 entries while holding
the allpmaps lock.  To avoid doing unnecessary work while holding this
global lock, copy only the entries that we expect to be valid.

Fixes: c862d5f2a789 ("riscv: Fix a race in pmap_pinit()")
Reported by: alc, jrtc27
Reviewed by: alc
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34267

2 years agovt: fix double-click word selection for first word on line
Ed Maste [Mon, 21 Feb 2022 04:09:36 +0000 (23:09 -0500)]
vt: fix double-click word selection for first word on line

Previously when double-clicking on the first word on a line we would
select from the cursor position to the end of the word, not from the
beginning of the line.  This is because we searched backward for a
space to mark the beginning of a word.

Now, use the beginning of the line if we do not find a space.

PR: 261553
Reported by: Stefan B.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agostress2: Added cleanup on error
Peter Holm [Tue, 22 Feb 2022 11:07:45 +0000 (12:07 +0100)]
stress2: Added cleanup on error

2 years agofiles: Make mmc_pwrseq depends on regulator and clk
Emmanuel Vadot [Tue, 22 Feb 2022 10:22:23 +0000 (11:22 +0100)]
files: Make mmc_pwrseq depends on regulator and clk

It uses those two frameworks too.

2 years agodwc: Support phy mode MII
Emmanuel Vadot [Tue, 22 Feb 2022 08:58:36 +0000 (09:58 +0100)]
dwc: Support phy mode MII

Some board use dwc phy in MII mode, so do not fail to attach if this is
the case.
Only rockchip code uses the phy mode to program some custom syscon register.

PR: 260848
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agodwc: Release resources when attach fails
Emmanuel Vadot [Tue, 22 Feb 2022 08:53:11 +0000 (09:53 +0100)]
dwc: Release resources when attach fails

PR: 259282
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agofiles: Make mmc_helpers depends on regulator and clk
Emmanuel Vadot [Tue, 22 Feb 2022 09:01:22 +0000 (10:01 +0100)]
files: Make mmc_helpers depends on regulator and clk

It also needs those two framework.

2 years agosdhci_fsl_fdt: Add voltage switching through syscon
Hubert Mazur [Thu, 20 Jan 2022 09:56:10 +0000 (10:56 +0100)]
sdhci_fsl_fdt: Add voltage switching through syscon

Some SoCs does not have a fixed regulator to handle voltage
switching automatically. Add support for voltage switching
through syscon register when necessary. Add new errata flag
indicating missing regulator. Apply errata to SoCs, which are
known to be affected, i.e. LS1046 and LS1012.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D34029

2 years agosdhci_fsl_fdt: Apply errata for LX2160A
Hubert Mazur [Tue, 21 Dec 2021 14:52:56 +0000 (15:52 +0100)]
sdhci_fsl_fdt: Apply errata for LX2160A

LX2160A is affected by two erratum regarding SDHCI. However this board
has generic compat string in DTS for SDHCI which means erratum cannot
be simply applied. Compare compat string from "/" path with LX2160A
compat string when attaching device and apply erratum.

Reviewed by: mmel, imp
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D34028

2 years agosdhci_fsl_fdt: Fix tuning code
Kornel Duleba [Wed, 22 Dec 2021 08:17:28 +0000 (09:17 +0100)]
sdhci_fsl_fdt: Fix tuning code

- Some of the register writes were already done in the generic tuning code.
  Remove them.
- Increase the polling timeout. The previous value is probably fine, but since
  timeouts are treated as fatal errors increasing it to 200ms won't hurt.
- Rework the HS400 switching code. Make sure that the switch happens at the
  right time. Reset the DLL0 block. We need to do that if u-boot has previously
  configured the controller in HS400 mode.
- Check current timing before tuning. The tuning devmethod is always called,
  even for timings that don't require the tuning procedure.
- Rework software tuning routine code. Use inner formula for clock
  divider calculation, as previous one was incorrect.
- Implement custom re-tune procedure.

Co-authored-by: Hubert Mazur <hum@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D34027

2 years agosdhci_fsl_fdt: Fix pulse width errata application
Kornel Duleba [Fri, 14 Jan 2022 11:21:51 +0000 (12:21 +0100)]
sdhci_fsl_fdt: Fix pulse width errata application

The errata has to be applied every time after SDHCI_RESET_ALL is done.
Move it from attach to the custom reset routine.

Reviewed by: wma, mmel
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D33981

2 years agoinit(8): use proper boolean type for globals
Mitchell Horne [Mon, 21 Feb 2022 16:54:49 +0000 (12:54 -0400)]
init(8): use proper boolean type for globals

Now that stdbool.h is included, prefer this. No functional change
intended.

2 years agorc.subr: boottrace annotations
Mitchell Horne [Sun, 17 Jan 2021 22:56:59 +0000 (18:56 -0400)]
rc.subr: boottrace annotations

When enabled, have the framework use the boottrace(8) utility to execute
each rc script, generating trace entries for the entire suite of
scripts.

Reviewed by: 0mp (slightly earlier version)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31930

2 years agoboottrace(8): small wrapper utility
Mitchell Horne [Fri, 5 Feb 2021 20:07:39 +0000 (16:07 -0400)]
boottrace(8): small wrapper utility

This is a small program that when invoked will create start and stop
boottrace entries via sysctl, and execute the desired command. Having
this as an executable -- as opposed to some shell script invoking
sysctl(8) -- allows the total resource usage recorded by the trace
entries to include the child process.

Reviewed by: 0mp, trasz (older version)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31929

2 years agoboottrace: annotate init and shutdown utilities
Mitchell Horne [Tue, 22 Feb 2022 00:16:07 +0000 (20:16 -0400)]
boottrace: annotate init and shutdown utilities

Add boottrace annotations to record events in init(8), shutdown(8), and
reboot(8).

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #23
Differential Revision: https://reviews.freebsd.org/D31928

2 years agoboottrace: trace annotations for startup and shutdown
Mitchell Horne [Tue, 22 Feb 2022 00:15:57 +0000 (20:15 -0400)]
boottrace: trace annotations for startup and shutdown

Add trace events for execution of SYSINITs (both static and dynamically
loaded), and to the various steps in the shutdown/panic/reboot paths.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #23
Differential Revision: https://reviews.freebsd.org/D30187

2 years agoinit_main.c: sort includes
Mitchell Horne [Mon, 10 May 2021 14:37:41 +0000 (11:37 -0300)]
init_main.c: sort includes

This is preferred by style(9). Do this ahead of adding another include.

Reviewed by: imp, kevans, allanjude
MFC after: 3 days
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30186

2 years agokern_linker.c: sort includes
Mitchell Horne [Sun, 20 Feb 2022 16:59:57 +0000 (12:59 -0400)]
kern_linker.c: sort includes

This is preferred by style(9). Do this ahead of adding another include.

Reviewed by: imp, kevans
MFC after: 3 days
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30185

2 years agoboottrace: a simple boot and shutdown-time tracing facility
Mitchell Horne [Tue, 22 Feb 2022 00:15:45 +0000 (20:15 -0400)]
boottrace: a simple boot and shutdown-time tracing facility

Boottrace is a facility for capturing trace events during boot and
shutdown. This includes kernel initialization, as well as rc. It has
been used by NetApp internally for several years, for catching and
diagnosing slow devices or subsystems. It is driven from userspace by
sysctl interface, and the output is a human-readable log of events
(kern.boottrace.log).

This commit adds the core boottrace functionality implementing these
interfaces. Adding the trace annotations themselves to kernel and
userland will happen in follow-up commits. A future commit will also add
a boottrace(4) man page.

For now, boottrace is unconditionally compiled into the kernel but
disabled by default. It can be enabled by setting the
kern.boottrace.enabled tunable to 1 in loader.conf(5).

There is an existing boot-time event tracing facility, which can be
compiled into the kernel with 'options TSLOG'. While there is some
functional overlap between this and boottrace, they are distinct. TSLOG
is suitable for generating detailed timing information and flamegraphs,
and has been used to great success by cperciva@ to diagnose and reduce
the overall system boot time. Boottrace aims to more quickly provide an
overview of timing and resource usage of the boot (and shutdown) process
to a sysadmin who requires this knowledge.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #23
Differential Revision: https://reviews.freebsd.org/D30184

2 years agobridge: Don't share broadcast packets
Kristof Provost [Sat, 19 Feb 2022 15:34:31 +0000 (16:34 +0100)]
bridge: Don't share broadcast packets

if_bridge duplicates broadcast packets with m_copypacket(), which
creates shared packets. In certain circumstances these packets can be
processed by udp_usrreq.c:udp_input() first, which modifies the mbuf as
part of the checksum verification. That may lead to incorrect packets
being transmitted.

Use m_dup() to create independent mbufs instead.

Reported by: Richard Russo <toast@ruka.org>
Reviewed by: donner, afedorov
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34319

2 years agonvme: fix spelling of Namespace
Chuck Tuffli [Mon, 21 Feb 2022 18:34:46 +0000 (10:34 -0800)]
nvme: fix spelling of Namespace

Fix spelling of a macro definition.

Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D34330

2 years agonvme: Add OAES bit-field definitions
Chuck Tuffli [Mon, 21 Feb 2022 18:34:14 +0000 (10:34 -0800)]
nvme: Add OAES bit-field definitions

Create definitions for the Optional Asynchronous Events Supported (OAES)
values. Also adds a helper macro for the common use case of "mask and
shift". E.g.
    value = NVME_CTRLR_DATA_OAES_NS_ATTR_MASK << NVME_CTRLR_DATA_OAES_NS_ATTR_SHIFT;
becomes
    value = NVMEB(NVME_CTRLR_DATA_OAES_NS_ATTR);

Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D34300

2 years agofiles: Make mmc_helper depend on gpio
Emmanuel Vadot [Mon, 21 Feb 2022 17:31:00 +0000 (18:31 +0100)]
files: Make mmc_helper depend on gpio

mmc_helper have an hard dependency on gpio_if.h
gpio(4) isn't in the default x86 kernel and none of the x86
sd/mmc drivers uses mmc_helper so just add a dependency on gpio.

Fixes: 85b3794ceef ("files: Make ext_resources non-optional")

2 years agoman: Remove mention of EXT_RESOURCES
Emmanuel Vadot [Tue, 11 Jan 2022 10:31:15 +0000 (11:31 +0100)]
man: Remove mention of EXT_RESOURCES

It doesn't exists anymore.

Reviewed by: debdrup (manpages)
Differential Revision: https://reviews.freebsd.org/D33840

2 years agooptions: Remove EXT_RESOURCES
Emmanuel Vadot [Tue, 11 Jan 2022 10:13:05 +0000 (11:13 +0100)]
options: Remove EXT_RESOURCES

It is now unused in kernel code.

MFC after: Never
Differential Revision: https://reviews.freebsd.org/D33839

2 years agoriscv: conf: Remove options EXT_RESOURCES
Emmanuel Vadot [Tue, 11 Jan 2022 10:12:40 +0000 (11:12 +0100)]
riscv: conf: Remove options EXT_RESOURCES

It is now unused in kernel code.

Reviewed by: mhorne
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33838

2 years agoarm: conf: Remove options EXT_RESOURCES
Emmanuel Vadot [Tue, 11 Jan 2022 10:12:01 +0000 (11:12 +0100)]
arm: conf: Remove options EXT_RESOURCES

It is now unused in kernel code.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33837

2 years agoarm64: conf: Remove options EXT_RESOURCES
Emmanuel Vadot [Tue, 11 Jan 2022 10:10:07 +0000 (11:10 +0100)]
arm64: conf: Remove options EXT_RESOURCES

It is now unused in kernel code.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33836

2 years agoofw_cpu: Make ext_resources non-optional for arm* and riscv
Emmanuel Vadot [Tue, 11 Jan 2022 10:08:18 +0000 (11:08 +0100)]
ofw_cpu: Make ext_resources non-optional for arm* and riscv

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.
For RISC-V it was always enabled.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33835

2 years agofiles: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 10:03:05 +0000 (11:03 +0100)]
files: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33834

2 years agoarmv7: allwinner: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:51:52 +0000 (10:51 +0100)]
armv7: allwinner: Make ext_resources non-optional

The only valid condition for if_awg and aw_syscon is syscon.
EXT_RESOURCES is enabled in GENERIC since 12-CURRENT.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33833

2 years agovf_i2c: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:51:06 +0000 (10:51 +0100)]
vf_i2c: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33832

2 years agoimx_gpio: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:50:05 +0000 (10:50 +0100)]
imx_gpio: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33831

2 years agoimx_i2c: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:49:32 +0000 (10:49 +0100)]
imx_i2c: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33830

2 years agobcm2835_sdhci: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:48:15 +0000 (10:48 +0100)]
bcm2835_sdhci: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

Reviewed by: kevans
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33829

2 years agouart_dev_snps: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:46:50 +0000 (10:46 +0100)]
uart_dev_snps: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33828

2 years agousb: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:45:42 +0000 (10:45 +0100)]
usb: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33827

2 years agouart_dev_imx: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:43:40 +0000 (10:43 +0100)]
uart_dev_imx: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33826

2 years agoif_cgem: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:42:34 +0000 (10:42 +0100)]
if_cgem: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33825

2 years agosdhci: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:41:23 +0000 (10:41 +0100)]
sdhci: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33824

2 years agotwsi: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:39:47 +0000 (10:39 +0100)]
twsi: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33823

2 years agodwmmc: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:38:24 +0000 (10:38 +0100)]
dwmmc: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33822

2 years agommc: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:37:02 +0000 (10:37 +0100)]
mmc: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33821

2 years agodwc: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:34:36 +0000 (10:34 +0100)]
dwc: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33820

2 years agommap map_at_zero test: handle W^X
Arka Sharma [Fri, 18 Feb 2022 15:34:15 +0000 (09:34 -0600)]
mmap map_at_zero test: handle W^X

Use kern.elfXX.allow_wx to decide whether to map W+X or W-only memory.

Future work could expand this test to add an "allow_wx" axis to the
test matrix, but I would argue that a separate test should be written,
since that's orthogonal to map_at_zero.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 years agotcp: Congestion control move to using reference counting.
Randall Stewart [Mon, 21 Feb 2022 11:30:17 +0000 (06:30 -0500)]
tcp: Congestion control move to using reference counting.

In the transport call on 12/3 Gleb asked to move the CC modules towards
using reference counting to prevent folks from unloading a module in use.
It was also agreed that Michael would do a user space utility like tcp_drop
that could be used to move all connections that are using a specific CC
to some other CC.

This is the half I committed to doing, making it so that we maintain a refcount
on a cc module every time a pcb refers to it and decrementing that every
time a pcb no longer uses a cc module. This also helps us simplify the
whole unloading process by getting rid of tcp_ccunload() which munged
through all the tcb's. Instead we mark a module as being removed and
prevent further references to it. We also make sure that if a module is
marked as being removed it cannot be made as the default and also
the opposite of that, if its a default it fails and does not mark it as being
removed.

Reviewed by: Michael Tuexen, Gleb Smirnoff
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D33249

2 years agolibarchive: merge vendor bugfix
Martin Matuska [Mon, 21 Feb 2022 11:06:54 +0000 (12:06 +0100)]
libarchive: merge vendor bugfix

OSS-Fuzz #44843 (security):
RAR reader: fix null-dereference in RAR (v4) filter code

X-MFC-with: 833a452e9d

2 years agoUpdate vendor/libarchive to libarchive/libarchive@1271f775d
Martin Matuska [Mon, 21 Feb 2022 11:04:05 +0000 (12:04 +0100)]
Update vendor/libarchive to libarchive/libarchive@1271f775d

Bugfixes:
OSS-Fuzz #44843 (security):
  RAR reader: fix null-dereference in RAR (v4) filter code

Obtained from: libarchive
Libarchive commit: 1271f775dc917798ad7d03c3b3bd66bacad03603

2 years agocpufreq: dt: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:04:09 +0000 (11:04 +0100)]
cpufreq: dt: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agotwsi: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:03:57 +0000 (11:03 +0100)]
twsi: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoaudio_soc: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:03:38 +0000 (11:03 +0100)]
audio_soc: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoif_dwc: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:03:25 +0000 (11:03 +0100)]
if_dwc: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm: allwinner: a33_codec: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:03:09 +0000 (11:03 +0100)]
arm: allwinner: a33_codec: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm: allwinner: a10_timer: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:02:53 +0000 (11:02 +0100)]
arm: allwinner: a10_timer: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agopmic: rockchip: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:55:43 +0000 (10:55 +0100)]
pmic: rockchip: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm: allwinner: clk: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:55:07 +0000 (10:55 +0100)]
arm: allwinner: clk: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm64: allwinner: aw_usb3phy: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:54:47 +0000 (10:54 +0100)]
arm64: allwinner: aw_usb3phy: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm64: allwinner: aw_i2s: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:54:17 +0000 (10:54 +0100)]
arm64: allwinner: aw_i2s: Plug set but not used variable
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm: allwinner: aw_gpio: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:53:58 +0000 (10:53 +0100)]
arm: allwinner: aw_gpio: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm64: allwinner: axp81x: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:39:05 +0000 (10:39 +0100)]
arm64: allwinner: axp81x: Plug set but not used variable
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoarm64: allwinner: aw_sid: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:38:06 +0000 (10:38 +0100)]
arm64: allwinner: aw_sid: Plug set but not used variable
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agomlx5core: Add PCI IDs for ConnectX-8.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:45 +0000 (09:25 +0100)]
mlx5core: Add PCI IDs for ConnectX-8.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5ib: Add support for NDR link speed.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:29 +0000 (09:25 +0100)]
mlx5ib: Add support for NDR link speed.

The IBTA specification has new speed - NDR. That speed supports signaling
rate of 100Gb. mlx5 IB driver translates link modes reported by ConnectX
device to IB speed and width. Added translation of new 100Gb, 200Gb and
400Gb link modes to NDR IB type and width of x1, x2 or x4 respectively.

Linux commits:
f946e45f59ef01ff54ffb3b1eba3a8e7915e7326

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5core: Add PCI IDs for ConnectX-7.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:23 +0000 (09:25 +0100)]
mlx5core: Add PCI IDs for ConnectX-7.

Linux commits:
505a7f5478062c6cd11e22022d9f1bf64cd8eab3
dd8595eabeb486d41ad9994e6cece36e0e25e313

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoibcore: Add support for NDR link speed.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:10 +0000 (09:25 +0100)]
ibcore: Add support for NDR link speed.

Add new IBTA speed NDR, supporting signaling rate of 100Gb.

Linux commit:
c7adf7717301558e8852949d8e3dc3748d1a4a97

MFC after: 1 week
Sponsored by: NVIDIA Networking