]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoixgbe: clear all queues on VF reset
Simon Ellmann [Thu, 17 Dec 2020 17:14:52 +0000 (18:14 +0100)]
ixgbe: clear all queues on VF reset

ixgbe devices support up to 8 Rx and Tx queues per virtual function.
Currently, the registers of only seven queues are set to default when
resetting a VF.

Signed-off-by: Simon Ellmann <simon.ellmann@tum.de>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Approved by: imp
Obtained from: DPDK (d2565b347915def3a0f3c68bde6824acf096a0e6)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31621

2 years agokqueue: drain kqueue taskqueue if syscall tickled it
Konstantin Belousov [Mon, 6 Sep 2021 11:43:06 +0000 (14:43 +0300)]
kqueue: drain kqueue taskqueue if syscall tickled it

Otherwise return from the syscall and next syscall, which could be
kevent(2) on the kqueue that should be notified, races with the kqueue
taskqueue thread, and potentially misses the wakeup.  This is reliably
visible when kevent(2) only peeks into events using zeroed timeout.

PR: 258310
Reported by: arichardson, Jan Kokemüller <jan.kokemueller@gmail.com>
Reviewed by: arichardson, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31858

2 years agolltable: do not require prefix lookup when checking lle allocation rules.
Alexander V. Chernikov [Fri, 3 Sep 2021 11:48:36 +0000 (11:48 +0000)]
lltable: do not require prefix lookup when checking lle allocation rules.

With the new FIB_ALGO infrastructure, nearly all subsystems use
 fib[46]_lookup() functions, which provides lockless lookups.
A number of places remains that uses old-style lookup functions, that
 still requires RIB read lock to return the result. One of such places
 is arp processing code.
FIB_ALGO implementation makes some tradeoffs, resulting in (relatively)
 prolonged periods of holding RIB_WLOCK. If the lock is held and datapath
 competes for it, the RX ring may get blocked, ending in traffic delays and losses.
As currently arp processing is performed directly in the interrupt handler,
 handling ARP replies triggers the problem descibed above when the amount of
 ARP replies is high.

To be more specific, prior to creating new ARP entry, routing lookup for the entry
 address in interface fib is executed. The following conditions are the verified:

1. If lookup returns an empty result, or the resulting prefix is non-directly-reachable,
 failure is returned. The only exception are host routes w/ gateway==address.
2. If the routing lookup returns different interface and non-host route,
 we want to support the use case of having multiple interfaces with the same prefix.
 In fact, the current code just checks if the returned prefix covers target address
 (always true) and effectively allow allocating ARP entries for any directly-reachable prefix,
 regardless of its interface.

Change the code to perform the following:

1) use fib4_lookup() to get the nexthop, instead of requesting exact prefix.
2) Rewrite first condition check using nexthop flags (1:1 match)
3) Rewrite second condition to check for interface addresses matching target address on
 the input interface.

Differential Revision: https://reviews.freebsd.org/D31824
Reviewed by: ae
MFC after: 1 week
PR: 257965

2 years agocompiler-rt: add aarch64 init function for LSE atomics
Dimitry Andric [Mon, 6 Sep 2021 19:23:10 +0000 (21:23 +0200)]
compiler-rt: add aarch64 init function for LSE atomics

As reported by Ronald, adding the out-of-line LSE atomics helpers for
aarch64 to compiler-rt was not sufficient to link programs using these,
as they also require a __aarch64_have_lse_atomics global. This is
initialized in compiler-rt's lib/builtins/cpu_model.c, roughly similar
to the x86 CPU model and feature detection in that file.

Since upstream does not yet have a FreeBSD specific implementation for
getting the required information, add a simple one that should work for
now, while I try to get it sorted with the LLVM people.

Reported by: Ronald Klop <ronald-lists@klop.ws>
Fixes: cc55ee8009a5
PR: 257392
MFC after: 2 weeks

2 years agoFix powf().
Mark Murray [Mon, 6 Sep 2021 17:26:39 +0000 (18:26 +0100)]
Fix powf().

Summary:
From Steve Kargl:

Paul Zimmermann has identified a bug in Openlibm's powf(),
which is identical to FreeBSD's libm.  Both derived from
fdlibm. https://github.com/JuliaMath/openlibm/issues/212.

Consider

% cat h.c
int
main(void)
{
  float x, y, z;
  x =  0x1.ffffecp-1F;
  y = -0x1.000002p+27F;
  z =  0x1.557a86p115F;
  printf("%e %e %e <-- should be %e\n", x, y, powf(x,y), z);
  return 0;
}

% cc -o h -fno-builtin h.c -lm && ./h
9.999994e-01 -1.342177e+08 inf <-- should be 5.540807e+34

Reviewers: manu

Subscribers: imp, andrew, emaste

Differential Revision: https://reviews.freebsd.org/D31865

2 years agogit-arc: allow word splitting in build_commit_list()
Robert Wing [Mon, 6 Sep 2021 15:42:46 +0000 (07:42 -0800)]
git-arc: allow word splitting in build_commit_list()

git-rev-list expects commits to be listed separately, allow word
splitting and disable shellcheck SC2086 when using git-rev-list
to build the commit list.

Fixes: 4fd0c6ab1a9e ("Fix most shellcheck warnings in git-arc.sh")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31838

2 years agoiconv: Fix "make make-ref"
Edward Tomasz Napierala [Mon, 6 Sep 2021 14:47:30 +0000 (15:47 +0100)]
iconv: Fix "make make-ref"

The purpose of this command is to "refresh" the source reference
files generated with GNU libiconv, located in tools/test/iconv/ref/.
Previously it would generate copies somewhere in OBJDIR, which
we don't use.

Reviewed By: allanjude
Sponsored by:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31820

2 years agoiconv: Fix tablegen iconv test utility on arm64
Edward Tomasz Napierala [Mon, 6 Sep 2021 14:44:59 +0000 (15:44 +0100)]
iconv: Fix tablegen iconv test utility on arm64

Previously it would loop indefinitely on getopt_long(3)
due to 'char' being unsigned.

Reviewed By: allanjude
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31817

2 years agoiconv: Fix path names used by iconv(3) tests.
Edward Tomasz Napierala [Mon, 6 Sep 2021 14:43:24 +0000 (15:43 +0100)]
iconv: Fix path names used by iconv(3) tests.

Reviewed By: allanjude
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31815

2 years agoiconv: Make it possible to build iconv(3) test suite.
Edward Tomasz Napierala [Mon, 6 Sep 2021 14:41:06 +0000 (15:41 +0100)]
iconv: Make it possible to build iconv(3) test suite.

It was broken after 1243a98e38a5.

Reviewed By: allanjude
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31816

2 years agostress2: Added a syzkaller reproducer
Peter Holm [Mon, 6 Sep 2021 13:32:23 +0000 (13:32 +0000)]
stress2: Added a syzkaller reproducer

2 years agoEnable MK_LLVM_BINUTILS if MK_ASAN is requested
Alex Richardson [Mon, 6 Sep 2021 09:24:33 +0000 (10:24 +0100)]
Enable MK_LLVM_BINUTILS if MK_ASAN is requested

ASan will not be able to provide backtraces with symbol names with
elftoolchain's addr2line. To fix this turn MK_LLVM_BINUTILS on by
default when ASan instrumentation is requested.

Reviewed By: emaste, markj
Differential Revision: https://reviews.freebsd.org/D31061

2 years agoAdd WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain
Alex Richardson [Mon, 6 Sep 2021 08:49:49 +0000 (09:49 +0100)]
Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain

When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as
ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones.
Having the LLVM binutils instead of the elftoolchain ones allows us to use
features such as LTO that depend on binutils that understand LLVM IR.
Another benefit will be an improved user-experience when compiling with
AddressSanitizer, since ASAN does not symbolize backtraces correctly if
addr2line is elftoolchain addr2line instead of llvm-symbolizer.
See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html
for more details.

This is currently off by default but will be turned on by default at some
point in the near future.

Reviewed By: emaste

Differential Revision: https://reviews.freebsd.org/D31060

2 years agoDon't build and install {llvm,clang,lldb}-tblgen for the target
Alex Richardson [Mon, 6 Sep 2021 08:31:58 +0000 (09:31 +0100)]
Don't build and install {llvm,clang,lldb}-tblgen for the target

The tablegen binaries are only needed to build software that uses
LLVM's infrastructure for command line options,
disassembler tables, etc. They are not user-facing binaries and
should therefore not be installed by default.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D31058

2 years agoDon't default MK_LLVM_TARGET_ALL to yes unless MK_CLANG is requested
Alex Richardson [Mon, 6 Sep 2021 08:31:24 +0000 (09:31 +0100)]
Don't default MK_LLVM_TARGET_ALL to yes unless MK_CLANG is requested

When building -DWITH_LLVM_BINUTILS -DWITHOUT_CLANG, this avoids
building a few hundred C++ source files that should not be needed
by default.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D31059

2 years agoAdd _sleep to TSLOG
Colin Percival [Sun, 5 Sep 2021 19:50:15 +0000 (12:50 -0700)]
Add _sleep to TSLOG

Most of the nvme initialization time in my tests is being spent here
(via pause_sbt).

2 years agoAdd some nvme initialization routines to TSLOG
Colin Percival [Sun, 5 Sep 2021 19:48:43 +0000 (12:48 -0700)]
Add some nvme initialization routines to TSLOG

About 335 ms of EC2 instance boot time is being spent here.

2 years agoAdd run_interrupt_driven_config_hooks to TSLOG
Colin Percival [Sun, 5 Sep 2021 19:45:29 +0000 (12:45 -0700)]
Add run_interrupt_driven_config_hooks to TSLOG

The 'intr_config_hooks' SYSINIT is now taking a nontrivial amount of
time in my profiling; run_interrupt_driven_config_hooks is responsible
for most of it, so this adds useful information to the resulting
flamecharts.

2 years agohpen(4): removed leftover hpen_final_digi_cb declaration
Mateusz Guzik [Sun, 5 Sep 2021 17:30:51 +0000 (17:30 +0000)]
hpen(4): removed leftover hpen_final_digi_cb declaration

2 years agostress2: Added missing ktrace() cleanup
Peter Holm [Sun, 5 Sep 2021 07:01:20 +0000 (09:01 +0200)]
stress2: Added missing ktrace() cleanup

2 years agosound(4): Remove pointless Giant from bus_dma_tag_create().
Alexander Motin [Sat, 4 Sep 2021 22:22:53 +0000 (18:22 -0400)]
sound(4): Remove pointless Giant from bus_dma_tag_create().

None of the drivers really implement asynchronous buffer loading, so
they don't need lock there.  The only question is which of them have
BUS_DMA_NOWAIT flag there already, and to which it should be added.

2 years agoffs: remove unused thread argument from ffs_reload()
Robert Wing [Sat, 4 Sep 2021 20:25:10 +0000 (12:25 -0800)]
ffs: remove unused thread argument from ffs_reload()

MFC After:      1 week
Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D31127

2 years agoRemove impossible checks.
Alexander Motin [Sat, 4 Sep 2021 20:10:50 +0000 (16:10 -0400)]
Remove impossible checks.

2 years agoioat(4): Remove Giant from ioat_test enable/disable.
Alexander Motin [Sat, 4 Sep 2021 19:53:28 +0000 (15:53 -0400)]
ioat(4): Remove Giant from ioat_test enable/disable.

MFC after: 1 month

2 years agoaltq: mark callouts as mpsafe
Kristof Provost [Sat, 4 Sep 2021 12:18:45 +0000 (14:18 +0200)]
altq: mark callouts as mpsafe

There's no reason to acquire the Giant lock while executing the ALTQ
callouts.

While here also remove a few backwards compatibility defines for long
obsolete FreeBSD versions.

Reviewed by: mav
Suggested by: mav
Differential Revision: https://reviews.freebsd.org/D31835

2 years agoSupport bootstrapping from Linux/ppc*
Justin Hibbits [Sat, 4 Sep 2021 16:45:56 +0000 (11:45 -0500)]
Support bootstrapping from Linux/ppc*

2 years agopowerpc: Fix typo in thread register copy
Justin Hibbits [Sat, 4 Sep 2021 16:43:17 +0000 (11:43 -0500)]
powerpc: Fix typo in thread register copy

Should be saving off td0's register's, not td's.

2 years ago[PowerPC] Fix outdated FP regs on fork(2) and friends
Brandon Bergren [Mon, 3 May 2021 02:12:18 +0000 (21:12 -0500)]
[PowerPC] Fix outdated FP regs on fork(2) and friends

Summary:
Failure to update the FP / vector state was causing daemon(3) to violate C ABI by failing to preserve nonvolatile registers.

This was causing a weird issue where moused was not working on PowerBook G4s when daemonizing, but was working fine when running it foreground.

Force saving off the same state that cpu_switch() does in cases where we are about to copy a thread.

MFC after: 1 week
Sponsored by: Tag1 Consulting, Inc.

Test Plan:
```
/*
 * Test for ABI violation due to side effects of daemon(3).
 *
 * NOTE: Compile with -O2 to see the effect.
 */
/* Allow compiling for Linux too. */

static double test = 1234.56f;

/*
 * This contrivance coerces clang to not bounce the double
 * off of memory again in main.
 */
void __attribute__((noinline))
print_double(int j1, int j2, double d)
{
printf("%f\n", d);
}

int
main(int argc, char *argv[])
{
print_double(0, 0, test);

if (daemon(0, 1)) {
}
/* Compiler assumes nonvolatile regs are intact... */
print_double(0, 0, test);
return(0);
}
```

Working output:
```
1234.560059
1234.560059
```

Output in broken case:
```
1234.560059
0.0
```

Reviewers: #powerpc

Subscribers: jhibbits, luporl, alfredo

Tags: #powerpc

Differential Revision: https://reviews.freebsd.org/D29851

2 years agoopenssh: update default version addendum in man pages
Ed Maste [Sat, 4 Sep 2021 15:33:13 +0000 (11:33 -0400)]
openssh: update default version addendum in man pages

Fixes: 2f513db72b03 ("Upgrade to OpenSSH 7.9p1.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agopfctl: print counters in decimal
Kristof Provost [Sat, 4 Sep 2021 14:07:59 +0000 (16:07 +0200)]
pfctl: print counters in decimal

795d78a46713 pfctl: Don't use PRIu64 mistakenly changed these to be
printed as hexadecimal numbers.

Reported by: Florian Smeets
MFC after: 4 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agocrypto(4): Fix a few typos in camellia.c
Gordon Bergling [Sat, 4 Sep 2021 11:02:11 +0000 (13:02 +0200)]
crypto(4): Fix a few typos in camellia.c

 - s/valiables/variables/

Obtained from: NetBSD
MFC after: 3 days

2 years agoFix a common typo in source code comments
Gordon Bergling [Sat, 4 Sep 2021 10:56:57 +0000 (12:56 +0200)]
Fix a common typo in source code comments

- s/existant/existent/

MFC after: 3 days

2 years agonet80211: add func/line information to IEEE80211_DISCARD* macros
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:24:51 +0000 (09:24 +0000)]
net80211: add func/line information to IEEE80211_DISCARD* macros

While debugging is very good in net80211, some log messages are
repeated in multiple places 1:1.  In order to distinguish where the
discard happened and to speed up analysis, add __func__:__LINE__
information to all these messages.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agonet80211: comments and whitespace
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:16:25 +0000 (09:16 +0000)]
net80211: comments and whitespace

Add a missing '.', fix spelling of "failed" and unwrap a closing );
No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agocaroot: update root store
Kyle Evans [Sat, 4 Sep 2021 07:26:32 +0000 (02:26 -0500)]
caroot: update root store

- Four (4) added
- Two (2) removed

2 years agoUnify console output.
Alexander Motin [Sat, 4 Sep 2021 03:13:42 +0000 (23:13 -0400)]
Unify console output.

Without this change when virtual console enabled depending on buffer
presence and state different parts of output go to different consoles.

MFC after: 1 month

2 years agoRe-implement virtual console (constty).
Alexander Motin [Sat, 4 Sep 2021 02:18:51 +0000 (22:18 -0400)]
Re-implement virtual console (constty).

Protect conscallout with tty lock instead of Giant.  In addition to
Giant removal it also closes race on console unset.

Introduce additional lock to protect against concurrent console sets.

Remove consbuf free on console unset as unsafe, making impossible to
change buffer size after first allocation.  Instead increase default
buffer size from 8KB to 64KB and processing rate from 5Hz to 10-15Hz
to make the output more smooth.

MFC after: 1 month

2 years agort(4): Replace Giant callout+task with timeout_task.
Alexander Motin [Fri, 3 Sep 2021 22:08:29 +0000 (18:08 -0400)]
rt(4): Replace Giant callout+task with timeout_task.

2 years agoopenssh: remove login class restrictions leftovers
Ed Maste [Thu, 2 Sep 2021 21:13:29 +0000 (17:13 -0400)]
openssh: remove login class restrictions leftovers

MFC after: 2 weeks
Fixes: 27ceebbc2402 ("openssh: simplify login class...")
Sponsored by: The FreeBSD Foundation

2 years agoopenssh: restore local change to gssapi include logic
Ed Maste [Thu, 2 Sep 2021 20:43:59 +0000 (16:43 -0400)]
openssh: restore local change to gssapi include logic

/usr/include/gssapi.h claims that it is deprecated, and gssapi/gssapi.h
should be used instead.  So, test HAVE_GSSAPI_GSSAPI_H first falling
back to HAVE_GSSAPI_H.

This will be submitted upstream.

Fixes: 6eac665c8126 ("openssh: diff reduction against...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31810

2 years agovt(4): Mark callouts MP-safe.
Alexander Motin [Fri, 3 Sep 2021 19:42:46 +0000 (15:42 -0400)]
vt(4): Mark callouts MP-safe.

The code explicitly takes Giant when it accesses keyboard, and I see
no reason to take it globally by callout(9).

MFC after: 1 month

2 years agopcib(4): Switch from callout to timeout_task.
Alexander Motin [Fri, 3 Sep 2021 19:00:21 +0000 (15:00 -0400)]
pcib(4): Switch from callout to timeout_task.

This allows to avoid blocking on Giant in callout context, moving to
already existing dedicated taskqueue_pci_hp thread.

MFC after: 1 month

2 years agomprotect.2: Remove legacy BSD text
Brooks Davis [Fri, 3 Sep 2021 18:30:23 +0000 (19:30 +0100)]
mprotect.2: Remove legacy BSD text

This text dates to the BSD 4.4 import and is misleading.  The mprotect
syscall acts on page granularity and breaks up mappings as required to
do so.

Note that with the addition of non-transparent superpages (aka
largepages) the size of a page at a given address may vary.  This
commit does not attempt to address the lack of documentation of this
feature.

Sponsored by: DARPA

Reviewed by: alc, mckusick, imp, kib, markj
Differential Revision: https://reviews.freebsd.org/D31776

2 years agobnxt(4): Mark sysctls MP-safe.
Alexander Motin [Fri, 3 Sep 2021 17:51:08 +0000 (13:51 -0400)]
bnxt(4):  Mark sysctls MP-safe.

MFC after: 1 month

2 years agobxe(4): Mark sysctls and callout MP-safe.
Alexander Motin [Fri, 3 Sep 2021 16:25:32 +0000 (12:25 -0400)]
bxe(4): Mark sysctls and callout MP-safe.

MFC after: 1 month

2 years agomge(4): Mark sysctls and callout MP-safe.
Alexander Motin [Fri, 3 Sep 2021 16:13:56 +0000 (12:13 -0400)]
mge(4): Mark sysctls and callout MP-safe.

MFC after: 1 month

2 years agollvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLo...
Alfredo Dal'Ava Junior [Thu, 2 Sep 2021 17:54:31 +0000 (14:54 -0300)]
llvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount."

Reverts llvm commit 42eaf4fe0adef3344adfd9fbccd49f325cb549ef, pointed
from bisect as source of regression that causes liblzma to compress/
uncompress incorrectly. It's know to affect powerpc64 BE only.

The patch unbreaks FreeBSD powerpc64 installation media, since
bsdinstall can't uncompress the *.txz produced by FreeBSD CI. It's
probably miscompiling other software bas well.

Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=51714

Reviewed by: dim
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D31804

2 years agowpa: Enable RSN Preauthentication
Cy Schubert [Fri, 3 Sep 2021 13:14:59 +0000 (06:14 -0700)]
wpa: Enable RSN Preauthentication

RSN Preauthentication allows a station autnetnicate to an AP that
it is not associated with yet while associated with a different AP.
This allows athentication to multiple APs simulteneously.

Tested by: philip
MFC after: 2 months

2 years agowpa: Enable MBO
Cy Schubert [Fri, 3 Sep 2021 13:14:01 +0000 (06:14 -0700)]
wpa: Enable MBO

Enable WiFi 6 MBO (Multi Band Operation). MBO is a prereq to 802.11ax.

MBO allows the efficient use of multiple frequency bands (channels).

To facilitate MBO, WNM (Wireless Network Monitoring) is a prerequisite.
It is required to build.

Tested by: philip
MFC after: 2 months

2 years agowpa: Import wpa_supplicant/hostapd commits up to b4f7506ff
Cy Schubert [Fri, 3 Sep 2021 13:07:19 +0000 (06:07 -0700)]
wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff

Merge vendor commits 40c7ff83e74eabba5a7e2caefeea12372b2d3f9a,
efec8223892b3e677acb46eae84ec3534989971f, and
2f6c3ea9600b494d24cac5a38c1cea0ac192245e.

Tested by: philip
MFC after: 2 months

2 years agopf: ensure states passed to pf_free_state() are always unlinked
Kristof Provost [Fri, 3 Sep 2021 07:36:19 +0000 (09:36 +0200)]
pf: ensure states passed to pf_free_state() are always unlinked

In pf_create_state() we can end up deleting the state immediately. This
can happen if we fail to map the relevant addresses or fail
normalization or fail to insert it into the state table.
If that happens we delete the state again with pf_free_state(). However,
this asserts that the state must be unlinked.

It's correct to simply set the state to PFTM_UNLINKED because we've not
yet linked it.

Submitted by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed by: scottl
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31752

2 years agotcp: document TCP Fast Open (RFC 7413) in tcp(4)
Philip Paeps [Fri, 3 Sep 2021 02:33:12 +0000 (10:33 +0800)]
tcp: document TCP Fast Open (RFC 7413) in tcp(4)

Adds documentation for the TCP_FASTOPEN socket option
and related MIB variables to the tcp(4) manual page.

PR: 257907
Reviewed by: gbe
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31764

2 years agoMissed line from 7af4475a6e31.
Alexander Motin [Fri, 3 Sep 2021 02:25:16 +0000 (22:25 -0400)]
Missed line from 7af4475a6e31.

MFC after: 2 weeks

2 years agocallout(9): Allow spin locks use with callout_init_mtx().
Alexander Motin [Fri, 3 Sep 2021 01:16:46 +0000 (21:16 -0400)]
callout(9): Allow spin locks use with callout_init_mtx().

Implement lock_spin()/unlock_spin() lock class methods, moving the
assertion to _sleep() instead.  Change assertions in callout(9) to
allow spin locks for both regular and C_DIRECT_EXEC cases. In case of
C_DIRECT_EXEC callouts spin locks are the only locks allowed actually.

As the first use case allow taskqueue_enqueue_timeout() use on fast
task queues.  It actually becomes more efficient due to avoided extra
context switches in callout(9) thanks to C_DIRECT_EXEC.

MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D31778

2 years agovmd(4): Major driver refactoring
Alexander Motin [Fri, 3 Sep 2021 00:58:02 +0000 (20:58 -0400)]
vmd(4): Major driver refactoring

 - Re-implement pcib interface to use standard pci bus driver on top of
vmd(4) instead of custom one.
 - Re-implement memory/bus resource allocation to properly handle even
complicated configurations.
 - Re-implement interrupt handling to evenly distribute children's MSI/
MSI-X interrupts between available vmd(4) MSI-X vectors and setup them
to be handled by standard OS mechanisms with minimal overhead, except
sharing when unavoidable.

Successfully tested on Dell XPS 13 laptop with Core i7-1185G7 CPU (VMD
device ID 0x9a0b) and single NVMe SSD, dual-booting with Windows 10.

Successfully tested on Supermicro X11DPI-NT motherboard with Xeon(R)
Gold 6242R CPUs (VMD device ID 0x201d), simultaneously handling NVMe
SSD on one PCIe port and PLX bridge with 3 NVMe and 1 AHCI SSDs on
another.  Handles SSD hot-plug (except Optane 905p for some reason,
which are not detected until manual bus rescan) and enabled IOMMU
(directly connected SSDs work, but ones connected to the PLX fail
without errors from IOMMU).

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential revision: https://reviews.freebsd.org/D31762

2 years agobnxt(4): Fix bugs in WOL support.
Alexander Motin [Thu, 2 Sep 2021 22:11:58 +0000 (18:11 -0400)]
bnxt(4): Fix bugs in WOL support.

Before this change driver reported IFCAP_WOL_MAGIC enabled, but not
supported.  It caused errors on some SIOCSIFCAP calls.  Instead
report the support if hardware supports WOL, and enabled status if
it has such filter installed on boot.

Also bnxt_wol_config() should check WOL status in if_getcapenable(),
not in if_getcapabilities() to get current one.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

2 years agoloader.efi: fix console output after BS off
Toomas Soome [Thu, 2 Sep 2021 21:17:32 +0000 (00:17 +0300)]
loader.efi: fix console output after BS off

When Boot Services (BS) are switched off, we can not use BS
functions any more. Since drawn console does implement our own
Blt(), we can use it to draw the console.

However, SimpleTextOutput protocol based console output must be
blocked.

Tested by inserting printf() after ExitBootServices() call.

MFC after: 1 week

2 years agoses: Guard the elm_type_names declaration by _KERNEL
Alan Somers [Mon, 30 Aug 2021 20:45:13 +0000 (14:45 -0600)]
ses: Guard the elm_type_names declaration by _KERNEL

MFC after: 2 weeks
Sponsored by: Axcient

2 years agoses: Correct spelling of "Temperature Sensor"
Alan Somers [Mon, 30 Aug 2021 19:59:32 +0000 (13:59 -0600)]
ses: Correct spelling of "Temperature Sensor"

According to SES 4 revision 2 table 71, it should be singular.

MFC after: 2 weeks
Sponsored by: Axcient

2 years agohmt(4): Add support for touchpads with no "button type" or
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:51 +0000 (22:33 +0300)]
hmt(4): Add support for touchpads with no "button type" or

"maximum number of contacts" usages.

Assume touchpad to be a clickpad if it has only internal button.
Set number of contacts to 5 for touchpads and to 10 for touchscreens.
Check for fetched report length to avoid reading of stalled data.
Fixes Dell Precision 7550 laptop.

Tested by: Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
PR: 257992
MFC after: 2 week

2 years agohpen(4): Add support for legacy MS-compatible single touch protocol
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:24 +0000 (22:33 +0300)]
hpen(4): Add support for legacy MS-compatible single touch protocol

It is used by many pre- and post- 2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 2 week

2 years agohidbus(4): Add routine to check presence of collection of given usage
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:57 +0000 (22:32 +0300)]
hidbus(4): Add routine to check presence of collection of given usage

MFC after: 2 week

2 years agohidmap: Do not forget to initialize bitmap items to unset state
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:14 +0000 (22:32 +0300)]
hidmap: Do not forget to initialize bitmap items to unset state

MFC after: 2 week

2 years agohidmap: Implement forbidden flag for hidmap item.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:51 +0000 (22:31 +0300)]
hidmap: Implement forbidden flag for hidmap item.

If HID usage is mapped to evdev event by hidmap item marked with this
flag than entire driver attachment is blocked.

MFC after: 2 week

2 years agohmt(4): Add support for serial packet reporting mode
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:17 +0000 (22:31 +0300)]
hmt(4): Add support for serial packet reporting mode

In Serial mode, each packet contains information that describes a
single physical contact point. Multiple contacts are streamed
serially. In this mode, devices report all contact information in a
series of packets. The device sends a separate packet for each
concurrent contact.

Serial packet reporting mode is used by post-2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 2 weeks

2 years agopsm: Use evdev autorelease feature for Synaptics and Elantech drivers
Vladimir Kondratyev [Thu, 2 Sep 2021 19:30:29 +0000 (22:30 +0300)]
psm: Use evdev autorelease feature for Synaptics and Elantech drivers

MFC after: 2 weeks

2 years agopsm: Enable touch-tracking for late Synaptics PS/2 touchpads.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:29:49 +0000 (22:29 +0300)]
psm: Enable touch-tracking for late Synaptics PS/2 touchpads.

They are true multitouch internally but Synaptics PS/2 protocol
limitations do not all allow to export touch identificators.

MFC after: 2 weeks

2 years agoevdev: Do not export multitouch functions which are unused outside evdev
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:34 +0000 (22:28 +0300)]
evdev: Do not export multitouch functions which are unused outside evdev

2 years agocyapa(4): Adapt to recent evdev KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:05 +0000 (22:28 +0300)]
cyapa(4): Adapt to recent evdev KPI changes

MFC after: 2 weeks

2 years agowmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:27:02 +0000 (22:27 +0300)]
wmt(4): Adapt to recent KPI changes

MFC after: 2 weeks

2 years agohmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:25:27 +0000 (22:25 +0300)]
hmt(4): Adapt to recent KPI changes

MFC after: 2 weeks

2 years agoopenssh: diff reduction against upstream 7.9p1
Ed Maste [Thu, 2 Sep 2021 17:38:30 +0000 (13:38 -0400)]
openssh: diff reduction against upstream 7.9p1

Clean up whitespace and nonfunctional differences, and unused functions.

2 years agocluster_write(): do not access buffer after it is released
Konstantin Belousov [Thu, 2 Sep 2021 04:04:23 +0000 (07:04 +0300)]
cluster_write(): do not access buffer after it is released

The issue was reported by
Alexander Lochmann <alexander.lochmann@tu-dortmund.de>,
who found the problem by performing lock analysis using LockDoc,
see https://doi.org/10.1145/3302424.3303948.

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31780

2 years agovmem: disable debug.vmem_check by default
Mateusz Guzik [Thu, 2 Sep 2021 09:49:39 +0000 (11:49 +0200)]
vmem: disable debug.vmem_check by default

It has a prohibitive performance impact when running real workloads.

Note this only affects kernels with DIAGNOSTIC.

Reviewed by: markj
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31784

2 years agogetdelim(3): Fix losing data on [EAGAIN]
Bryan Drewery [Wed, 25 Aug 2021 18:37:11 +0000 (11:37 -0700)]
getdelim(3): Fix losing data on [EAGAIN]

Currently when an [EAGAIN] is encountered we return a partial result
that does not contain the delimeter.  On the next (successful) read we
were returning the next part of the line without the preceding string
from the first failed call.

Fix this by using the same mechanism as ungetc(3) does.  For the buffered
case we could simply set fp->_r and fp->_p back to their values before
sappend() is ran but for simplicity ungetc(3) is done in there as well.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31687

2 years agoopenssh: regenerate freebsd-namespace.h
Ed Maste [Thu, 2 Sep 2021 01:54:57 +0000 (21:54 -0400)]
openssh: regenerate freebsd-namespace.h

For some reason poly64 was omitted when this file was last generated
(perhaps it was inlined by the Clang version then in use).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoopenssh: tag generated file with @generated
Ed Maste [Thu, 2 Sep 2021 01:49:44 +0000 (21:49 -0400)]
openssh: tag generated file with @generated

Tools like Phabricator use the @generated tag to identify files that
may be excluded from review by default.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agodtrace: fix ipfw_rule_info_t translator
Andrey V. Elsukov [Thu, 2 Sep 2021 13:35:01 +0000 (16:35 +0300)]
dtrace: fix ipfw_rule_info_t translator

322e5efda8578b has changed field names in the struct ip_fw.
Use correct names in ipfw_rule_info_t translator in the ipfw.d script.

Reported by: Keith White <kwhite uottawa at gmail>
MFC after: 1 week

2 years agoSymbol.map: Remove an extra space before _Fork
Ka Ho Ng [Thu, 2 Sep 2021 13:07:08 +0000 (21:07 +0800)]
Symbol.map: Remove an extra space before _Fork

Make it consistent with all other entries.

Sponsored by: The FreeBSD Foundation

2 years agoman: A trailing space cleanup in man9's Makefile
Ka Ho Ng [Thu, 2 Sep 2021 13:04:01 +0000 (21:04 +0800)]
man: A trailing space cleanup in man9's Makefile

Sponsored by: The FreeBSD Foundation

2 years agopfctl: Don't use PRIu64
Kristof Provost [Wed, 1 Sep 2021 16:18:26 +0000 (18:18 +0200)]
pfctl: Don't use PRIu64

Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

MFC after: 1 week
Suggested by: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agostress2: Update test to new working of option nomtime
Peter Holm [Thu, 2 Sep 2021 07:12:58 +0000 (07:12 +0000)]
stress2: Update test to new working of option nomtime

2 years agostress2: Added timeout for looping mdnsd
Peter Holm [Thu, 2 Sep 2021 07:11:01 +0000 (07:11 +0000)]
stress2: Added timeout for looping mdnsd

2 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:09:39 +0000 (07:09 +0000)]
stress2: Fix cleanup

2 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:08:58 +0000 (07:08 +0000)]
stress2: Fix cleanup

2 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:07:44 +0000 (07:07 +0000)]
stress2: Fix cleanup

2 years agostress2: Make test less verbose
Peter Holm [Thu, 2 Sep 2021 07:06:55 +0000 (07:06 +0000)]
stress2: Make test less verbose

2 years agoopenssh: regenerate config.h
Ed Maste [Thu, 2 Sep 2021 00:35:45 +0000 (20:35 -0400)]
openssh: regenerate config.h

Since config.h was last regenerated FreeBSD has added (a stub) libdl,
and has removed sys/dir.h.  Regenerate config.h to avoid spurious
additional changes when OpenSSH is next updated.

There should be no issue if this change is MFC'd, but I don't plan to do
so.  Although configure checks for libdl HAVE_LIBDL isn't even used, and
sys/dir.h was non-functional before being removed.  The state of these
two config.h settings should make no difference in the built OpenSSH.

Sponsored by: The FreeBSD Foundation

2 years agoopenssh: disable libwrap (TCP wrappers) at configure time
Ed Maste [Thu, 2 Sep 2021 00:30:05 +0000 (20:30 -0400)]
openssh: disable libwrap (TCP wrappers) at configure time

We define LIBWRAP at build time in secure/usr.sbin/sshd/Makefile if
WITH_TCPWRAPPERS is in effect, so it should not be set in config.h.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoopenssh: clarify krb5 use in freebsd-configure
Ed Maste [Thu, 2 Sep 2021 00:23:40 +0000 (20:23 -0400)]
openssh: clarify krb5 use in freebsd-configure

freebsd-configure.sh runs configure twice, --with-kerberos5 and
--without-kerberos5, in order to build a config.h that defaults to
kerberos5 disabled, and a small config file that represents the
differences.

Rename config.h.orig to config.h.kerberos5 to clarify the intent of this
script.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoena: Update driver version to v2.4.1
Michal Krawczyk [Thu, 12 Aug 2021 08:34:30 +0000 (10:34 +0200)]
ena: Update driver version to v2.4.1

Some of the changes in this release:
* Hardware RSS hash key reconfiguration and indirection table
reconfiguration support.
* Full kernel RSS support.
* Extra statistic counters.
* Netmap support for ENAv3.
* Locking assertions.
* Extra log messages.
* Reset handling fixes.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Implement full RSS reconfiguration
Artur Rojek [Thu, 12 Aug 2021 08:34:29 +0000 (10:34 +0200)]
ena: Implement full RSS reconfiguration

Bind RX/TX queues and MSI-X vectors to matching CPUs based on the RSS
bucket entries.

Introduce sysctls for the following RSS functionality:
- rss.indir_table:      indirection table mapping
- rss.indir_table_size: indirection table size
- rss.key:              RSS hash key (if Toeplitz used)

Said sysctls are only available when compiled without `option RSS`, as
kernel-side RSS support currently doesn't offer RSS reconfiguration.

Migrate the hash algorithm from CRC32 to Toeplitz and change the initial
hash value to 0x0 in order to match the standard Toeplitz implementation.
Provide helpers for hash key inversion required for HW operations.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add missing statistics
Artur Rojek [Thu, 12 Aug 2021 08:34:29 +0000 (10:34 +0200)]
ena: Add missing statistics

Provide the following sysctl statistics in order to stay aligned with
the Linux driver:
* rx_ring.csum_good
* tx_ring.unmask_interrupt_num

Also rename the 'bad_csum' statistic name to 'csum_bad' for alignment.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Share ena_global_lock between driver instances
Artur Rojek [Thu, 12 Aug 2021 08:34:28 +0000 (10:34 +0200)]
ena: Share ena_global_lock between driver instances

In order to use `ena_global_lock` in sysctl context, it must be kept
outside the driver instance's software context, as sysctls can be called
before attach and after detach, leading to lock use before sx_init and
after sx_destroy otherwise.
Solve this issue by turning `ena_global_lock` into a file scope
variable, shared between all instances of the driver and associated
sysctl context, and in turn initialized/destroyed in dedicated
SYSINIT/SYSUNINIT functions.
As a side effect, this change also fixes existing race in the reset
routine, when simultaneously accessing sysctl exposed properties.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Disable meta descriptor caching for netmap
Artur Rojek [Thu, 12 Aug 2021 08:34:28 +0000 (10:34 +0200)]
ena: Disable meta descriptor caching for netmap

If LLQ is being used, `ena_tx_ctx.meta_valid` must stay enabled. This
fixes netmap support on latest generation ENA HW and aligns it with the
core driver behavior.

As netmap doesn't support any csum offloads, the
`adapter->disable_meta_caching` value can be simply passed to the HW.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Move RSS logic into its own source files
Artur Rojek [Thu, 12 Aug 2021 08:34:27 +0000 (10:34 +0200)]
ena: Move RSS logic into its own source files

Delegate RSS related functionality into separate .c/.h files in
preparation for the full RSS support.

While at it, reorder functions and remove prototypes for ones with
internal linkage.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add locking assertions
Artur Rojek [Thu, 12 Aug 2021 08:34:26 +0000 (10:34 +0200)]
ena: Add locking assertions

ENA silently assumed that ena_up, ena_down and ena_start_xmit routines
should be called within locked context. Driver's logic heavily assumes
on concurrent access to those routines, so for safety and better
documentation about this assumption, the locking assertions were added
to the above functions.

The assertion was added only for the main steps (skipping the helper
functions) which can be called from multiple places including the kernel
and the driver itself.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add extra log messages
Artur Rojek [Thu, 12 Aug 2021 08:34:26 +0000 (10:34 +0200)]
ena: Add extra log messages

Stay aligned with the Linux driver by adding the following logs:
* inform the user about retrying queue creation
* warn on non-empty ena_tx_buffer.mbuf prior to ena_tx_map_mbuf

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Prevent reset after device destruction
Artur Rojek [Thu, 12 Aug 2021 08:34:25 +0000 (10:34 +0200)]
ena: Prevent reset after device destruction

Check for ENA_FLAG_TRIGGER_RESET inside a locked context in order to
avoid potential race conditions with ena_destroy_device. This aligns the
reset task logic with the Linux driver.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Trigger reset on ena_com_prepare_tx failure
Artur Rojek [Thu, 12 Aug 2021 08:34:24 +0000 (10:34 +0200)]
ena: Trigger reset on ena_com_prepare_tx failure

All ena_com_prepare_tx errors other than ENA_COM_NO_MEM are fatal and
require device reset.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.