]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoOptionalObsoleteFiles: remove ping with INET & INET6 disabled
Ed Maste [Sun, 28 Nov 2021 18:23:29 +0000 (13:23 -0500)]
OptionalObsoleteFiles: remove ping with INET & INET6 disabled

Reported by: kevans
Fixes: a4ef9e58bc0c ("sbin: build ping if at least one of...")
Sponsored by: The FreeBSD Foundation

2 years agosbin: build ping if at least one of INET & INET6 is enabled
Ed Maste [Sun, 28 Nov 2021 17:50:13 +0000 (12:50 -0500)]
sbin: build ping if at least one of INET & INET6 is enabled

It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
in ping to make this case clear.

PR: 260082
Sponsored by: The FreeBSD Foundation

2 years agoRemove options VESA from x86 GENERIC
Ed Maste [Sat, 27 Nov 2021 20:27:45 +0000 (15:27 -0500)]
Remove options VESA from x86 GENERIC

options VESA / vesa.ko provides VESA Bios Extensions (VBE) support for
the legacy sc(4) console.  It is not used by the default console, vt(4).

There is a report[1] of an incompatibility between VESA and the Nvidia
driver breaking suspend/resume.  Since VESA is not used by the default
configuration anyway, just remove options VESA from GENERIC.  The kernel
module is still available and may be loaded by sc(4) users who want to
select a VBE mode.

(Note that vt(4) does not support selecting a VBE mode.  The loader can
set a VBE mode and vt(4) will use it via the vt_vbefb driver.)

[1] https://lists.freebsd.org/archives/freebsd-hackers/2021-November/000469.html

PR: 253733
Reported by: Stefan Blachmann [1]
Reviewed by: imp, manu, tsoome
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33141

2 years agolinker_kldload_busy(): allow recursion
Konstantin Belousov [Fri, 12 Nov 2021 19:45:06 +0000 (21:45 +0200)]
linker_kldload_busy(): allow recursion

Some drivers recursively loads modules by explicit calls to kldload
during initialization, which might occur during kldload.

PR: 259748
Reported and tested by: thj
Reviewed by: markj
Sponsored by: Nvidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32972

2 years agoDisable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack
Li-Wen Hsu [Sun, 28 Nov 2021 06:58:21 +0000 (14:58 +0800)]
Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack

PR: 259969
Sponsored by: The FreeBSD Foundation

2 years agonfscl: Disable use of the LookupOpen RPC
Rick Macklem [Sat, 27 Nov 2021 23:34:45 +0000 (15:34 -0800)]
nfscl: Disable use of the LookupOpen RPC

The LookupOpen RPC reduces the number of Open RPCs
needed.  Unfortunately, it breaks certain software
builds over NFS, so disable it until this is fixed.

The LookupOpen RPC is only used for NFSv4.1/4.2
mounts when the "oneopenown" mount option is
specified, so this should not affect many users.

2 years agovfs: fully lockless v_writecount adjustment
Mateusz Guzik [Fri, 26 Nov 2021 12:33:28 +0000 (13:33 +0100)]
vfs: fully lockless v_writecount adjustment

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

2 years agovfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF
Mateusz Guzik [Tue, 18 May 2021 10:47:21 +0000 (12:47 +0200)]
vfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF

This allows to stop maintaing the VI_TEXT_REF flag and consequently
opens up fully lockless v_writecount adjustment.

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

2 years agonfscl: Sanity check the Sequence slotid in reply
Rick Macklem [Sat, 27 Nov 2021 23:02:04 +0000 (15:02 -0800)]
nfscl: Sanity check the Sequence slotid in reply

The slotid in the Sequence reply must be the same as
in the request.  Check that it is the same and log
a console message if it is not, plus set it to the
correct value.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260071
MFC after: 2 weeks

2 years agoCorrect syscons description in i386 and amd64 configs
Ed Maste [Sat, 27 Nov 2021 21:15:41 +0000 (16:15 -0500)]
Correct syscons description in i386 and amd64 configs

Commit 2d6f6d63733d switched to vt(4) as the default console.

Sponsored by: The FreeBSD Foundation

2 years agoKeep running fsck_ffs as long as "WAS MODIFIED" is reported
Peter Holm [Sat, 27 Nov 2021 10:54:53 +0000 (10:54 +0000)]
Keep running fsck_ffs as long as "WAS MODIFIED" is reported

2 years agoHyper-V: vPCI: Prepopulate device bars
Wei Hu [Sat, 27 Nov 2021 06:42:34 +0000 (06:42 +0000)]
Hyper-V: vPCI: Prepopulate device bars

In recent Hyper-V releases on Windows Server 2022, vPCI code does not
initialize the last 4 bit of device bar registers. This behavior change
could result weird problems cuasing PCI code failure when configuring
bars.

Just write all 1's to those bars whose probed values are not the same
as current read ones. This seems to make Hyper-V vPCI and
pci_write_bar() to cooperate correctly on these releases.

Reported by: khng@freebsd.org
Tested by: khng@freebsd.org
MFC after: 2 weeks
Sponsored by: Microsoft

2 years agoxhci: Add PCI IDs from recent Intel CPUs.
Alexander Motin [Sat, 27 Nov 2021 01:35:12 +0000 (20:35 -0500)]
xhci: Add PCI IDs from recent Intel CPUs.

MFC after: 2 weeks

2 years agonfsd: Sanity check the len argument for ListXattr
Rick Macklem [Fri, 26 Nov 2021 23:56:29 +0000 (15:56 -0800)]
nfsd: Sanity check the len argument for ListXattr

The check for the original len being >= retlen needs to
be done before the "if (nd->nd_repstat == 0)" code, so
that it can be reported as too small.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260046
MFC after: 2 weeks

2 years agonfsd: Add checks for layout errors in LayoutReturn
Rick Macklem [Fri, 26 Nov 2021 23:42:32 +0000 (15:42 -0800)]
nfsd: Add checks for layout errors in LayoutReturn

For a LayoutReturn when using the Flexible File Layout,
error reports may be provided in the request.
Sanity check the size of these error reports and
check that they exist before calling nfsrv_flexlayouterr().

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260012
MFC after: 2 weeks

2 years agonfscl: Sanity check irdcnt in nfsrpc_createsession
Rick Macklem [Fri, 26 Nov 2021 23:28:40 +0000 (15:28 -0800)]
nfscl: Sanity check irdcnt in nfsrpc_createsession

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 259996
MFC after: 2 weeks

2 years agotmpfs: add vop_stdadd_writecount_nomsync to fifo vnode ops
Mateusz Guzik [Fri, 26 Nov 2021 19:29:49 +0000 (19:29 +0000)]
tmpfs: add vop_stdadd_writecount_nomsync to fifo vnode ops

Reported by: yasu
Fixes: 3ffcfa599e29686c ("vfs: add vop_stdadd_writecount_nomsync")
2 years agosrc.conf: regenerate
Warner Losh [Fri, 26 Nov 2021 19:22:48 +0000 (12:22 -0700)]
src.conf: regenerate

2 years agoMK_NAND: this option was retired some time ago
Warner Losh [Fri, 26 Nov 2021 19:16:03 +0000 (12:16 -0700)]
MK_NAND: this option was retired some time ago

Remove the now-bogus WITH_NAND and WITHOUT_NAND flags.

Sponsored by: Netflix

2 years agoPer-thread stack canary on arm64
Andrew Turner [Mon, 22 Nov 2021 15:20:51 +0000 (15:20 +0000)]
Per-thread stack canary on arm64

With the update to llvm 13 we are able to tell the compiler it can find
the SSP canary relative to the register that holds the userspace stack
pointer. As this is unused in most of the kernel it can be used here
to point to a per-thread SSP canary.

As the kernel could be built with an old toolchain, e.g. when upgrading
from 13, add a warning that the options was enabled but the compiler
doesn't support it to both the build and kernel boot.

Discussed with: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33079

2 years agoHoist cddl prebuild lib dependency definitions out of a MK_ZFS block
Mark Johnston [Fri, 26 Nov 2021 14:27:19 +0000 (09:27 -0500)]
Hoist cddl prebuild lib dependency definitions out of a MK_ZFS block

The compilation of several libraries under cddl/lib is not conditional
on MK_ZFS = "yes", so their dependency on libspl is not conditional
either.  Unbreak buildworld when WITHOUT_ZFS is set.

Reported by: bz
Fixes: 9e9c651caceb ("cddl: fix missing ZFS library dependencies")
MFC after: 1 week

2 years agotwsi: support more message combinations in transfers
Andriy Gapon [Fri, 26 Nov 2021 09:48:21 +0000 (11:48 +0200)]
twsi: support more message combinations in transfers

Most prominently, add support for a transfer where a write with no-stop
flag is followed by a write with no-start flag.  Logically, it's a
single larger write, but consumers may want to split it like that
because one part can be a register ID and the other part can be data to
be written to (or starting at) that register.

Such a transfer can be created by i2c tool and iic(4) driver, e.g., for
an EEPROM write at specific offset:
    i2c -m tr -a 0x50 -d w -w 16 -o 0 -c 8 -v < /dev/random

This should be fixed by new code that handles the end of data transfer
for both reads and writes.  It handles two existing conditions and one
new.  Namely:
- the last message has been completed -- end of transfer;
- a message has been completed and the next one requires the start
  condition;
- a message has been completed and the next one should be sent without
  the start condition.

In the last case we simply switch to the next message and start sending
its data.  Reads without the start condition are not supported yet,
though.  That's because we NACK the last byte of the previous message,
so the device stops sending data.  To fix this we will need to add a
look-ahead at the next message when handling the penultimate byte of the
current one.

This change also fixed a bug where msg_idx was not incremented after a
read message.  Apparently, typically a read message is a last message in
a transfer, so the bug did not cause much trouble.

PR: 258994
MFC after: 3 weeks

2 years agotwsi: make data receiving code safer
Andriy Gapon [Fri, 26 Nov 2021 08:34:42 +0000 (10:34 +0200)]
twsi: make data receiving code safer

Assert that we are not receiving data beyond the requested length.
Assert that we have not NACK-ed incoming data prematurely.
Abort the current transfer if the incoming data is NACK-ed or not
NACK-ed unexpectedly.

Add debug logging of received data to complement logging of sent data.

MFC after: 3 weeks

2 years agotwsi: remove redundant write of control register
Andriy Gapon [Fri, 26 Nov 2021 08:09:59 +0000 (10:09 +0200)]
twsi: remove redundant write of control register

The write at the end of twsi_intr() already handles all cases, no need
to have another write for TWSI_STATUS_START / TWSI_STATUS_RPTD_START.

MFC after: 3 weeks

2 years agotwsi: move handling of TWSI_CONTROL_ACK into the state machine
Andriy Gapon [Fri, 26 Nov 2021 08:07:27 +0000 (10:07 +0200)]
twsi: move handling of TWSI_CONTROL_ACK into the state machine

Previously the code set TWSI_CONTROL_ACK in twsi_transfer() based on
whether the first message had a length of one.  That was done regardless
of whether the message was a read or write and what kind of messages
followed it.
Now the bit is set or cleared while handling TWSI_STATUS_ADDR_R_ACK
state transition based on the current (read) message.

The old code did not correctly work in a scenario where a single byte
was read from an EEPROM device with two byte addressing.
For example:
    i2c -m tr -a 0x50 -d r -w 16 -o 0 -c 1 -v
The reason is that the first message (a write) has two bytes, so
TWSI_CONTROL_ACK was set and never cleared.
Since the controller did not send NACK the EEPROM sent more data resulting
in a buffer overrun.

While working on TWSI_STATUS_ADDR_R_ACK I also added support for
the zero-length read access and then I did the same for zero-length write
access.
While rare, those types of I2C transactions are completely valid and are
used by some devices.

PR: 258994
MFC after: 3 weeks

2 years agotwsi: unify error handling, explicitly handle more conditions
Andriy Gapon [Fri, 26 Nov 2021 07:44:30 +0000 (09:44 +0200)]
twsi: unify error handling, explicitly handle more conditions

twsi_error() is a new function that stops the current transfer and sets
up softc when an error condition is detected.
TWSI_STATUS_DATA_WR_NACK, TWSI_STATUS_BUS_ERROR and
TWSI_STATUS_ARBITRATION_LOST are now handled explicitly rather than
via the catch-all unknown status.

Also, twsi_intr() now calls wakeup() in a single place when the
transfer is finished.

MFC after: 2 weeks

2 years agotwsi: improve a handful of debug messages
Andriy Gapon [Fri, 26 Nov 2021 07:34:28 +0000 (09:34 +0200)]
twsi: improve a handful of debug messages

- use 0x prefix for hex values
- print indexes and counts as decimals
- break too long lines

MFC after: 2 weeks

2 years agotwsi: do not attempt transfer if bus is not idle
Andriy Gapon [Fri, 26 Nov 2021 07:30:38 +0000 (09:30 +0200)]
twsi: do not attempt transfer if bus is not idle

MFC after: 2 weeks

2 years agotwsi: remove redundant enabling of the controller
Andriy Gapon [Fri, 26 Nov 2021 07:28:18 +0000 (09:28 +0200)]
twsi: remove redundant enabling of the controller

MFC after: 2 weeks

2 years agotwsi: protect interaction between twsi_transfer and twsi_intr
Andriy Gapon [Fri, 26 Nov 2021 07:25:01 +0000 (09:25 +0200)]
twsi: protect interaction between twsi_transfer and twsi_intr

All accesses to softc are now done under a mutex to prevent data races
between the open context and the interrupt handler.
Additionally, the wait time in twsi_transfer is bounded now.
Previously we could get stuck there forever if an interrupt got lost.

MFC after: 2 weeks

2 years agotwsi: compile in support for debug messages, disabled by default
Andriy Gapon [Fri, 26 Nov 2021 06:52:56 +0000 (08:52 +0200)]
twsi: compile in support for debug messages, disabled by default

Debug messages can now be enabled per driver instance via a new sysctl.
Also, debug messages in TWSI_READ and TWSI_WRITE require debug level
greater than 1 as they are mostly redundant because callers of those
functions already log most interesting results.

NB: the twsi drivers call their device iichb, so the new sysctl will
appear under dev.iichb.N.

MFC after: 1 week

2 years agotwsi: remove write-only softc field
Andriy Gapon [Fri, 26 Nov 2021 06:45:12 +0000 (08:45 +0200)]
twsi: remove write-only softc field

MFC after: 1 week

2 years agotwsi: add more of status definitions
Andriy Gapon [Fri, 26 Nov 2021 06:30:22 +0000 (08:30 +0200)]
twsi: add more of status definitions

For completeness and for future use.

MFC after: 1 week

2 years agotwsi: sort headers, remove unneeded
Andriy Gapon [Fri, 26 Nov 2021 06:28:41 +0000 (08:28 +0200)]
twsi: sort headers, remove unneeded

MFC after: 1 week

2 years agosctp: improve consistency, no functional change intended
Michael Tuexen [Fri, 26 Nov 2021 11:53:12 +0000 (12:53 +0100)]
sctp: improve consistency, no functional change intended

2 years agovfs: plug a set-but-not-used var in kern_alternate_path
Mateusz Guzik [Fri, 26 Nov 2021 12:22:09 +0000 (12:22 +0000)]
vfs: plug a set-but-not-used var in kern_alternate_path

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

2 years agovfs: add vop_stdadd_writecount_nomsync
Mateusz Guzik [Fri, 26 Nov 2021 09:02:19 +0000 (10:02 +0100)]
vfs: add vop_stdadd_writecount_nomsync

This avoids needing to inspect the mount point every time.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D33125

2 years agoFix build with -DNO_ROOT
Fernando ApesteguĂ­a [Fri, 26 Nov 2021 10:55:50 +0000 (11:55 +0100)]
Fix build with -DNO_ROOT

The inclusion of 0a0f7486413c broke the build with the -DNO_ROOT option.
Specifically, that commit adds some relative paths (with `..`) to METALOG
that make other tools using that log, fail afterwards (tar, makefs...).

It's been argued[1] if this is really something mtree(8) should handle more
graciously. In the meantime, fix the breakage but changing the order in which
the links are created: first in the parent directory, then in the
architecture-specific one.

We keep the architecture-specific directories an the links to the parent
directories. This is something that we might want to change in the future.

This commit is based on a concept patch by avg@.

[1] https://lists.freebsd.org/archives/dev-commits-src-all/2021-November/index.html

Reported by: bapt@, emaste@
Approved by: avg@
Fixes: 0a0f7486413c
Differential Revision: https://reviews.freebsd.org/D33126

2 years agosctp: add some asserts, no functional changes intended
Michael Tuexen [Fri, 26 Nov 2021 11:19:33 +0000 (12:19 +0100)]
sctp: add some asserts, no functional changes intended

This might help in narrowing down
https://syzkaller.appspot.com/bug?id=fbd79abaec55f5aede63937182f4247006ea883b

2 years agopci_vendors: update to 2021-11-24
Baptiste Daroussin [Fri, 26 Nov 2021 07:52:20 +0000 (08:52 +0100)]
pci_vendors: update to 2021-11-24

2 years agoEC2: Turn off IPv6 DAD
Colin Percival [Tue, 23 Nov 2021 04:16:34 +0000 (20:16 -0800)]
EC2: Turn off IPv6 DAD

Disable Duplicate Address Detection in EC2 instances.  The networking
configuration in EC2, with IPv6 addresses assigned by DHCPv6 and
host egress filtering, makes "duplicate addresses" impossible.

This speeds up the boot process in EC2 by 2 seconds.

Reviewed by: kp, imp, bz
MFC after: 2 weeks
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33091

2 years agoetc/defaults/rc.conf: Add -i flag to rtsol/rtsold
Colin Percival [Mon, 22 Nov 2021 21:51:43 +0000 (13:51 -0800)]
etc/defaults/rc.conf: Add -i flag to rtsol/rtsold

This disables the random (between zero and one seconds) delay before
rtsol and rtsold send a a Router Solicitation packet.  This delay is
specified as a SHOULD by RFC 4861 for avoidance of network congestion,
but network speeds have increased enough in the 25 years since this
first appeared (in RFC 1970) that it seems unnecessary as a default
at this point.

This speeds up the FreeBSD boot process by an average of 500 ms.

Reviewed by: kp
MFC after: 1 week
Relnotes: yes
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33089

2 years agoarch.7: update applicable FreeBSD versions to 12.0 and later
Ed Maste [Thu, 25 Nov 2021 18:50:03 +0000 (13:50 -0500)]
arch.7: update applicable FreeBSD versions to 12.0 and later

Information in this document is unchanged between 11.x and 12.x, but
this is intended to be a quick reference for supported architectures.
Also bump .Dd to cover recent changes including MIPS deprecation.

Sponsored by: The FreeBSD Foundation

2 years agohwpmc: Add IDs for Intel Comet/Ice/Tiger/Rocketlake CPUs.
Alexander Motin [Fri, 26 Nov 2021 00:17:58 +0000 (19:17 -0500)]
hwpmc: Add IDs for Intel Comet/Ice/Tiger/Rocketlake CPUs.

MFC after: 1 month

2 years agovfs: remove the unused thread argument from NDINIT*
Mateusz Guzik [Thu, 25 Nov 2021 21:43:06 +0000 (21:43 +0000)]
vfs: remove the unused thread argument from NDINIT*

See b4a58fbf640409a1 ("vfs: remove cn_thread")

Bump __FreeBSD_version to 1400043.

2 years agovfs: drop the always curthread argument from kern_alternate_path
Mateusz Guzik [Thu, 25 Nov 2021 21:42:42 +0000 (21:42 +0000)]
vfs: drop the always curthread argument from kern_alternate_path

2 years agolinux: remove the always curthread argument from lconvpath
Mateusz Guzik [Thu, 25 Nov 2021 21:42:13 +0000 (21:42 +0000)]
linux: remove the always curthread argument from lconvpath

2 years agolink_elf_obj: Process global ifunc relocs after other global relocs
Mark Johnston [Thu, 25 Nov 2021 21:52:17 +0000 (16:52 -0500)]
link_elf_obj: Process global ifunc relocs after other global relocs

This is needed to ensure that resolvers that reference global symbols
return correct results.

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

2 years agork_spi: declare support for rk3328
Andriy Gapon [Thu, 25 Nov 2021 21:12:11 +0000 (23:12 +0200)]
rk_spi: declare support for rk3328

Tested on Rock64 using the onboard SPI flash.

MFC after: 1 week

2 years agopowerpc64: make autoboot possible on powernv machines
Alfredo Dal'Ava Junior [Fri, 26 Nov 2021 00:02:53 +0000 (21:02 -0300)]
powerpc64: make autoboot possible on powernv machines

It's required to specify a default boot option in order to make
petitboot's autoboot feature work.

Tested on Raptor Blackbird

Reviewed by: imp, luporl
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D32838

2 years agopowerpc64le: fix boot when using QEMU PowerNV
Leandro Lupori [Thu, 25 Nov 2021 19:41:46 +0000 (16:41 -0300)]
powerpc64le: fix boot when using QEMU PowerNV

When using QEMU PowerNV with latest op-build release (v2.7), its
kexec transfers control to FreeBSD kernel in BE mode, causing an
instant exception on LE kernels. Make kboot able to detect and
swap endian to fix this.

Reviewed by: imp
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33104

2 years agovt: export RGB offsets with FBIO_GETRGBOFFS
Leandro Lupori [Thu, 25 Nov 2021 18:54:11 +0000 (15:54 -0300)]
vt: export RGB offsets with FBIO_GETRGBOFFS

Add a new ioctl to vt to make it possible to export RGB offsets
set by vt drivers. This is needed to fix colors on X and Mesa
on some machines, especially on modern PowerPC64 BE ones.

With the appropriate changes in SCFB, to use this ioctl to find
out the correct RGB offsets, this fixes wrong colors on Talos II
and Blackbird, when used with their built-in video cards.

Reviewed by: alfredo
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D29000

2 years agoswap_pager: lock vnode in swapdev_strategy()
Konstantin Belousov [Wed, 24 Nov 2021 11:26:46 +0000 (13:26 +0200)]
swap_pager: lock vnode in swapdev_strategy()

VOP_STRATEGY() requires locked vnode.  Note that we lock the swap vnode
while pages are busy, but this would only cause real LoR if pages belong
to the swap vnode, which must not be the case for correct use.

Reported and tested by: peterj
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33119

2 years agoswapon: extend the region where the swap vnode is locked
Konstantin Belousov [Wed, 24 Nov 2021 03:06:02 +0000 (05:06 +0200)]
swapon: extend the region where the swap vnode is locked

to cover VOP_GETATTR() call in sys_swapon().  Move locking from inside
swapongeom() and swaponvp() into sys_swapon().

Reported by and tested by: peterj
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33119

2 years agoswap pager: lock vnode around VOP_CLOSE()
Konstantin Belousov [Tue, 23 Nov 2021 09:16:53 +0000 (11:16 +0200)]
swap pager: lock vnode around VOP_CLOSE()

Reported and tested by: peterj
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33119

2 years agoarch.7: move discontinued CPU archs to own table
Ed Maste [Thu, 25 Nov 2021 02:13:04 +0000 (21:13 -0500)]
arch.7: move discontinued CPU archs to own table

With MIPS' retirement we now have more discontinued architectures than
supported ones, making the table somewhat unclear.  Split the table in
two.

Reviewed by: allanjude
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33110

2 years agomake_dev.9: Fix a typo
Mark Johnston [Thu, 25 Nov 2021 16:32:30 +0000 (11:32 -0500)]
make_dev.9: Fix a typo

MFC after: 1 week

2 years agoagp: Handle multiple devices more gracefully
Mark Johnston [Thu, 25 Nov 2021 16:27:49 +0000 (11:27 -0500)]
agp: Handle multiple devices more gracefully

Currently agp(4) effectively assumes that only one driver instance
exists, as the generic attach routine attempts to create /dev/agpgart
and triggers a panic if it already exists.  Instead, handle this
situation by creating /dev/agpgart<unit> and making /dev/agpgart an
alias of /dev/agpgart0 for compatibility.

PR: 187015
Reviewed by: imp, kib
Tested by: Yoshihiro Ota <ota@j.email.ne.jp> (earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33068

2 years agolibpmc: Update some x86 event definitions.
Alexander Motin [Thu, 25 Nov 2021 16:19:26 +0000 (11:19 -0500)]
libpmc: Update some x86 event definitions.

MFC after: 1 month

2 years agousb/u3g: Add support for Quectel EM05.
Hans Petter Selasky [Thu, 25 Nov 2021 14:27:50 +0000 (15:27 +0100)]
usb/u3g: Add support for Quectel EM05.

Pull Request: https://github.com/freebsd/freebsd-src/pull/565
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agommc: plug set-but-not-used vars
Mateusz Guzik [Thu, 25 Nov 2021 12:10:27 +0000 (12:10 +0000)]
mmc: plug set-but-not-used vars

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

2 years agostress2: Added an option to set the file size. Added missing error checks
Peter Holm [Thu, 25 Nov 2021 11:44:59 +0000 (12:44 +0100)]
stress2: Added an option to set the file size.  Added missing error checks

2 years agogeom_multipath: plug set-but-not-used vars
Mateusz Guzik [Thu, 25 Nov 2021 11:31:50 +0000 (11:31 +0000)]
geom_multipath: plug set-but-not-used vars

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

2 years agofdc: plug set-but-not-used vars
Mateusz Guzik [Thu, 25 Nov 2021 11:25:11 +0000 (11:25 +0000)]
fdc: plug set-but-not-used vars

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

2 years agoamr.4: Remove man page
Warner Losh [Thu, 25 Nov 2021 09:49:15 +0000 (02:49 -0700)]
amr.4: Remove man page

Sponsored by: Netflix

2 years agopci: Don't try to read cfg registers of non-existing devices
Kornel Duleba [Tue, 23 Nov 2021 08:13:56 +0000 (09:13 +0100)]
pci: Don't try to read cfg registers of non-existing devices

Instead of returning 0xffs some controllers, such as Layerscape generate
an external exception when someone attempts to read any register
of config space of a non-existing device other than PCIR_VENDOR.
This causes a kernel panic.
Fix it by bailing during device enumeration if a device vendor register
returns invalid value. (0xffff)
Use this opportunity to replace some hardcoded values with a macro.

I believe that this change won't have any unintended side-effects since
it is safe to assume that vendor == 0xffff -> hdr_type == 0xffff.

Sponsored by: Alstom
Obtained from: Semihalf
Reviewed by: jhb
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D33059

2 years agoObsoleteFiles: Remove old CAM driver man pages
Warner Losh [Thu, 25 Nov 2021 07:22:08 +0000 (00:22 -0700)]
ObsoleteFiles: Remove old CAM driver man pages

Add the old man pages to ObsoleteFiles for amr, esp iir, mly and twa
that were slated to be removed before 13.0, but were overlooked.

Sponsored by: Netflix

2 years agotwa: Remove
Warner Losh [Thu, 25 Nov 2021 07:21:41 +0000 (00:21 -0700)]
twa: Remove

Belatedly remove twa(4). It was supposed to go before 13.0, but was
overlooked.

Sponsored by: Netflix
Relnotes: yes
Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D33114

2 years agoesp: Remove
Warner Losh [Thu, 25 Nov 2021 07:21:24 +0000 (00:21 -0700)]
esp: Remove

Belatedly remove esp(4). It was tagged as gone in 13, but was overlooked
until now.

Sponsored by: Netflix
Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D33115

2 years agoamr: remove
Warner Losh [Thu, 25 Nov 2021 07:20:51 +0000 (00:20 -0700)]
amr: remove

Belatedly remove amr(4). It was slated to depart before 13.0 but was
overlooked until now.

Sponsored by: Netflix
Relnotes: yes
Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D33113

2 years agoiir: Remove
Warner Losh [Thu, 25 Nov 2021 07:20:31 +0000 (00:20 -0700)]
iir: Remove

Belatedly remove iir(4). It was slated to go before 13, but was
overlooked.

Sponsored by: Netflix
Relnotes: yes
Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D33112

2 years agomly: Remove.
Warner Losh [Thu, 25 Nov 2021 07:20:10 +0000 (00:20 -0700)]
mly: Remove.

We'd said this was going away in 13, but was overlooked. Belatedly
remove.

Sponsored by: Netflix
Relnotes: yes
Reviewed by: scottl
Differential Revision: https://reviews.freebsd.org/D33111

2 years agoAPEI: Fix Generic Error Data Entry revision 3.0 handling.
Alexander Motin [Thu, 25 Nov 2021 04:03:20 +0000 (23:03 -0500)]
APEI: Fix Generic Error Data Entry revision 3.0 handling.

Since revision 3.0 this structure grown another field, breaking access
to the following data structures.  This change fixes the PCIe errors
decoding on newer systems.

MFC after: 2 weeks

2 years agoFix "set but not used" warnings in the ciss driver.
Scott Long [Thu, 25 Nov 2021 03:33:39 +0000 (03:33 +0000)]
Fix "set but not used" warnings in the ciss driver.

2 years agoFix "set but not used" warnings in the mpr driver. This fixes a minor
Scott Long [Thu, 25 Nov 2021 03:28:29 +0000 (03:28 +0000)]
Fix "set but not used" warnings in the mpr driver.  This fixes a minor
bug in error handling.

2 years agoFix "set but not used" warnings in the mps driver.
Scott Long [Thu, 25 Nov 2021 03:23:02 +0000 (03:23 +0000)]
Fix "set but not used" warnings in the mps driver.

2 years agoFix "set but not used" warnings in CAM.
Scott Long [Thu, 25 Nov 2021 03:17:54 +0000 (03:17 +0000)]
Fix "set but not used" warnings in CAM.

2 years agoFix "set but not used" warnings in mfi. The one in mfi.c:mfi_data_cb()
Scott Long [Thu, 25 Nov 2021 02:41:18 +0000 (02:41 +0000)]
Fix "set but not used" warnings in mfi.  The one in mfi.c:mfi_data_cb()
was a hidden but likely harmless mistake.  The rest were just old code
that was OBE.

2 years agosh: Avoid some headers when NO_HISTORY is set.
Bryan Drewery [Thu, 25 Nov 2021 01:52:11 +0000 (17:52 -0800)]
sh: Avoid some headers when NO_HISTORY is set.

This is more simpler compatibility with using this source on older
systems before libedit was made to install filecomplete.h in
commit b315a7296d2.

2 years agoig4: Add PCI IDs for Intel Alder Lake I2C controller.
Alexander Motin [Thu, 25 Nov 2021 01:13:38 +0000 (20:13 -0500)]
ig4: Add PCI IDs for Intel Alder Lake I2C controller.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

2 years agoldconfig(8): check for no-args command line after options are parsed
Konstantin Belousov [Fri, 19 Nov 2021 04:07:58 +0000 (06:07 +0200)]
ldconfig(8): check for no-args command line after options are parsed

Default action for ldconfig is specified as -R AKA 'append', and for
no-args (without options changing default actions), ldconfig should
append empty list of directories to current list.  But because the check
was done before options were parsed out, presence of any option turned
off default rescan.

As result, innocently-looked commands like `ldconfig -v' were interpreted
as setting directory hints list to one specified on the command line,
i.e. empty.

Reported by: https://github.com/mesonbuild/meson/issues/9592
Reviewed by: emaste
Tested by: jbeich
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33058

2 years agoldconfig: use libexec/rtld-elf/rtld_paths.h
Konstantin Belousov [Fri, 19 Nov 2021 03:45:31 +0000 (05:45 +0200)]
ldconfig: use libexec/rtld-elf/rtld_paths.h

instead of duplicating definitions using slighly different macro names.

Reviewed by: emaste
Tested by: jbeich
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33058

2 years agortld_paths.h: Provide _PATH_ELF32_HINTS string, unconditionally
Konstantin Belousov [Fri, 19 Nov 2021 03:44:33 +0000 (05:44 +0200)]
rtld_paths.h: Provide _PATH_ELF32_HINTS string, unconditionally

Reviewed by: emaste
Tested by: jbeich
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33058

2 years agoldconfig(8): nostd/-s does nothing
Konstantin Belousov [Fri, 19 Nov 2021 05:21:21 +0000 (07:21 +0200)]
ldconfig(8): nostd/-s does nothing

Remove the option from man page and summary.  Silently ignore it when
parsing command line for backward compatibility.

Reviewed by: emaste
Tested by: jbeich
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33058

2 years agoldconfig: start of cleanup
Konstantin Belousov [Fri, 19 Nov 2021 03:35:50 +0000 (05:35 +0200)]
ldconfig: start of cleanup

Use bool.
Use local variables instead of static.
Remove non-functional debugging override of hints file path.
Use explicit exit() instead of return from main.
Minor style tweaks.

Reviewed by: emaste
Tested by: jbeich
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33058

2 years agoldconfig: remove a comment which is another remnant of a.out support
Konstantin Belousov [Wed, 24 Nov 2021 20:44:20 +0000 (22:44 +0200)]
ldconfig: remove a comment which is another remnant of a.out support

Noted and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33058

2 years agoext2: plug set-but-not-used vars
Mateusz Guzik [Wed, 24 Nov 2021 22:59:51 +0000 (22:59 +0000)]
ext2: plug set-but-not-used vars

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

2 years agoLinuxKPI: USB return possible error from suspend/resume
Bjoern A. Zeeb [Wed, 24 Nov 2021 21:28:46 +0000 (21:28 +0000)]
LinuxKPI: USB return possible error from suspend/resume

USB suspend/resume cannot fail so we never returned the error which
resulted in a -Wunused-but-set-variable warning.
Initialize the return variable and return a possible error possibly
triggering a printf upstream to at least have a trace of the problem.
This also fixes the warning.

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

2 years agoLinuxKPI: fix -Wunused-but-set-variable warnings
Bjoern A. Zeeb [Wed, 24 Nov 2021 21:20:52 +0000 (21:20 +0000)]
LinuxKPI: fix -Wunused-but-set-variable warnings

Handle write-only variables by removing the unused return value from void
functions or removing the unused variables entirely.

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

2 years agounionfs: plug a set-but-not-unused var
Mateusz Guzik [Wed, 24 Nov 2021 21:31:35 +0000 (21:31 +0000)]
unionfs: plug a set-but-not-unused var

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

2 years agoif_epair: ifdef vars only used with ALTQ
Mateusz Guzik [Wed, 24 Nov 2021 21:28:54 +0000 (21:28 +0000)]
if_epair: ifdef vars only used with ALTQ

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

2 years agofdescfs: plug a set-but-not-unused var
Mateusz Guzik [Wed, 24 Nov 2021 21:25:24 +0000 (21:25 +0000)]
fdescfs: plug a set-but-not-unused var

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

2 years agogeom_journal: plug set-but-not-unused vars
Mateusz Guzik [Wed, 24 Nov 2021 21:21:59 +0000 (21:21 +0000)]
geom_journal: plug set-but-not-unused vars

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

2 years agolinprocfs: plug set-but-not-unused vars
Mateusz Guzik [Wed, 24 Nov 2021 21:18:36 +0000 (21:18 +0000)]
linprocfs: plug set-but-not-unused vars

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

2 years agolinux: plug set-but-not-unused vars
Mateusz Guzik [Wed, 24 Nov 2021 21:16:03 +0000 (21:16 +0000)]
linux: plug set-but-not-unused vars

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

2 years agoixl(4): Remove iavf(4) source files
Eric Joyner [Sat, 13 Feb 2021 00:04:54 +0000 (16:04 -0800)]
ixl(4): Remove iavf(4) source files

Since iavf(4) no longer shares code with ixl(4) as of commit
f2fbd56a8d07665bc0a5e8b7e40026b50a591e2a and now has its own directory,
remove these now-unused iavf(4)-only files.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D28638

2 years agoiavf(4): Split source and update to 3.0.26-k
Eric Joyner [Fri, 12 Feb 2021 21:28:18 +0000 (13:28 -0800)]
iavf(4): Split source and update to 3.0.26-k

The iavf(4) driver now uses a different source base from ixl(4), since
it will be the standard VF driver for new Intel Ethernet products going
forward, including ice(4). It continues to use the iflib framework
for network drivers.

Since it now uses a different source code base, this commit adds a new
sys/dev/iavf entry, but it re-uses the existing module name so no
configuration changes are necessary.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: kbowling@
Tested by: lukasz.szczepaniak@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D28636

2 years agoAdd ncurses/form to _prebuild_libs to fix build
Ed Maste [Wed, 24 Nov 2021 18:56:38 +0000 (13:56 -0500)]
Add ncurses/form to _prebuild_libs to fix build

Reported by: bz

2 years agovm_fault: Factor out per-object operations into vm_fault_object()
Mark Johnston [Wed, 24 Nov 2021 18:43:38 +0000 (13:43 -0500)]
vm_fault: Factor out per-object operations into vm_fault_object()

No functional change intended.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33018

2 years agovm_fault: Introduce a fault_status enum for internal return types
Mark Johnston [Wed, 24 Nov 2021 18:43:26 +0000 (13:43 -0500)]
vm_fault: Introduce a fault_status enum for internal return types

Rather than overloading the meanings of the Mach statuses, introduce a
new set for use internally in the fault code.  This makes the control
flow easier to follow and provides some extra error checking when a
fault status variable is used in a switch statement.

vm_fault_lookup() and vm_fault_relookup() continue to use Mach statuses
for now, as there isn't much benefit to converting them and they
effectively pass through a status from vm_map_lookup().

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33017