Commit Graph

257310 Commits

Author SHA1 Message Date
Jason A. Harmening
e4b8deb222 amd64 pmap: convert to counter(9), add PV and pagetable page counts
This change converts most of the counters in the amd64 pmap from
global atomics to scalable counter(9) counters.  Per discussion
with kib@, it also removes the handrolled per-CPU PCID save count
as it isn't considered generally useful.

The bulk of these counters remain guarded by PV_STATS, as it seems
unlikely that they will be useful outside of very specific debugging
scenarios.  However, this change does add two new counters that
are available without PV_STATS.  pt_page_count and pv_page_count
track the number of active physical-to-virtual list pages and page
table pages, respectively.  These will be useful in evaluating
the memory footprint of pmap structures under various workloads,
which will help to guide future changes in this area.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D28923
2021-03-09 09:27:10 -08:00
Leandro Lupori
043577b721 ofwfb: fix boot on LE
Some framebuffer properties obtained from the device tree were not being
properly converted to host endian.
Replace OF_getprop calls by OF_getencprop where needed to fix this.

This fixes boot on PowerPC64 LE, when using ofwfb as the system console.

Reviewed by:    bdragon
Sponsored by:   Eldorado Research Institute (eldorado.org.br)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27475
2021-03-09 13:29:24 -03:00
Baptiste Daroussin
f61831d2e8 Revert "rc: implement parallel boot"
This is not ready yet for prime time

This reverts commit 763db58932.
This reverts commit f1ab799927.
This reverts commit 6e822e9957.
This reverts commit 77e1ccbee3.
2021-03-09 14:26:07 +01:00
Kyle Evans
b3dac3913d ifconfig: allow displaying/setting persistent-keepalive
The kernel-side already accepted a persistent-keepalive-interval, so
just add a verb to ifconfig(8) for it and start exporting it so that
ifconfig(8) can view it.

PR:		253790
MFC after:	3 days
Discussed with:	decke
2021-03-09 05:16:42 -06:00
Kyle Evans
172a8241c9 ifconfig: wg: stop requiring peer endpoints
The way that wireguard is designed does not actually require all peers
to have endpoints. In an architecture that might mimic a traditional
VPN server <-> client, the wg interface on a server would have a number
of peers without set endpoints -- the expectation is that the "clients"
will connect to the "server" peer, which will authenticate the
connection as a known peer and learn the endpoint from there.

MFC after:	3 days
Discussed with:	decke, grehan (independently)
2021-03-09 05:16:42 -06:00
Kyle Evans
1ae20f7c70 kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING()
Simple condition flip; we wanted to panic here after epoch_trace_list().

Reviewed by:	glebius, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29125
2021-03-09 05:16:39 -06:00
Kyle Evans
e80e371d79 if_wg: avoid sleeping under the net epoch
No sleeping allowed here, so avoid it.  Collect the subset of data we
want inside of the epoch, as we'll need extra allocations when we add
items to the nvlist.

Reviewed by:	grehan (earlier version), markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29124
2021-03-09 05:16:30 -06:00
Kyle Evans
bae59285f9 if_wg: return to m_defrag() of incoming mbuf, sans leak
This partially reverts df55485085 but still fixes the leak. It was
overlooked (sigh) that some packets will exceed MHLEN and cannot be
physically contiguous without clustering, but we don't actually need
it to be. m_defrag() should pull up enough for any of the headers that
we do need to be accessible.

Fixes:	df55485085
Pointy hat;	kevans
2021-03-09 04:52:22 -06:00
Rick Macklem
09673fc0f3 mountd(8): generate a syslog message when the "V4:" line is missing
Daniel reported that NFSv4 mounts were not working despite having
set "nfsv4_server_enable=YES" in /etc/rc.conf.  Mountd was logging a
message that there was no /etc/exports file.
He noted that creating a /etc/exports file with a "V4:" line in it
was needed make NFSv4 mounts work.
At least one "V4:" line in one of the exports(5) file(s) is needed to
make NFSv4 mounts work. This patch fixes mountd.c so that it logs a
message indicting that there is no "V4:" line in any exports(5)
file when NFSv4 mounts are enabled.
To avoid this message being generated erroneously, /etc/rc.d/mountd
is updated to make sure vfs.nfsd.server_max_nfsvers is properly set
before mountd(8) is started.

Reported by:	debdrup
PR:	253901
MFC after:	2 weeks
2021-03-08 16:08:02 -08:00
Alexander Motin
075e4807df Do not read timer extra time when MWAIT is used.
When we enter C2+ state via memory read, it may take chipset some
time to stop CPU.  Extra register read covers that time.  But MWAIT
makes CPU stop immediately, so we don't need to waste time after
wakeup with interrupts still disabled, increasing latency.

On my system it reduces ping localhost latency, waking up all CPUs
once a second, from 277us to 242us.

MFC after:	1 month
2021-03-08 18:43:47 -05:00
Alexander Motin
455219675d Change mwait_bm_avoidance use to match Linux.
Even though the information is very limited, it seems the intent of
this flag is to control ACPI_BITREG_BUS_MASTER_STATUS use for C3,
not force ACPI_BITREG_ARB_DISABLE manipulations for C2, where it was
never needed, and which register not really doing anything for years.
It wasted lots of CPU time on congested global ACPI hardware lock
when many CPU cores were trying to enter/exit deep C-states same time.

On idle 80-core system it pushed ping localhost latency up to 20ms,
since badport_bandlim() via counter_ratecheck() wakes up all CPUs
same time once a second just to synchronously reset the counters.
Now enabling C-states increases the latency from 0.1 to just 0.25ms.

Discussed with:	kib
MFC after:	1 month
2021-03-08 18:27:36 -05:00
Warner Losh
6ffdaa5f2d Move back the isa non-PNP driver deadline to FreeBSD 14. 2021-03-08 16:00:23 -07:00
Warner Losh
88a5591203 config_intrhook: Move from TAILQ to STAILQ and padding
config_intrhook doesn't need to be a two-pointer TAILQ. We rarely add/delete
from this and so those need not be optimized. Instaed, use the one-pointer
STAILQ plus a uintptr_t to be used as a flags word. This will allow these
changes to be MFC'd to 12 and 13 to fix a race in removable devices.

Feedback from: jhb
Reviewed by: mav
Differential Revision:	https://reviews.freebsd.org/D29004
2021-03-08 15:59:00 -07:00
Alexander V. Chernikov
7634919e15 Fix 'in6_purgeaddr: err=65, destination address delete failed' message.
P2P ifa may require 2 routes: one is the loopback route, another is
 the "prefix" route towards its destination.

Current code marks loopback routes existence with IFA_RTSELF and
 "prefix" p2p routes with IFA_ROUTE.

For historic reasons, we fill in ifa_dstaddr for loopback interfaces.
To avoid installing the same route twice, we preemptively set
 IFA_RTSELF when adding "prefix" route for loopback.
However, the teardown part doesn't have this hack, so we try to
 remove the same route twice.

Fix this by checking if ifa_dstaddr is different from the ifa_addr
 and moving this logic into a separate function.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D29121
MFC after:	3 days
2021-03-08 21:28:35 +00:00
Jessica Clarke
f2f8405cf6 if_vtbe: Add missing includes to fix build
PR:		254137
Reported by:	Mina Galić <me@igalic.co>
MFC after:	3 days
Fixes:		f8bc74e2f4 ("tap: add support for virtio-net offloads")
2021-03-08 20:48:48 +00:00
Kyle Evans
8cc15b0dfc x86: tsc: deprioritize TSC on VirtualBox
Misbehavior has been observed with TSC under VirtualBox, where threads
doing small sleeps (~1 second) may miss their wake up and hang around
in a sleep state indefinitely.  Switching back to ACPI-fast decidedly
fixes it, so stop using TSC on VirtualBox at least for the time being.

This partially reverts 84eaf2ccc6, applying it only to VirtualBox and
increasing the quality to 0. Negative qualities can never be chosen and
cannot be chosen with the tunable recently added. If we do not have a
timecounter with a higher quality than 0, then TSC does at least leave
the system mostly usable.

PR:		253087
Reviewed by:	emaste, kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29132
2021-03-08 14:43:06 -06:00
John Baldwin
ef74bfc6fe Add ObsoleteFiles.inc entries for various OCF headers removed in 13.
MFC after:	3 days
2021-03-08 11:17:21 -08:00
John Baldwin
c5a365623f Correct the name of the structure used for TCP socket options.
The structure was renamed while refactoring Netflix's KTLS changes for
upstreaming, but the original name remained in tcp.4 and was
subsequently copied to ktls.4.

PR:		254141
Reported by:	asomers
MFC after:	3 days
2021-03-08 10:46:40 -08:00
Mark Johnston
1bb7c45c53 wg: Fix a mismerge
df55485085 fixed a leak that I had initially fixed in a11009dccb.

Fixes:	a11009dccb
2021-03-08 12:56:14 -05:00
Mark Johnston
ffe3def903 iflib: Make if_shared_ctx_t a pointer to const
This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by:	gallatin, erj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29102
2021-03-08 12:39:06 -05:00
Mark Johnston
435c7cfb24 Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h
Other kernel sanitizers (KMSAN, KASAN) require interceptors as well, so
put these in a more generic place as a step towards importing the other
sanitizers.

No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29103
2021-03-08 12:39:06 -05:00
Mark Johnston
0e72eb4602 ath_hal: Stop printing messages during boot
ath_hal is compiled into the kernel by default and so always prints a
message to dmesg even when the system has no ath hardware.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-03-08 12:39:06 -05:00
Mark Johnston
7995dae9d3 posix timers: Improve the overrun calculation
timer_settime(2) may be used to configure a timeout in the past.  If
the timer is also periodic, we also try to compute the number of timer
overruns that occurred between the initial timeout and the time at which
the timer fired.  This is done in a loop which iterates once per period
between the initial timeout and now.  If the period is small and the
initial timeout was a long time ago, this loop can take forever to run,
so the system is effectively DOSed.

Replace the loop with a more direct calculation of
(now - initial timeout) / period to compute the number of overruns.

Reported by:	syzkaller
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29093
2021-03-08 12:39:06 -05:00
Mark Johnston
60d12ef952 posix timers: Sprinkle some style fixes
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-03-08 12:39:06 -05:00
Mark Johnston
8ff2b41c05 posix timers: Declare unexported functions as static
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-03-08 12:39:06 -05:00
Mark Johnston
d8cebef50e wg: Style
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-03-08 12:39:05 -05:00
Mark Johnston
a11009dccb wg: Avoid leaking mbufs when the input handshake queue is full
Reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29011
2021-03-08 12:39:05 -05:00
Mark Johnston
af06ff5553 dumpon.8: Ask DDB to call doadump() rather than calling it directly
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-03-08 12:39:05 -05:00
Alex Richardson
221622ec0c lib/msun: Avoid FE_INEXACT for x86 log2l/log10l
This fixes tests/lib/msun/logarithm_test after compiling the test with
-fno-builtin (D28577). Adding invln10_lo + invln10_10 results in
FE_INEXACT (for all inputs) and the same for the log2l invln2_lo + invln2_hi.
This patch avoids FE_INEXACT (for exact results such as 0) by defining a
constant and using that.

Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D28786
2021-03-08 09:39:32 +00:00
Alex Richardson
0b86424c31 tests/sys/cddl: correctly quote atf_set "require.progs"
The argument has to be a single whitespace-separate value. While touching
all these lines also add ksh93, since `atf_set "require.progs"` overrides
the default value specified in the Kyuafile. This then results in tests
being executed despite ksh93 not being installed.

Reviewed By:	asomers
Differential Revision: https://reviews.freebsd.org/D29066
2021-03-08 09:38:27 +00:00
Alex Richardson
01fe4cac28 kern.mk: Fix wrong variable being used for linker path after 172a624f0
When I synchronized kern.mk with bsd.sys.mk, I accidentally changed
CCLDFLAGS to LDFLAGS which is not used by the kernel builds. This commit
should unbreak the GitHub actions cross-build CI. I didn't notice it
locally because cheribuild already passes -fuse-ld in the linker flags as
it predates this being done in the makefiles.

Reported By:	Jose Luis Duran
Fixes:		172a624f0 ("Silence annoying and incorrect non-default linker warning with GCC")
2021-03-08 09:37:46 +00:00
Peter Holm
e0fd837a30 stress2: open(2) tests with BENEATH flags.
Update tests to reflect the changes of "open(2): Remove O_BENEATH and
AT_BENEATH" in 20e91ca36a.
2021-03-08 09:19:37 +01:00
Kyle Evans
2b82c94acf if_wg: avoid null ptr deref
While we're here, sync up with OpenBSD and don't use a keypair !kp_valid

MFC after:	3 days
2021-03-08 00:25:34 -06:00
Kyle Evans
df55485085 wg_input: avoid leaking due to an m_defrag failure
m_defrag() will not free the chain on failure, leaking the mbuf.

Obtained from:	OpenBSD
MFC after:	3 days
2021-03-08 00:21:23 -06:00
Kyle Evans
d9a50109e2 if_wg: release correct lock in noise_remote_begin_session()
The keypair lock is not taken until later.

Obtained from:	Jason A. Donenfeld via OpenBSD
MFC after:	3 days
2021-03-08 00:21:03 -06:00
Hajimu UMEMOTO
006a01374f Simplify using nvlist_append_string_array().
Reported by:	hrs
MFC after:	1 week
2021-03-08 12:03:32 +09:00
Konstantin Belousov
56b9bee63a Make kern.timecounter.hardware tunable
Noted and reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D29122
2021-03-08 03:48:21 +02:00
Robert Wing
38dfb0626f bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM
The save/restore feature uses a unix domain socket to send messages
from bhyvectl(8) to a bhyve(8) process. A datagram socket will suffice
for this.

An added benefit of using a datagram socket is simplified code. For
bhyve, the listen/accept calls are dropped; and for bhyvectl, the
connect() call is dropped.

EPRINTLN handles raw mode for bhyve(8), use it to print error messages.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D28983
2021-03-07 15:23:29 -09:00
Eric van Gyzen
0424d9ebeb decryptcore: do not include sys/sysctl.h
It's not needed.  Removing it is a small improvement in portability.

Sponsored by:	Dell EMC Isilon
2021-03-07 17:29:03 -06:00
Eric van Gyzen
576313b983 dumpon: do not print errno for resolver failure
When the netdump host name fails to resolve, don't print errno, since
it's irrelevant.  We might as well use a different exit status, too.

Sponsored by:	Dell EMC Isilon
2021-03-07 17:23:04 -06:00
Alexander V. Chernikov
d5be41beb7 Fix dpdk/ldradix fib lookup algorithm preference calculation.
The current preference number were copied from IPv4 code,
 assuming 500k routes to be the full-view. Adjust with the current
 reality (100k full-view).

Reported by:	Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
MFC after:	3 days
2021-03-07 22:17:53 +00:00
Oleksandr Tymoshenko
748be78e60 armv8crypto: fix AES-XTS regression introduced by ed9b7f44
Initialization of the XTS key schedule was accidentally dropped
when adding AES-GCM support so all-zero schedule was used instead.
This rendered previously created GELI partitions unusable.
This change restores proper XTS key schedule initialization.

Reported by:	Peter Jeremy <peter@rulingia.com>
MFC after:	immediately
2021-03-07 12:03:47 -08:00
Gordon Bergling
f7bfe31019 wg(4): Fix an example in the manual page
The example in the manual page of wg(4) for connecting to a
peer was missing the 'public-key' ifconfig(8) keyword and for the
addressed peer the port must be specified.

PR:	253866
Reported by:	Sergey Akhmatov <sergey at akhmatov dot ru>
Reviewed by:	debdrup
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29115
2021-03-07 20:27:59 +01:00
Bjoern A. Zeeb
3fca90af43 net80211: ratectl header guard against multiple inclusions
Add missing #ifndef/#define/#endif guards against multiple inclusions
to ieee80211_ratectl.h as they are missing.

MFC after:	3 days
Sponsored-by:	Rubicon Communications, LLC ("Netgate")
2021-03-07 17:35:58 +00:00
Li-Wen Hsu
2c75196236 Revert "TEST gitrepo-dev"
This reverts commit 4287fa844f.
2021-03-07 17:34:21 +00:00
Li-Wen Hsu
4287fa844f TEST gitrepo-dev 2021-03-07 12:52:38 +00:00
Michal Meloun
01c6d79189 mvebu_gpio: Fix settings of gpio pin direction.
Data Output Enable Control register is inverted – 0 means output direction.
Reflect this fact in code.

MFC after:	3 weeks
2021-03-07 11:41:30 +01:00
Robert Wing
6bb140e3ca bhyvectl: print a better error message when vm_open() fails
Use errno to print a more descriptive error message when vm_open() fails

libvmm: preserve errno when vm_device_open() fails

vm_destroy() squashes errno by making a dive into sysctlbyname() - we
can safely skip vm_destroy() here since it's not doing any critical
clean up at this point. Replace vm_destroy() with a free() call.

PR:             250671
MFC after:      3 days
Submitted by:   marko@apache.org
Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D29109
2021-03-06 21:19:30 -09:00
Jung-uk Kim
2fc640d5bc poly1305: Chase xform_poly1305.h removal
It was missed in bb6e84c988 and afbee98232.
2021-03-06 21:47:03 -05:00
Mark Murray
fbf8e32452 Remove references to the now-removed bktr(4) driver. 2021-03-07 00:09:22 +00:00