]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoiSCSI: Add support for segmentation offload for hardware offloads.
John Baldwin [Fri, 6 Aug 2021 21:03:00 +0000 (14:03 -0700)]
iSCSI: Add support for segmentation offload for hardware offloads.

Similar to TSO, iSCSI segmentation offload permits the upper layers to
submit a "large" virtual PDU which is split up into multiple segments
(PDUs) on the wire.  Similar to how the TCP/IP headers are used as
templates for TSO, the BHS at the start of a large PDU is used as a
template to construct the specific BHS at the start of each PDU.  In
particular, the DataSN is incremented for each subsequent PDU, and the
'F' flag is only set on the last PDU.

struct icl_conn has a new 'ic_hw_isomax' field which defaults to 0,
but can be set to the largest virtual PDU a backend supports.  If this
value is non-zero, the iSCSI target and initiator use this size
instead of 'ic_max_send_data_segment_length' to determine the maximum
size for SCSI Data-In and SCSI Data-Out PDUs.  Note that since PDUs
can be constructed from multiple buffers before being dispatched, the
target and initiator must wait for the PDU to be fully constructed
before determining the number of DataSN values were consumed (and thus
updating the per-transfer DataSN value used for the start of the next
PDU).

The target generates large PDUs for SCSI Data-In PDUs in
cfiscsi_datamove_in().  The initiator generates large PDUs for SCSI
Data-Out PDUs generated in response to an R2T.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31222

2 years agopkg: use specific CONFSNAME_${file} for FreeBSD.conf
Kyle Evans [Thu, 18 Feb 2021 04:10:46 +0000 (22:10 -0600)]
pkg: use specific CONFSNAME_${file} for FreeBSD.conf

Setting CONFSNAME directly is a little more complicated for downstream
consumers, as any additional CONFS that are added here will inherit the
group name by default.  This is perhaps arguably a design flaw in CONFS
because inheriting NAME will never give a good result when additional
files are added, but this is a low-effort change.

While we're here, pull FreeBSD.conf.${branch} out into a PKGCONF
variable so one can just drop a new repo config in entirely with a new
naming scheme. CONFSNAME gets set based on chopping anything off after
".conf", so that, e.g.:

- FooBSD.conf => FooBSD.conf
- FooBSD.conf.internal => FooBSD.conf

Reviewed by: bapt, manu
Differential Revision: https://reviews.freebsd.org/D28767

2 years agopkg: allow multiple add arguments again
Kyle Evans [Thu, 18 Feb 2021 03:41:53 +0000 (21:41 -0600)]
pkg: allow multiple add arguments again

While pkg(7) add only handles a single 'add' argument, pkg-add(8) fully
handles multiple arguments.

Stop rejecting it, just turn off local-bootstrap mode and proceed to
remote bootstrap if we need it.

While we're here, check if the first argument to pkg add is even a pkg
package. If it's not, also do remote bootstrap instead. Future work
could improve this altogether by picking out a pkg package out of many
and local bootstrap then pass the rest through to the newly installed
pkg.

Reviewed by: bapt, manu (earlier version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28766

2 years agoAdd ElfW() macro for compatibility with Linux
Dimitry Andric [Thu, 5 Aug 2021 18:57:22 +0000 (20:57 +0200)]
Add ElfW() macro for compatibility with Linux

Some Linux software using ELF headers assumes the existence of an
ElfW(type) macro, which concatenates 'Elf', the default ELF word size,
and the given type. This is identical to our __ElfN(x) macro in
<sys/elf_generic.h>. Add the macro for compatibility, with a comment
that we prefer the __ElfN() macro for FreeBSD.

Reviewed by: emaste, kib
Differential Revision: https://reviews.freebsd.org/D31427
MFC after: 1 week

2 years agoman: Install more man pages unconditionally
Fernando Apesteguía [Fri, 6 Aug 2021 16:33:31 +0000 (18:33 +0200)]
man: Install more man pages unconditionally

Add more manual pages which were not spotted previously in 0a0f7486413c

Ideally to be MFH'ed with:

8539518055d0 - Remove manpages from OLD_FILES
8b487b8292e4 - Fix bsd.subdir.mk-related issues after 0a0f7486413c
f6043a672135 - ObsoleteFiles.inc: Remove manpages from OLD_FILES
0a0f7486413c - man: Build manpages for all architectures

There is at least one pending issue when building with -DNO_ROOT.

Reported by:    ceri@
MFH:    4 weeks
Discussed with: wosch
Differential Revision: https://reviews.freebsd.org/D31018

2 years agobsd.cpu.mk: add support for x86-64-v[234] levels as CPUTYPE
Greg V [Fri, 6 Aug 2021 13:33:37 +0000 (09:33 -0400)]
bsd.cpu.mk: add support for x86-64-v[234] levels as CPUTYPE

These are supported in LLVM 12 and GCC 11:

https://github.com/llvm/llvm-project/commit/012dd42e027e
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=324bec558e95584e8c1997575ae9d75978af59f1

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

2 years agomodules: felix: Add needed dependencies
Emmanuel Vadot [Fri, 6 Aug 2021 13:20:06 +0000 (15:20 +0200)]
modules: felix: Add needed dependencies

Modules should list all needed _if dependencies in their makefile otherwise
if one compiles a kernel that didn't compile those files the module won't build.

Fixes: 451bcf1b3601
2 years agopkgbase: locales: Also tag the files dir
Emmanuel Vadot [Fri, 6 Aug 2021 12:36:06 +0000 (14:36 +0200)]
pkgbase: locales: Also tag the files dir

Otherwise bsd.dirs.mk will create the directory with the default
package (utilities) and we end up with a bunch of empty dirs managed
by this package while it shouldn't be the case.

2 years agopkgbase: Add nfsiod to the FreeBSD-nfs package
Emmanuel Vadot [Thu, 5 Aug 2021 16:17:34 +0000 (18:17 +0200)]
pkgbase: Add nfsiod to the FreeBSD-nfs package

Missed in 081fb644925f

2 years agoFix panic in IPv6 multicast code.
Andrey V. Elsukov [Thu, 5 Aug 2021 08:51:46 +0000 (11:51 +0300)]
Fix panic in IPv6 multicast code.

Add check that ifp supports IPv6 multicasts in in6_getmulti.
This fixes panic when user application tries to join into multicast
group on an interface that doesn't support IPv6 multicasts, like
IFT_PFLOG interfaces.

PR:             257302
Reviewed by: melifaro
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31420

2 years agoUpdate the TCP LRO code to handle both encrypted and un-encrypted traffic.
Hans Petter Selasky [Mon, 2 Aug 2021 09:53:12 +0000 (11:53 +0200)]
Update the TCP LRO code to handle both encrypted and un-encrypted traffic.

Encrypted and un-encrypted traffic needs to be coalesced separately.
Split the 16-bit lro_type field in the address information into two
8-bit fields, and then use the last 8-bit field for flags, which among
other indicate if the received mbuf is encrypted or un-encrypted.

Differential Revision: https://reviews.freebsd.org/D31377
Reviewed by: gallatin
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agosound(4): Implement playback and recording mode sysctl(8).
Hans Petter Selasky [Wed, 28 Jul 2021 11:22:52 +0000 (13:22 +0200)]
sound(4): Implement playback and recording mode sysctl(8).

The dev.pcm.<N>.mode sysctl(8) gives information if a sound device
supports hardware mixing, playback or recording.

Submitted by: Christos Margiolis <christos@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D31320
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agosound(4): Fix typos.
Hans Petter Selasky [Wed, 28 Jul 2021 11:25:01 +0000 (13:25 +0200)]
sound(4): Fix typos.

Submitted by: Christos Margiolis <christos@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D31320
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoctypedef: fix installation of C.UTF-8
Kyle Evans [Thu, 5 Aug 2021 18:39:36 +0000 (13:39 -0500)]
ctypedef: fix installation of C.UTF-8

The appropriate directory and name were assigned to the FILESDIR
grouping, but not the ALWAYS grouping where C.UTF-8 is actually
assigned. Add the appropriate bits for ALWAYSDIR, and remove an
obsolete *PACKAGE= assignment since C.UTF-8 is explicitly not included
in FILES.

Prior to this change, C.UTF-8 was being installed as
/usr/share/C.UTF-8.LC_CTYPE.

Reviewed by: manu
Fixes: 0fa5403d493b ("pkgbase: move locales into their own package")
Differential Revision: https://reviews.freebsd.org/D31429

2 years agopkgbase: fix locale packages
Kyle Evans [Thu, 5 Aug 2021 18:37:18 +0000 (13:37 -0500)]
pkgbase: fix locale packages

Most places spelled it -locales, but numericdef spelled it as -locale
in just this one place. Pluralize it.

Reviewed by: emaste, manu
Fixes: 0fa5403d493b ("pkgbase: move locales into their own package")
Differential Revision: https://reviews.freebsd.org/D31428

2 years agoktls: Move KERN_TLS ifdef to tcp_var.h
Andrew Gallatin [Thu, 5 Aug 2021 23:17:35 +0000 (19:17 -0400)]
ktls: Move KERN_TLS ifdef to tcp_var.h

This allows us to remove stubs in ktls.h and allows us
to sort the function prototypes.

Reviewed by: jhb
Sponsored by: Netflix

2 years agoktls: Use the new PNOLOCK flag
Andrew Gallatin [Thu, 5 Aug 2021 21:19:12 +0000 (17:19 -0400)]
ktls: Use the new PNOLOCK flag

Use the new PNOLOCK flag to tsleep() to indicate that
we are managing potential races, and don't need to
sleep with a lock, or have a backstop timeout.

Reviewed by: jhb
Sponsored by: Netflix

2 years agotsleep: Add a PNOLOCK flag
Andrew Gallatin [Thu, 5 Aug 2021 21:16:30 +0000 (17:16 -0400)]
tsleep: Add a PNOLOCK flag

Add a PNOLOCK flag so that, in the race circumstance where
wakeup races are externally mitigated, tsleep() can be
called with a sleep time of 0 without triggering an
an assertion.

Reviewed by: jhb
Sponsored by: Netflix

2 years agoUse lltable calculated header when sending lle holdchain after successful lle resolution.
Alexander V. Chernikov [Mon, 2 Aug 2021 23:16:48 +0000 (23:16 +0000)]
Use lltable calculated header when sending lle holdchain after successful lle resolution.

Subscribers: imp, ae, bz

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

2 years agoiscsi: Remove icl_soft-only fields from struct icl_conn.
John Baldwin [Thu, 5 Aug 2021 19:05:30 +0000 (12:05 -0700)]
iscsi: Remove icl_soft-only fields from struct icl_conn.

Create a struct icl_soft_conn which extends struct icl_conn and
move fields only used by icl_soft from struct icl_conn to
struct icl_soft_conn.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31414

2 years agofork.2: correct minor typo in manpage.
Ceri Davies [Thu, 5 Aug 2021 18:36:33 +0000 (19:36 +0100)]
fork.2: correct minor typo in manpage.

2 years agoktls: fix a panic with INVARIANTS
Andrew Gallatin [Thu, 5 Aug 2021 17:05:00 +0000 (13:05 -0400)]
ktls: fix a panic with INVARIANTS

98215005b747fef67f44794ca64abd473b98bade introduced a new
thread that uses tsleep(..0) to sleep forever.  This hit
an assert due to sleeping with a 0 timeout.

So spell "forever" using SBT_MAX instead, which does not
trigger the assert.

Pointy hat to: gallatin
Pointed out by: emaste
Sponsored by: Netflix

2 years agocoretemp: use x86_msr_op for thermal MSR access
Konstantin Belousov [Mon, 2 Aug 2021 19:53:08 +0000 (22:53 +0300)]
coretemp: use x86_msr_op for thermal MSR access

Reviewed by: markj
Discussed with: mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31386

2 years agox86_msr_op: extend the KPI to allow MSR read and single-CPU operations
Konstantin Belousov [Mon, 2 Aug 2021 19:52:26 +0000 (22:52 +0300)]
x86_msr_op: extend the KPI to allow MSR read and single-CPU operations

Reivewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31386

2 years agoparam.h: Bump __FreeBSD_version to 1400029 for commit 0dc332bff200
Ka Ho Ng [Wed, 4 Aug 2021 18:35:57 +0000 (02:35 +0800)]
param.h: Bump __FreeBSD_version to 1400029 for commit 0dc332bff200

Commit 0dc332bff200 changes fileops layout and adds VOP_DEALLOCATE VOP
call. LinuxKPI kmods and file system modules need to be rebuilt at
least.

Sponsored by: The FreeBSD Foundation

2 years agoRegen after 0dc332bff200
Ka Ho Ng [Wed, 4 Aug 2021 19:34:42 +0000 (03:34 +0800)]
Regen after 0dc332bff200

2 years agoAdd fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
Ka Ho Ng [Thu, 5 Aug 2021 15:20:42 +0000 (23:20 +0800)]
Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).

fspacectl(2) is a system call to provide space management support to
userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the
deallocation. vn_deallocate(9) is a public KPI for kmods' use.

The purpose of proposing a new system call, a KPI and a VOP call is to
allow bhyve or other hypervisor monitors to emulate the behavior of SCSI
UNMAP/NVMe DEALLOCATE on a plain file.

fspacectl(2) comprises of cmd and flags parameters to specify the
space management operation to be performed. Currently cmd has to be
SPACECTL_DEALLOC, and flags has to be 0.

fo_fspacectl is added to fileops.
VOP_DEALLOCATE(9) is added as a new VOP call. A trivial implementation
of VOP_DEALLOCATE(9) is provided.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D28347

2 years agovfs: Introduce vn_bmap_seekhole_locked()
Ka Ho Ng [Wed, 4 Aug 2021 19:20:59 +0000 (03:20 +0800)]
vfs: Introduce vn_bmap_seekhole_locked()

vn_bmap_seekhole_locked() is factored out version of vn_bmap_seekhole().
This variant requires shared vnode lock being held around the call.

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

2 years agoAdd vnode_pager_purge_range(9) KPI
Ka Ho Ng [Wed, 4 Aug 2021 19:20:37 +0000 (03:20 +0800)]
Add vnode_pager_purge_range(9) KPI

This KPI is created in addition to the existing vnode_pager_setsize(9)
KPI. The KPI is intended for file systems that are able to turn a range
of file into sparse range, also known as hole-punching.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D27194

2 years agoktls: start a thread to keep the 16k ktls buffer zone populated
Andrew Gallatin [Thu, 5 Aug 2021 14:15:09 +0000 (10:15 -0400)]
ktls: start a thread to keep the 16k ktls buffer zone populated

Ktls recently received an optimization where we allocate 16k
physically contiguous crypto destination buffers. This provides a
large (more than 5%) reduction in CPU use in our
workload. However, after several days of uptime, the performance
benefit disappears because we have frequent allocation failures
from the ktls buffer zone.

It turns out that when load drops off, the ktls buffer zone is
trimmed, and some 16k buffers are freed back to the OS. When load
picks back up again, re-allocating those 16k buffers fails after
some number of days of uptime because physical memory has become
fragmented. This causes allocations to fail, because they are
intentionally done without M_NORECLAIM, so as to avoid pausing
the ktls crytpo work thread while the VM system defragments
memory.

To work around this, this change starts one thread per VM domain
to allocate ktls buffers with M_NORECLAIM, as we don't care if
this thread is paused while memory is defragged. The thread then
frees the buffers back into the ktls buffer zone, thus allowing
future allocations to succeed.

Note that waking up the thread is intentionally racy, but neither
of the races really matter. In the worst case, we could have
either spurious wakeups or we could have to wait 1 second until
the next rate-limited allocation failure to wake up the thread.

This patch has been in use at Netflix on a handful of servers,
and seems to fix the issue.

Differential Revision: https://reviews.freebsd.org/D31260
Reviewed by: jhb, markj,  (jtl, rrs, and dhw reviewed earlier version)
Sponsored by: Netflix

2 years agotcp, udp: improve input validation in handling bind()
Michael Tuexen [Thu, 5 Aug 2021 11:42:30 +0000 (13:42 +0200)]
tcp, udp: improve input validation in handling bind()

Reported by: syzbot+24fcfd8057e9bc339295@syzkaller.appspotmail.com
Reported by: syzbot+6e90ceb5c89285b2655b@syzkaller.appspotmail.com
Reviewed by: markj, rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D31422

2 years agoDisable compressed debug by default
Ed Maste [Thu, 5 Aug 2021 12:34:03 +0000 (08:34 -0400)]
Disable compressed debug by default

In c910570e7573 I enabled compressed debug sections, but it broke mips
and powerpc.  Disable it for now.

Reported by: jenkins, manu
Sponsored by: The FreeBSD Foundation

2 years agoarm64: conf: std.broadcom: Add dwcotg and smsc
Emmanuel Vadot [Thu, 5 Aug 2021 11:16:23 +0000 (13:16 +0200)]
arm64: conf: std.broadcom: Add dwcotg and smsc

Add the dwcotg and smsc usb to ethernet driver to std.broadcom.
Those are used in RPI3

PR:   257593

2 years agoAdd more arm64 external abort sources
Andrew Turner [Tue, 3 Aug 2021 13:20:54 +0000 (13:20 +0000)]
Add more arm64 external abort sources

These will be used when we support the Arm Reliability, Availability,
and Serviceability extension.

Sponsored by: The FreeBSD Foundation

2 years ago[lltable] Unify datapath feedback mechamism.
Alexander V. Chernikov [Mon, 2 Aug 2021 22:39:00 +0000 (22:39 +0000)]
[lltable] Unify datapath feedback mechamism.

Use newly-create llentry_request_feedback(),
 llentry_mark_used() and llentry_get_hittime() to
 request datapatch usage check and fetch the results
 in the same fashion both in IPv4 and IPv6.

While here, simplify llentry_provide_feedback() wrapper
 by eliminating 1 condition check.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31390

2 years agoadd blank line between variables (testing git commit)
Phil Shafer [Wed, 4 Aug 2021 20:56:55 +0000 (16:56 -0400)]
add blank line between variables (testing git commit)

2 years agoUse compressed debug in standalone userland debug files by default
Ed Maste [Mon, 1 Mar 2021 17:25:22 +0000 (12:25 -0500)]
Use compressed debug in standalone userland debug files by default

The compiler supports CFLAGS=-gz=zlib to compress .debug sections in
object files, libraries, and binaries.  Enable it to reduce disk usage
for standalone debug files (and /usr/obj).

Reviewed by: dim, kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29002

2 years agovtfontcvt: minor style(9) fixes from clang-format
Ed Maste [Thu, 13 May 2021 00:17:35 +0000 (20:17 -0400)]
vtfontcvt: minor style(9) fixes from clang-format

Found during clang-format experiments (in D26340).

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

2 years agoInstall ipmi man page also on arm64
Ed Maste [Sat, 29 May 2021 20:49:20 +0000 (16:49 -0400)]
Install ipmi man page also on arm64

Fixes: 40d0971bbe5d ("arm64: enable build of the ipmi module")
Sponsored by: The FreeBSD Foundation

2 years agoCirrus-CI: add some timing info on pkg install failure
Ed Maste [Wed, 2 Jun 2021 17:08:29 +0000 (13:08 -0400)]
Cirrus-CI: add some timing info on pkg install failure

Sponsored by: The FreeBSD Foundation

2 years agoDocument kern.log_wakeups_per_second.
John Baldwin [Wed, 4 Aug 2021 18:50:34 +0000 (11:50 -0700)]
Document kern.log_wakeups_per_second.

PR: 148680
MFC after: 2 weeks

2 years agoPrefer MK_SSP=no to SSP_CFLAGS=
Mitchell Horne [Wed, 4 Aug 2021 18:20:50 +0000 (15:20 -0300)]
Prefer MK_SSP=no to SSP_CFLAGS=

It is more idiomatic. CFLAGS is only augmented with $SSP_CFLAGS when
$MK_SSP != "no".

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31401

2 years agoarm: enable stack-smashing protection
Mitchell Horne [Wed, 4 Aug 2021 18:18:18 +0000 (15:18 -0300)]
arm: enable stack-smashing protection

With current generation clang/llvm it can pass all of our tests in
libc/ssp.

While here, remove the extra MACHINE_CPUARCH check for mips. SSP is
included in BROKEN_OPTIONS for this architecture in src.opts.mk, which
is enough to ensure normal builds won't set SSP_CFLAGS.

Reviewed by: kevans, imp, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31400

2 years agomk: format some option lists
Mitchell Horne [Wed, 4 Aug 2021 18:17:34 +0000 (15:17 -0300)]
mk: format some option lists

Alphabetize and give each option its own line, ahead of making another
change to these lists. This makes future diffs easier to read.

Reviewed by: imp, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31399

2 years agohwpmc_intel: assert for correct nclasses value
Mitchell Horne [Wed, 4 Aug 2021 17:37:05 +0000 (14:37 -0300)]
hwpmc_intel: assert for correct nclasses value

This variable is set based on the exact CPU model detected. If this
value is set too small, it could lead to a NULL-dereference from an
improperly initialized pmc_rowindex_to_classdep array.

Though it has been fixed, this was previously the case for Broadwell.
Add two asserts to catch this in DEBUG kernels, as it represents a
configuration error that may be hard to uncover otherwise.

PR: 253687
Reported by: Zhenlei Huang <zlei.huang@gmail.com>
Sponsored by: The FreeBSD Foundation

2 years agohwpmc: disable uncore class on Sandy Bridge and newer
Mitchell Horne [Wed, 4 Aug 2021 17:31:36 +0000 (14:31 -0300)]
hwpmc: disable uncore class on Sandy Bridge and newer

It was written for Nehalem and Westmere, with minor but incomplete
updates for Sandy Bridge in 78d763a29b15. The uncore architecture
changed significantly with this generation, bringing new layouts and
locations for some MSRs.

Misprogramming these MSRs in ucp_start_pmc() may panic the system, and
this is trivially reproducible via pmcstat(8) on at least Broadwell and
Haswell. Disable the class on these CPUs until it can be updated more
completely and leave a TODO comment detailing some of the work required.
Note that the nclasses value for Broadwell was already incorrect and
doesn't need changing.

The result is that any uncore events listed by pmcstat -L will no longer
be allocatable, but this is already the case for newer generations of
Intel CPUs.

PR: 253687
Reported by: Zhenlei Huang <zlei.huang@gmail.com>
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31389

2 years agoAdd vn_lktype_write()
Konstantin Belousov [Wed, 4 Aug 2021 02:34:48 +0000 (05:34 +0300)]
Add vn_lktype_write()

and remove repetetive code that calculates vnode locking type for write.

Reviewed by: khng, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31405

2 years agosound: Add an example of basic sound application
Goran Mekić [Wed, 4 Aug 2021 10:04:54 +0000 (18:04 +0800)]
sound: Add an example of basic sound application

This is an example demonstrating the usage of the OSS-compatible APIs
provided by the sound(4) subsystem. It reads frames from a dsp node and
writes them to the same dsp node.

MFC after: 2 weeks
Reviewed by: hselasky, bcr
Differential revision: https://reviews.freebsd.org/D30149

2 years agoRevert "arm: remove fslsdma from GENERIC"
Warner Losh [Wed, 4 Aug 2021 02:09:18 +0000 (20:09 -0600)]
Revert "arm: remove fslsdma from GENERIC"

The firmware was already in the tree when I did this commit, and I
missed the message. The bug was obsolete.

This reverts commit 9e3761d126c5c019d6c935e83989928eb1a0e76e.

PR: 237466
Sponsored by: Netflix

2 years agoAdd _Fork()
Konstantin Belousov [Mon, 2 Aug 2021 09:50:32 +0000 (12:50 +0300)]
Add _Fork()

Current POSIX standard requires fork() to be async-signal safe.  Neither
our implementation, nor implementations in other operating systems are,
and practically it is impossible to make fork() async-signal safe without
too much efforts.  Also, that would put undue requirement that all atfork
handlers should be async-signal safe as well, which contradicts its main
use.

As result, Austin Group dropped the requirement, and added a new function
_Fork() that should be async-signal safe, but it does not call atfork
handlers.  Basically, _Fork() can be implemented as a raw syscall.

Release of glibc 2.34 added _Fork(), do the same for FreeBSD.
Clarify threading behavior for fork() in the manpage.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D31378

2 years agoStyle
Konstantin Belousov [Mon, 2 Aug 2021 21:05:11 +0000 (00:05 +0300)]
Style

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31378

2 years agoFix native-xtools build
Bryan Drewery [Tue, 3 Aug 2021 15:20:57 +0000 (08:20 -0700)]
Fix native-xtools build

Fixes https://github.com/freebsd/poudriere/issues/894
Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-line")
X-MFC-With: d0c737e18

2 years agoRevert "Fix native-xtools build"
Bryan Drewery [Tue, 3 Aug 2021 16:59:44 +0000 (09:59 -0700)]
Revert "Fix native-xtools build"

This reverts commit 36269b82318280ef184c953b90674f5905e0f53f.

This had an unintended change included.

2 years agopkgbase: move locales into their own package
Baptiste Daroussin [Tue, 3 Aug 2021 15:02:16 +0000 (17:02 +0200)]
pkgbase: move locales into their own package

The only exception here being C.UTF-8 as this is the default
locales so it needs to always be installed

Reviewed by: pkgbase (emaste)
Differential Revision: https://reviews.freebsd.org/D31397

2 years agolocales: fix abuse of bsd.dirs.mk
Baptiste Daroussin [Tue, 3 Aug 2021 16:00:45 +0000 (18:00 +0200)]
locales: fix abuse of bsd.dirs.mk

the way SAMEDIRS was defined was an abuse of bsd.dirs.mk resulting in
all the directory to be created in one single command, but DESTDIR is
only prepend once on the first element of the list

Switch to the properway to use bsd.dirs.mk

2 years agoOnly store the arm64 ID registers in the cpu_desc
Andrew Turner [Thu, 29 Jul 2021 08:55:01 +0000 (08:55 +0000)]
Only store the arm64 ID registers in the cpu_desc

There is no need to store a pointer to the CPU implementer and part
strings. Switch to load them directly into the sbuf used to print them
on boot.

While here print the machine ID register when we fail to determine the
implementer or part we are booting on.

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

2 years agoMove setting arm64 HWCAP values to the ID tables
Andrew Turner [Fri, 16 Jul 2021 13:49:33 +0000 (13:49 +0000)]
Move setting arm64 HWCAP values to the ID tables

The HWCAPS values are based on the ID registers. Move setting these
to the existing ID register parsing code.

Previously we would need to handle all possible ID field values where
a HWCAP is set, however as most ID fields follow a scheme where when
the field increments it will only add new features meaning we only
need to check if the field is greater than when the HWCAP feature
was added.

While here stop setting HWCAP value that need kernel support, but this
support is missing.

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

2 years agoFix native-xtools build
Bryan Drewery [Tue, 3 Aug 2021 15:20:57 +0000 (08:20 -0700)]
Fix native-xtools build

Fixes https://github.com/freebsd/poudriere/issues/894
Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-line")
X-MFC-With: d0c737e18

2 years agomtree: remove a leftover '..' in BSD.usr.dist making it inconsistent
Baptiste Daroussin [Tue, 3 Aug 2021 15:05:37 +0000 (17:05 +0200)]
mtree: remove a leftover '..' in BSD.usr.dist making it inconsistent

Reported by: Michael Butler <imb@protected-networks.net>

2 years agolocales: fix typo preventing installation of collation for ru_RU.CP866
Baptiste Daroussin [Tue, 3 Aug 2021 12:37:26 +0000 (14:37 +0200)]
locales: fix typo preventing installation of collation for ru_RU.CP866

2 years agolocales: stop hardcoding the directories in the mtree
Baptiste Daroussin [Tue, 3 Aug 2021 12:25:00 +0000 (14:25 +0200)]
locales: stop hardcoding the directories in the mtree

The framework knows how to create directories and tag them properly
for a the creation of a mtree, not need to hardcode all the locales
entries in bsd.usr.mk

This simplifies addition of new locales but also allow people building
with WITHOUT_LOCALES to end up with a directory full of empty files

2 years agonl_NL.ISO8859-1: reinstall the missing LC_MESSAGES
Baptiste Daroussin [Tue, 3 Aug 2021 10:10:21 +0000 (12:10 +0200)]
nl_NL.ISO8859-1: reinstall the missing LC_MESSAGES

2 years agohdaa: add missing break in hdac_pin_patch().
Gleb Smirnoff [Tue, 3 Aug 2021 10:06:16 +0000 (03:06 -0700)]
hdaa: add missing break in hdac_pin_patch().

Fixes driver attach on my Thinkpad X1 Carbon, and likely on
many other ALC family devices.

Fixes: ef790cc7407e827db9563d08a52a71ab36436986

2 years agoenetc_mdio: Support building the driver as a loadable module.
Kornel Duleba [Wed, 28 Jul 2021 11:38:53 +0000 (13:38 +0200)]
enetc_mdio: Support building the driver as a loadable module.

After recent arm64 GENERIC config cleanup the ENETC MDIO
in NXP LS1028A SoC should support being loaded as a module.

Obtained from: Semihalf
Sponsored by: Alstom Group

2 years agoenetc: Support building the driver as a loadable module.
Kornel Duleba [Wed, 28 Jul 2021 09:23:23 +0000 (11:23 +0200)]
enetc: Support building the driver as a loadable module.

Function level reset has to be done in attach in order to put the
hardware in a known state before configuring it.
The order of DRIVER_MODULEs was changed to ensure that the miibus driver
is loaded when mii_attach is called.

Obtained from: Semihalf
Sponsored by: Alstom Group

2 years agodtb: freescale: Add fsl-ls1028a-rdb to the build
Kornel Duleba [Wed, 23 Jun 2021 12:56:34 +0000 (14:56 +0200)]
dtb: freescale: Add fsl-ls1028a-rdb to the build

With the recent inclusion of ENETC networking driver we now support this
board.

Obtained from: Semihalf
Sponsored by: Alstom Group

2 years agoIntroduce driver for Freescale Felix switch
Marcin Wojtas [Wed, 9 Jun 2021 11:23:26 +0000 (13:23 +0200)]
Introduce driver for Freescale Felix switch

It is found on boards equipped with LS1028A SoC.
802.1q VLAN grouping is supported.
An external MDIO device is used for communicating with PHYs.
The driver is built as a module by default, it is not included
in GENERIC kernel config.

Submitted by: Lukasz Hajec <lha@semihalf.com>
              Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30923

2 years agoetherswitch: Add a new striptagingress port flag
Kornel Duleba [Wed, 23 Jun 2021 11:13:05 +0000 (13:13 +0200)]
etherswitch: Add a new striptagingress port flag

Felix switch found in LS1028A supports stripping VLAN tag on
ingress, instead of egress. The striptag flag excepts the latter
behaviour.
Add a new flag to support the feature.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30922

2 years agoUse .sinclude for bsd.sanitizer.mk
Alex Richardson [Tue, 3 Aug 2021 09:37:28 +0000 (10:37 +0100)]
Use .sinclude for bsd.sanitizer.mk

We don't install this file since MK_ASAN/MK_UBSAN is only supported for
src builds. However, some ports also use bsd.lib.mk/bsd.prog.mk so we
should not fail the build if it can't be included.

Reported by: jkim
Fixes: 7bc797e3f380 ("Add build system support for ASAN+UBSAN instrumentation")

2 years agomalloc(9): provide missing malloc_aligned implementation
Kyle Evans [Tue, 3 Aug 2021 02:11:44 +0000 (21:11 -0500)]
malloc(9): provide missing malloc_aligned implementation

Pointy hat: kevans
Fixes: 6162cf885c00 ("malloc(9): Document/complete aligned variants")

2 years agoawk: Enable tests again
Warner Losh [Mon, 2 Aug 2021 21:53:26 +0000 (15:53 -0600)]
awk: Enable tests again

Since we now pass all 24 of the NetBSD awk tests, re-enable these tests.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31370

2 years agoclock_id: These symbols weren't in 4.4BSD, adjust copyright
Warner Losh [Mon, 2 Aug 2021 21:49:47 +0000 (15:49 -0600)]
clock_id: These symbols weren't in 4.4BSD, adjust copyright

Peter Wemm added the first CLOCK_* symbols in 0f5ed9f420528 in 1997
after obtaining them from NetBSD. In NetBSD, jtc@netbsd.org committed
them in sys/sys/time.h rev 1.19 dated 1996/11/15, along with all the
system calls associated with 1003.1b. FreeBSD's values are, however,
different than NetBSD's today. The USL/UCB lawsuit was settled in 1994,
so these couldn't have been derived from material provided to University
of California covered in that settlement. This file does not need the
settlement disclaimer.

Furthermore, I rewrote most of the code (except the symbols and their
values) when merging it from time.h and sys/time.h. Most of the creative
content of the file is new, so update copyright to reflect that.

Reviewed by: kaktus
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31369

2 years agomalloc(9): Document/complete aligned variants
Adam Fenn [Mon, 2 Aug 2021 20:33:31 +0000 (15:33 -0500)]
malloc(9): Document/complete aligned variants

Comments on a pending kvmclock driver suggested adding a
malloc_aligned() to complement malloc_domainset_aligned(); add it now,
and document both.

Reviewed by: imp, kib, allanjude (manpages)
Differential Revision: https://reviews.freebsd.org/D31004

2 years agoFix lockstat:::thread-spin dtrace probe with LOCK_PROFILING
Eric van Gyzen [Mon, 2 Aug 2021 18:54:57 +0000 (13:54 -0500)]
Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING

The spinning start time is missing from the calculation due to a
misplaced #endif.  Return the #endif where it's supposed to be.

Submitted by: Alexander Alexeev <aalexeev@isilon.com>
Reviewed by: bdrewery, mjg
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31384

2 years agocxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
John Baldwin [Mon, 2 Aug 2021 16:41:27 +0000 (09:41 -0700)]
cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.

The remote peer might send a FIN in the middle of a burst of data
PDUs.  In the case of T6 with data PDU completion moderation, the
driver would not have seen these PDUs since the final PDU in the burst
was never received resulting in a stale rcv_nxt when the FIN is
received.

While here, invert the logic in the condition to be more readable and
always set tp->rcv_nxt from the sequence number in the CPL.  This sets
the proper value of rcv_nxt for FINs on connections with data received
but not reported via a CPL (e.g. a partial iSCSI PDU burst interrupted
by a FIN).

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D30871

2 years agopf: bound DIOCGETSTATES memory use
Kristof Provost [Mon, 2 Aug 2021 07:46:33 +0000 (09:46 +0200)]
pf: bound DIOCGETSTATES memory use

Similar to what we did earlier for DIOCGETSTATESV2 we only allocate
enough memory for a handful of states and copy those out, bit by bit,
rather than allocating memory for all states in one go.

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

2 years agodevclass_alloc_unit: move "at" hint test to after device-in-use test
Adam Fenn [Mon, 2 Aug 2021 16:27:17 +0000 (11:27 -0500)]
devclass_alloc_unit: move "at" hint test to after device-in-use test

Only perform this expensive operation when the unit number is a
potential candidate (i.e. not already in use), thereby reducing device
scan time on systems with many devices, unit numbers, and drivers.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #61
Differential Revision: https://reviews.freebsd.org/D31381

2 years agoAdd missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3
Alex Richardson [Mon, 2 Aug 2021 15:38:39 +0000 (16:38 +0100)]
Add missing bsd.linker.mk include after 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3

This is needed for -DWITH_CLEAN builds since the cleandir phase does not
include bsd.linker.mk from bsd.compiler.mk

2 years agoFix GCC and -DWITH_CLEAN build after 7bc797e3f3807660cf98e5b1bd63545cafe820f8
Alex Richardson [Mon, 2 Aug 2021 15:01:30 +0000 (16:01 +0100)]
Fix GCC and -DWITH_CLEAN build after 7bc797e3f3807660cf98e5b1bd63545cafe820f8

Reported by: kib

2 years agosched_ule(4): Pre-seed sched_random().
Alexander Motin [Mon, 2 Aug 2021 14:50:34 +0000 (10:50 -0400)]
sched_ule(4): Pre-seed sched_random().

I don't think it changes anything, but why not.

While there, make cpu_search_highest() use all 8 lower load bits for
noise, since it does not use cs_prefer and the code is not shared
with cpu_search_lowest() any more.

MFC after: 1 month

2 years agoFix BUILD_WITH_STRICT_TMPPATH build after adding time to ITOOLS
Alex Richardson [Mon, 2 Aug 2021 14:34:26 +0000 (15:34 +0100)]
Fix BUILD_WITH_STRICT_TMPPATH build after adding time to ITOOLS

This is needed after bbd16236e986ef1b0e1da37c9c8a7f9dd2d63b5d (and
99feb137f5f66f903bba816c1d98ced2a92bef12).

2 years agoAllow bootstrapping llvm-tblgen on macOS and Linux
Alex Richardson [Mon, 2 Aug 2021 13:36:03 +0000 (14:36 +0100)]
Allow bootstrapping llvm-tblgen on macOS and Linux

This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan: Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D31057

2 years agoRemove mkcsmapper_static and mkesdb_static from build-tools
Alex Richardson [Mon, 2 Aug 2021 09:49:01 +0000 (10:49 +0100)]
Remove mkcsmapper_static and mkesdb_static from build-tools

Build them as part of the bootstrap-tools phase instead.

Reviewed by: emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D28181

2 years agolibc: Disable ASAN for certain string functions
Alex Richardson [Mon, 2 Aug 2021 08:51:34 +0000 (09:51 +0100)]
libc: Disable ASAN for certain string functions

They deliberately read out-of-bounds values to avoid byte-by-byte
loads and check multiple bytes at once. While this will work on x86,
it is flagged as an out-of-bounds read with ASAN, so we have to
disable instrumentation here. This also causes bounds errors for CHERI,
so in CheriBSD we use implementations that avoid OOB reads.

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

2 years agoDon't instrument the rdtsc ifunc when building with ASAN/UBSAN
Alex Richardson [Mon, 2 Aug 2021 08:51:01 +0000 (09:51 +0100)]
Don't instrument the rdtsc ifunc when building with ASAN/UBSAN

The ifunc resolver is called before the sanitizer runtime is initialized,
so any instrumentation results in an immediate crash.

Reviewed By: kib
Differential Revision: https://reviews.freebsd.org/D31046

2 years agoFix build of stand/ when building world with ASAN
Alex Richardson [Mon, 2 Aug 2021 08:50:16 +0000 (09:50 +0100)]
Fix build of stand/ when building world with ASAN

The userboot/test  program links against the default userspace libraries
(e.g. shared libgcc_s.so) that will be instrumented if WITH_ASAN is set.
All other programs link against libsa instead of libc and therefore can't
use the sanitizer runtime library. To fix the stand/ build with
sanitizers, we disable MK_ASAN/MK_UBSAN if -nostdlib is found in the
LDFLAGS (i.e. we are using libsa instead of libc).

Reviewed By: imp, tsoome
Differential Revision: https://reviews.freebsd.org/D31047

2 years agoFix MK_TESTS build with MK_ASAN/MK_UBSAN
Alex Richardson [Mon, 2 Aug 2021 08:49:50 +0000 (09:49 +0100)]
Fix MK_TESTS build with MK_ASAN/MK_UBSAN

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

2 years agolibthr: work around an ASAN false-positive
Alex Richardson [Mon, 2 Aug 2021 08:49:21 +0000 (09:49 +0100)]
libthr: work around an ASAN false-positive

I got the following error with an ASAN-instrument libthr:

==803==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffcdb0 at pc 0x000801863396 bp 0x7ff8
READ of size 4 at 0x7fffffffcdb0 thread T0
    #0 0x801863395 in handle_signal /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:262:2
    #1 0x801860da2 in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:246:2

Address 0x7fffffffcdb0 is located in stack of thread T0 at offset 208 in frame
    #0 0x80186080f in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:213

  This frame has 1 object(s):
    [32, 64) 'act' (line 216) <== Memory access at offset 208 overflows this variable
HINT: this may be a false positive if your program uses some custom stack

This seems like a false-positive since the line in question is
`SIGSETOR(actp->sa_mask, ucp->uc_sigmask);` and it complains about a read
operation (from the ucontext_t argument) so this indicates to me that ASAN
does not understand that thr_sighandler() is a signal handler.

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

2 years agoAdd build system support for ASAN+UBSAN instrumentation
Alex Richardson [Mon, 2 Aug 2021 08:48:21 +0000 (09:48 +0100)]
Add build system support for ASAN+UBSAN instrumentation

This adds two new options WITH_ASAN/WITH_UBSAN that can be set to
enable instrumentation of all binaries with AddressSanitizer and/or
UndefinedBehaviourSanitizer. This current patch is almost sufficient
to get a complete buildworld with sanitizer instrumentation but in
order to actually build and boot a system it depends on a few more
follow-up commits.

Reviewed By: brooks, kib, markj
Differential Revision: https://reviews.freebsd.org/D31043

2 years agotools/build: Don't redefine open() for the linux bootstrap
Alex Richardson [Mon, 2 Aug 2021 08:45:05 +0000 (09:45 +0100)]
tools/build: Don't redefine open() for the linux bootstrap

This is needed to bootstrap llvm-tblgen on Linux since LLVM calls
`::open(...)` which does not work if open is a statement macro.
Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools
user of those flags to deal with missing definitions.

Reviewed By: jrtc27
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31226

2 years agoloader: tftp client should use server address from rootip
Toomas Soome [Mon, 2 Aug 2021 12:27:38 +0000 (15:27 +0300)]
loader: tftp client should use server address from rootip

servip is set from bootp bp_siaddr (if present) and rootip is
set immediately from servip in tha sane bootp code.

However, the common/dev_net.c does only set rootip (based on
url processing etc). Therefore, we should also use rootip in tftp
reader.

Fixes hung tftp based boot when bp_siaddr is not provided.

MFC after: 1 week

2 years agoIgnore ResourceProducer flag for:
Aleksandr Rybalko [Mon, 2 Aug 2021 10:41:14 +0000 (13:41 +0300)]
Ignore ResourceProducer flag for:
o Arm CoreLink TM CMN-600 Coherent Mesh Network controller,
o Arm CoreLink DMC-620 Dynamic Memory Controller.

Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.

2 years agovmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1
Ka Ho Ng [Mon, 2 Aug 2021 09:54:40 +0000 (17:54 +0800)]
vmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1

In hw.vmm.create sysctl handler the maximum length of vm name is
VM_MAX_NAMELEN. However in vm_create() the maximum length allowed is
only VM_MAX_NAMELEN - 1 chars. Bump the length of the internal buffer to
allow the length of VM_MAX_NAMELEN for vm name.

MFC after: 3 days
Reviewed by: grehan
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31372

2 years agoxen/timer: fix amd64 LINT kernel build
Roger Pau Monné [Mon, 2 Aug 2021 08:22:22 +0000 (10:22 +0200)]
xen/timer: fix amd64 LINT kernel build

On amd64 XENHVM depends on the xentimer device for PVH early startup,
so both should be added or removed together (like the current
dependency with xenpci). Fix this by adding xentimer to NOTES and
updating the comments on the config files. Note that on i386 there's
no such dependency between xentimer and XENHVM, since there's no PVH
support.

While there also fix the MINIMAL i386 build to include the xentimer,
so it keeps the same functionality as before xentimer was split from
XENHVM.

Reported by: lwhsu
PR: 257549
Fixes: ae5981274815 ('xen/timer: make xen timer optional')
2 years agoAdd missing file to sys/conf/files after 469884cf04a9b92677c7c83e229ca6b8814f8b0a .
Hans Petter Selasky [Mon, 2 Aug 2021 06:24:22 +0000 (08:24 +0200)]
Add missing file to sys/conf/files after 469884cf04a9b92677c7c83e229ca6b8814f8b0a .

Found by: vishwin@
Differential Revision: https://reviews.freebsd.org/D29921
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agosched_ule(4): Use trylock when stealing load.
Alexander Motin [Mon, 2 Aug 2021 02:42:01 +0000 (22:42 -0400)]
sched_ule(4): Use trylock when stealing load.

On some load patterns it is possible for several CPUs to try steal
thread from the same CPU despite randomization introduced.  It may
cause significant lock contention when holding one queue lock idle
thread tries to acquire another one.  Use of trylock on the remote
queue allows both reduce the contention and handle lock ordering
easier.  If we can't get lock inside tdq_trysteal() we just return,
allowing tdq_idled() handle it.  If it happens in tdq_idled(), then
we repeat search for load skipping this CPU.

On 2-socket 80-thread Xeon system I am observing dramatic reduction
of the lock spinning time when doing random uncached 4KB reads from
12 ZVOLs, while IOPS increase from 327K to 403K.

MFC after: 1 month

2 years agosched_ule(4): Reduce duplicate search for load.
Alexander Motin [Mon, 2 Aug 2021 02:07:51 +0000 (22:07 -0400)]
sched_ule(4): Reduce duplicate search for load.

When sched_highest() called for some CPU group returns nothing, idle
thread calls it for the parent CPU group.  But the parent CPU group
also includes the CPU group we've just searched, and unless there is
a race going on, it is unlikely we find anything new this time.

Avoid the double search in case of parent group having only two sub-
groups (the most prominent case). Instead of escalating to the parent
group run the next search over the sibling subgroup and escalate two
levels up after if that fail too.  In case of more than two siblings
the difference is less significant, while searching the parent group
can result in better decision if we find several candidate CPUs.

On 2-socket 40-core Xeon system I am measuring ~25% reduction of CPU
time spent inside cpu_search_highest() in both SMT (2x20x2) and non-
SMT (2x20) cases.

MFC after: 1 month

2 years agoamd64 pmap_vm_page_alloc_check(): loose the assert
Konstantin Belousov [Sun, 1 Aug 2021 21:58:21 +0000 (00:58 +0300)]
amd64 pmap_vm_page_alloc_check(): loose the assert

Current expression checks that vm_page_alloc(9) never returns a page
belonging to the preload area.  This is not true if something was freed
from there, for instance a preloaded module was unloaded, or ucode update
freed.

Only check that we never allow to allocate a page belonging to the kernel
proper, check against _end.

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

2 years agobhyve: net_backends, automatically IFF_UP tap devices
Bjoern A. Zeeb [Wed, 28 Jul 2021 22:53:25 +0000 (22:53 +0000)]
bhyve: net_backends, automatically IFF_UP tap devices

If you want communications with the outside world and tell bhyve to
create an interfaces then it should be usable as well.
Rather than relying on the sysctl net.link.tap.up_on_open automatically
try to IFF_UP the opened tap device.

MFC after: 10 days
Reviewed by: markj, grehan
Differential Revision: https://reviews.freebsd.org/D31342

2 years agoawk: document updating
Warner Losh [Sun, 1 Aug 2021 17:31:50 +0000 (11:31 -0600)]
awk: document updating

Fill in all the details to the standard process so they are hand in one
place and don't need to be re-remembered or rediscovered for the next
import.

Sponsored by: Netflix