Commit graph

137408 commits

Author SHA1 Message Date
Rick Macklem
9ec7dbf46b nfscl: Add a Linux compatible "nconnect" mount option
Linux has had an "nconnect" NFS mount option for some time.
It specifies that N (up to 16) TCP connections are to created for a mount,
instead of just one TCP connection.

A discussion on freebsd-net@ indicated that this could improve
client<-->server network bandwidth, if either the client or server
have one of the following:
- multiple network ports aggregated to-gether with lagg/lacp.
- a fast NIC that is using multiple queues
It does result in using more IP port#s and might increase server
peak load for a client.

One difference from the Linux implementation is that this implementation
uses the first TCP connection for all RPCs composed of small messages
and uses the additional TCP connections for RPCs that normally have
large messages (Read/Readdir/Write).  The Linux implementation spreads
all RPCs across all TCP connections in a round robin fashion, whereas
this implementation spreads Read/Readdir/Write across the additional
TCP connections in a round robin fashion.

(cherry picked from commit 1e0a518d65)
2021-08-03 16:40:47 -07:00
Kevin Bowling
914e70b909 arm: Bump KSTACK_PAGES default to match i386/amd64
See 3f6867ef63 for additional context.

It is also needed for OpenZFS performance and stability.

Reviewed by:	ian (arm), imp
Differential Revision:	https://reviews.freebsd.org/D31244

(cherry picked from commit b684d812fc)
2021-08-03 15:51:14 -07:00
Konstantin Belousov
130f41810e linuxkpi: remove global atomic counter of the task allocations
(cherry picked from commit d96f55bc71)
2021-08-03 12:56:02 +03:00
Hans Petter Selasky
3a83634c0f Wait for all task_struct allocations to be returned before freeing the UMA zone in the LinuxKPI
(cherry picked from commit b764a42653)
2021-08-03 12:55:12 +03:00
Konstantin Belousov
6ba7789189 amd64: add pmap_alloc_page_below_4g()
(cherry picked from commit c8bae074d9)
2021-08-03 12:52:37 +03:00
Konstantin Belousov
5a84640fcf amd64 pti init: fix calculation of the kernel text start
(cherry picked from commit 34516d4ad1)
2021-08-03 12:52:37 +03:00
Konstantin Belousov
2c7315c09a amd64: do not touch low memory in AP startup unless we used legacy boot
(cherry picked from commit 2572376f7f)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
17332276a6 amd64: do not touch low memory in AP startup unless we used legacy boot
(cherry picked from commit 48216088b1)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
21049f0567 amd64: make efi_boot global
(cherry picked from commit 6a3821369f)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
dfda6a71e7 /dev/pci: clarify meaning of writeable file descriptor
(cherry picked from commit 85ae35ef37)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
fb29b54a91 Regen 2021-08-03 12:52:36 +03:00
Konstantin Belousov
2fb281fa02 Revert most of ce42e79310
to restore ABI compatibility for pre-10.x binaries.

It restores _umtx_lock() and _umtx_unlock() syscalls, and UMTX_OP_LOCK/
UMTX_OP_UNLOCK umtx_op(2) operations. UMUTEX_ERROR_CHECK flag is left
out for now, I do not think it makes a difference.

PR:	218571
Reviewed by:	brooks (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31220

(cherry picked from commit 9b6b793bd7)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
7f5a4aff9b nullfs: provide custom null_rename bypass
(cherry picked from commit 4eaf9609fe)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
5c52335fd1 null_rename: some style
(cherry picked from commit 26e72728ce)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
2a56a5c2c2 fifofs: fifo vnode might be relocked before VOP_OPEN() is called
(cherry picked from commit 10db189649)
2021-08-03 12:52:36 +03:00
Konstantin Belousov
a3c7e571c0 null_lookup: restore dvp lock always, not only on success
(cherry picked from commit 4f21442e10)
2021-08-03 12:52:35 +03:00
Konstantin Belousov
0a4eb4d65c null_bypass(): prevent loosing the only reference to the lower vnode
(cherry picked from commit d5b078163e)
2021-08-03 12:52:35 +03:00
Konstantin Belousov
b5eaf00527 nullfs: provide custom null_advlock bypass
(cherry picked from commit 161e9a9736)
2021-08-03 12:52:35 +03:00
Konstantin Belousov
75e8553e79 null_bypass(): some style
(cherry picked from commit 7b7227c4a6)
2021-08-03 12:52:35 +03:00
Alexander Motin
814254f51b Remove opensolaris_atomic.S dependency.
This file is no longer there, so this broke static zfs build.

(cherry picked from commit e0229c5110)
2021-08-02 22:45:04 -04:00
Kevin Bowling
bb048438e7 igb: clean up igb_txrx comments
Reviewed by:	grehan
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D31227

(cherry picked from commit ff01d6343f)
2021-08-02 19:04:46 -07:00
Kevin Bowling
b91bb9b07f e1000: Add missing branch prediction
I missed this edit from the ixgbe review (D30074)

Reviewed by:	gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30073

(cherry picked from commit 9fd0cda92d)
2021-08-02 19:04:31 -07:00
Kevin Bowling
4ccafcfc86 e1000: Clean up igb_txrx
The intention here is to reduce differences between em, igb, igc, ixgbe.

The main functional change is logical simplification in igb_rx_checksum
and getting interface caps from scctx instead of the ifp.

Reviewed by:	gallatin, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30073

(cherry picked from commit 41f0225714)
2021-08-02 19:04:05 -07:00
Mark Johnston
668a555de6 rip: Add missing minimum length validation in rip_output()
If the socket is configured such that the sender is expected to supply
the IP header, then we need to verify that it actually did so.

Reported by:	syzkaller+KMSAN
Reviewed by:	donner
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ba21825202)
2021-08-02 15:01:11 -04:00
Alexander Motin
156b889469 mrsas(4): Report more correct maximum I/O size.
Subtract one SGE for the case of misaligned address.  Also take into
account maximum number of sectors reported by firmware, that gives
nicer 256KB limit instead of 276KB calculated from the SGE limit.

While there, remove number of I/O size checks, duplicating what is
already checked by CAM and busdma(9).

MFC after:	1 month
Sponsored by:	iXsystems, Inc.

(cherry picked from commit fa3d57c256)
2021-08-02 11:56:10 -04:00
Kristof Provost
c9ef3984a1 vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp()
These two fuctions were identical, so move them into the common
vlan_set_pcp() function, exposed in the if_vlan_var.h header.

Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31275

(cherry picked from commit 9ef8cd0b79)
2021-08-02 16:50:32 +02:00
Luiz Otavio O Souza
50ecd99be5 bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf
This allows the use of VLAN PCP in dhclient, which is required for
certain ISPs (such as Orange.fr).

Reviewed by:	bcr (man page)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31263

(cherry picked from commit 1e7fe2fbb9)
2021-08-02 16:50:32 +02:00
Richard Scheffenegger
e4ee2a39ad tcp: Add PRR cwnd reduction for non-SACK loss
This completes PRR cwnd reduction in all circumstances
for the base TCP stack (SACK loss recovery, ECN window reduction,
non-SACK loss recovery), preventing the arriving ACKs to
clock out new data at the old, too high rate. This
reduces the chance to induce additional losses while
recovering from loss (during congested network conditions).

For non-SACK loss recovery, each ACK is assumed to have
one MSS delivered. In order to prevent ACK-split attacks,
only one window worth of ACKs is considered to actually
have delivered new data.

MFC after: 6 weeks
Reviewed By: rrs, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29441

(cherry picked from commit 74d7fc8753)
2021-08-02 13:59:23 +02:00
Dimitry Andric
af732203b8 Merge llvm-project 12.0.1 release and follow-up fixes
Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the
upstream release/12.x branch was created.

PR:		255570

(cherry picked from commit e8d8bef961)

Merge llvm-project 12.0.0 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release.

PR:		255570

(cherry picked from commit d409305fa3)

Disable strict-fp for powerpcspe, as it does not work properly yet

Merge commit 5c18d1136665 from llvm git (by Qiu Chaofan)

  [SPE] Disable strict-fp for SPE by default

  As discussed in PR50385, strict-fp on PowerPC SPE has not been
  handled well. This patch disables it by default for SPE.

  Reviewed By: nemanjai, vit9696, jhibbits

  Differential Revision: https://reviews.llvm.org/D103235

PR:		255570

(cherry picked from commit 715df83abc)

Apply upstream libc++ fix to allow building with devel/xxx-xtoolchain-gcc

Merge commit 52e9d80d5db2 from llvm git (by Jason Liu):

  [libc++] add `inline` for __open's definition in ifstream and ofstream

  Summary:

  When building with gcc on AIX, it seems that gcc does not like the
  `always_inline` without the `inline` keyword.
  So adding the inline keywords in for __open in ifstream and ofstream.
  That will also make it consistent with __open in basic_filebuf
  (it seems we added `inline` there before for gcc build as well).

  Differential Revision: https://reviews.llvm.org/D99422

PR:		255570

(cherry picked from commit d099db2546)

Undefine HAVE_(DE)REGISTER_FRAME in llvm's config.h on arm

Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm,
stating that __register_frame is undefined. This function is normally
provided by libunwind, but explicitly not for the ARM Exception ABI.

Reported by:	oh
PR:		255570

(cherry picked from commit f336b45e94)

Merge llvm-project 12.0.1 rc2

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2.

PR:		255570

(cherry picked from commit 23408297fb)

Revert libunwind change to fix backtrace segfault on aarch64

Revert commit 22b615a96593 from llvm git (by Daniel Kiss):

  [libunwind] Support for leaf function unwinding.

  Unwinding leaf function is useful in cases when the backtrace finds a
  leaf function for example when it caused a signal.
  This patch also add the support for the DW_CFA_undefined because it marks
  the end of the frames.

  Ryan Prichard provided code for the tests.

  Reviewed By: #libunwind, mstorsjo

  Differential Revision: https://reviews.llvm.org/D83573

  Reland with limit the test to the x86_64-linux target.

Bisection has shown that this particular upstream commit causes programs
using backtrace(3) on aarch64 to segfault. This affects the lang/rust
port, for instance. Until we can upstream to fix this problem, revert
the commit for now.

Reported by:	mikael
PR:		256864

(cherry picked from commit 5866c369e4)

Merge llvm-project 12.0.1 release

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release.

PR:		255570

(cherry picked from commit 4652422eb4)

compilert-rt: build out-of-line LSE atomics helpers for aarch64

Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for
aarch64. This requires a bunch of helper functions in libcompiler_rt.a,
to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel".

(Note: of course you can use -mno-outline-atomics as a workaround too,
but this would negate the potential performance benefit of the faster
LSE instructions.)

Bump __FreeBSD_version so ports maintainers can easily detect this.

PR:		257392

(cherry picked from commit cc55ee8009)
2021-07-31 20:56:55 +02:00
Kristof Provost
adde304e53 pf: fix ABI breakage
The introduction of synproxy support changed the size of struct
pf_status, which in turn broke the userspace ABI.

Revert the relevant change. More work is needed on the synproxy code to
keep and expose the counters, but in the mean time this restores the
ABI.

PR:             257469
MFC after:      3 days
Sponsored by:   Modirum MDPay

(cherry picked from commit da8d8b22e6)
2021-07-31 10:12:20 +02:00
Kristof Provost
70d4a7a966 pf: match keyword support
Support the 'match' keyword.
Note that support is limited to adding queuing information, so without
ALTQ support in the kernel setting match rules is pointless.

For the avoidance of doubt: this is NOT full support for the match
keyword as found in OpenBSD's pf. That could potentially be built on top
of this, but this commit is NOT that.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31115

(cherry picked from commit ef950daa35)
2021-07-31 10:12:02 +02:00
Kristof Provost
5a1bc5f902 altq: Fix typo in features sysctl description
Reported by:	Jose Luis Duran

(cherry picked from commit 35dabb7b9c)
2021-07-31 10:12:01 +02:00
Kristof Provost
b0e7f371cd Add FEATURE sysctls for ALTQ disciplines
This will allow userspace to more easily figure out if ALTQ is built
into the kernel and what disciplines are supported.

Reviewed by:		donner@
Differential Revision:	https://reviews.freebsd.org/D28302

(cherry picked from commit e111d79806)
2021-07-31 10:12:01 +02:00
Mark Johnston
057275e4be ktrace: Zero request structures when populating the pool
Otherwise uninitialized pad bytes may be copied into the ktrace log
file.

Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5c18bf9d5f)
2021-07-29 20:32:59 -04:00
Mark Johnston
3e148d6029 select: Define select_flags[] as const
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cae3f9dd01)
2021-07-29 20:32:59 -04:00
Mark Johnston
d364264b29 cdefs: Add a default definition for __nosanitizememory
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4cd7e82a4c)
2021-07-29 20:32:58 -04:00
Mark Johnston
9ac0aec3a3 lio_listio: Don't post a completion notification if none was requested
One is allowed to use LIO_NOWAIT without specifying a sigevent.  In this
case, lj->lioj_signal is left uninitialized, but several code paths
examine liov_signal.sigev_notify to figure out which notification to
post.  Unconditionally initialize that field to SIGEV_NONE.

Add a dumb test case which triggers the bug.

Reported by:	KMSAN+syzkaller
Reviewed by:	asomers
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2e5f615295)
2021-07-29 20:32:58 -04:00
Mark Johnston
24c558ca3c imgact_elf: Avoid redefining suword()
Otherwise this interferes with the definition for sanitizer
interceptors.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ebf9886654)
2021-07-29 20:32:58 -04:00
Mark Johnston
fdeacf8fdf acct: Zero pad bytes in accounting records
Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 90959dd1e5)
2021-07-29 20:32:58 -04:00
Mark Johnston
a67749ac45 vfs: Initialize "lastfail" in vfs_mountroot_wait()
This variable is only used to rate-limit "Root mount waiting for: ..."
messages using ppsratecheck().

Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 048cd371f3)
2021-07-29 20:32:58 -04:00
Mark Johnston
b76e41fca9 Add required sysctl name length checks to various handlers
Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0dcef81de9)
2021-07-29 20:32:58 -04:00
Kevin Bowling
fe6803c18e ixgbe: Clean up ix_txrx
The intention here is to reduce differences with D30072.
The only functional change is logical simplification in
ixgbe_rx_checksum.

Reviewed by:	gallatin
Differential Revision:	https://reviews.freebsd.org/D30074

(cherry picked from commit 51e46835e1)
2021-07-29 17:27:24 -07:00
Kevin Bowling
ebdd2bc441 ixgbe: Print FW NVM and Option ROM versions
It can be useful for system operators to see this kind of information
when correlating issues or requesting support from the OEM or Intel for
hardware and firmware issues.

Reviewed by:	gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30178

(cherry picked from commit 7660e4ea5c)
2021-07-29 17:26:45 -07:00
Mitchell Horne
862ea25915 hwpmc_arm64: add a PMCDBG to the interrupt handler
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 13f5a3076b)
2021-07-29 12:05:55 -03:00
Mitchell Horne
83166f8714 arm64 support for pmu-events
8cc3815f:
hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE

Make it possible to specify event codes without an offset of
PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is
required to make use of event definitions from pmu-events.

Reviewed by:	ray (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30602

28dd6730:
libpmc: enable pmu_utils on arm64

This allows supported libpmc to query/select from the pmu-events table,
which may have a more complete set of events than what we define
manually. A future update to these definitions should greatly improve
this support. The alias table is empty for now, until this future import
is complete.

Add the Foundation's copyright for recent work on this file.

Reviewed by:	ray (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30603

27ea55fc:
libpmc/hwpmc: fix issues with arm64 pmu-events support

Due to a mis-merge, the changes committed to libpmc never called
pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be
used to carry the actual pmc event code anyway, as it is expected to
contain the index into the pmu event array (otherwise, it breaks event
name lookup in pmclog_get_event()). Add a new MD field,
pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc().

Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as
this is a union, not a struct. Restore the proper padding size.

Reviewed by:	luporl, ray, andrew
Fixes:		28dd6730a5 ("libpmc: enable pmu_utils on arm64")
Fixes:		8cc3815f02 ("hwpmc_arm64: accept raw event codes...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31221

(cherry picked from commit 8cc3815f02)
(cherry picked from commit 28dd6730a5)
(cherry picked from commit 27ea55fc65)
2021-07-29 12:02:05 -03:00
Mitchell Horne
d876c5a052 hwpmc_arm64: fill kern.hwpmc.cpuid
This will be used to detect supported pmu events. The expected format is
the MIDR register with the revision and variant fields masked. See also:
lib/libpmc/pmu-events/arch/arm64/mapfile.csv.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30601

(cherry picked from commit 5867cccdc4)
2021-07-29 12:01:11 -03:00
Mitchell Horne
a2d252f89f hwpmc_arm64.c: fix return style
In accordance to style(9).

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2129c8f677)
2021-07-29 12:01:10 -03:00
Mitchell Horne
96da64391d hwpmc: fix PMC_CPU_LAST
It is unused, but incorrect.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f59127dac5)
2021-07-29 12:01:09 -03:00
Andrew Turner
19135e372f arm64: Fix finding the pmc event ID
The lower pmc event bits were masked off to find the PMC event ID.
The doesn't work when there are more events. Switch it to use the
offser relative to the first event while also checking the ID is
in the expected range.

Reviewed by:	gnn, ray
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D29600

(cherry picked from commit 24b2f4ea49)
2021-07-29 12:00:37 -03:00
Mark Johnston
90ffac35b7 eli: Zero pad bytes that arise when certain auth algorithms are used
When authentication is configured, GELI ensures that the amount of data
per sector is a multiple of 16 bytes.  This is done in
eli_metadata_softc().  When the digest size is not a multiple of 16
bytes, this leaves some extra pad bytes at the end of every sector, and
they were not being zeroed before being written to disk.  In particular,
this happens with the HMAC/SHA1, HMAC/RIPEMD160 and HMAC/SHA384 data
authentication algorithms.

This change ensures that they are zeroed before being written to disk.

Reported by:	KMSAN
Reviewed by:	delphij, asomers
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0fcafe8516)
2021-07-29 08:12:22 -04:00