Commit Graph

266460 Commits

Author SHA1 Message Date
Rick Macklem
b49ba74dee nfscl: Add entries to UPDATING and RELNOTES for commit a145cf3f73 2021-06-24 19:10:36 -07:00
Rick Macklem
a145cf3f73 nfscl: Change the default minor version for NFSv4 mounts
When NFSv4.1 support was added to the client, the implementation was
still experimental and, as such, the default minor version was set to 0.
Since the NFSv4.1 client implementation is now believed to be solid
and the NFSv4.1/4.2 protocol is significantly better than NFSv4.0,
I beieve that NFSv4.1/4.2 should be used where possible.

This patch changes the default minor version for NFSv4 to be the highest
minor version supported by the NFSv4 server. If a specific minor version
is desired, the "minorversion" mount option can be used to override
this default.  This is compatible with the Linux NFSv4 client behaviour.

This was discussed on freebsd-current@ in mid-May 2021 under
the subject "changing the default NFSv4 minor version" and
the consensus seemed to be support for this change.
It also appeared that changing this for FreeBSD 13.1 was
not considered a POLA violation, so long as UPDATING
and RELNOTES entries were made for it.

MFC after:	2 weeks
2021-06-24 18:52:23 -07:00
Alan Cox
c94249decd arm64: make it possible to define PV_STATS
Remove an #if 0 that results in a compilation error if PV_STATS is
defined.  Aside from this #if 0, there is nothing wrong with the
PV_STATS code.

MFC after:	1 week
2021-06-24 18:32:56 -05:00
Randall Stewart
66aec14a53 tcp: Rack not being very friendly with V6:4 socket and having a connection from V4
There were two bugs that prevented V4 sockets from connecting to
a rack server running a V4/V6 socket. As well as a bug that stops the
mapped v4 in V6 address from working.

Reviewed by: mtuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30885
2021-06-24 14:42:21 -04:00
Mariusz Zaborski
6ba108e52d rc.subr: use _pidcmd to determine pid for protect
This is a more reliable method that accounts for existing pidfiles,
procname and interpreter settings.

Current method of obtaining the pid for oomprotect="YES"|"ALL" processes
in certain cases fails to find a unique pid.

One such case are rc.d scripts defining command as:
command="daemon"

which results in all processes started via daemon being selected and
passed to protect(1) which fails and prints usage:

$ /etc/rc.d/exampled restart
Stopping exampled.
Starting exampled.
usage: protect [-i] command
   protect [-cdi] -g pgrp | -p pid

Running the same with -x reveals what happens:

+ pid='3051 4268 4390 4421 4427 4470 4588 4733 4740 4870 4949 4954 4979
5835 5866 55487 55583 56525 57643 57789 57882 58072 58167 99419'
+ /usr/bin/protect -p 3051 4268 4390 4421 4427 4470 4588 4733 4740 4870
4949 4954 4979 5835 5866 55487 55583 56525 57643 57789 57882 58072 58167
99419
usage: protect [-i] command
   protect [-cdi] -g pgrp | -p pid

We have a more reliable way of obtaining pid already defined in rc.subr
and available when protect(1) needs it. We can simply `eval $_pidcmd`
which also invokes `check_process` but properly accounts for existing
pidfile, procname and interpreter settings.

With the change the pidfile is properly obtained.

Submitted by:	Adam Wolk <a.wolk at fudosecurity.com>
Sponsored by:	Fudo Security
Differential Revision:	https://reviews.freebsd.org/D30367
2021-06-24 20:14:31 +02:00
Warner Losh
779b70a226 bsd-family-tree: add DragonFly 6.0.0
Tagged on May 8, 2021.

Sponsored by:		Netflix
2021-06-24 10:43:18 -06:00
Marcin Wojtas
93f0df457b Update ENA version to v2.4.0
Some of the changes in this release:
* Large LLQ headers,
* Bug/stability fixes,
* Change of the README/Documentation.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 16:35:40 +02:00
Marcin Wojtas
e34856a2c4 Update ENA driver man page
Bring the obsolete man page up to date:
* update diagnostic error messages
* add documentation of loader tunables
* document netmap support
* add a driver history section
* update the contact information

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 16:35:37 +02:00
Marcin Wojtas
3fc5d816f8 Merge tag 'vendor/ena-com/2.4.0'
Update the driver in order not to break its compilation
and make use of the new ENA logging system

Migrate platform code to the new logging system provided by ena_com
layer.

Make ENA_INFO the new default log level.

Remove all explicit use of `device_printf`, all new logs requiring one
of the log macros to be used.
2021-06-24 16:15:18 +02:00
Marcin Wojtas
0e7d31f63b ena: hide sysctl nodes for unused ENA queues
IO queue related attributes are registered statically at driver attach
with the rest of the ENA specific sysctl nodes. However, the number of
queues can be changed at runtime via the `ena_sysctl_io_queues_nb`
request, leading to a potential exposure of attributes for non-existing
queues.

Introduce a new `ena_sysctl_update_queue_node_nb` function, which
updates the sysctl nodes after the number of queues is altered.
This happens by either registering or unregistering node specific oids,
based on a delta between the previous and current queue count.

NOTE: All unregistered oids must be registered again before the driver
detach, e.g. by another call to this function.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 16:02:39 +02:00
Marcin Wojtas
ddec69e6a7 ena: remove surplus NULL checks when freeing ENA resources
Calling free on a NULL pointer is valid, as appropriate check is already
done internally:

/* free(NULL, ...) does nothing */
if (addr == NULL)
    return;

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 16:02:39 +02:00
Marcin Wojtas
beaadec9ea ena: add support for the large LLQ headers in ENA
Default LLQ (Low-latency queue) maximum header size is 96 bytes and can
be too small for some types of packets - like IPv6 packets with multiple
extension. This can be fixed, by using large LLQ headers.

If the device supports larger LLQ headers, the user can activate this
feature by setting sysctl tunable 'hw.ena.force_large_llq_header' to '1'
in the /boot/loader.conf file.

In case the device isn't supporting this feature, the default value (96B)
will be used.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 16:02:39 +02:00
Marcin Wojtas
438c9e3cf8 ena: change ENA C++-style comment into C-style
According to man style(9), only C-style comments should be used.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 16:02:39 +02:00
Marcin Wojtas
1f4f67f524 ena-com: restructure the ENA logging system
Introduce a new logging system, which replaces the old logging method.

All logs are now displayed in `device_printf` format, requiring
`adapter->pdev` to be passed down to `ena_log`. Whenever that's
impossible, a `printf` wrapped `ena_log_raw` is provided.

For netmap logs, `ena_log_nm` is available, prepending "[nm] " to
an `ena_log` formatted message.

Tx/Rx data path logs are now printed via `ena_log_io`. This allows them
to be conditionally compiled out, depending on the presence of
ENA_LOG_IO_ENABLE compilation flag. By default this flag is disabled.

All `ena_trc_*` ena_com level messages are now also wrapped around
`ena_log` and require `ena_dev->dmadev` to be present.

There are four log levels:
* 0 - ENA_ERR  - enable driver error messages and ena_com error logs,
* 1 - ENA_WARN - enable logs for non-critical errors,
* 2 - ENA_INFO - make the driver more verbose about its actions,
* 3 - ENA_DBG  - enable debug logs

Please see `ena_fbsd_log.h` for implementation details.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 15:48:26 +02:00
Marcin Wojtas
e0f5dd7cdd ena-com: update sources to the latest version
This patch mainly introduces fixes from the static code analysis.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2021-06-24 15:45:53 +02:00
Marcin Wojtas
a2dc172dda Introduce LS1028A PCI MDIO driver.
Implement support for the NXP LS1028A SoC MDIO controller.
It is attached to the internal PCI root complex.
The controller is used to communicate with PHYs of ports connected
to the internal switch.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30731
2021-06-24 13:01:22 +02:00
Marcin Wojtas
19aa95e4b3 Introduce new driver for NXP Ethernet controller
ENETC it a gigabit Ethernet controller found on the LS1028A board.
It supports basic VLAN offloads - tag extraction, injection and hardware
filtering. Inband MDIO connectivity is used for link status
monitoring through the miibus interface. Fixed-link mode is also
supported, which allows for operation of internal cpu to switch port.
Since no admin interrupts are present in hardware, link status polling
has to be used.
Due to a hardware bug software reset of the NIC results in a external
abort. Because of that most of the hardware initialization is done
during attach. This also means that in the case of an fatal error full
board reset is required.
The enetc_hw.h header was imporoted from Linux. It is dual licensed.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30729
2021-06-24 13:01:13 +02:00
Marcin Wojtas
59061c7ebc Introduce MDIO read/write functions for LS1028A.
Provide common MDIO code for two LS1028 ENETC controllers -
an external one found on the PCI bus and internal one found in ENETC.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30730
2021-06-24 13:01:05 +02:00
Marcin Wojtas
58632fa7a3 iflib: Add a new quirk
ENETC NIC found in LS1028A has a bug where clearing TX pidx/cidx
causes the ring to hang after being re-enabled.
Add a new flag, if set iflib will preserve the indices during restart.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: gallatin, erj
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30728
2021-06-24 13:00:56 +02:00
Michal Meloun
3eae4e106a Fix error value returned by ofw_bus_gen_get_node().
By definition ofw_bus_get_node() should  consistently return -1 when there
is no associated OF node.

MFC after:	4 weeks
Discussed with:	nwhitehorn
Analyzed in: 	https://reviews.freebsd.org/D30761
2021-06-24 12:01:05 +02:00
Colin Percival
e6caac717b libsa: Add tslog support for arm64
The original code only supported x86 and used rdtsc(); we now also
support arm64 and use the CNTVCT_EL0 special register.
2021-06-23 22:21:23 -07:00
Colin Percival
ccadcb8f33 arm64: Instrument initarm with TSLOG
The "function entry" needs to be recorded with TSRAW() rather than
TSENTER() since curthread is not yet defined.  (The same approach
is taken in amd64's hammer_time.)
2021-06-23 22:17:55 -07:00
Colin Percival
0acc529dc3 arm64: Disable early printf if TSLOG
The warning message "ERROR loading DTB" (for systems without a device
tree blob) is printed extremely early in the boot process -- among
other things, before curthread or other pcpu data has been set up.
Unfortunately, printf is instrumented with TSLOG, which cannot run
quite this early.

Wrap the printf in #ifndef TSLOG; the situations where the printf
will be useful are not ones where TSLOG would be in use.
2021-06-23 22:10:26 -07:00
Alan Cox
0c188c06c6 arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2()
Revise pmap_remove_l2() to use the constant-time function page_to_pvh()
instead of the linear-time function pa_to_pvh().

Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30876
2021-06-23 22:35:46 -05:00
Konstantin Belousov
33e1287b6a amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30872
2021-06-24 00:38:00 +03:00
Konstantin Belousov
60b0ad10dd vdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME_FAST
so that libc vdso and kernel syscall give closer results.

Reported by:	dchagin
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30873
2021-06-24 00:36:33 +03:00
Konstantin Belousov
e912fbe167 vdso gettimeofday: minor restructuring
Call binuptime inside switch statement, instead of pre-calculating
the abs argument.
Change the type of the abs argument to bool.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30873
2021-06-24 00:36:33 +03:00
Ryan Moeller
b50db44f02 bsdinstall: Avoid double-mounting /dev
After 34766aa8cb we are mounting and
unmounting devfs elsewhere already.

Reviewed by:	nwhitehorn
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D30877
2021-06-23 21:24:53 +00:00
Konstantin Belousov
50acaaef54 ffs_softdep: force sync if journal is low in journal_check_space
This effectively causes syncing of the mount point from softdep_prealloc(),
softdep_prerename(), and softdep_prelink().  Typically it avoids the need
for journal suspension at this point, at all.

Suggested and reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:47:05 +03:00
Konstantin Belousov
2126f103e0 ffs_softdep.c: add journal_check_space() helper
Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:47:05 +03:00
Konstantin Belousov
64b494a105 softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink
We call into softdep_prerename() and softdep_prelink() when there is
low free space in the journal. Functions sync all vnodes participating
in the VOP, in the hope that this would reduce journal utilization. But
if the vnodes are already synced, doing sync would only spend writes,
journal is filled not due to the records from modifications of our
vnodes.

Remember original seqc numbers for vnodes, and only initiate syncs when
seqc changed.

Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:54 +03:00
Konstantin Belousov
f756546662 ufs_rename(): only do softdep_prerename() when other thread changed a vnode
Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
d4d289cd51 ffs: mark block (re-)allocations as seqc writes
Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
5eacde3eb8 ufs_rename(): softdep_prerename() does something only for SU+J
so call it only in SU+J case

Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
d0929a990c ffs: reduce number of dvp relocks in softdep_prelink()
If vp == NULL, we unlocked and then immediately relocked dvp there.

Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
b2b40b28b1 ufs_vnops.c: style
Wrap too long functions declarations.

Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
190110f2eb unionfs: do not use bare struct componentname
Allocate nameidata on stack and NDPREINIT() it, for compatibility with
assumptions from other filesystems' lookup code.

Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
802cf4ab0e namei: add NDPREINIT() macro
Its intent is to do the initialization of the future part of struct nameidata
which should be used across several namei() and VOPs.  Right now it is NOP.

Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Konstantin Belousov
71faea9307 seqc: add symbolic name for in-modify bit
Reviewed by:	mckusick
Discussed with:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D30041
2021-06-23 23:46:15 +03:00
Alan Cox
62ea198e95 arm64: remove an unneeded test from pmap_clear_modify()
The page table entry for a 4KB page mapping must be valid if a PV entry
for the mapping exists, so there is no point in testing each page table
entry's validity when iterating over a PV list.

Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30875
2021-06-23 14:22:46 -05:00
Florian Florensa
f13da24715 net/bpf: Fix writing of buffer bigger than PAGESIZE
When allocating the mbuf we used m_get2 which fails
if len is superior to MJUMPAGESIZE, if its the case,
use m_getjcl instead.

Reviewed by:	kp@
PR:		205164
Pull Request:	https://github.com/freebsd/freebsd-src/pull/131
2021-06-23 10:39:18 -06:00
Rozhuk Ivan
a75819461e devctl: add ADDR_ADD and ADDR_DEL devctl event for IFNET
Add devd event on network iface address add/remove.  Can be used to
automate actions on any address change.

Reviewed by:		imp@ (and minor style tweaks)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30840
2021-06-23 10:26:56 -06:00
Rozhuk Ivan
4fb3e0bb94 devctl: add RENAME devctl event for IFNET
Add devd event on network iface rename.

Reviewed by:		imp@,asomers@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30839
2021-06-23 10:20:58 -06:00
Mark Johnston
4420bb6a86 mdconfig tests: Correct a copy-pasted test description
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-06-23 10:37:40 -04:00
Mark Johnston
2bbeada0f7 rpc.lockd: Use libc strnlen() instead of reimplementing it
No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-06-23 10:06:57 -04:00
Wojciech Macek
17ac6d94db ip_mroute: initialize vif ifnet properly
Use if_alloc to ensure all fields of ifnet are allocated
properly

Reported by:   Damien Deville
Sponsored by:  Stormshield
Obtained from: Semihalf
Reviewed by:   mw
Differential revision: https://reviews.freebsd.org/D30608
2021-06-23 10:13:52 +02:00
Lutz Donnerhacke
f70c98a2f5 libalias: Fix compile time warning about unused functions
Compiling libalias results in warnings about unused functions.
Those warnings are caused by clang's heuristic to consider an inline
function as in use, iff the declaration is in a *.c file.
Declarations in *.h files do not emit those warnings.

Hence the declarations must be moved to an extra *.h file.

MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D30844
2021-06-23 10:06:04 +02:00
Warner Losh
c90902d39e bus_child_pnpinfo: fix two stragglers
ddfc9c4c59 was missing changes to two files to complete the
bus_child_pnpinfo_str->bus_child_pnpinfo. This fixes the broken kernel
builds.

Sponsored by:		Netflix
2021-06-22 22:10:31 -06:00
Warner Losh
ddfc9c4c59 newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf
Now that the upper layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.

Reviewed by:		jhb, bcr
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D29937
2021-06-22 20:52:06 -06:00
John Baldwin
a7f6c6fd94 toe: Read-lock the inp in toe_4tuple_check().
tcp_twcheck now expects a read lock on the inp for the SYN case
instead of a write lock.

Reviewed by:	np
Fixes:		1db08fbe3f tcp_input: always request read-locking of PCB for any pure SYN segment.
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D30782
2021-06-22 16:31:01 -07:00