Commit Graph

278675 Commits

Author SHA1 Message Date
Warner Losh
2da6a6b31d nvmecontrol: use uintmax_t for a size
Use uintmax_t cast to print the size of the device for the non-humanize
case to avoid issues with 32-bit longs.

Fixes:			9c1bec9c21
Sponsored by:		Netflix
2022-10-07 21:44:23 -06:00
Colin Percival
39d6144dcd ns8250_drain: Drain without DELAY first
In virtual machines with virtual UARTs which have fictitious baud
rates, it may be possible to drain the receive queue very quickly,
without needing to DELAY after each character.  Attempt to read
(and discard) the receive queue as fast as possible, stopping for
a DELAY only when LSR_RXRDY is no longer asserted; assume that we
have finished draining the queue when LSR_RXRDY is asserted both
before and after a DELAY.

This speeds up the boot process in FreeBSD/Firecracker by 27 ms.

Reviewed by:	imp, jrtc27
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36184
2022-10-07 17:51:54 -07:00
Wanpeng Qian
9c1bec9c21 nvmecontrol: improve namespace size unit of devlist command output
Add an option of -h --human to output human readable size unit instead
of the fixed unit (MB).

Signed-off-by:		Wanpeng Qian <wanpengqian@gmail.com>
Reviewed by:		imp, bcr
Differential Revision:	https://reviews.freebsd.org/D32957
2022-10-07 17:59:20 -06:00
Mitchell Horne
34aac98e35 EVENTHANDLER(9): drop the list of event handlers
Maintaining a comprehensive list of event handlers in this man page is a
futile endeavor. It is entirely detached from the source code, and
therefore requires that anyone adding/removing an event handler have
prior knowledge of the list. Many do not, so it will naturally become
stale (and is).

This is demonstrated by the fact that there are currently 88 instances
of EVENTHANDLER_DECLARE() in the source tree, but the list contains 66
items.

Many of the descriptions do not offer much detail that could not be
gleaned from the handler name alone. It is a more effective strategy to
document the purpose/details of the event handler in a comment alongside
its declaration.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36895
2022-10-07 19:26:41 -03:00
Mitchell Horne
af39048601 bus.h: rewrite comment describing intr_type
Describe more clearly the purpose of these flags and where they are
used.

Remove grog's comment about revisiting the flags. At this point it does
not make sense to change this long-standing API, especially in light of
2cf7870864 ("Collapse interrupt thread priorities").

Give a better example of a bus modifying these flags; I did not find any
existing instance where a bus changes the interrupt's type.

Reviewed by:	imp, markj, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36896
2022-10-07 19:26:41 -03:00
John Baldwin
ce9e720af2 <sys/_pv_entry>: Add a fallback for __LONG_WIDTH__ for older compilers.
clang only includes a __LONG_WIDTH__ builtin in clang 14 and later.
2022-10-07 12:44:31 -07:00
John Baldwin
765c48cc86 sys/_pv_entry.h: Drop UCB copyright as this is all Peter's code.
Reported by:	alc
2022-10-07 12:18:28 -07:00
John Baldwin
4d90a5afc5 sys: Consolidate common implementation details of PV entries.
Add a <sys/_pv_entry.h> intended for use in <machine/pmap.h> to
define struct pv_entry, pv_chunk, and related macros and inline
functions.

Note that powerpc does not yet use this as while the mmu_radix pmap
in powerpc uses the new scheme (albeit with fewer PV entries in a
chunk than normal due to an used pv_pmap field in struct pv_entry),
the Book-E pmaps for powerpc use the older style PV entries without
chunks (and thus require the pv_pmap field).

Suggested by:	kib
Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36685
2022-10-07 10:14:03 -07:00
Kristof Provost
61ab88d873 if_ovpn: remove an incorrect assertion
netisr_dispatch() can fail, especially when under high traffic loads.
This isn't a fatal error, so simply don't check the return value.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-10-07 19:10:01 +02:00
Kristof Provost
307625842b w: don't truncate if we're writing libxo json/xml
If we're writing structured output (i.e. json or xml) we shouldn't worry
about terminal width, and instead always output full width information.

This means that, for example, if we're called from crontab with 'w
--libxo json' we'll provide full the command field rather than
pointlessly truncating it.

Suggested by:	Phil Shafer
Event:		Aberdeen Hackathon 2022
Differential Revision:	https://reviews.freebsd.org/D25013
2022-10-07 18:21:27 +02:00
Rene Ladan
947fcb84b7 Update the organization graph for pkgmgr
Event:		Aberdeen 2022 Hackathon
2022-10-07 17:27:35 +02:00
Allan Jude
5031550134 Bump MAC_VERSION to 5
2449b9e5fe introduced API changes
that require ensuring that loadable MAC modules use the matching API.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
2022-10-07 15:24:32 +00:00
Alan Somers
46fcf947c6 fusefs: during F_GETLK, don't change l_pid if no lock is found
PR:		266885
MFC after:	2 weeks
Submitted by:	John Millikin <jmillikin@gmail.com>
Sponsored by:	Axcient
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D36905
2022-10-07 09:09:21 -06:00
Richard Scheffenegger
6bf91573c1 tcp: update repeat <SYN,ACK> with latest IP ECN info
When multiple <SYN> segments are received, update the <SYN,ACK>
sent in response to the latest IP ECN and TCP ECN information.

On retransmitting the <SYN,ACK>, once ECN maxtries are done, not
only disable RFC3168 ECN, but AccECN also.

Reviewed By:    	tuexen, #transport
Sponsored by:   	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D36875
2022-10-07 01:51:19 +02:00
Richard Scheffenegger
265d0f767c tcp: honor rfc1323 sysctl on passive sessions
On passive sessions, honor the local settings disabling or
enabling window scaling and timestamp options.

Reviewed By:    	tuexen, #transport
Sponsored by:   	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D36874
2022-10-07 01:49:10 +02:00
Richard Scheffenegger
9c65583835 siftr: apply filter early on
Quickly check TCP port filter, before investing into
expensive operations.

No functional change.

Obtained from:  	guest-ccui
Reviewed By:    	#transport, tuexen, guest-ccui
Sponsored by:   	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D36842
2022-10-07 01:39:41 +02:00
Zhenlei Huang
de1ea2d517 if_vxlan(4): Correct the statistic for output bytes
The vxlan interface encapsulates the Ethernet frame by prepending IP/UDP
and vxlan headers. For statistics, only the payload, i.e. the
encapsulated (inner) frame should be counted.

Event:		Aberdeen Hackathon 2022
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D36855
2022-10-07 13:45:16 +02:00
Hans Petter Selasky
62d42655bc usb(4): Substitute "unsigned int" using the equivalent and shorter "unsigned" keyword.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-07 13:41:00 +02:00
Hans Petter Selasky
8758aabb16 usb(4): Make the enumeration thread nice time a variable.
Depends on "options USB_DEBUG".

Suggested by:	koobs@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-07 13:41:00 +02:00
Benedict Reuschling
1c2be25f60 Add extra EINVAL information about wrong block size to read(2)/write(2)
The read system call will return EINVAL if the current file offset is
not a multiple of the block size. This also applies to write(2). Add an
entry for EINVAL about this error to both man pages.

PR:			91149
Event:			Aberdeen Hackathon 2022
Differential Revision:	https://reviews.freebsd.org/D24617
2022-10-07 11:32:37 +00:00
Gleb Smirnoff
53af690381 tcp: remove INP_TIMEWAIT flag
Mechanically cleanup INP_TIMEWAIT from the kernel sources.  After
0d7445193a, this commit shall not cause any functional changes.

Note: this flag was very often checked together with INP_DROPPED.
If we modify in_pcblookup*() not to return INP_DROPPED pcbs, we
will be able to remove most of this checks and turn them to
assertions.  Some of them can be turned into assertions right now,
but that should be carefully done on a case by case basis.

Differential revision:	https://reviews.freebsd.org/D36400
2022-10-06 19:24:37 -07:00
Gleb Smirnoff
51c0184297 systat: remove INP_TIMEWAIT 2022-10-06 19:24:37 -07:00
Gleb Smirnoff
9c3507f919 tcp: in tcp_usr_detach() remove special handling of compressed time-wait
Differential revision:	https://reviews.freebsd.org/D36399
2022-10-06 19:24:32 -07:00
Gleb Smirnoff
0d7445193a tcp: remove tcptw, the compressed timewait state structure
The memory savings the tcptw brought back in 2003 (see 340c35de6a) no
longer justify the complexity required to maintain it.  For longer
explanation please check out the email [1].

Surpisingly through almost 20 years the TCP stack functionality of
handling the TIME_WAIT state with a normal tcpcb did not bitrot.  The
existing tcp_input() properly handles a tcpcb in TCPS_TIME_WAIT state,
which is confirmed by the packetdrill tcp-testsuite [2].

This change just removes tcptw and leaves INP_TIMEWAIT.  The flag will
be removed in a separate commit.  This makes it easier to review and
possibly debug the changes.

[1] https://lists.freebsd.org/archives/freebsd-net/2022-January/001206.html
[2] https://github.com/freebsd-net/tcp-testsuite

Differential revision:	https://reviews.freebsd.org/D36398
2022-10-06 19:22:23 -07:00
Simon J. Gerraty
f48114b653 ldd: ignore unverified files
When mac_veriexec is enforcing, we won't run unverified binaries,
don't let ldd examine them either.

Reviewed by:	stevek emaste
MFC after:	1 week
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D36897
2022-10-06 17:51:28 -07:00
Mitchell Horne
b05b1ecbef amd64, arm64 pmap: fix a comment typo
There is no such error code.

Fixes:	1d5ebad06c ("pmap: optimize MADV_WILLNEED on existing superpages")
2022-10-06 19:04:54 -03:00
Mitchell Horne
1f9cc5ffc5 riscv: handle kernel PTE edge-case in pmap_enter_l2()
Page table pages are never freed from the kernel pmap, instead they are
zeroed when a range is unmapped. This allows future mappings to be
constructed more quickly. Detect this scenario in pmap_enter_l2(), so we
don't fail to create a superpage mapping when the 2MB range is actually
available.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36885
2022-10-06 19:04:53 -03:00
Mitchell Horne
99fe523778 riscv: add an assert to pmap_remove_pages()
Similar checks exist for both arm64 and amd64, but note that for amd64
it is a bare panic().

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36564
2022-10-06 19:04:41 -03:00
Mitchell Horne
9d1aef8402 riscv: handle superpage in pmap_enter_quick_locked()
Previously, if pmap_enter_l2() was asked to re-map an existing superpage
(the result of madvise(MADV_WILLNEED) on a mapped range), it could
'fail' to do so, falling back to trying pmap_enter_quick_locked() for
each 4K virtual page. Because this function does not check if the l2
entry it finds is a superpage, it would proceed, sometimes resulting in
the creation of false PV entries.

If the relevant range was later munmap'ed, the system would panic during
the process' exit in pmap_remove_pages(), while attempting to clean up
the PV entries for mappings which no longer exist.

Instead, we should return early in the presence of an existing
superpage, as is done in other pmaps.

PR:             266108
Reviewed by:	markj, alc
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36563
2022-10-06 19:02:38 -03:00
Mitchell Horne
95b1c27069 riscv: optimize MADV_WILLNEED on existing superpages
Specifically, avoid pointless calls to pmap_enter_quick_locked() when
madvise(MADV_WILLNEED) is applied to an existing superpage mapping.

1d5ebad06c made the change for amd64 and arm64.

Reviewed by:	markj, alc
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36563
2022-10-06 19:02:38 -03:00
Mitchell Horne
dd18b62cec riscv: better CTR messages in pmap_enter_l2()
Disambiguate the failure cases.

Reviewed by:	jhb
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D36562
2022-10-06 19:02:37 -03:00
Alfredo Dal'Ava Junior
344986ff4c zfs: powerpc: disable kernel floating point support
Powerpc* doesn't support support floating point in the kernel yet,
so disable it on zfs for now.

This fixes "panic: altivec unavailable trap" when loading zfs.ko

Approved by:	jhibbits
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D36894
2022-10-06 20:35:48 -03:00
Jessica Clarke
a45048565a bsdinstall: Fix race condition when shutting down after installation
Whilst reboot(8) will block whilst it runs, shutdown(8) does not,
daemonizing instead. This means that we must wait after running it,
otherwise we will exit and cause the system to attempt to go multi-user
in parallel with the shutdown daemon killing init. With the new
multi-console support in the installer, runconsoles will immediately
kill this daemon, racing with the daemon being able to signal init as
desired, and I have seen this race be lost in QEMU with a single CPU. In
the past this wasn't such an issue, since shutdown's daemon puts itself
in a new session group immediately after fork (and the parent doesn't
wait until that has happened, so whilst there's technically a race
condition in there where it could receive a SIGHUP from the death of the
parent's session leader, in practice this is very unlikely to be hit.
This means that the only consequence of this oversight before was that
you might get the beginnings of more console output on the way to
multi-user and thus the console would look a little confusing.

Reviewed by:	gjb
Fixes:		e4505364c0 ("release/rc.local: Provide option to shutdown after installation complete")
Fixes:		a09af1b7fd ("bsdinstall release: Start installer on multiple consoles")
Differential Revision:	https://reviews.freebsd.org/D36879
2022-10-06 20:04:04 +01:00
Cy Schubert
142c3c7fef nvmecontrol: Apply cast
The proper fix also casts to uintmax_t.

Reported by:	imp
Fixes:		a7b568109e
2022-10-06 11:58:16 -07:00
Alexander Motin
e4e91353c6 ioat: Add Ice Lake ID.
MFC after:	2 weeks
2022-10-06 14:44:10 -04:00
Cy Schubert
a7b568109e nvmecontrol: Fix i386 build
Fix:

--- all_subdir_sbin ---
/opt/src/git-src/sbin/nvmecontrol/modules/samsung/samsung.c:149:64:
error: format specifies type 'unsigned long' but the argument has type
'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
        printf("   Read Reclaim Count                       : %lu\n",
le64dec(&temp->rrc));
                                                              ~~~
^~~~~~~~~~~~~~~~~~~
                                                              %llu
/opt/src/git-src/sbin/nvmecontrol/modules/samsung/samsung.c:150:64:
error: forma t specifies type 'unsigned long' but the argument has type
'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
        printf("   Lifetime Uncorrectable ECC Count         : %lu\n",
le64dec(&temp->lueccc));
                                                              ~~~
^~~~~~~~~~~~~~~~~~~~~~
                                                              %llu
2 errors generated.

Fixes:		84e8678870
2022-10-06 11:26:50 -07:00
Dries Michiels
e6d47601a3 Makefile: replace mergemaster references with etcupdate
Similar to UPDATING and handbook changes, treat Makefile the same.

PR:			260822
Approved by:		jhb, philip
Differential Revision:	https://reviews.freebsd.org/D36877
2022-10-06 20:19:16 +02:00
Warner Losh
7466f157f3 arm64/machdep: Delete trailing whitespace
No functional change.

Sponsored by:		Netflix
2022-10-06 12:08:55 -06:00
Navdeep Parhar
661faa1f77 cxgbe/cxgbei: Do not validate the hardware iSCSI tag mask.
This was added in 7cba15b16e in 2016 and firmwares at that time were
already setting up the iSCSI tag mask properly.  Since then it has also
become possible to split the iSCSI region between multiple PCIE PFs but
the driver's calculation takes only its own PF's allocation into account
and that means this code is incorrect and not just a harmless no-op.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-10-06 10:12:00 -07:00
Andrey V. Elsukov
ccd69bd573 Ignore IPv6 NA and drop IPv6 NS when BACKUP CARP address is used
When system acts as CARP BACKUP ignore received IPv6 Neighbor Advertisements
to ensure that neighbor cache will not be changed.
Also do not send IPv6 Neighbor Solicitation from CARP BACKUP source address.
Such packets can confuse network switch and it detects MAC addresses
flapping.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision:	    https://reviews.freebsd.org/D36649
2022-10-06 20:01:16 +03:00
Alexander Motin
9bce114106 vmd: Add DID 8086:7D0B and 8086:AD0B for Intel MTL SKUs
MFC after:	2 weeks
2022-10-06 12:44:59 -04:00
Alexander Motin
c28220d866 vmd: Bypass MSI/MSI-X remapping when possible.
By default all VMD devices remap children MSI/MSI-X interrupts into their
own.  It creates additional isolation, but also complicates things due to
sharing, etc.  Fortunately some VMD devices can bypass the remapping.
Add tunable to control it for remap testing or if something go wrong.

MFC after:	2 weeks
2022-10-06 12:15:25 -04:00
Konstantin Belousov
9cabef3d14 ldd: use direct exec mode unconditionally
Trying to exec malformed or unusual binary, for instance, a non-FreeBSD
ABI, or using a non-standard interpreter, might give unexpected outcome.

Reported by:	The UK's National Cyber Security Centre (NCSC)
Reviewed by:	emaste, markj, philip
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
admbug:	991
PR:	127276, 175339, 231926
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36650
2022-10-06 18:50:26 +03:00
Kristof Provost
4f756295e0 if_ovpn: ensure we're in net_epoch when calling ovpn_encap()
If the crypto callback is asynchronous we're no longer in net_epoch,
which ovpn_encap() (and ip_output() it calls) expect.

Ensure we've entered the epoch.

Do the same thing for the rx path.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-10-06 17:42:12 +02:00
Kornel Dulęba
6bdc398832 uart_dev_snps: Fix device probing
The "uart_bus_probe" function is used as a generic part of uart probe
logic. It returns a driver priority(negative number) if successful and
an error code otherwise.
Fix the error checking condition to account for that.
Also, while here return "BUS_PROBE_VENDOR", instead of "0".
This fixes uart on clearfog pro with recent DT.

PR:		266657
Reviewed by:	mw
Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D36880
2022-10-06 16:42:51 +02:00
Kornel Dulęba
fdbd0ba75d test/sys/opencrypto: Fix NIST KAT parser iterator
When yield a.k.a "generator" iterator is used we need to return all
data using "yield", before returning from the function.
Because of that only encryption tests were run for AES-CBC, other modes
were affected as well.
Add one more loop to the iterator "next" routine to fix that.
This unveiled a problem in the GCM AEAD parser logic, which didn't
correctly handle tests cases with empty plaintext, i.e. AAD only.
Include the fix in this patch as it's a rather trivial one.

Obtained from:	Semihalf
Differential Revision: https://reviews.freebsd.org/D36861
2022-10-06 16:42:31 +02:00
Andrew Turner
dc39a3346e Make #if and #endif do what people expect in *_if.m
These are used in a few places. Pass them to the generated .c and .h
files to allow us to build the parts of the interface the kernel config
supports.

Reviewed by:	imp, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36882
2022-10-06 14:35:31 +01:00
Andrew Turner
232323a531 Stop relying on header pollution in sdhci_xenon.c
Include sys/malloc.h directly in sdhci_xenon.c to get the malloc(9)
definition rather than depend on header pollution.

Sponsored by:	The FreeBSD Foundation
2022-10-06 14:30:19 +01:00
Andrew Turner
e590c9eff8 Fix the options to build rk_usb2phy.c
We need to check for fdt rk_usb2phy on both sides of the '|'.

Sponsored by:	The FreeBSD Foundation
2022-10-06 14:30:18 +01:00
Hans Petter Selasky
9e0edafe92 uslcom(4): Clear stall at every open.
To avoid data loss, make sure both the receive and transmit data toggles
get reset, before trying to read or write any data.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-06 13:54:02 +02:00