Commit Graph

268558 Commits

Author SHA1 Message Date
Konstantin Belousov
1c56781cc9 amd64 wakeup: rework trampoline page allocation
There is no need to restrict trampoline page table to low 1M, it
should work with any pages below 4G.  Only wakeup code itself should
be below 1M.

Do not waste level 5 page when LA48 mode is used.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31931
2021-09-14 00:23:15 +03:00
Konstantin Belousov
2b6eec531a x86: duplicate acpi_wakeup.c per i386 and amd64
The file as is is the maze of #ifdef passages, all slightly different.
Divorcing i386 and amd64 version actually makes changing the code
easier, also no changes for i386 are planned.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31931
2021-09-14 00:23:14 +03:00
Krzysztof Galazka
abf774528d
ixl(4): Fix 2.5 and 5G speeds reporting and update shared code
Fix 2.5 and 5G speeds reporting and update shared code with recent
changes:
- Update expected FW API versions for X710 and X722 adapters
- Define pointers related to Preservation Rules Module
- Add definitions for Shadow RAM pointers to new modules: 5th and 6th
  FPA, and Preservation Rules Module.
- Add I40E_RX_PTYPE_PARSER_ABORTED definition, so the driver will know
  opcode for parser aborted packets.
- Add the new filter types needed for custom cloud filters.
- Add support for Minimum Rollback Revision
- Fix RX_ONLY mode for unicast promiscuous on VLAN
- Add EEE LPI status check for X722 adapters
- Fix PHY type identifiers for 2.5G and 5G adapters
- Fix update link data for X722
- Increase the timeout value for PF reset to give PF more time to finish
  reset if it is loaded with filters.
- Added support for Min Rollback Revision for 4 more X722 modules
- Fix reporting of Active Optical Cable media type
- Add flags and fields for double VLAN processing
- Fix potentially uninitialized variables in NVM code

Reviewed by:	kbowling@, mike.jakubik@gmail.com
Tested by:	gowtham.kumar.ks@intel.com
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D31565
2021-09-13 14:00:50 -07:00
Jessica Clarke
f28c1d0c5c llvm-objcopy: Install llvm-strip, and optionally strip, links
Just as elftoolchain's objcopy doubles as strip, so does LLVM's. This
ensures that a strip binary is still present for WITH_LLVM_BINUTILS
builds. Note that we do not currently have a committed copy of the
manpage generated from the rST source so no manpage is installed for
(llvm-)strip.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Tested by:	Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after:	1 week
2021-09-13 21:52:40 +01:00
Jorgen Lundman
7443299fe0
Iterate encrypted clones at zvol_create_minor
Userland figures out which encryption-root keys are required to load,
and issues ZFS_IOC_LOAD_KEY.
The tail section of spa_keystore_load_wkey() will call
zvol_create_minors() on the encryption-root object.

Any clones of the encrypted zvol will not be plumbed. This commits
adds additional logic to detect if zvol has clones, and is encrypted,
then adds these to the list of zvols to call zvol_create_minors() on.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #12471
2021-09-13 13:27:07 -07:00
Arun KV
f82f0279ed
Fixed data integrity issue when underlying disk returns error
Errors in zil_lwb_write_done() are not propagated to
zil_lwb_flush_vdevs_done() which can result in zil_commit_impl()
not returning an error to applications even when zfs was not able
to write data to the disk.

Remove the ZIO_FLAG_DONT_PROPAGATE flag from zio_rewrite() to
allow errors to propagate and consolidate the error handling for
flush and write errors to a single location (rather than having
error handling split between the "write done" and "flush done"
handlers).

Reviewed-by: George Wilson <gwilson@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Signed-off-by: Arun KV <arun.kv@datacore.com>
Closes #12391
Closes #12443
2021-09-13 13:02:39 -07:00
Stefan Grundmann
e673ac3ffb libnv: Fix array unpack endianness logic
When a nvlist(9) is converted into a binary buffer by nvlist_pack(9),
the host endianness is encoded in the nvlist_header of the binary
buffer. The nvlist_unpack(9) function converts a given binary buffer
to an nvlist. In the conversion process the endianness encoded in the
nvlist_header is evaluated and -- should the encoded endianness differ
from the endianess of the decoding host -- endianness conversion is
applied to nvlist_header and nvpair_header elements as well as
to some nvpair values.

In 2015 @oshogbo extended libnv with array support (in 347a39b).
The unpacking code misses the possible need to convert the endianness
of the nvph_nitems element of nvpair_headers.

The patch (re)enables libnv to unpack nvlists regardless of the
endianness of the packing host.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/528
2021-09-13 21:21:14 +02:00
Brian Behlendorf
695d4ae815
ZTS: Waiting for zvols to be available
This is a follow up patch for PR #12515 which addresses some
additional ZTS tests which are unreliable are should explicitly
wait for the required zvols to be available.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: @Theo13111
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12553
2021-09-13 12:18:01 -07:00
John Baldwin
93d6fa53c9 Disable -Woverflow errors for i386 for GCC 9.
GCC 9 warns about floating point constants overflowing for i386.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D26201
2021-09-13 11:00:38 -07:00
John Baldwin
3b5f95d7bd ctld: Disable TCP DDP for connection sockets.
cxgbei is not able to offload PDU processing for a socket using TCP
DDP offload.

Sponsored by:	Chelsio Communications
2021-09-13 09:57:54 -07:00
John Baldwin
91c62d626d iscsid: Disable TCP DDP for connection sockets.
cxgbei is not able to offload PDU processing for a socket using TCP
DDP offload.

Sponsored by:	Chelsio Communications
2021-09-13 09:57:54 -07:00
John Baldwin
f63ddf465f cxgbei: Only convert "plain" TCP connections to ISCSI.
Reject attempts to convert a connection using a different ULP
mode: (e.g. DDP or TLS) to ISCSI.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
2021-09-13 09:57:54 -07:00
John Baldwin
b7caa81576 cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff.
This permits unindenting almost half of the function.

Sponsored by:	Chelsio Communications
2021-09-13 09:57:54 -07:00
John Baldwin
9b1bb0aee6 cxgbei: Disable ISO for -SO cards without external memory.
Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications
2021-09-13 09:57:54 -07:00
Konstantin Belousov
db2ba218d9 amd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table
This is required since kernel text might be physically located
anywhere below 4G.

PR:	258432
Reported by:	Taku YAMAMOTO <taku@tackymt.homeip.net>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31916
2021-09-13 19:52:13 +03:00
Konstantin Belousov
ceca8ac1ce x86 acpi_install_wakeup_handler(): style
Do not use tab between type and variable name in local declarations.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31916
2021-09-13 19:52:06 +03:00
Konstantin Belousov
e99255c8a6 amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31916
2021-09-13 19:51:52 +03:00
Dimitry Andric
45feade38e Add -Wno-error=unused-but-set-variable when building with Clang 13+
This warning triggers many times while building world. Downgrade it to a
warning until all occurrences have been fixed. Once the Clang warnings
have been fixed we should be able to turn it on for GCC as well. See
also f4fed768bb which did the same for the
kernel builds.

Reviewed by:	arichardson, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31927
2021-09-13 18:05:43 +02:00
Andrew Turner
b029ef7fe6 Restrict spsr updated in the arm64 set_regs*
When using ptrace(2) on arm64 to set registers in a 32-bit program we
need to take care to only set some of the fields. Follow the existing
arm64 path and only let the user set the flags fields. This is also the
case in the arm kernel so fixes a change in behaviour between the two.

While here update set_regs to only set spsr and elr once.

Sponsored by:	The FreeBSD Foundation
2021-09-13 16:32:50 +01:00
Edward Tomasz Napierala
ddedf2a11e tzcode: Implement timezone change detection
Implement optional timezone change detection for local time libc
functions.  This is disabled by default; set WITH_DETECT_TZ_CHANGES
to build it.

Reviewed By:	imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#47
Differential Revision:	https://reviews.freebsd.org/D30183
2021-09-12 03:07:58 +00:00
Ed Maste
b9df18d6e8 libprocstat: extend zfs_defs hack for .pieo
By default _pie.a archives are built only for INTERNALLIBs, so there is
usually no need for zfs_defs.pieo to exist.  However, some experimental
work builds _pie.a archives for everything.  Extend the existing set of
zfs_defs hacks to build zfs_defs.pieo as well.

Reviewed by:	arichardson
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31924
2021-09-13 09:03:55 -04:00
Alexander Motin
e76786909c Fix data race in scsi cd driver.
There is a data race between cdsysctlinit and cdcheckmedia.  Both
functions change softc->flags without synchronization.

Submitted by:	Arseny Smalyuk <smalukav@gmail.com>
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D31726
2021-09-13 08:59:51 -04:00
Alex Richardson
2d78130185 Add missing dep patterns for .pieo
While adding sanitizer support, I noticed that all other extensions were
handled but .pieo was missing.

Reviewed By:	emaste, imp
MFC after:	1 week

Differential Revision: https://reviews.freebsd.org/D31040
2021-09-13 13:22:31 +01:00
Ed Maste
7c0226cad3 bsd.lib.mk: add conditions for building _pie.a archives
As with other .a targets, build _pie.a archives only if LIB is set.

At present we build _pie.a only for INTERNALLIBs, and none of them
include bsd.lib.mk without setting LIB.  However, we might want to build
_pie.a for non-INTERNALLIBs in the future.

Reviewed by:	arichardson
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31920
2021-09-13 07:52:02 -04:00
Wojciech Macek
6e93bdfff3 Revert "if_mvneta: Build the driver as a kernel module"
This reverts commit 41b0190cc4.
2021-09-13 12:55:15 +02:00
Hubert Mazur
41b0190cc4 if_mvneta: Build the driver as a kernel module
Fix device detach and attach routine. Add required Makefile
to build as a module. Remove entry from GENERIC, since now
it can be loaded automatically.

Tested on EspressoBin.

Obtained from:		Semihalf
Reviewed by:		manu
Differential revision:	https://reviews.freebsd.org/D31581
2021-09-13 11:44:31 +02:00
Hubert Mazur
ee1b7811a3 e6000sw: Build the driver as a kernel module
Fix detach routine.
Driver was tested on EspressoBin.
Remove it from GENERIC, since now it can be loaded automatically.

Obtained from:		Semihalf
Reviewed by:		manu
Differential revision:	https://reviews.freebsd.org/D31580
2021-09-13 11:42:16 +02:00
Hubert Mazur
1e1253510a e6000sw: Use taskqueue subsytem for MDIO polling
Previosuly the link status was pooled in an infinite loop in a separate
kproc. Use taskqueue subsytem instead. This is a prequisite for making
this driver work as a loadable module.

Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D31579
2021-09-13 11:37:11 +02:00
Alex Richardson
d7d962ead0 Add a test for https://reviews.freebsd.org/D31858 (PR 258310)
This test (based on https://github.com/jiixyj/epoll-shim/pull/32#issuecomment-891276654)
fails reproducibly on QEMU with KVM and `-smp 2` prior to D31858 (committed
as 98168a6e6c) and passes with the patch applied.

Reviewed By:	kib, imp
Differential Revision: https://reviews.freebsd.org/D31862
2021-09-13 10:16:05 +01:00
Peter Holm
89379af43f stress2: Update test to the sysctl 'vfs.lookup_shared' being removed 2021-09-13 08:56:06 +00:00
Peter Holm
ddd74e40e2 stress2: Added missing unmount 2021-09-13 08:55:19 +00:00
Bartlomiej Grzesik
d00c1f7f2f sdhci: add sysctls to dump sdhci registers and capabilites
Add sysctls dev.sdhci.X.slotY.dumpregs and dev.sdhci.X.slotY.dumpcaps
which dumps sdhci registers or capabilities.

Obtained from:		Semihalf
Reviewed by:		mw
Differential revision:	https://reviews.freebsd.org/D31406
2021-09-13 10:00:25 +02:00
Wojciech Macek
6fa041d7f1 Measure latency of PMC interruptions
Add HWPMC events to measure latency.
Provide sysctl to choose the number of outstanding events which
trigger HWPMC event.

Obtained from:		Semihalf
Sponsored by:		Stormshield
Differential revision:	https://reviews.freebsd.org/D31283
2021-09-13 06:08:32 +02:00
Mark Johnston
b864b67a0d socket: Do not include control messages in FIONREAD return value
Some system software expects to be able to read at least the number of
bytes returned by FIONREAD.  When control messages are counted in this
return value, this assumption is violated.  Follow Linux and OpenBSD
here (as well as our own kevent(EVFILT_READ)) and only return the number
of data bytes available.

Reported by:	avg
MFC after:	2 weeks
2021-09-12 16:39:44 -04:00
Ka Ho Ng
e31cc1d526 bhyve: Fix pci device node key in bhyve_config.5
PCI device node key in the manual page is wrong. It should be
pci.bus.slot.function.

MFC after:	3 days
2021-09-13 04:35:03 +08:00
Michael Tuexen
29545986bd sctp: avoid LOR
Don't lock the inp-info lock while holding an stcb lock.

MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D31921
2021-09-12 21:11:14 +02:00
Michael Tuexen
4181fa2a20 sctp: minor cleanup, no functional change
MFC after:	1 week
2021-09-12 19:21:15 +02:00
Rick Macklem
ae87a08c41 UPDATING: Add entry for commit 55089ef4f8 2021-09-11 15:44:52 -07:00
Rick Macklem
55089ef4f8 nfscl: Make vfs.nfs.maxcopyrange larger by default
As of commit 103b207536, the NFSv4.2 server will limit the size
of a Copy operation based upon a 1 second timeout.  The Linux 5.2
kernel server also limits Copy operation size to 4Mbytes.
As such, the NFSv4.2 client can attempt a large Copy without
resulting in a long RPC RTT for these servers.

This patch changes vfs.nfs.maxcopyrange to 64bits and sets
the default to the maximum possible size of SSIZE_MAX, since
a larger size makes the Copy operation more efficient and
allows for copying to complete with fewer RPCs.
The sysctl may be need to be made smaller for other non-FreeBSD
NFSv4.2 servers.

MFC after:	2 weeks
2021-09-11 15:36:32 -07:00
John Baldwin
b9485d76e3 Add EPOCH_TRACE to NOTES to get LINT coverage.
Sponsored by:	The FreeBSD Foundation
2021-09-11 13:05:44 -07:00
Mark Johnston
3a0976dea3 lio_test: Specify a mode with O_CREAT
Sponsored by:	The FreeBSD Foundation
2021-09-11 12:59:10 -04:00
Mark Johnston
2884918c73 aio: Fix up the opcode in aiocb32_copyin()
With lio_listio(2), the opcode is specified by userspace rather than
being hard-coded by the system call (e.g., aio_readv() -> LIO_READV).
kern_lio_listio() calls aio_aqueue() with an opcode of LIO_NOP, which
gets fixed up when the aiocb is copied in.

When copying in a job request for vectored I/O, we need to dynamically
allocate a uio to wrap an iovec.  So aiocb_copyin() needs to get the
opcode from the aiocb and then decide whether an allocation is required.
We failed to do this in the COMPAT_FREEBSD32 case.  Fix it.

Reported by:	syzbot+27eab6f2c2162f2885ee@syzkaller.appspotmail.com
Reviewed by:	kib, asomers
Fixes:	f30a1ae8d5 ("lio_listio(2):  Allow LIO_READV and LIO_WRITEV.")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31914
2021-09-11 12:58:41 -04:00
Mark Johnston
2d5c48eccd sctp: Tighten up locking around sctp_aloc_assoc()
All callers of sctp_aloc_assoc() mark the PCB as connected after a
successful call (for one-to-one-style sockets).  In all cases this is
done without the PCB lock, so the PCB's flags can be corrupted.  We also
do not atomically check whether a one-to-one-style socket is a listening
socket, which violates various assumptions in solisten_proto().

We need to hold the PCB lock across all of sctp_aloc_assoc() to fix
this.  In order to do that without introducing lock order reversals, we
have to hold the global info lock as well.

So:
- Convert sctp_aloc_assoc() so that the inp and info locks are
  consistently held.  It returns with the association lock held, as
  before.
- Fix an apparent bug where we failed to remove an association from a
  global hash if sctp_add_remote_addr() fails.
- sctp_select_a_tag() is called when initializing an association, and it
  acquires the global info lock.  To avoid lock recursion, push locking
  into its callers.
- Introduce sctp_aloc_assoc_connected(), which atomically checks for a
  listening socket and sets SCTP_PCB_FLAGS_CONNECTED.

There is still one edge case in sctp_process_cookie_new() where we do
not update PCB/socket state correctly.

Reviewed by:	tuexen
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31908
2021-09-11 10:15:21 -04:00
Doug Rabson
895545d0e6 Fix spelling of BUILDENV_SHELL 2021-09-11 13:27:11 +01:00
Ka Ho Ng
3703c18883 md: Add MD_MUSTDEALLOC support
This adds an option to detect if hole-punching is implemented by the
underlying file system.  If this flag is set, and if the underlying file
system does not support hole-punching, md(4) fails BIO_DELETE requests
with EOPNOTSUPP.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31883
2021-09-11 20:04:52 +08:00
Alan Somers
71a1ae7ceb Import atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542
The main improvement is the ability to skip a test that is expected to
fail.
2021-09-10 17:08:42 -06:00
Alan Somers
cd355e3667 Vendor import of atf commit 55c21b2c5fb189bbdfccb2b297bfa89236502542
Updated from https://github.com/freebsd/atf
2021-09-10 16:50:50 -06:00
John Baldwin
4d4cf62e29 cxgbei: Handle errors in PDUs.
When a PDU with an error (bad padding, header digest, or data digest)
is received, log the error via ICL_WARN() and then reset the
connection via the ic_error callback.

While here, add per-rxq counters for errors.

Sponsored by:	Chelsio Communications
2021-09-10 15:10:00 -07:00
Gleb Smirnoff
c96b4d87ba pkg: fix regression that breaks bootstrap from not a current directory.
Fixes:		40b9f924b1
Reviewed by:	kevans
2021-09-10 14:49:17 -07:00
Mark Johnston
141fe2dcee aio: Interlock with listen(2)
soo_aio_queue() did not handle the possibility that the provided socket
is a listening socket.  Up until recently, to fix this one would have to
acquire the socket lock first and check, since the socket buffer locks
were destroyed by listen(2).

Now that the socket buffer locks belong to the socket, simply check
SOLISTENING(so) after acquiring them, and make listen(2) return an error
if any AIO jobs are enqueued on the socket.

Add a couple of simple regression test cases.

Note that this fixes things only for the default AIO implementation;
cxgbe(4)'s TCP offload has a separate pru_aio_queue implementation which
requires its own solution.

Reported by:	syzbot+c8aa122fa2c6a4e2a28b@syzkaller.appspotmail.com
Reported by:	syzbot+39af117d43d4f0faf512@syzkaller.appspotmail.com
Reported by:	syzbot+60cceb9569145a0b993b@syzkaller.appspotmail.com
Reported by:	syzbot+2d522c5db87710277ca5@syzkaller.appspotmail.com
Reviewed by:	tuexen, gallatin, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31901
2021-09-10 17:21:11 -04:00