aq: Report partial initialization failures to iflib
Stop initialization when hardware setup, ring initialization/start, or
datapath start fails. Run the existing best-effort stop/cache/reset
cleanup and report the failure through iflib_init_failed(). Do not keep
configuring later rings or publish the interface as running.
Reviewed by: nprice
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59853
aq: Invalidate the descriptor cache after stopping all rings
Atlantic controllers can retain receive descriptors and their data
addresses after their rings are disabled. Reusing or releasing those
mappings without invalidating the device cache has caused observed
IOMMU and SMMU faults in the referenced Linux reports (7a1bb49461b1,
ed4d81c4b3f2 and 7526183cfdbe).
Move global cache invalidation out of the per-ring stop routine. Disable
every ring first, toggle invalidation once, and wait for its completion
indication. Exclude Atlantic A0, as in the upstream workaround. Report
a completion timeout rather than silently discarding it.
Reviewed by: nprice
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59852
llan: byte swap the receive queue entries
The receive queue of a PAPR logical LAN is filled in by the hypervisor, so
its fields are big endian, but llan_intr() read the offset and the length of
each frame natively. On a little endian kernel the length of a 134 byte
frame reads as 0x86000000, and ether_input() discards the mbuf because m_len
is not even large enough for an ethernet header. No frame is ever received.
Reproduced on a POWER9 pseries guest with a spapr-vlan interface. Before:
llan0: discard frame w/o leading ethernet header (len -2046820352
pkt len -2046820352)
llan0 1500 <Link#1> 52:54:00:12:34:56 123 118 0 5838733312 7 0
that is 118 input errors out of 123 packets, dhclient(8) never completes and
ping(8) loses every packet, although transmit works because the transmit
path passes the lengths in hcall registers rather than through memory.
Afterwards the interface gets a DHCP lease and ping reports no loss.
[3 lines not shown]
filesystems: use g_vfs_close_unlocked(9)
As result, we lock the devvp vnode around calls to VOP_FSYNC() on
unmount. For instance, the vn_fsync_buf() implementation of fsync()
needs exclusive lock on the vnode to guarantee that all dirty buffers
are indeed synced.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59932
VFS: style
Wrap long lines, related to the nullfs mounts over regular files and
sockets type checks. Also fix indent.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
lockf: Do not block in vfs_busy()
A race is possible otherwise: vfs_busy() may return after an unmounted
filesystem has been removed from the global mount list. That is,
vfs_busy() will block until vfs_mount_destroy() sets MNTK_REFEXPIRE, and
at that point the mountpoint has been removed from the mountlist, so
TAILQ_FOREACH can return an invalid value.
Simply do not block if the mountpoint is being unmounted.
Reviewed by: kib
Fixes: eca39864f702 ("Add sysctl KERN_LOCKF")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59982
tests/sys/kern: skip unix_connectat fdescfs cases when fdescfs is missing
unix_connectat's fdescfs cases call mount_fdescfs(), which skipped on ENODEV.
nmount(2) never returns ENODEV: vfs_donmount() remaps the ENODEV from a failed
fdescfs module load to EINVAL with errmsg "Invalid fstype", so the skip never
fired and the cases failed on kernels without fdescfs.
Approved by: ngie, asomers
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59227
vm_page: Fix the error path in vm_page_alloc_contig_domain()
If we are inserting a run of pages into a VM object and fail at some
point due to a memory allocation failure, we have to free all of the
pages in the run. We do that by resetting some fields and calling
vm_page_free_toq() on each page; this removes the page from the object
and frees it back to the buddy allocator.
If the page is supposed to be wired, we reset the reference count, but
this was done incorrectly: the VPRC_OBJREF flag must be retained as the
page still belongs to an object. Resetting it to zero will cause a
panic in vm_page_free_prep(): vm_page_free_object_prep() will subtract
VPRC_OBJREF from the refcount, causing underflow, and
vm_page_free_prep() subsequently calls panic() if the refcount is
non-zero.
Reviewed by: alc, kib
Fixes: fee2a2fa3983 ("Change synchonization rules for vm_page reference counting.")
MFC after: 1 week
[2 lines not shown]
cd9660: merge level 1 and 2 filename conversion
Merge the nearly identical level 1 and level 2 filename conversion
functions and add output buffer bounds checking.
Always NUL-terminate the converted filename, allowing the redundant
memset() in cd9660_translate_node_common() to be removed.
Signed-off-by: Manuel Einfalt <einfalt1 at proton.me>
Reviewed by: emaste
Pull request: https://github.com/freebsd/freebsd-src/pull/2443
build/options: Remove old, obolsete GCC options
These aren't referenced in the tree anymore, so remove them from
here. This doesn't chanage src.conf.5, so I didn't commit that file.
Sponsored by: Netflix
nvme: derive CC.CSS from CAP.CSS instead of hardcoding the NVM set
CC.CSS was always writting zero, which is a reserved encoding on a
controller that does not support the NVM command set.
Select 111b on admin-only controllers and 110b when the
I/O command set mechanism is available.
Reviewed by: ngie, imp, adrian
Differential Revision: https://reviews.freebsd.org/D59628
nvme: honor FLBAS Format Index Upper when selecting the LBA format
Added nvme_ns_data_format_index() in the nvme, nda, and nvmf
host paths as well as nvmecontrol and camdd.
Reviewed by: imp, adrian
Differential Revision: https://reviews.freebsd.org/D59627
tarfs_test: split large file test into independent cases
This avoids globally set timeouts for the group of
tarfs_large tests on slower emulated architectures.
While here, lower each testcase's timeout to reflect
the reduction of work. On QEMU aarch64, the largest case
runs in ~500s on a modern desktop, so double that for a
conservative estimate.
Discussed with: des
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59033
(cherry picked from commit 34c40126fd10abac06cd628c0563c57e777c9eef)
loader.efi: Be cautious about using GOPs
When we're searching for the EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID (GOPs) to
use, skip any whose Mode or Mode->Info pointers are NULL. The spec
requires these to be non-null, however, some firmwares seem to fail to
populate the Info when, for example, a monitor is not present. Work
around these bugs by skipping any GOPs with bad pointers.
PR: 288900
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D59830
loader.efi: Use EfiLoaderData memory type for ram disks
For the images we read into the memory, use EfiLoaderData memory type
instead of EfiReservedMemoryType. The kernel handles the former properly
and won't reallocate it. While the latter isn't necessarily mapped,
which can cause ram disks to fault when loaded. memdisk_uefi.efi
used the latter type, but also registered the device as an ACPI
RAM disk, which we don't do.
Fixes: afee781523e45
Sponsored by: Netflix
atf-sh/integration_test: fix hang when invoked via kyua
The code in `create_test_program` called cat on top of the calling
function, resulting in code that would hang waiting for an EOF to be
sent. This was wrong. Pass the heredoc output directly to
`create_test_program` so the content is output to the test program once.
Closes: #201
Signed-off-by: Enji Cooper <ngie at FreeBSD.org>
tcp: fix TCPS_CLOSED state underleak in syncache_socket()
The syncache entry holds one TCPS_SYN_RECEIVED count that normally is
transferred to the the newborn tp. Upon failure syncache_socket() shall
not use TCPSTATES_INC/TCPSTATES_DEC (see 5050df3f4aa4 why). But when
syncache_socket() fails in_pcbconnect(), it calls tcp_discardcb() to free
resources that were just allocated by tcp_newtcpcb() and this
tcp_discardcb() would do TCPSTATES_DEC(tp->t_state). The t_state is
TCPS_CLOSED at this point.
Make tcp_discardcb() symmetrical to tcp_newtcpcb() - not responsible for
the TCPSTATES. Make the caller responsible for state count book keeping.
Reviewed by: tuexen
Fixes: 3703e1a73e0e0367c04f47f793e46495e46e647b
Differential Revision: https://reviews.freebsd.org/D59325
(cherry picked from commit b712bb84a7a7dc229324a95170b8a77e0d9c5bec)
recv(2): update description of MSG_WAITALL
Remove a note about "data of a different type". This was a bug that was
fixed in FreeBSD 15. Instead put an exact quote from SUS that lists
allowed cases of a short read with MSG_WAITALL. See discussion in D57511.
(cherry picked from commit e5bcf988398924568015202bf853b3a9abd3845e)