]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoImplement flowid calculation for outbound connections to balance
Alexander V. Chernikov [Sun, 18 Oct 2020 17:15:47 +0000 (17:15 +0000)]
Implement flowid calculation for outbound connections to balance
 connections over multiple paths.

Multipath routing relies on mbuf flowid data for both transit
 and outbound traffic. Current code fills mbuf flowid from inp_flowid
 for connection-oriented sockets. However, inp_flowid is currently
 not calculated for outbound connections.

This change creates simple hashing functions and starts calculating hashes
 for TCP,UDP/UDP-Lite and raw IP if multipath routes are present in the
 system.

Reviewed by: glebius (previous version),ae
Differential Revision: https://reviews.freebsd.org/D26523

3 years agoIf the SIM freezes the queue at exactly the wrong moment, after
Edward Tomasz Napierala [Sun, 18 Oct 2020 16:30:49 +0000 (16:30 +0000)]
If the SIM freezes the queue at exactly the wrong moment, after
another thread has started to send in a CCB and already checked
the queue wasn't frozen, we would end up with iscsi_action()
being called despite the queue is now frozen.

Add a check to make sure this doesn't happen . Perhaps this should
be fixed at the CAM level instead, but given how the send queue and
SIM are governed by two separate mutexes, it is somewhat hard to do.

Reviewed by: imp, mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26750

3 years agoMake g_attach() return ENXIO for orphaned providers; update various
Edward Tomasz Napierala [Sun, 18 Oct 2020 16:24:08 +0000 (16:24 +0000)]
Make g_attach() return ENXIO for orphaned providers; update various
classes to add missing error checking.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26658

3 years agoStop calling set_syscall_retval() from linux_set_syscall_retval().
Edward Tomasz Napierala [Sun, 18 Oct 2020 16:16:22 +0000 (16:16 +0000)]
Stop calling set_syscall_retval() from linux_set_syscall_retval().
The former clobbers some registers that shouldn't be touched.

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

3 years agoAdd compat.linux.dummy_rlimits, and disable by default.
Edward Tomasz Napierala [Sun, 18 Oct 2020 15:58:16 +0000 (15:58 +0000)]
Add compat.linux.dummy_rlimits, and disable by default.

Turns out the dummy rlimits fix prlimit(1), but break su(8)
(login-1:4.5-1ubuntu2) - although not sudo(8), for some reason.

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

3 years agoSlightly tweak linux ptrace(2) debug message; no functional changes.
Edward Tomasz Napierala [Sun, 18 Oct 2020 15:56:47 +0000 (15:56 +0000)]
Slightly tweak linux ptrace(2) debug message; no functional changes.

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

3 years agoSimplify NET_EPOCH_EXIT in inp_join_group().
Alexander V. Chernikov [Sun, 18 Oct 2020 12:03:36 +0000 (12:03 +0000)]
Simplify NET_EPOCH_EXIT in inp_join_group().

Suggested by: kib

3 years agoAdd new USB quirk.
Hans Petter Selasky [Sun, 18 Oct 2020 08:58:14 +0000 (08:58 +0000)]
Add new USB quirk.

PR: 250422
Submitted by: vidwer+fbsdbugs@gmail.com
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoCorrect location and date of the Boston Shoemakers' organization,
Greg Lehey [Sun, 18 Oct 2020 03:01:26 +0000 (03:01 +0000)]
Correct location and date of the Boston Shoemakers' organization,
which significantly predated the USA.

Reference: http://www.famousdaily.com/history/boston-shoemakers-form-first-us-labor-organization.html

3 years agonet80211: update for (more) VHT160 support
Bjoern A. Zeeb [Sun, 18 Oct 2020 00:27:20 +0000 (00:27 +0000)]
net80211: update for (more) VHT160 support

Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ()
and its 80+80 counter part to check in vhtcaps for appropriate
levels of support and use the macros throughout the code.

Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue
to vht80 in various parts of the code.

Add ieee80211_add_channel_cbw() which also takes the CBW flag
fields and make the former ieee80211_add_channel() a wrapper to it.
With the CBW flags we can add HT/VHT channels passing them to
getflags() for the 2/5ghz functions.

In ifconfig(8) add the regdomain_addchans() support for VHT160
and VHT80P80.

With this (+ regdoain.xml updates) VHT160 channels can be
configured, listed, and pass regdomain where appropriate.

Tested with: iwlwifi
Reviewed by: adrian
MFC after: 10 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26712

3 years agoclk: fix indentation
Bjoern A. Zeeb [Sat, 17 Oct 2020 23:42:33 +0000 (23:42 +0000)]
clk: fix indentation

Just fix indentation of an if() clause.
No functional changes intended.

MFC after: 3 days

3 years agoddb: add show sysinit command
Bjoern A. Zeeb [Sat, 17 Oct 2020 22:47:08 +0000 (22:47 +0000)]
ddb: add show sysinit command

Add a show sysinit command to ddb (similar to show vnet_sysinit) which
proved to be helpful to debug some ordering issues on early-mid kernel
start panics.

3 years agocache: shorten names of debug stats
Mateusz Guzik [Sat, 17 Oct 2020 21:30:46 +0000 (21:30 +0000)]
cache: shorten names of debug stats

3 years agocache: don't automatically evict negative entries if usage is low
Mateusz Guzik [Sat, 17 Oct 2020 21:22:40 +0000 (21:22 +0000)]
cache: don't automatically evict negative entries if usage is low

The previous scheme only looked at negative entry count in relation to the
total count, leading to tons of spurious evictions if the cache is not
significantly populated.

Instead, only try the above if negative entry count goes beyond namecache
capacity.

3 years agoFix sleepq_add panic happening with too wide net epoch in mcast control.
Alexander V. Chernikov [Sat, 17 Oct 2020 20:33:09 +0000 (20:33 +0000)]
Fix sleepq_add panic happening with too wide net epoch in mcast control.

PR: 250413
Reported by: Christopher Hall <hsw at bitmark.com>
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D26827

3 years agoriscv: zero reserved PTE bits for L2 PTEs
Mitchell Horne [Sat, 17 Oct 2020 17:31:06 +0000 (17:31 +0000)]
riscv: zero reserved PTE bits for L2 PTEs

As was done for L3 PTEs in r362853, mask out the reserved bits when
extracting the physical address from an L2 PTE. Future versions of the
spec or custom implementations may make use of these reserved bits, in
which case the resulting physical address could be incorrect.

Submitted by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by: kp, mhorne
Differential Revision: https://reviews.freebsd.org/D26607

3 years agocache: erwork sysctl vfs.cache tree
Mateusz Guzik [Sat, 17 Oct 2020 13:06:29 +0000 (13:06 +0000)]
cache: erwork sysctl vfs.cache tree

Split everything into neg, debug, param and stat categories.

The legacy nchstats sysctl (queried e.g., by systat) remains untouched.

While here rename some vars to be easier on the eye.

3 years agocache: factor negative lookup out of cache_fplookup_next
Mateusz Guzik [Sat, 17 Oct 2020 13:04:46 +0000 (13:04 +0000)]
cache: factor negative lookup out of cache_fplookup_next

3 years agocache: avoid smr in cache_neg_evict in favoro of the already held bucket lock
Mateusz Guzik [Sat, 17 Oct 2020 13:04:25 +0000 (13:04 +0000)]
cache: avoid smr in cache_neg_evict in favoro of the already held bucket lock

3 years agocache: rework parts of negative entry management
Mateusz Guzik [Sat, 17 Oct 2020 08:48:58 +0000 (08:48 +0000)]
cache: rework parts of negative entry management

- declutter sysctl vfs.cache by moving relevant entries into
vfs.cache.neg
- add a little more parallelism to eviction by replacing the
global lock with an atomically modified counter
- track more statistics

The code needs further effort.

3 years agocache: remove entries before trying to add new ones, not after
Mateusz Guzik [Sat, 17 Oct 2020 08:48:32 +0000 (08:48 +0000)]
cache: remove entries before trying to add new ones, not after

Should allow positive entries to replace negative ones in case
the cache is full.

3 years agovfs: annotate mountlist_mtx with __exclusive_cache_line
Mateusz Guzik [Sat, 17 Oct 2020 08:47:08 +0000 (08:47 +0000)]
vfs: annotate mountlist_mtx with __exclusive_cache_line

3 years agoBump __FreeBSD_version after ptsname_r addition.
Xin LI [Sat, 17 Oct 2020 04:14:46 +0000 (04:14 +0000)]
Bump __FreeBSD_version after ptsname_r addition.

3 years agoImplement ptsname_r.
Xin LI [Sat, 17 Oct 2020 04:14:38 +0000 (04:14 +0000)]
Implement ptsname_r.

MFC after: 2 weeks
PR: 250062
Reviewed by: jilles, 0mp, Ray <i maskray me>
Differential Revision: https://reviews.freebsd.org/D26647

3 years agoUpdate OpenZFS to 2.0.0-rc3-gfc5966
Matt Macy [Sat, 17 Oct 2020 01:06:04 +0000 (01:06 +0000)]
Update OpenZFS to 2.0.0-rc3-gfc5966

- fix panic due to tqid overflow
- Improve libzfs_error_init messages
- Expose zfetch_max_idistance tunable
- Make dbufstat work on FreeBSD
- Fix EIO after resuming receive of new dataset over an existing one

3 years agoImport tzdata 2020c
Philip Paeps [Sat, 17 Oct 2020 00:44:04 +0000 (00:44 +0000)]
Import tzdata 2020c

Changes: https://github.com/eggert/tz/blob/2020c/NEWS

MFC after: 1 day

3 years agoImport tzdata 2020c
Philip Paeps [Sat, 17 Oct 2020 00:41:14 +0000 (00:41 +0000)]
Import tzdata 2020c

3 years agocache: add a probe reporting addition of duplicate entries
Mateusz Guzik [Sat, 17 Oct 2020 00:27:26 +0000 (00:27 +0000)]
cache: add a probe reporting addition of duplicate entries

3 years agoUpdate OpenZFS to 2.0.0-rc3-gbd565f
Matt Macy [Sat, 17 Oct 2020 00:05:34 +0000 (00:05 +0000)]
Update OpenZFS to 2.0.0-rc3-gbd565f

3 years agoTry to enable multipath routing in flowid tests.
Alexander V. Chernikov [Fri, 16 Oct 2020 21:51:17 +0000 (21:51 +0000)]
Try to enable multipath routing in flowid tests.

3 years agobhyve: Update TX descriptor base address and host mapping on change
Ryan Moeller [Fri, 16 Oct 2020 20:27:20 +0000 (20:27 +0000)]
bhyve: Update TX descriptor base address and host mapping on change

bhyve sometimes segfaults when using an e1000 NIC with a Windows guest.

We are only updating our tdba and cached host mapping when the low address
register is written and when tx is set enabled, but not when the high address
or length registers are written. It is observed that Windows 10 is occasionally
enabling tx first then writing the registers in the order low, high, len. This
leaves us with a bogus base address and mapping, which causes a segfault later
when we try to copy from a descriptor that has unpredictable garbage in a
pointer.

Updating the address and mapping when any of those registers change seems to fix
that particular issue.

Reviewed by: mav, grehan (bhyve)
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26798

3 years agolibc: typo fix (s/involes/involves)
Kyle Evans [Fri, 16 Oct 2020 17:51:09 +0000 (17:51 +0000)]
libc: typo fix (s/involes/involves)

Reported by: Masahiko Sawada via twitter
MFC after: 3 days

3 years agoMFC r366760: lua: update to 5.3.6
Kyle Evans [Fri, 16 Oct 2020 17:03:27 +0000 (17:03 +0000)]
MFC r366760: lua: update to 5.3.6

This release contains some minor bugfixes; notably:
- 2x minor Makefile fixes (not used in base)
- Long brackets with a huge number of '=' overflow some internal buffer
  arithmetic.
- Joining an upvalue with itself can cause a use-after-free crash.

See here for examples: http://www.lua.org/bugs.html#5.3.5

MFC after: 2 weeks

3 years agoamd64 pmap.h: explicitly provide constants values instead of relying
Konstantin Belousov [Fri, 16 Oct 2020 16:22:32 +0000 (16:22 +0000)]
amd64 pmap.h: explicitly provide constants values instead of relying
on some more advanced C features.

This fixes gcc-toolchain build of exception.S.

Reported and tested by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoUpdate arcmsr(4) to 1.50.00.00:
Xin LI [Fri, 16 Oct 2020 15:55:06 +0000 (15:55 +0000)]
Update arcmsr(4) to 1.50.00.00:

Add support for ARC-1886, NVMe/SAS/SATA controller.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by:   黃清隆 <ching2048 areca com tw>
MFC after:      2 weeks

3 years agoMakefile: add a small blurb about building with gcc xtoolchain
Kyle Evans [Fri, 16 Oct 2020 15:16:23 +0000 (15:16 +0000)]
Makefile: add a small blurb about building with gcc xtoolchain

The key details are to install the appropriate flavor of devel/freebsd-gcc9
and pass CROSS_TOOLCHAIN while building.

Suggested by: kib

3 years ago This fixes some fun type size truncation that shows up giving errors like
Adrian Chadd [Fri, 16 Oct 2020 14:28:13 +0000 (14:28 +0000)]
 This fixes some fun type size truncation that shows up giving errors like
" changes value from '287948901175001088' to '0' "

.. which turns out is a known issue with later gcc's.

eg - https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html

It was fixed up upstream corelib/gnulib in commit hash
252b52457da7887667c036d18cc5169777615bb0
(eg in https://github.com/coreutils/gnulib/commit/252b52457da7887667c036d18cc5169777615bb0)

TEST PLAN
  - compiled/run for gcc-6.4 on amd64

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26804

3 years agoarm64: export a few more HWCAPs
Mitchell Horne [Fri, 16 Oct 2020 13:37:58 +0000 (13:37 +0000)]
arm64: export a few more HWCAPs

These were missed in the previous pass. The extensions (partially)
supported by this change are:
 - ARMv8.2-FHM, Floating-point multiplication variant
 - ARMv8.4-LSE, Large System Extensions
 - ARMv8.4-DIT, Data Independent Timing instructions

Reviewed by: andrew, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26707

3 years agoUpdate the ID_AA64MMFR2_EL1 register definitions
Mitchell Horne [Fri, 16 Oct 2020 13:35:29 +0000 (13:35 +0000)]
Update the ID_AA64MMFR2_EL1 register definitions

This brings these definitions in sync with the ARMv8.6 version of the
architecture reference manual.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26706

3 years agolua: update to 5.3.6
Kyle Evans [Fri, 16 Oct 2020 13:04:28 +0000 (13:04 +0000)]
lua: update to 5.3.6

This release contains some minor bugfixes; notably:
- 2x minor Makefile fixes (not used in base)
- Long brackets with a huge number of '=' overflow some internal buffer
  arithmetic.
- Joining an upvalue with itself can cause a use-after-free crash.

See here for examples: http://www.lua.org/bugs.html#5.3.5

3 years agoTrigger soft lifetime expiration on sequence number
Marcin Wojtas [Fri, 16 Oct 2020 11:27:01 +0000 (11:27 +0000)]
Trigger soft lifetime expiration on sequence number

This patch adds 80% of UINT32_MAX limit on sequence number.
When sequence number reaches limit kernel sends SADB_EXPIRE message to
IKE daemon which is responsible to perform rekeying.

Submitted by:           Patryk Duda <pdk@semihalf.com>
Reviewed by:            ae
Differential revision:  https://reviews.freebsd.org/D22370
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoAdd support for IPsec ESN and pass relevant information to crypto layer
Marcin Wojtas [Fri, 16 Oct 2020 11:25:45 +0000 (11:25 +0000)]
Add support for IPsec ESN and pass relevant information to crypto layer

Implement support for including IPsec ESN (Extended Sequence Number) to
both encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined
mode (eg. AES-GCM). Both ESP and AH protocols are updated. Additionally
pass relevant information about ESN to crypto layer.

For the ETA mode the ESN is stored in separate crp_esn buffer because
the high-order 32 bits of the sequence number are appended after the
Next Header (RFC 4303).

For the AEAD modes the high-order 32 bits of the sequence number
[e.g.  RFC 4106, Chapter 5 AAD Construction] are included as part of
crp_aad (SPI + ESN (32 high order bits) + Seq nr (32 low order bits)).

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb, gnn
Differential revision:  https://reviews.freebsd.org/D22369
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoImplement anti-replay algorithm with ESN support
Marcin Wojtas [Fri, 16 Oct 2020 11:24:12 +0000 (11:24 +0000)]
Implement anti-replay algorithm with ESN support

As RFC 4304 describes there is anti-replay algorithm responsibility
to provide appropriate value of Extended Sequence Number.

This patch introduces anti-replay algorithm with ESN support based on
RFC 4304, however to avoid performance regressions window implementation
was based on RFC 6479, which was already implemented in FreeBSD.

To keep things clean and improve code readability, implementation of window
is kept in seperate functions.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D22367
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoSet default stack size for Linux apps to 8MB. This matches Linux'
Edward Tomasz Napierala [Fri, 16 Oct 2020 11:23:30 +0000 (11:23 +0000)]
Set default stack size for Linux apps to 8MB.  This matches Linux'
defaults, makes core files smaller, and fixes applications which use
pthread_join(3) in a wrong way, namely Steam.

This is based on a patch submitted by Jason Yang, which I've reworked
to set the limit instead of only changing the value reported (which
is enough to fix the bug for Linux pthreads, but could be confusing).

PR: 248225
Submitted by: Jason_YH_Yang at wistron.com (earlier version)
Analyzed by: Alex S <iwtcex@gmail.com>
Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26778

3 years agoAdd SADB_SAFLAGS_ESN flag
Marcin Wojtas [Fri, 16 Oct 2020 11:22:29 +0000 (11:22 +0000)]
Add SADB_SAFLAGS_ESN flag

This flag is going to be used by IKE daemon to signal if
Extended Sequence Number feature is going to be used.

Value for this flag was taken from OpenBSD source code
https://github.com/openbsd/src/commit/6b4cbaf181c6b60701d9fb888fd0e7a4333eecbd

Submitted by:           Patryk Duda <pdk@semihalf.com>
Reviewed by:            ae
Differential revision:  https://reviews.freebsd.org/D22366
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoAdd support for ESN in AES-NI crypto driver
Marcin Wojtas [Fri, 16 Oct 2020 11:21:56 +0000 (11:21 +0000)]
Add support for ESN in AES-NI crypto driver

This patch adds support for IPsec ESN (Extended Sequence Numbers) in
encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined mode
(eg. AES-GCM).

For the encrypt and authenticate mode the ESN is stored in separate
crp_esn buffer because the high-order 32 bits of the sequence number are
appended after the Next Header (RFC 4303).

For the combined modes the high-order 32 bits of the sequence number
[e.g.  RFC 4106, Chapter 5 AAD Construction] are part of crp_aad
(prepared by netipsec layer in case of ESN support enabled), therefore
non visible diff around combined modes.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D22365
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoAdd support for ESN in cryptosoft
Marcin Wojtas [Fri, 16 Oct 2020 11:18:13 +0000 (11:18 +0000)]
Add support for ESN in cryptosoft

This patch adds support for IPsec ESN (Extended Sequence Numbers) in
encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined mode
(eg. AES-GCM).

For encrypt and authenticate mode the ESN is stored in separate crp_esn
buffer because the high-order 32 bits of the sequence number are
appended after the Next Header (RFC 4303).

For combined modes the high-order 32 bits of the sequence number [e.g.
RFC 4106, Chapter 5 AAD Construction] are part of crp_aad (prepared by
netipsec layer in case of ESN support enabled), therefore non visible
diff around combined modes.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D22364
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoPrepare crypto framework for IPsec ESN support
Marcin Wojtas [Fri, 16 Oct 2020 11:06:33 +0000 (11:06 +0000)]
Prepare crypto framework for IPsec ESN support

This permits requests (netipsec ESP and AH protocol) to provide the
IPsec ESN (Extended Sequence Numbers) in a separate buffer.

As with separate output buffer and separate AAD buffer not all drivers
support this feature. Consumer must request use of this feature via new
session flag.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D24838
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoRemove ifdefs around IS_ALIGNED() definition in the LinuxKPI.
Hans Petter Selasky [Fri, 16 Oct 2020 11:01:21 +0000 (11:01 +0000)]
Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.

Discussed with: manu@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImprove the handling of cookie life times.
Michael Tuexen [Fri, 16 Oct 2020 10:44:48 +0000 (10:44 +0000)]
Improve the handling of cookie life times.
The staleness reported in an error cause is in us, not ms.
Enforce limits on the life time via sysct; and socket options
consistently. Update the description of the sysctl variable to
use the right unit. Also do some minor cleanups.
This also fixes an interger overflow issue if the peer can
modify the cookie. This was reported by Felix Weinrank by fuzz testing
the userland stack and in
https://oss-fuzz.com/testcase-detail/4800394024452096

MFC after: 3 days

3 years agoMake linux getrlimit(2) and prlimit(2) return something reasonable
Edward Tomasz Napierala [Fri, 16 Oct 2020 10:10:09 +0000 (10:10 +0000)]
Make linux getrlimit(2) and prlimit(2) return something reasonable
for linux-specific limits.  Fixes prlimit (util-linux-2.31.1-0.4ubuntu3.7).

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

3 years agoBump pseudofs size limit from 128kB to 1MB. The old limit could result
Edward Tomasz Napierala [Fri, 16 Oct 2020 09:58:10 +0000 (09:58 +0000)]
Bump pseudofs size limit from 128kB to 1MB.  The old limit could result
in process' memory maps being truncated.

PR: 237883
Submitted by: dchagin
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20575

3 years agocache: flip inverted condition in previous
Mateusz Guzik [Fri, 16 Oct 2020 02:19:33 +0000 (02:19 +0000)]
cache: flip inverted condition in previous

It happened to not affect correctness in that the fallback code would
simply neglect to promote the entry.

3 years agocache: support negative entry promotion in slowpath smr
Mateusz Guzik [Fri, 16 Oct 2020 00:56:13 +0000 (00:56 +0000)]
cache: support negative entry promotion in slowpath smr

3 years agocache: elide vhold/vdrop around promoting negative entry
Mateusz Guzik [Fri, 16 Oct 2020 00:55:57 +0000 (00:55 +0000)]
cache: elide vhold/vdrop around promoting negative entry

3 years agocache: dedup code for negative promotion
Mateusz Guzik [Fri, 16 Oct 2020 00:55:31 +0000 (00:55 +0000)]
cache: dedup code for negative promotion

3 years agocache: neglist -> nl; negstate -> ns
Mateusz Guzik [Fri, 16 Oct 2020 00:55:09 +0000 (00:55 +0000)]
cache: neglist -> nl; negstate -> ns

No functional changes.

3 years agoBump the ISO EFI partition size from 1024 to 2048, following r366732.
Glen Barber [Thu, 15 Oct 2020 23:05:13 +0000 (23:05 +0000)]
Bump the ISO EFI partition size from 1024 to 2048, following r366732.

Suggested by: imp
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoSimplify preload_dump() condition
Mitchell Horne [Thu, 15 Oct 2020 20:21:15 +0000 (20:21 +0000)]
Simplify preload_dump() condition

Hiding this feature behind RB_VERBOSE is gratuitous. The tunable is enough
to limit its use to only those who explicitly request it.

Suggested by: kevans

3 years agokldxref: Avoid buffer overflows in parse_pnp_list
Jessica Clarke [Thu, 15 Oct 2020 18:03:14 +0000 (18:03 +0000)]
kldxref: Avoid buffer overflows in parse_pnp_list

We convert a string like "W32:vendor/device" into "I:vendor;I:device",
where the output is longer than the input, but only allocate space equal
to the length of the input, leading to a buffer overflow.

Instead use open_memstream so we get a safe dynamically-grown buffer.

Found by: CHERI
Reviewed by: imp, jhb (mentor)
Approved by: imp, jhb (mentor)
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D26637

3 years agocache: split hotlist between existing negative lists
Mateusz Guzik [Thu, 15 Oct 2020 17:44:17 +0000 (17:44 +0000)]
cache: split hotlist between existing negative lists

This simplifies the code while allowing for concurrent negative eviction
down the road.

Cache misses increased slightly due to higher rate of evictions allowed by
the change.

The current algorithm remains too aggressive.

3 years agocache: make neglist an array given the static size
Mateusz Guzik [Thu, 15 Oct 2020 17:42:22 +0000 (17:42 +0000)]
cache: make neglist an array given the static size

3 years agoDrop unsolicited responses to the still attaching CODECs.
Alexander Motin [Thu, 15 Oct 2020 17:40:02 +0000 (17:40 +0000)]
Drop unsolicited responses to the still attaching CODECs.

It is reported to fix kernel panics when early unsolicited responses
delivered to the CODEC device not having driver attached yet.

PR: 250248
Reported by: Rajeev Pillai <rajeev_v_pillai@yahoo.com>
Reviewed by: avg
MFC after: 2 weeks

3 years agoIncrease the amd64 ISO ESP file size from 800KB to 1024KB.
Glen Barber [Thu, 15 Oct 2020 17:12:58 +0000 (17:12 +0000)]
Increase the amd64 ISO ESP file size from 800KB to 1024KB.

At some poing over the last week, the bootx64.efi file has grown
past the 800KB threshold, resulting in being unable to copy it to
the EFI/BOOT directory.

 # stat -f %z efiboot.znWo7m
 819200
 # stat -f %z stand-test.PIEugN/EFI/BOOT/bootx64.efi
 842752

The comment in the script that creates the ISOs suggests that 800KB
is the maximum allowed for the boot code, however I was able to
boot an ISO with a 1024KB boot partition.  Additionally, I verified
against an ISO from OtherOS, where the boot EFI partition is 2.4MB.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agophysio: Don't store user addresses in bio_data
Brooks Davis [Thu, 15 Oct 2020 17:05:21 +0000 (17:05 +0000)]
physio: Don't store user addresses in bio_data

Only assign the address from the iovec to bio_data if it is a kernel
address.  This was the single place where bio_data stored (however
briefly) a userspace pointer.

Reviewed by: imp, markj
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26783

3 years agoFix nvmecontrol logpage -i parameter.
Alexander Motin [Thu, 15 Oct 2020 15:36:08 +0000 (15:36 +0000)]
Fix nvmecontrol logpage -i parameter.

MFC after: 3 days

3 years ago[pfctl_tests] Add missing void to empty function declaration
Adrian Chadd [Thu, 15 Oct 2020 14:56:51 +0000 (14:56 +0000)]
[pfctl_tests] Add missing void to empty function declaration

Our gcc-6.4 flags require non-empty function declarations.
Fix this to match the rest of the codebase.

Tested:

* compiled on gcc-6.4 for amd64

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26795

3 years ago[tests] Fix itimer test warning-errors on gcc-6.4
Adrian Chadd [Thu, 15 Oct 2020 14:55:07 +0000 (14:55 +0000)]
[tests] Fix itimer test warning-errors on gcc-6.4

This fixes a "suggested parens" compile warning-into-error
that shows up on gcc-6.4.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D26789

3 years agomove vmware pv drivers to sys/conf/files
Ed Maste [Thu, 15 Oct 2020 14:37:51 +0000 (14:37 +0000)]
move vmware pv drivers to sys/conf/files

VMware now has arm64 support; move these to MI files in advance of
building them on arm64.

PR: 250308
Reported by: Vincent Milum Jr
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoFix formatting of SYNOPSIS
Mateusz Piotrowski [Thu, 15 Oct 2020 14:17:45 +0000 (14:17 +0000)]
Fix formatting of SYNOPSIS

There was an unnecessary newline being added before Nm.

MFC after: 3 days

3 years agoSplit-out Guest Address Space (GAS) macroses to a separate header.
Ruslan Bukin [Thu, 15 Oct 2020 13:47:52 +0000 (13:47 +0000)]
Split-out Guest Address Space (GAS) macroses to a separate header.

Sponsored by: Innovate DSbD

3 years agoProvide a slightly more-tolerant set of thermal parameters for PowerMac
Nathan Whitehorn [Thu, 15 Oct 2020 13:43:43 +0000 (13:43 +0000)]
Provide a slightly more-tolerant set of thermal parameters for PowerMac
motherboard temperatures. In particular, the U4 northbridge die is very
hard to cool or heat effectively with fans and is not responsive to load.
It generally sits around 64C, where it seems happy, so (like Linux) just
declare that to be its target temperature.

This makes the PowerMac G5 much less loud, with no change in the
temperatures of any system components.

MFC after: 2 weeks

3 years agoWith some popular multiplayer games (such as Counter-Strike: Global
Edward Tomasz Napierala [Thu, 15 Oct 2020 12:48:30 +0000 (12:48 +0000)]
With some popular multiplayer games (such as Counter-Strike: Global
Offensive) the Linux Steam client likes to occasionally scan the game
process memory, presumably as part anti-cheat measures. Turns out
the client also expects each inode entry to be followed by a space
character, otherwise the parsing code crashes.

PR: 248216
Submitted by: Alex S <iwtcex@gmail.com>
MFC after: 2 weeks

3 years agoHyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock
Wei Hu [Thu, 15 Oct 2020 11:44:28 +0000 (11:44 +0000)]
Hyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock

The try lock loop in HN_LOCK put the thread spinning on cpu if the lock
is not available. It is possible to cause deadlock if the thread holding
the lock is sleeping. Relinquish the cpu to work around this problem even
it doesn't completely solve the issue. The priority inversion could cause
the livelock no matter how less likely it could happen. A more complete
solution may be needed in the future.

Reported by: Microsoft, Netapp
MFC after: 2 weeks
Sponsored by: Microsoft

3 years agoHyper-V: pcib: Check revoke status during device attach
Wei Hu [Thu, 15 Oct 2020 05:57:20 +0000 (05:57 +0000)]
Hyper-V: pcib: Check revoke status during device attach

It is possible that the vmbus pcib channel is revoked during attach path.
The attach path could be waiting for response from host and this response will never
arrive since the channel has already been revoked from host point of view. Check
this situation during wait complete and return failed if this happens.

Reported by: Netapp
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D26486

3 years agoBump __FreeBSD_version after addition of VOP_EAGAIN
Mateusz Guzik [Thu, 15 Oct 2020 05:11:16 +0000 (05:11 +0000)]
Bump __FreeBSD_version after addition of VOP_EAGAIN

3 years agozfs: g/c unused vop_vector zfsctl_ops_shares_dir
Mateusz Guzik [Thu, 15 Oct 2020 05:04:57 +0000 (05:04 +0000)]
zfs: g/c unused vop_vector zfsctl_ops_shares_dir

3 years agozfs: add missing fplookup vops
Mateusz Guzik [Thu, 15 Oct 2020 04:49:34 +0000 (04:49 +0000)]
zfs: add missing fplookup vops

Some vnodes come with a hack which inherits the fplookup flag despite having vops
which don't provide the routine.

Reported by: YAMAMOTO Shigeru <shigeru@os-hackers.jp>

3 years agovfs: add VOP_EAGAIN
Mateusz Guzik [Thu, 15 Oct 2020 04:48:14 +0000 (04:48 +0000)]
vfs: add VOP_EAGAIN

Can be used to stub fplookup for example.

3 years agoarm64: Increase NIRQ to 16k
D Scott Phillips [Thu, 15 Oct 2020 03:12:00 +0000 (03:12 +0000)]
arm64: Increase NIRQ to 16k

Ampere Altra in a dual socket configuration has 12 ITSes for the
12 PCIe root complexes. The NIRQ interrupts are statically split
between each child of the gic bus, so here we increase that
value. 16k is enough for

  (#cpus * #its * max_pcie_bifurcation) LPIs + (#SPIs and #PPIs)

Reviewed by: jhb
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D26766

3 years agoFix for mis-interpretation of PCB_KERNFPU.
Konstantin Belousov [Wed, 14 Oct 2020 23:01:41 +0000 (23:01 +0000)]
Fix for mis-interpretation of PCB_KERNFPU.

RIght now PCB_KERNFPU is used both as indication that kernel prepared
hardware FPU context to use and that the thread is fpu-kern
thread.  This also breaks fpu_kern_enter(FPU_KERN_NOCTX), since
fpu_kern_leave() then clears PCB_KERNFPU.

Introduce new flag PCB_KERNFPU_THR which indicates that the thread is
fpu-kern.  Do not clear PCB_KERNFPU if fpu-kern thread leaves noctx
fpu region.

Reported and tested by: jhb (amd64)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25511

3 years agoLimit workaround for errata E400 to appropriate AMD cpus.
Konstantin Belousov [Wed, 14 Oct 2020 22:57:50 +0000 (22:57 +0000)]
Limit workaround for errata E400 to appropriate AMD cpus.

From Linux sources and several datasheets I looked at, it seems that
the workaround is only needed on families 0xf and 0x10.  For instance,
Ryzens do not implement the accessed MSR at all, it is documented as
reserved.  Also, hypervisors should not allow guest to put CPU into
idle state, so activate workaround only when on bare hardware.

While there, style the code:
    move MSR defines to specialreg.h
    move identification to initcpu.c

Reported by: whu
Reviewed by: avg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26470

3 years agoAvoid dump_avail[] redefinition.
Konstantin Belousov [Wed, 14 Oct 2020 22:51:40 +0000 (22:51 +0000)]
Avoid dump_avail[] redefinition.

Move dump_avail[] extern declaration and inlines into a new header
vm/vm_dumpset.h.  This fixes default gcc build for mips.

Reviewed by: alc, scottph
Tested by: kevans (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26741

3 years agoSplit-out iommu type definitions to a separate header.
Ruslan Bukin [Wed, 14 Oct 2020 21:22:23 +0000 (21:22 +0000)]
Split-out iommu type definitions to a separate header.

Reviewed by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26780

3 years ago[skein] Fix compile issue with unknown symbol SKEIN_ASM_UNROLL1024
Adrian Chadd [Wed, 14 Oct 2020 20:55:31 +0000 (20:55 +0000)]
[skein] Fix compile issue with unknown symbol SKEIN_ASM_UNROLL1024

Weirdly, I needed to sprinkle more parens here to get gcc-as in 6.4
to correctly generate things.

Without them, I'd get an unknown variable reference to SKEIN_ASM_UNROLL1024.

This at least links now, but I haven't run any test cases against it.
It may be worthwhile doing it in case gcc-as demands we liberally sprinkle
more brackets around variables in .if statements.

Thanks to ed for the suggestion of just sprinkling more brackets to
see if that helped.

Reviewed by: emaste

3 years agoRewrite pfctl_test in C to reduce testsuite run time
Alex Richardson [Wed, 14 Oct 2020 17:39:50 +0000 (17:39 +0000)]
Rewrite pfctl_test in C to reduce testsuite run time

The new C test takes 25 seconds on QEMU-RISC-V, wheras the shell version
takes 332 seconds.

Even with the latest optimizations to atf-sh this test still takes a few
seconds to startup in QEMU. Re-writing it in C reduces the runtime for a
single test from about 2-3 seconds to less than .5 seconds. Since there
are ~80 tests, this adds up to about 3-4 minutes.
This may not seem like a big speedup, but before the recent optimizations
to avoid atf_get_srcdir, each test took almost 100 seconds on QEMU RISC-V
instead of 3. This also significantly reduces the time it takes to list
the available test cases, which speeds up running the tests via kyua:

```
root@qemu-riscv64-alex:~ # /usr/bin/time kyua test -k /usr/tests/sbin/pfctl/Kyuafile pfctl_test_old
...
158/158 passed (0 failed)
      332.08 real        42.58 user       286.17 sys
root@qemu-riscv64-alex:~ # /usr/bin/time kyua test -k /usr/tests/sbin/pfctl/Kyuafile pfctl_test
158/158 passed (0 failed)
       24.96 real         9.75 user        14.26 sys

root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test pf1001
pfctl_test: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Running pfctl -o none -nvf /usr/tests/sbin/pfctl/./files/pf1001.in
---
binat on em0 inet6 from fc00::/64 to any -> fc00:0:0:1::/64
binat on em0 inet6 from any to fc00:0:0:1::/64 -> fc00::/64
---
passed
        0.17 real         0.06 user         0.08 sys
root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_old pf1001
pfctl_test_old: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test_old: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Id  Refs Name
141    1 pf
Executing command [ pfctl -o none -nvf - ]
passed
        1.73 real         0.25 user         1.41 sys
root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_old -l > /dev/null
       24.36 real         2.26 user        21.86 sys
root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test -l > /dev/null
        0.04 real         0.02 user         0.01 sys
```

The speedups are even more noticeable on CHERI-RISC-V (since QEMU runs
slower when emulating CHERI instructions):
```
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_new -l > /dev/null
        0.51 real         0.49 user         0.00 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test -l > /dev/null
       34.20 real        32.69 user         0.16 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test pf1001
pfctl_test: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Id  Refs Name
147    1 pf
Executing command [ pfctl -o none -nvf - ]
passed
        5.74 real         5.41 user         0.03 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_new pf1001
pfctl_test_new: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test_new: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Running pfctl -o none -nvf /usr/tests/sbin/pfctl/./files/pf1001.in
---
binat on em0 inet6 from fc00::/64 to any -> fc00:0:0:1::/64
binat on em0 inet6 from any to fc00:0:0:1::/64 -> fc00::/64
---
passed
        0.68 real         0.66 user         0.00 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl #
```

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D26779

3 years agoUse RTD3 Entry Latency value as shutdown timeout.
Alexander Motin [Wed, 14 Oct 2020 15:50:28 +0000 (15:50 +0000)]
Use RTD3 Entry Latency value as shutdown timeout.

This field was not in specs when the driver was written, but now there
are SSDs with the reported latency of 10s, where hardcoded value of 5s
seems to be not enough sometimes, causing shutdown timeout messages.

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

3 years agoRemove direct user access from the arm64 copyinstr
Andrew Turner [Wed, 14 Oct 2020 15:31:42 +0000 (15:31 +0000)]
Remove direct user access from the arm64 copyinstr

These already use the load variant that simulates userspace access.
Remove the macros that enable normal loads and stores from userspace
as they are unneeded.

Sponsored by: Innovate UK

3 years agoAdd a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleep
Ruslan Bukin [Wed, 14 Oct 2020 14:51:11 +0000 (14:51 +0000)]
Add a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleep
during iommu guest address space entries unload.

Suggested by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26722

3 years ago[skein] Fix compilation on gnu assembler with gcc-6 and gcc-9
Adrian Chadd [Wed, 14 Oct 2020 14:29:56 +0000 (14:29 +0000)]
[skein] Fix compilation on gnu assembler with gcc-6 and gcc-9

For some reason I don't want to really understand, the following
happens with gnu as.

/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S: Assembler messages:
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:466: Error: found '(', expected: ')'
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:466: Error: junk at end of line, first unrecognized character is `('
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:795: Error: found '(', expected: ')'
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:795: Error: junk at end of line, first unrecognized character is `('
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement

After an exhaustive search and experimentation at 11pm, I discovered that
putting them in parentheses fixes the compilation.

Ed pointed out that I could likely fix this in a bunch of other
locations but I'd rather leave these alone until other options
are enabled.

Tested:

* gcc-6, amd64

Reviewed by: emaste

3 years agoAdd iommu_get_ctx_domain() that allows to get iommu domain for a given
Ruslan Bukin [Wed, 14 Oct 2020 14:12:15 +0000 (14:12 +0000)]
Add iommu_get_ctx_domain() that allows to get iommu domain for a given
iommu context.

Submitted by: andrew
Sponsored by: Innovate DSbD

3 years agoRename a header protection macro.
Ruslan Bukin [Wed, 14 Oct 2020 13:39:50 +0000 (13:39 +0000)]
Rename a header protection macro.

Sponsored by: DARPA, AFRL

3 years agoAdd 'netserver' command to EFI loader.
Michal Meloun [Wed, 14 Oct 2020 13:13:14 +0000 (13:13 +0000)]
Add 'netserver' command to EFI loader.

In some environments is difficult to access bootp/dhcp
configuration as "standard user". Add a command that allows to set
or display the URI of the network server used as "net:" device.
Currently only tftp and nfs protocols are supported.

Typical usage pattern is:
netserver tftp://192.168.168.1/path_to_obj_dir/arm.armv7/sys/GENERIC/
boot net:kernel

Reviewed by: imp, kevans
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D26736

3 years agoFix more -Wundef warnings during bootstrap
Alex Richardson [Wed, 14 Oct 2020 12:28:54 +0000 (12:28 +0000)]
Fix more -Wundef warnings during bootstrap

3 years agoDon't build the malo module with clang 10
Alex Richardson [Wed, 14 Oct 2020 12:28:48 +0000 (12:28 +0000)]
Don't build the malo module with clang 10

Compiling it with LLVM 10 triggers https://bugs.llvm.org/show_bug.cgi?id=44351
While LLVM 11 is the default compiler, I regularly build with
CROSS_TOOLCHAIN=llvm10 or use system packages for clang on Linux/macOS and
those have not been updated to 11 yet.

3 years agoinstall(1): Avoid unncessary fstatfs() calls and use mmap() based on size
Alex Richardson [Wed, 14 Oct 2020 12:28:41 +0000 (12:28 +0000)]
install(1): Avoid unncessary fstatfs() calls and use mmap() based on size

According to git blame the trymmap() function was added in 1996 to skip
mmap() calls for NFS file systems. However, nowadays mmap() should be
perfectly safe even on NFS. Importantly, onl ufs and cd9660 file systems
were whitelisted so we don't use mmap() on ZFS. It also prevents the use
of mmap() when bootstrapping from macOS/Linux since on those systems the
trymmap() function was always returning zero due to the missing MFSNAMELEN
define.

This change keeps the trymmap() function but changes it to check whether
using mmap() can reduce the number of system calls that are required.
Using mmap() only reduces the number of system calls if we need multiple read()
syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is more expensive
than read() so this sets the threshold at 4 fewer syscalls. Additionally, for
larger file size mmap() can significantly increase the number of page faults,
so avoid it in that case.

It's unclear whether using mmap() is ever faster than a read with an appropriate
buffer size, but this change at least removes two unnecessary system calls
for every file that is installed.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D26041

3 years agocxgbe(4): Do not request FEC when requesting speeds that don't have FEC.
Navdeep Parhar [Wed, 14 Oct 2020 10:12:39 +0000 (10:12 +0000)]
cxgbe(4): Do not request FEC when requesting speeds that don't have FEC.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoImplement SIOCGIFALIAS.
Andrey V. Elsukov [Wed, 14 Oct 2020 09:22:54 +0000 (09:22 +0000)]
Implement SIOCGIFALIAS.

It is lightweight way to check if an IPv4 address exists.

Submitted by: Roy Marples
Reviewed by: gnn, melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26636

3 years agocxgbe(4): unimplemented cudbg routines should return the correct
Navdeep Parhar [Wed, 14 Oct 2020 08:04:39 +0000 (08:04 +0000)]
cxgbe(4): unimplemented cudbg routines should return the correct
internal error code and not an errno.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoaxgbe: fix tinderbox build
Mateusz Guzik [Wed, 14 Oct 2020 02:23:49 +0000 (02:23 +0000)]
axgbe: fix tinderbox build