Commit graph

285891 commits

Author SHA1 Message Date
Kevin Bowling 725e4008ef iflib: invert default restart on VLAN changes
In rS360398, a new iflib device method was added to opt out of VLAN
events needing an interface reset.

I am switching the default to not requiring a restart for:
* VLAN events
* unknown events

After fixing various bugs, I do not think this would be a common need
of hardware and it is undesirable from the user's perspective causing
link flaps and much slower VLAN configuration. Currently, there are no
other restart events besides VLAN events, and setting the
ifdi_needs_restart default to false will alleviate the need to churn
every driver if an odd event is added in the future for specific
hardware.

markj points out this could cause churn in the other direction; I will
solve that problem with an event registration system as he mentions in
the review should we need it in the future.

These drivers will opt into restart and need further inspection or work:
* ixv (needs code audit, 61a8231 fixed principal issue; re-init probably
not necessary)
* axgbe (needs code audit; re-init probably not necessary)
* iavf - (needs code audit; interaction with Malicious Driver Detection
mentioned in rS360398)
* mgb - no VLAN functions are currently implemented. Left a comment.

MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:48:19 -07:00
Kevin Bowling 14a14e36ae ice: Don't restart on VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

This re-init is unnecessary for ice(4).

MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:46:57 -07:00
Kevin Bowling 1d6c12c511 iavf: Add explicit ifdi_needs_reset for VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

iavf(4) was the original need for this, because VLAN filter changes
currently have negative interactions with Malicious Driver Detection.

Add iavf_if_needs_restart and explicitly enable VLAN re-init.

MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:46:56 -07:00
Kevin Bowling fe6c4e214d enic: Don't restart on VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

This re-init is unintentional for vmxnet3(4).

MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:46:56 -07:00
Kevin Bowling b6b75424c5 vmxnet3: Don't restart on VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

This re-init is unintentional for vmxnet3(4).

MFC after:      2 weeks
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D41558
2023-08-24 13:46:56 -07:00
Kevin Bowling f9e0a790ae enetc: Don't restart on VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

This re-init is unintentional for enetc(4).

MFC after:      2 weeks
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D41558
2023-08-24 13:46:56 -07:00
Kevin Bowling bce864d1c2 bnxt: Don't restart on VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

This is unintentional for bnxt(4) and is causing another bug in its VLAN
initialization code to affect the common case of adding and removing
VLANs on an existing interface.

PR:		269133
Tested by:	kp
MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:46:56 -07:00
Jake Freeland 8544651dc5 timerfd: Add manual page.
This manual page accompanies the timerfd system calls.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40218
2023-08-24 14:29:06 -06:00
Jake Freeland af93fea710 timerfd: Move implementation from linux compat to sys/kern
Move the timerfd impelemntation from linux compat code to sys/kern. Use
it to implement the new system calls for timerfd. Add a hook to kern_tc
to allow timerfd to know when the system time has stepped. Add kqueue
support to timerfd. Adjust a few names to be less Linux centric.

RelNotes: YES
Reviewed by: markj (on irc), imp, kib (with reservations), jhb (slack)
Differential Revision: https://reviews.freebsd.org/D38459
2023-08-24 14:28:56 -06:00
Dmitry Chagin f8bc606aad tests: Handle SIGSEGV in the vm stack mprotect exec test
To exit gracefully handle SIGSEGV and mark the test as failed.

MFC after:		3 days
2023-08-24 21:02:52 +03:00
Piotr Pawel Stefaniak 5c0a1c15ff ps: add a new option -D to reimplement tree traversal
It takes a non-optional parameter string, one of "up", "down", or "both"
that can request tree traversal in the chosen directions. This adds PIDs
from the paths to the selection of PIDs and can be used together with -d
to draw a subset of the process tree.

Differential Revision:	https://reviews.freebsd.org/D41231
2023-08-24 18:35:56 +02:00
Piotr Pawel Stefaniak f06e32e9b9 Revert "ps: extend the non-standard option -d (tree view) to work with -p"
This reverts commit ca8c0d5e81.

By commiting ca8c0d5e81 I was hoping that the existing option -d
could just be extended to work with -p to implement a feature that was
and I think is still needed, that is to show all descendant processes
of a given process id or a set of process ids.

After a complaint from -current which may represent a wider
dissatisfaction with this change in the program's behavior, I think it
will be better to revert ca8c0d5e81 and reintroduce this feature
using a separate option -D.
2023-08-24 18:35:50 +02:00
Michael Tuexen 847fa61fad sctp: improve handling of socket shutdown for reading
If a socket is marked as cannot read anymore, drop chunks which
should be added to a control element in the receive queue.
This is consistent with dropping control elements instead of
adding them in the same situation.

Reported by:	syzbot+291f6581cecb77097b16@syzkaller.appspotmail.com
MFC after:	1 week
2023-08-24 15:52:55 +02:00
Kajetan Staszkiewicz d10de21f2f pf: Access r->rpool.cur->kif under mutex protection
pf_route() sends traffic to a specified next hop over a specific
interface. The next hop is obtained in pf_map_addr() but the interface
is obtained directly via r->rpool.cur->kif` outside of the lock held in
pf_map_addr() in multiple places around pf. The chosen interface is not
stored in source node.

Move the interface selection into pf_map_addr(), have the function
return it together with the chosen IP address and ensure its stored
in struct pf_ksrc_node, store it in the source node and use the stored
value when needed.

Sponsored by:	InnoGames GmbH
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D41570
2023-08-24 13:05:33 +02:00
Warner Losh d9fee1d021 cam/scsi_da: Bump deprecation one release.
These are still used in a quick poll that I've done, so we can't remove
them in 14. Reset the removal to FreeBSD 15.

Sponsored by:		Netflix
2023-08-23 22:34:41 -06:00
John Baldwin 0677f5ccbb cxgbe ddp: Trim stale function prototype
Sponsored by:	Chelsio Communications
2023-08-23 14:30:16 -07:00
Mark Johnston d5b5497e10 m4 tests: Update tests after $FreeBSD$ removal
Fixes:	d54a7d3373 ("Remove $FreeBSD$: one-line m4 tag")
2023-08-23 15:44:36 -04:00
Robert Wing 760987ecd3 bectl: make mount subcommand less verbose
The mount subcommand currently produces output such as:
    # bectl mount <bootenv>
    Successfully mounted <bootenv> at <mountpoint>

This commit changes it to only print the mountpoint:
    # bectl mount <bootenv>
    <mountpoint>

This makes it easier to script the mount subcommand. If an error occurs
while mounting, an error message is printed to stderr and bectl will
exit with a non-zero value.

PR:             273180
Reviewed by:    kevans, asomers
Differential Revision:	https://reviews.freebsd.org/D41562
2023-08-23 10:45:01 -08:00
Emmanuel Vadot 0fd310c83c arm64: Remove duplicate fdt build option
Reported by:	andrew
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-08-23 20:18:38 +02:00
Mark Johnston c903f66478 sh tests: Update $LINENO tests after $FreeBSD$ removal
Fixes:	d0b2dbfa0e ("Remove $FreeBSD$: one-line sh pattern")
2023-08-23 13:25:35 -04:00
Jessica Clarke ecf01a8ebc Makefile: Support universe-toolchain on non-FreeBSD
We currently pass MACHINE and MACHINE_ARCH as TARGET and TARGET_ARCH
respectively for universe-toolchain, but on non-FreeBSD these may not
have values that we understand (e.g. on Linux it will be x86_64 rather
than amd64) for TARGET/TARGET_ARCH (note that we do support them for
MACHINE/MACHINE_ARCH). Since the choice is a bit arbitrary and merely
determines what LLVM's default triple will be, use amd64 on non-FreeBSD
as a known-good default.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D41545
2023-08-23 18:00:16 +01:00
Jessica Clarke 62f243acea tools/build/make.py: Make --with-default-sys-path mirror usr.bin/bmake
The top-level Makefile passes -m to its sub-makes in order to ensure
they use the in-tree mk files in share/mk, but the top-level make itself
has to rely on whatever environment the bmake used has. For FreeBSD, we
configure the system bmake with .../share/mk:/usr/share/mk, which means
it will pick up src's share/mk whenever run from within the src tree,
but currently for non-FreeBSD we configure our bootstrap bmake only with
bmake's own mk files. This is mostly compatible, with two exceptions:

1. "targets" runs at the top level, but needs TARGET_MACHINE_LIST and
   the corresponding MACHINE_ARCH_LIST_${target}, otherwise it will just
   print an empty list.

2. "universe" and "universe-toolchain", when run at the top level (i.e.
   not via the various wrappers around universe like tinderbox), end up
   failing in universe-toolchain itself with:

     bmake[1]: "/path/to/freebsd/share/mk/src.sys.obj.mk" line 112: Cannot use MAKEOBJDIR=
     Unset MAKEOBJDIR to get default:  MAKEOBJDIR='${.CURDIR:S,^${SRCTOP},${OBJTOP},}'

By including .../share/mk in the default sys path like FreeBSD's system
bmake we ensure that we get the in-tree mk files for the top-level make,
not just sub-makes, and avoid such issues.

Note that we cannot (yet) stop using the installed mk files, since the
MAKEOBJDIRPREFIX check in Makefile runs in the object directory and uses
env -i, thereby losing the MAKESYSPATH exported by src.sys.env.mk. Other
such issues may also exist, though are likely rare if so.

Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D41544
2023-08-23 17:56:56 +01:00
Jessica Clarke 69cfdc81ea tools/build/make.py: Keep bootstrapped bmake binary up-to-date
We currently assume that any existing bootstrapped bmake binary will
work, but this means it never gets updated as contrib/bmake is, and
similarly we won't rebuild it as and when the configure arguments given
to boot-strap change. Whilst the former isn't necessarily a huge problem
given WANT_MAKE_VERSION rarely gets bumped in Makefile, having fewer
variables is a good thing, and so it's easiest if we just always keep it
up-to-date rather than trying to do something similar to what's already
in Makefile (which may or may not be accurate, given updating FreeBSD
gives you an updated bmake, but nothing does so for our bootstrapped
bmake on non-FreeBSD). The latter is more problematic, though, and the
next commit will be changing this configuration.

We thus now add in two checks. The first is to compare MAKE_VERSION
against _MAKE_VERSION from contrib/bmake/VERSION. The second is to
record at bootstrap time the exact configuration used, and compare that
against what we would bootstrap with.

Reviewed by:	arichardson, sjg
Differential Revision:	https://reviews.freebsd.org/D41556
2023-08-23 17:56:50 +01:00
Andrew Turner 7d2dd08d01 gicv3: Add checks for the device ID
Add checks that the device ID is supported by the hardware and is
within the range allocated when the driver attaches.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41554
2023-08-23 17:38:20 +01:00
Andrew Turner 629734783d gicv3: Add a verbose message for unknown tables
Add a message under bootverbose when we find a gicv3 its table type
that is unknown.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41553
2023-08-23 17:38:20 +01:00
Andrew Turner 2f11b2abfc gicv3: Stop setting the esize field
The GITS_BASER esize field is read-only, there is no need to change it.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41552
2023-08-23 17:38:20 +01:00
Andrew Turner 43d74fcac0 Revert "gicv3: Stop setting the esize field"
This reverts commit 47a4b8ca96.

It has the wrong differential review link
2023-08-23 17:38:20 +01:00
Andrew Turner b9cdb04f4e Revert "gicv3: Add a verbose message for unknown tables"
This reverts commit 7f9694ad7e.

It has the wrong differential review link
2023-08-23 17:38:20 +01:00
Andrew Turner 160919c864 Revert "gicv3: Add checks for the device ID"
This reverts commit 950421e231.

It has the wrong differential review link
2023-08-23 17:38:20 +01:00
Jake Freeland fcace2906d syslogd: Add some basic regression tests
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41403
2023-08-23 12:17:40 -04:00
Andrew Turner 676386b556 Support dynamically sized register sets
We don't always know the size of the register set at compile time,
e.g. on arm64 the size of the SVE registers need to be queried on boot.
To support register sets that needs to be calculated at run time
query the correct size when it is zero.

Reviewed by:	markj, kib (earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41302
2023-08-23 15:32:56 +01:00
Andrew Turner 950421e231 gicv3: Add checks for the device ID
Add checks that the device ID is supported by the hardware and is
within the range allocated when the driver attaches.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Andrew Turner 7f9694ad7e gicv3: Add a verbose message for unknown tables
Add a message under bootverbose when we find a gicv3 its table type
that is unknown.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Andrew Turner 47a4b8ca96 gicv3: Stop setting the esize field
The GITS_BASER esize field is read-only, there is no need to change it.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Andrew Turner 3fc4f7c880 gicv3: Split out finding the page size
When adding indirect (2 level) tabled we will need to know the page
size to calculate the size of the level 1 table. To allow for this find
the page size before entering the loop to calculate the final register
value.

Reviewed by:	gallatin, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41551
2023-08-23 15:29:34 +01:00
Piotr Kubaj 0834f13da9 iavf: remove compatibility code and address some warnings
Code for pre-11 FreeBSD versions is removed.
Also removed are macros that are not used anymore and "i" variable
does not shadow anymore other "i" variable.

Differential Revision: https://reviews.freebsd.org/D41547
Approved by:	erj
2023-08-23 14:48:11 +02:00
Zhenlei Huang 838c8c4786 net: Do not overwrite if_vlan's PCP
In commit c7cffd65c5 the function ether_8021q_frame() was slightly
refactored to use pointer of struct ether_8021q_tag as parameter qtag to
include the new option proto.

It is wrong to write to qtag->pcp as it will effectively change the memory
that qtag points to. Unfortunately the transmit routine of if_vlan parses
pointer of the member ifv_qtag of its softc which stores vlan interface's
PCP internally, when transmitting mbufs that contains PCP the vlan
interface's PCP will get overwritten.

Fix by operating on a local copy of qtag->pcp. Also mark 'struct ether_8021q_tag'
as const so that compilers can pick up such kind of bug.

PR:	273304
Reviewed by:	kp
Fixes:	c7cffd65c5 Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D39505
2023-08-23 17:53:48 +08:00
Michael Tuexen d18c845f99 sctp: improve handling of SHUTDOWN and SHUTDOWN ACK chunks
When handling a SHUTDOWN or SHUTDOWN ACK chunk detect if the peer
is violating the protocol by not having made sure all user messages
are reveived by the peer. If this situation is detected, abort the
association.

MFC after:	1 week
2023-08-23 08:36:15 +02:00
Emmanuel Vadot 5fb94d0e16 arm64: xilinx: dwc3: Fix reset names
Use the correct resets and not the same one three times in a row.

Reported by:	rpokala
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-08-23 09:42:40 +02:00
Emmanuel Vadot 29bfcb3a28 arm64: xilinx: Add glue driver for usb3 controller
Like other dwc3 controller, on Xilinx ZynqMP the base node is just here
to provide resets, the main dwc3 controller node is a child node.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-08-23 09:00:05 +02:00
Kyle Evans 939199a2b5 libc: iconv: zero out cv_shared on allocation
Right now we have to zero-initialize most fields in the varius callers,
but this is a little error prone.  Simplify it by zeroing it out upon
allocation instead, drop the other redundant initialization.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41546
2023-08-22 22:40:45 -05:00
Kyle Evans e2030ca246 libc: fix c*rtomb/mbrtoc*
In 693f88c9da ("iconv_std: complete the //IGNORE support"), we
more completely implemented //IGNORE, which changed the semantics of
ci_discard_ilseq. DISCARD_ILSEQ semantics are supposed to match
//IGNORE, so we really can't do much about that particular
incompatibility.  This broke c*rtomb and mbrtoc* handling of invalid
sequences, but it turns out they don't want DISCARD_ILSEQ semantics at
all; they really want the subset that we call
_CITRUS_ICONV_F_HIDE_INVALID.

This restores the exact flow in iconv_std to precisely how it happened
prior to 693f88c9da.

PR:	265871
Fixes:	693f88c9da ("iconv_std: complete the //IGNORE support")
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41513
2023-08-22 22:40:45 -05:00
Konstantin Belousov c7df872096 Regen 2023-08-23 03:02:21 +03:00
Konstantin Belousov 4a69fc16a5 Add membarrier(2)
This is an attempt at clean-room implementation of the Linux'
membarrier(2) syscall.  For documentation, you would need to read
both membarrier(2) Linux man page, the comments in Linux
kernel/sched/membarrier.c implementation and possibly look at
actual uses.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32360
2023-08-23 03:02:21 +03:00
Konstantin Belousov 74ccb8ecf6 Add cpu_sync_core()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32360
2023-08-23 03:02:21 +03:00
Konstantin Belousov 8882b7852a add pmap_active_cpus()
For amd64, i386, arm, and riscv, i.e. all architectures except arm64,
the custom implementation is provided since we maintain the bitmask of
active CPUs anyway.

Arm64 uses somewhat naive iteration over CPUs and match current vmspace'
pmap with the argument. It is not guaranteed that vmspace->pmap is the
same as the active pmap, but the inaccuracy should be toleratable.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32360
2023-08-23 03:02:21 +03:00
Bartosz Sobczak c7f73a1588
ofed: mask seq_num identifier to occupy only 3 bytes
The seq_num among other things is used to assign rq_psn value, which is
a 24-bit identifier.  When the seq_num is full 4-byte value, we are
usually receiving: '_ib_modify_qp rq_psn overflow, masking to 24 bits'
warning.

This is burdensome for running rdma traffic with large number of
connections, because the number of logs is growing fast.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	kib@, erj@
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D41531
2023-08-22 16:09:13 -07:00
John Baldwin 80e9ea426c Makefile.asm: Drop mention of $FreeBSD$ from instructions. 2023-08-22 14:48:40 -07:00
Jessica Clarke 4101bcfa18 libzstd: Explicitly define ZSTD_DISABLE_ASM
On FreeBSD, ZSTD_ASM_SUPPORTED is defined as 0, but on macOS and Linux
it is defined as 1, yet we don't build any of the assembly sources.
Rather than add them just for bootstrapping on non-FreeBSD, explicitly
define ZSTD_DISABLE_ASM so they're not needed and everything is
consistent.

This fixes building a bootstrap LLVM toolchain on non-FreeBSD amd64 (the
only architecture with assembly available).

Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D41543
2023-08-22 21:01:03 +01:00
Jessica Clarke c9b2751d76 arm: Add missing no-ctfconvert for fw_stub.awk target
This target produces a C file not an object file, so using ctfconvert on
it should not be attempted. This keeps it in sync with all other uses of
fw_stub.awk, squashes a warning seen during the build of TEGRA124 on
FreeBSD and avoids the same issue failing the build on non-FreeBSD (such
errors are #ifdef'ed into being warnings on FreeBSD in ctfconvert, which
should be revisited in the future).

Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41542
2023-08-22 21:00:37 +01:00