]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoloader: zfs should support bootonce an nextboot
Toomas Soome [Mon, 21 Sep 2020 09:01:10 +0000 (09:01 +0000)]
loader: zfs should support bootonce an nextboot

bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by: Netflix, Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25512

3 years agoatomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr
Jessica Clarke [Sun, 20 Sep 2020 23:20:18 +0000 (23:20 +0000)]
atomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr

This was broken in r357940 which introduced the __typeof use. We need
the volatile qualifier to be on the pointee not the pointer otherwise it
does nothing. This was found by mhorne in D26498, noticing there was a
problem (a spin loop condition was hoisted for RISC-V boot code) but not
the root cause of it.

Reported by: mhorne
Reviewed by: mhorne, mjg
Approved by: mhorne, mjg
Differential Revision: https://reviews.freebsd.org/D26500

3 years agoamd64 pmap: handle cases where pml4 page table page is not allocated.
Konstantin Belousov [Sun, 20 Sep 2020 22:16:24 +0000 (22:16 +0000)]
amd64 pmap: handle cases where pml4 page table page is not allocated.

Possible in LA57 pmap config.

Noted by: alc
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26492

3 years agoRemove unused nhop_ref_any() function.
Alexander V. Chernikov [Sun, 20 Sep 2020 21:32:52 +0000 (21:32 +0000)]
Remove unused nhop_ref_any() function.
Remove "opt_mpath.h" header where not needed.

No functional changes.

3 years agoAdjust DMA alignment for USB stack.
Michal Meloun [Sun, 20 Sep 2020 17:28:24 +0000 (17:28 +0000)]
Adjust DMA alignment for USB stack.
It should be at least as large as the maximum value of caheline size
for currently known CPUs.

MFC after: 2 weeks

3 years agoarm: allwinner: aw_nmi: Fix wrong logic when we disable the nmi
Emmanuel Vadot [Sun, 20 Sep 2020 16:11:38 +0000 (16:11 +0000)]
arm: allwinner: aw_nmi: Fix wrong logic when we disable the nmi

MFC after: 1 week

3 years agoAdd missing assignment forgotten in r365899
Michal Meloun [Sun, 20 Sep 2020 15:11:52 +0000 (15:11 +0000)]
Add missing assignment forgotten in r365899

Noticed by: mav
MFC after: 1 month
MFC with: r365899

3 years agoFix gw updates / flag updates during route changes.
Alexander V. Chernikov [Sun, 20 Sep 2020 12:31:48 +0000 (12:31 +0000)]
Fix gw updates / flag updates during route changes.

* Zero gw_sdl if switching to interface route - the assumption
 that underlying storage is zeroed is incorrect with route changes.
* Apply proper flag mask to rte.

Reported by: vangyzen

3 years agoApply an opimization for the kernels used by cexp(x) and cexpf(x) submitted
Stefan Eßer [Sun, 20 Sep 2020 05:32:53 +0000 (05:32 +0000)]
Apply an opimization for the kernels used by cexp(x) and cexpf(x) submitted
by Steve Kargl:

- Use sincos[f] instead of a call to cos[f] and a call to sin[f].

- While here, alphabetize declaration.

Submitted by:   sgk at troutmask.apl.washington.edu (Steve Kargl)

3 years agoApply fix for ld80 and ld128 submitted by Steve Kargl:
Stefan Eßer [Sun, 20 Sep 2020 05:28:31 +0000 (05:28 +0000)]
Apply fix for ld80 and ld128 submitted by Steve Kargl:

- Micro-optimization: use sincosl(x) instead of a call to cosl(x) and
  a call to sinl(x).  Argument reduction is done once not twice.

- Use a long double constant instead of an invalid double constant.

- Spell scale2 correctly

He could not test ld128, so that patch is untested.

Submitted by: sgk at troutmask.apl.washington.edu (Steve Kargl)

3 years agoUpdate the libufs cgget() and cgput() interfaces to have a similar
Kirk McKusick [Sat, 19 Sep 2020 22:48:30 +0000 (22:48 +0000)]
Update the libufs cgget() and cgput() interfaces to have a similar
API to the sbget() and sbput() interfaces. Specifically they take
a file descriptor pointer rather than the struct uufsd *disk pointer
used by the libufs cgread() and cgwrite() interfaces. Update fsck_ffs
to use these revised interfaces.

No functional changes intended.

Sponsored by: Netflix

3 years agoFix for use of the XHCI driver on Cortex-A72 by adding a missing cache
Hans Petter Selasky [Sat, 19 Sep 2020 22:37:45 +0000 (22:37 +0000)]
Fix for use of the XHCI driver on Cortex-A72 by adding a missing cache
flush operation before writing to the XHCI_ERSTBA_LO/HI register(s).

PR: 237666
Discussed with: Mark Millard <marklmi@yahoo.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies // Nvidia

3 years agoThe fsdb(8) utility uses the fsck_ffs(8) disk I/O interfaces, so
Kirk McKusick [Sat, 19 Sep 2020 20:06:12 +0000 (20:06 +0000)]
The fsdb(8) utility uses the fsck_ffs(8) disk I/O interfaces, so
switch from using libufs's bread() to using fsck_ffs's getdatablk()
when importing tools/diag/prtblnos's prtblknos().

Sponsored by: Netflix

3 years agofix integer underflow in getgrnam_r and getpwnam_r
Alan Somers [Sat, 19 Sep 2020 19:08:27 +0000 (19:08 +0000)]
fix integer underflow in getgrnam_r and getpwnam_r

Sometimes nscd(8) will return a 1-byte buffer for a nonexistent entry. This
triggered an integer underflow in grp_unmarshal_func, causing getgrnam_r to
return ERANGE instead of 0.

Fix the user's buffer size check, and add a correct check for a too-small
nscd buffer.

PR: 248932
Event: September 2020 Bugathon
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D26204

3 years agoAddress compiler warnings in C code used by the DTrace test suite.
Mark Johnston [Sat, 19 Sep 2020 16:15:22 +0000 (16:15 +0000)]
Address compiler warnings in C code used by the DTrace test suite.

Reported by: Jenkins
MFC after: 1 week

3 years agoFix some nits in 1G page support in the amd64 pmap.
Mark Johnston [Sat, 19 Sep 2020 15:22:04 +0000 (15:22 +0000)]
Fix some nits in 1G page support in the amd64 pmap.

- Move assertions out of the main loop to avoid duplicate conditional
  expressions, and improve assertion messages.
- Fix va_next updates.  In some cases we were not doing the wraparound
  check before continuing the loop.
- Use the right va_next.  In pmap_advise() and pmap_copy() we would step
  through 1G pages 2M at a time.
- Copy 1G mappings in pmap_copy().

Reviewed by: alc, kib
MFC with: r365518
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26463

3 years agodiskless(8): Correct Sections out of conventional order error
Gordon Bergling [Sat, 19 Sep 2020 15:10:17 +0000 (15:10 +0000)]
diskless(8): Correct Sections out of conventional order error

Event: September 2020 Bugathon
MFC after: 1 week

3 years agocrypto(7): Correct Sections out of conventional order error
Gordon Bergling [Sat, 19 Sep 2020 15:08:57 +0000 (15:08 +0000)]
crypto(7): Correct Sections out of conventional order error

Event: September 2020 Bugathon
MFC after: 1 week

3 years agosrc.conf(5): Fix some mandoc issues in source files
Gordon Bergling [Sat, 19 Sep 2020 14:49:31 +0000 (14:49 +0000)]
src.conf(5): Fix some mandoc issues in source files

- new sentence, new line
- blank line in fill mode

Event: September 2020 Bugathon
MFC after: 1 week

3 years agoCirrus-CI: skip svn_head branch
Ed Maste [Sat, 19 Sep 2020 13:55:26 +0000 (13:55 +0000)]
Cirrus-CI: skip svn_head branch

svn_head has the same content as the master or main branch (it's just
the result of a `git svn` conversion instead of svn2git).

Sponsored by: The FreeBSD Foundation

3 years agoFix dtrace tools bootstrap on non-FreeBSD after OpenZFS import
Alex Richardson [Sat, 19 Sep 2020 12:08:16 +0000 (12:08 +0000)]
Fix dtrace tools bootstrap on non-FreeBSD after OpenZFS import

This required surprisingly few build system changes and only two changes to the
openZFS compat headers which have been upstreamed as
https://github.com/openzfs/zfs/pull/10863

Reviewed By: #zfs, freqlabs
Differential Revision: https://reviews.freebsd.org/D26193

3 years agoImplement workaround for broken access to configuration space.
Michal Meloun [Sat, 19 Sep 2020 11:27:16 +0000 (11:27 +0000)]
Implement workaround for broken access to configuration space.
Due to a HW bug in the RockChip PCIe implementation, attempting to access
a non-existent register in the configuration space will throw an exception.
Use new bus functions bus_peek() and bus_poke() to overcomme this limitation.

3 years agoAdd NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.
Michal Meloun [Sat, 19 Sep 2020 11:06:41 +0000 (11:06 +0000)]
Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.
One problem with the bus_space_read_N() and bus_space_write_N() family of
functions is that they provide no protection against exceptions which can
occur when no physical hardware or device responds to the read or write
cycles. In such a situation, the system typically would panic due to a
kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family
of functions provide a mechanism to handle these exceptions gracefully
without the risk of crashing the system.

Typical example is access to PCI(e) configuration space in bus enumeration
function on badly implemented PCI(e) root complexes (RK3399 or Neoverse
N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state.

This commit adds a real implementation for arm64 only. The remaining
architectures have bus_space_peek()/bus_space_poke() emulated by using
bus_space_read()/bus_space_write() (without exception handling).

MFC after: 1 month
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25371

3 years agoMove finalize_components_config from get_params to cmd_*.
Colin Percival [Sat, 19 Sep 2020 02:15:56 +0000 (02:15 +0000)]
Move finalize_components_config from get_params to cmd_*.

This allows us to redirect its output in cmd_cron, so that the
"src component not installed, skipped" message will be treated
the same way as other output from freebsd-update cron: Sent
in an email to root (or other address specified) if there are
updates to install, and silenced otherwise.

PR: 202492
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D26432

3 years agocaroot: update base store
Kyle Evans [Sat, 19 Sep 2020 01:59:17 +0000 (01:59 +0000)]
caroot: update base store

Count:
- Two (2) removed
- Three (3) added

MFC after: 3 days

3 years agoFix a LOR between the NFS server and server side krpc.
Rick Macklem [Fri, 18 Sep 2020 23:52:56 +0000 (23:52 +0000)]
Fix a LOR between the NFS server and server side krpc.

Recent testing of the NFS-over-TLS code found a LOR between the mutex lock
used for sessions and the sleep lock used for server side krpc socket
structures in nfsrv_checksequence().  This was fixed by r365789.
A similar bug exists in nfsrv_bindconnsess(), where SVC_RELEASE() is called
while mutexes are held.
This patch applies a fix similar to r365789, moving the SVC_RELEASE() call
down to after the mutexes are released.

This patch fixes the problem by moving the SVC_RELEASE() call in
nfsrv_checksequence() down a few lines to below where the mutex is released.

MFC after: 1 week

3 years agoMFV 2.0-rc2
Matt Macy [Fri, 18 Sep 2020 23:21:24 +0000 (23:21 +0000)]
MFV 2.0-rc2

- Fixes divide by zero for unusual hz
- remove cryptodev dependency

3 years agoUpdate openzfs to 2.0.0-rc2-g4ce06f
Matt Macy [Fri, 18 Sep 2020 22:55:05 +0000 (22:55 +0000)]
Update openzfs to 2.0.0-rc2-g4ce06f

3 years agoamd64 pmap_pkru_same: prev_ppr was always NULL
Eric van Gyzen [Fri, 18 Sep 2020 20:53:40 +0000 (20:53 +0000)]
amd64 pmap_pkru_same: prev_ppr was always NULL

Fix the logic so it works as it appears.

Reported by: Coverity
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: D26211 (in progress, so omitting full URL)

3 years agoInstall library symlinks atomically.
Mark Johnston [Fri, 18 Sep 2020 19:03:34 +0000 (19:03 +0000)]
Install library symlinks atomically.

As we do for shared library binaries, pass -S to install(1) when
installing symlinks.  Doing so helps avoid transient failures when
libraries are being reinstalled, which seems to be the root cause of
spurious libgcc_s.so link failures during CI builds.

PR: 233769
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26453

3 years agoys/contrib/dev/ath: remove unintentional double semicolon
Ed Maste [Fri, 18 Sep 2020 18:35:18 +0000 (18:35 +0000)]
ys/contrib/dev/ath: remove unintentional double semicolon

Approved by: adrian

3 years agobuild: provide a default WARNS for all in-tree builds
Kyle Evans [Fri, 18 Sep 2020 17:17:46 +0000 (17:17 +0000)]
build: provide a default WARNS for all in-tree builds

The current default is provided in various Makefile.inc in some top-level
directories and covers a good portion of the tree, but doesn't cover parts
of the build a little deeper (e.g. libcasper).

Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that
variable is defined. This lets us relatively cleanly provide a default WARNS
no matter where you're building in the src tree without breaking things
outside of the tree.

Crunchgen has been updated as a bootstrap tool to work on this change
because it needs r365605 at a minimum to succeed. The cleanup necessary to
successfully walk over this change on WITHOUT_CLEAN builds has been added.

There is a supplemental project to this to list all of the warnings that are
encountered when the environment has WARNS=6 NO_WERROR=yes:
https://warns.kevans.dev -- this project will hopefully eventually go away
in favor of CI doing a much better job than it.

Reviewed by: emaste, brooks, ngie (all earlier version)
Reviewed by: emaste, arichardson (depend-cleanup.sh change)
Differential Revision: https://reviews.freebsd.org/D26455

3 years agovm_ooffset_t is now unsigned
Eric van Gyzen [Fri, 18 Sep 2020 16:48:08 +0000 (16:48 +0000)]
vm_ooffset_t is now unsigned

vm_ooffset_t is now unsigned. Remove some tests for negative values,
or make other adjustments accordingly.

Reported by: Coverity
Reviewed by: kib markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26214

3 years agoarm64: generate ISO release images
Mitchell Horne [Fri, 18 Sep 2020 14:40:13 +0000 (14:40 +0000)]
arm64: generate ISO release images

Some IPMI implementations on arm64 are reportedly unable to load our
memstick installer images, but support the older ISO format. Start
generating these for arm64.

Unlike installer ISOs for other platforms, these images are UEFI-only.

Reviewed by: emaste
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26452

3 years agopkgbase: use consistent annotation for objectk eys
Kyle Evans [Fri, 18 Sep 2020 14:29:01 +0000 (14:29 +0000)]
pkgbase: use consistent annotation for objectk eys

Everywhere else we use objects ("scripts", generally) we do sepcify the
optional colon. Be consistent and do the same for directories.

PR: 249273
Submitted by: Martin <martin.jakob gmx com>
MFC after: 1 week

3 years agoRemove unnecessary include "../Makefile.inc"
Alex Richardson [Fri, 18 Sep 2020 14:05:31 +0000 (14:05 +0000)]
Remove unnecessary include "../Makefile.inc"

This is already pulled in by bsd.init.mk.

Reported By: kevans

3 years agoInitialize some local variables earlier
Mitchell Horne [Fri, 18 Sep 2020 14:01:10 +0000 (14:01 +0000)]
Initialize some local variables earlier

Move the initialization of these variables to the beginning of their
respective functions.

On our end this creates a small amount of unneeded churn, as these
variables are properly initialized before their first use in all cases.
However, changing this benefits at least one downstream consumer
(NetApp) by allowing local and future modifications to these functions
to be made without worrying about where the initialization occurs.

Reviewed by: melifaro, rscheff
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26454

3 years agoAdd pargs, penv, pwdx commands and aliases to procstat(1).
Konstantin Belousov [Fri, 18 Sep 2020 12:59:27 +0000 (12:59 +0000)]
Add pargs, penv, pwdx commands and aliases to procstat(1).

Intent is to mimic Solaris commands with the same names.

Submitted by: Juraj Lutter <juraj@lutter.sk>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26310

3 years agoAssert we are not traversing through superpages in the arm64 pmap.
Mark Johnston [Fri, 18 Sep 2020 12:37:41 +0000 (12:37 +0000)]
Assert we are not traversing through superpages in the arm64 pmap.

Reviewed by: alc, andrew
MFC after: 1 week
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26465

3 years agoEnsure that a protection key is selected in pmap_enter_largepage().
Mark Johnston [Fri, 18 Sep 2020 12:30:39 +0000 (12:30 +0000)]
Ensure that a protection key is selected in pmap_enter_largepage().

Reviewed by: alc, kib
Reported by: Coverity
MFC with: r365518
Differential Revision: https://reviews.freebsd.org/D26464

3 years agoFix error checking in shm_create_largepage().
Mark Johnston [Fri, 18 Sep 2020 12:30:15 +0000 (12:30 +0000)]
Fix error checking in shm_create_largepage().

Reviewed by: alc, kib
Reported by: Coverity
MFC with: r365524
Differential Revision: https://reviews.freebsd.org/D26464

3 years agolibarchive: fix mismatch between library and test configuration
Alex Richardson [Fri, 18 Sep 2020 11:22:34 +0000 (11:22 +0000)]
libarchive: fix mismatch between library and test configuration

I was investigating libarchive test failures on CheriBSD and it turns out
we get a reproducible SIGBUS for test_archive_m5, etc. Debugging this shows
that libarchive and the tests disagree when it comes to the definition of
archive_md5_ctx: libarchive assumes it's the OpenSSL type whereas the test
use the libmd type. The latter is not necessarily aligned enough to store
a pointer (16 bytes for CHERI RISC-V), so we were crashing when storing
EVP_MD_CTX* to an 8-byte-aligned archive_md5_ctx.

To avoid problems like this in the future, factor out the common compiler
flags into a Makefile.inc and include that from the tests Makefile.

Reviewed By: lwhsu
Differential Revision: https://reviews.freebsd.org/D26469

3 years agocrypto_buffer(9): Bring back the reference for bus_dma(9)
Gordon Bergling [Fri, 18 Sep 2020 11:04:16 +0000 (11:04 +0000)]
crypto_buffer(9): Bring back the reference for bus_dma(9)

The reference was accidentally deleted in r365855.

Reported by: jhb
Pointy hat to: gbe

3 years agoUse atf_fail instead of exit 1 to indicate mpath tests failure.
Alexander V. Chernikov [Fri, 18 Sep 2020 07:27:01 +0000 (07:27 +0000)]
Use atf_fail instead of exit 1 to indicate mpath tests failure.

3 years agoFix byte-reversal of language ID in string descriptor.
Peter Grehan [Fri, 18 Sep 2020 05:54:59 +0000 (05:54 +0000)]
Fix byte-reversal of language ID in string descriptor.

The language id of String Descriptors in usb mouse is
0x0904, while the spec require 0x0409 (English - United States)

Submitted by: Wanpeng Qian
Reviewed by: grehan
Approved by: grehan (#bhyve)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26472

3 years agocxgbe(4): add the firmware binaries instead of the empty files that were added
Navdeep Parhar [Fri, 18 Sep 2020 03:11:47 +0000 (03:11 +0000)]
cxgbe(4): add the firmware binaries instead of the empty files that were added
in r365861.

Obtained from: Chelsio Communications
MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agocxgbe(4): add support for stateless offloads for VXLAN traffic.
Navdeep Parhar [Fri, 18 Sep 2020 03:01:47 +0000 (03:01 +0000)]
cxgbe(4): add support for stateless offloads for VXLAN traffic.

Hardware assistance includes checksumming (tx and rx), TSO, and RSS on
the inner traffic in a VXLAN tunnel.

Relnotes: Yes
Sponsored by: Chelsio Communications

3 years agoif_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS.
Navdeep Parhar [Fri, 18 Sep 2020 02:37:57 +0000 (02:37 +0000)]
if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS.

This lets a VXLAN pseudo-interface take advantage of hardware checksumming (tx
and rx), TSO, and RSS if the NIC is capable of performing these operations on
inner VXLAN traffic.

A VXLAN interface inherits the capabilities of its vxlandev interface if one is
specified or of the interface that hosts the vxlanlocal address. If other
interfaces will carry traffic for that VXLAN then they must have the same
hardware capabilities.

On transmit, if_vxlan verifies that the outbound interface has the required
capabilities and then translates the CSUM_ flags to their inner equivalents.
This tells the hardware ifnet that it needs to operate on the inner frame and
not the outer VXLAN headers.

An event is generated when a VXLAN ifnet starts. This allows hardware drivers to
configure their devices to expect VXLAN traffic on the specified incoming port.

On receive, the hardware does RSS and checksum verification on the inner frame.
if_vxlan now does a direct netisr dispatch to take full advantage of RSS. It is
not very clear why it didn't do this already.

Future work:
Rx: it should be possible to avoid the first trip up the protocol stack to get
the frame to if_vxlan just so it can decapsulate and requeue for a second trip
up the stack. The hardware NIC driver could directly call an if_vxlan receive
routine for VXLAN traffic instead.

Rx: LRO. depends on what happens with the previous item. There will have to to
be a mechanism to indicate that it's time for if_vxlan to flush its LRO state.

Reviewed by: kib@
Relnotes: Yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agoAdd a knob to allow zero UDP checksums for UDP/IPv6 traffic on the given UDP port.
Navdeep Parhar [Fri, 18 Sep 2020 02:21:15 +0000 (02:21 +0000)]
Add a knob to allow zero UDP checksums for UDP/IPv6 traffic on the given UDP port.

This will be used by some upcoming changes to if_vxlan(4).  RFC 7348 (VXLAN)
says that the UDP checksum "SHOULD be transmitted as zero.  When a packet is
received with a UDP checksum of zero, it MUST be accepted for decapsulation."
But the original IPv6 RFCs did not allow zero UDP checksum.  RFC 6935 attempts
to resolve this.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agoAdd two new ifnet capabilities for hw checksumming and TSO for VXLAN traffic.
Navdeep Parhar [Fri, 18 Sep 2020 02:10:28 +0000 (02:10 +0000)]
Add two new ifnet capabilities for hw checksumming and TSO for VXLAN traffic.

These are similar to the existing VLAN capabilities.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agombuf checksum flags and fields to support tunneling protocols.
Navdeep Parhar [Fri, 18 Sep 2020 01:38:47 +0000 (01:38 +0000)]
mbuf checksum flags and fields to support tunneling protocols.

These are being added to support VXLAN but will work for GENEVE as well.
ENCAP_RSVD1 will likely become ENCAP_GENEVE in the future.

The size of struct mbuf does not change and that means this change can be MFC'd.
If size wasn't a constraint a cleaner way may have been to add inner_csum_flags
and inner_csum_data to go with csum_flags and csum_data.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agoState kgssapi dependency on xdr.
Konstantin Belousov [Thu, 17 Sep 2020 22:29:38 +0000 (22:29 +0000)]
State kgssapi dependency on xdr.

Submitted by: Dmitry Afanasiev
PR: 249378
MFC after: 3 days

3 years agocxgbe(4): Update T4/5/6 firmwares to 1.25.0.0.
Navdeep Parhar [Thu, 17 Sep 2020 22:14:11 +0000 (22:14 +0000)]
cxgbe(4): Update T4/5/6 firmwares to 1.25.0.0.

Obtained from: Chelsio Communications
MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoarch(7): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 21:24:11 +0000 (21:24 +0000)]
arch(7): Some markup fixes

- no blank before trailing delimiter

MFC after: 3 days

3 years agoman(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 21:08:11 +0000 (21:08 +0000)]
man(9): Some markup fixes

- whitespace at end of input line
- skipping paragraph macro: Pp after Sh

MFC after: 3 days

3 years agopwmbus(9): some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:55:42 +0000 (20:55 +0000)]
pwmbus(9): some markup fixes

- whitespace at end of input line

MFC after: 3 days

3 years agombuf(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:53:24 +0000 (20:53 +0000)]
mbuf(9): Some markup fixes

- whitespace at end of input line
- no blank before trailing delimiter: Dv MJUM16BYTES

MFC after: 3 days

3 years agocrypto_buffer(9): Sort the SEE ALSO section
Gordon Bergling [Thu, 17 Sep 2020 20:50:02 +0000 (20:50 +0000)]
crypto_buffer(9): Sort the SEE ALSO section

MFC after: 3 days

3 years agoVOP_INACTIVE(9): Remove trailing whitespace
Gordon Bergling [Thu, 17 Sep 2020 20:42:41 +0000 (20:42 +0000)]
VOP_INACTIVE(9): Remove trailing whitespace

MFC after: 3 days

3 years agodomainset(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:37:54 +0000 (20:37 +0000)]
domainset(9): Some markup fixes

- new sentence, new line
- whitespace at end of input line

MFC after: 3 days

3 years agoRevert r361257: bsdinstall: do a `certctl rehash` upon installation [...]
Kyle Evans [Thu, 17 Sep 2020 20:35:45 +0000 (20:35 +0000)]
Revert r361257: bsdinstall: do a `certctl rehash` upon installation [...]

As of r365829, any given base distribution set will now include the /etc/ssl
symlinks that this rehash would've otherwise installed. This extra step is
no longer required.

MFC after: 1 week
X-MFC-With: r365837

3 years agormlock(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:32:10 +0000 (20:32 +0000)]
rmlock(9): Some markup fixes

- new sentence, new line

MFC after: 3 days

3 years agobus_dma(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:25:31 +0000 (20:25 +0000)]
bus_dma(9): Some markup fixes

- new sentence, new line
- no blank before trailing delimiter
- whitespace at end of input line

MFC after: 3 days

3 years agoMerge commit 46673763f from llvm git (by Craig Topper):
Dimitry Andric [Thu, 17 Sep 2020 19:47:41 +0000 (19:47 +0000)]
Merge commit 46673763f from llvm git (by Craig Topper):

  [X86] Place new constant node in topological order in
  X86DAGToDAGISel::matchBitExtract

  Fixes PR47482

This should fix 'Assertion failed: (Op->getNodeId() != -1 && "Node has
already selected predecessor node"), function DoInstructionSelection,
file
/usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp,
line 1149' when compiling part of the project_painter project, while
targeting the bdver2 (or higher) CPU.

Reported by: jkim
MFC after: 6 weeks
X-MFC-With: r364284

3 years agoMerge commit e09107ab8 from llvm git (by Raul Tambre):
Dimitry Andric [Thu, 17 Sep 2020 19:43:25 +0000 (19:43 +0000)]
Merge commit e09107ab8 from llvm git (by Raul Tambre):

  [Sema] Introduce BuiltinAttr, per-declaration builtin-ness

  Instead of relying on whether a certain identifier is a builtin,
  introduce BuiltinAttr to specify a declaration as having builtin
  semantics.

  This fixes incompatible redeclarations of builtins, as reverting the
  identifier as being builtin due to one incompatible redeclaration
  would have broken rest of the builtin calls.
  Mostly-compatible redeclarations of builtins also no longer have
  builtin semantics. They don't call the builtin nor inherit their
  attributes.
  A long-standing FIXME regarding builtins inside a namespace enclosed
  in extern "C" not being recognized is also addressed.

  Due to the more correct handling attributes for builtin functions are
  added in more places, resulting in more useful warnings.
  Tests are updated to reflect that.

  Intrinsics without an inline definition in intrin.h had `inline` and
  `static` removed as they had no effect and caused them to no longer
  be recognized as builtins otherwise.

  A pthread_create() related test is XFAIL-ed, as it relied on it being
  recognized as a builtin based on its name.
  The builtin declaration syntax is too restrictive and doesn't allow
  custom structs, function pointers, etc.
  It seems to be the only case and fixing this would require reworking
  the current builtin syntax, so this seems acceptable.

  Fixes PR45410.

  Reviewed By: rsmith, yutsumi

  Differential Revision: https://reviews.llvm.org/D77491

This should fix 'Assertion failed: (i < getNumParams() && "Illegal
param #"), function getParamDecl, file
/usr/src/contrib/llvm-project/clang/include/clang/AST/Decl.h, line 2430'
when building the graphics/pgplot port.

Note that there may also have been other ports which triggered this
assertion, if they redeclare standard functions with incompatible
arguments.

Reported by: zeising
MFC after: 6 weeks
X-MFC-With: r364284

3 years agomakefs: connect cd9660 El Torito EFI boot image system type
Ed Maste [Thu, 17 Sep 2020 19:41:10 +0000 (19:41 +0000)]
makefs: connect cd9660 El Torito EFI boot image system type

Sponsored by: The FreeBSD Foundation

3 years agoCirrus-CI: build as an unprivileged user
Ed Maste [Thu, 17 Sep 2020 18:47:23 +0000 (18:47 +0000)]
Cirrus-CI: build as an unprivileged user

The Cirrus-CI-provided working tree is owned by root.  Leave that as is
for simplicity but build as an unprivileged user; this tests building
with an unmodifiable source tree as a side effect.

Continue running the smoke test as root for now, as it failed when run
as an unprivileged user - pkg reported "Fail to chmod
/usr/bin/.pkgtemp.lpq.dUHpEqPGJ9pq:Operation not permitted"

Sponsored by: The FreeBSD Foundation

3 years agoFix additional memory leak in process_mapfile
Eric van Gyzen [Thu, 17 Sep 2020 18:24:51 +0000 (18:24 +0000)]
Fix additional memory leak in process_mapfile

Additional Coverity detected memory leak fix.

Submitted by: bret_ketchum@dell.com
Reported by: Coverity
Reviewed by: cem, emaste
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26462

3 years agoRemove no longer used variable.
John Baldwin [Thu, 17 Sep 2020 18:06:57 +0000 (18:06 +0000)]
Remove no longer used variable.

Pointy hat to: jhb
Reported by: kevans
MFC after: 1 week

3 years agoMove to a more robust and conservative alloation scheme for devctl messages
Warner Losh [Thu, 17 Sep 2020 17:29:33 +0000 (17:29 +0000)]
Move to a more robust and conservative alloation scheme for devctl messages

Change the zone setup:
- Allow slabs to be returned to the OS
- Set the number of slots to the max devctl will queue before discarding
- Reserve 2% of the max (capped at 100) for low memory allocations
- Disable per-cpu caching since we don't need it and we avoid some pathologies

Change the alloation strategiy a bit:
- If a normal allocation fails, try to get the reserve
- If a reserve allocation fails, re-use the oldest-queued entry for storage
- If there's a weird race/failure and nothing on the queue to steal, return NULL

This addresses two main issues in the old code:
- If devd had died, and we're generating a lot of messages, we have an
  unbounded leak. This new scheme avoids the issue that lead to this.
- The MPASS that was 'sure' the allocation couldn't have failed turned out
  to be wrong in some rare cases. The new code doesn't make this assumption.

Since we reserve only 2% of the space, we go from about 1MB of
allocation all the time to more like 50kB for the reserve.

Reviewed by: markj@
Differential Revision: https://reviews.freebsd.org/D26448

3 years agoRemove support for setting some obscure fields.
John Baldwin [Thu, 17 Sep 2020 17:07:04 +0000 (17:07 +0000)]
Remove support for setting some obscure fields.

Don't permit setting the exception bitmap or VMCS entry interrupt
information.  These are not generally useful to set.  If it is needed
in the future, dedicated pseudo registers can be added for these that
would be used with vm_set_register().

Discussed with: grehan
MFC after: 1 week

3 years agoIncrease the default vm.max_user_wired value.
Mark Johnston [Thu, 17 Sep 2020 16:49:28 +0000 (16:49 +0000)]
Increase the default vm.max_user_wired value.

Since r347532 (merged to stable/12) we only count user-wired pages
towards the system limit.  However, we now also treat pages wired by
hypervisors (bhyve and virtualbox) as user-wired, so starting VMs with
large amounts of RAM tends to fail due to the low limit.

The purpose of the limit is to provide a seatbelt, not to impose some
policy on the use of wired memory.  Thus, increase the default limit to
allow reasonable VM configurations to work without tuning.

Reviewed by: kib
Discussed with: dougm
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26424

3 years agoAdd some basic regression tests for SHM_LARGEPAGE.
Mark Johnston [Thu, 17 Sep 2020 16:44:12 +0000 (16:44 +0000)]
Add some basic regression tests for SHM_LARGEPAGE.

Discussed with: kib
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D25900

3 years agoPromote the installworld `certctl rehash` to distributeworld
Kyle Evans [Thu, 17 Sep 2020 15:58:42 +0000 (15:58 +0000)]
Promote the installworld `certctl rehash` to distributeworld

Contrary to my belief, installworld is not sufficient for getting certs
installed into VM images. Promote the rehash to both installworld and
distributeworld (notably: not stageworld) and rehash the base distdir so we
end up with /etc/ssl/certs populated in the base dist archive. A future
commit will remove the rehash from bsdinstall, which doesn't really need to
happen if they're installed into base.txz.

While here, fix a minor typo: s/CERTCLTFLAGS/CERTCTLFLAGS/

MFC after: 1 week

3 years agoStop using lorder and ranlib when building libraries
Alex Richardson [Thu, 17 Sep 2020 15:07:25 +0000 (15:07 +0000)]
Stop using lorder and ranlib when building libraries

Use of ranlib or lorder is no longer necessary with current linkers
(probably anything newer than ~1990) and ar's ability to create an object
index and symbol table in the archive.
Currently the build system uses lorder+tsort to sort the .o files in
dependency order so that a single-pass linker can use them. However,
we can use the -s flag to ar to add an index to the .a file which makes
lorder unnecessary.
Running ar -s is equivalent to running ranlib afterwards, so we can also
skip the ranlib invocation.

Similarly, we don't have to pass the .o files for shared libraries in
dependency order since both ld.bfd and ld.lld will correctly resolve
references between the .o files.

This removes many fork()+execve calls for each library so should speed up
builds a bit. Additionally lorder.sh uses a regular expression that is not
supported by the macOS libc or glibc and results in many warnings when
cross-building (see D25989).

There is one functional change: lorder.sh removed duplicated .o files
from the linker command line which now no longer happens. I fixed the duplicates
in the base system in r364649. I also checked the ports tree for uses of
bsd.lib.mk and found one duplicate source file which I fixed in r548168.
Most ports use CMake/autotools rather than bsd.lib.mk but if this breaks any
ports that I missed in my search please let me know.

Avoiding the shell script actually speeds up the linking step noticeably: I
measured how long it takes to rebuild the .a and .so files for lib/libc using a
basic benchmark: `rm $LIBC_OBJDIR/*.so* $LIBC_OBJDIR/*.a* && /usr/bin/time make -DWITHOUT_TESTS -s > /dev/null`
Without this change ~4.5 seconds and afterwards ~3.1 seconds.
Looking at truss -cf output we can see that the number fork() system
calls goes down from 27 to 12 (and the speedup while tracing is more
noticeable: 81 seconds -> 65 seconds).

See also https://www.gnu.org/software/coreutils/manual/html_node/tsort-background.html
for some more background:
This whole procedure has been obsolete since about 1980, because Unix
archives now contain a symbol table (traditionally built by ranlib, now
generally built by ar itself), and the Unix linker uses the symbol table
to effectively make multiple passes over an archive file.

Or alternatively https://www.unix.com/man-page/osf1/1/lorder/:
The lorder command is essentially obsolete.  Use the following command in
its place: % ar -ts file.a

Reviewed By:  emaste, imp, dim
Differential Revision: https://reviews.freebsd.org/D26044

3 years agoAdd dtb/sifive module
Mitchell Horne [Thu, 17 Sep 2020 14:58:30 +0000 (14:58 +0000)]
Add dtb/sifive module

This allows building the HiFive Unleashed device tree blob.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D26459

3 years agoReduce code duplication by introducing linux_copyout_sockaddr()
Edward Tomasz Napierala [Thu, 17 Sep 2020 12:14:24 +0000 (12:14 +0000)]
Reduce code duplication by introducing linux_copyout_sockaddr()
helper function.  No functional changes.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25804

3 years agoAdd support for SOUND_MIXER_WRITE_MONITOR ioctl. Fixes alsamixer(1)
Edward Tomasz Napierala [Thu, 17 Sep 2020 11:44:45 +0000 (11:44 +0000)]
Add support for SOUND_MIXER_WRITE_MONITOR ioctl.  Fixes alsamixer(1)
on my x220.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25806

3 years agoGet rid of sv_errtbl and SV_ABI_ERRNO().
Edward Tomasz Napierala [Thu, 17 Sep 2020 11:39:33 +0000 (11:39 +0000)]
Get rid of sv_errtbl and SV_ABI_ERRNO().

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26388

3 years agoRevert r249362, atime update in tmpfs is fixed in r365810
Li-Wen Hsu [Thu, 17 Sep 2020 07:13:41 +0000 (07:13 +0000)]
Revert r249362, atime update in tmpfs is fixed in r365810

PR: 249362
Sponsored by: The FreeBSD Foundation

3 years agogeom_part: make it possible recovering broken GPT after some LBAs cut off
Eugene Grosbein [Thu, 17 Sep 2020 04:39:39 +0000 (04:39 +0000)]
geom_part: make it possible recovering broken GPT after some LBAs cut off

This is followup to r365477.

If pre-formatted device has GPT and a partition covering
last available LBAs and the device is attached using
a bridge reducing amount of LBAs, then it could be not enough
forcing GEOM to use primary GPT. Also, we should make it possible
to recover GPT and this requires either deleting or resizing the partition.

This change enables "gpart delete" and "gpart resize" commands
on corrupted GPT with following "gpart recover".

It still does not allow modifying corrupted GPT without
preliminary setting sysctl kern.geom.part.check_integrity=0

For example:

# gpart show da0
=>        34  3906963389  da0  GPT  (1.8T) [CORRUPT]
          34      262144    1  ms-reserved  (128M)
      262178        2014       - free -  (1.0M)
      264192  3906764943    2  freebsd-swap  (1.8T)
# gpart resize -i 2 -s 3900000000 da0
# gpart recover da0

Reported by: Alex Korchmar
MFC after: 3 days

3 years agoinstallworld: run `certctl rehash` after installation completes
Kyle Evans [Thu, 17 Sep 2020 02:18:21 +0000 (02:18 +0000)]
installworld: run `certctl rehash` after installation completes

This was originally introduced back in r360833, and subsequently reverted
because it was broken for -DNO_ROOT builds and it may not have been the
correct place for it.

While debatably this may still not be 'the correct place,' it's much cleaner
than scattering rehashes all throughout the tree. brooks has fixed the issue
with -DNO_ROOT by properly writing to the METALOG in r361397.

Do note that this is different than what was originally committed; brooks
had revisions in D24932 that made it actually use the revised unprivileged
mode and write to METALOG, along with being a little more friendly to
foreign crossbuilds and just using the certctl in-tree.

With this change, I believe we should now have a populated /etc/ssl/certs in
the VM images.

MFC after: 1 week

3 years agoPut calls to check_pgrp_jobc() in fixjobc_kill() under INVARIANTS.
Konstantin Belousov [Thu, 17 Sep 2020 00:07:15 +0000 (00:07 +0000)]
Put calls to check_pgrp_jobc() in fixjobc_kill() under INVARIANTS.

Reported by: Michael Butler <imb@protected-networks.net>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoAdd check_pgrp_jobc() calls into process exit path.
Konstantin Belousov [Wed, 16 Sep 2020 21:49:19 +0000 (21:49 +0000)]
Add check_pgrp_jobc() calls into process exit path.

Both before and after job control adjustments.

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

3 years agoFix fixjobc+orhpanage.
Konstantin Belousov [Wed, 16 Sep 2020 21:46:57 +0000 (21:46 +0000)]
Fix fixjobc+orhpanage.

Orphans affect job control state, we must account for them when
changing pg_jobc.

Instead of p_pptr, use proc_realparent() to get parent relevant for
job control.

Use correct calculation of the parent for exiting process.  For jobc
purposes, we must use realparent, but if it is also exiting, we should
fall to reaper, then recursively find non-exiting reaper.

Reported by: trasz
PR: 249257
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26416

3 years agoAssert that P_TREE_GRPEXITED is set only once.
Konstantin Belousov [Wed, 16 Sep 2020 21:40:32 +0000 (21:40 +0000)]
Assert that P_TREE_GRPEXITED is set only once.

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

3 years agoproc_realparent: if p_oppid does not match pid of the current parent
Konstantin Belousov [Wed, 16 Sep 2020 21:38:24 +0000 (21:38 +0000)]
proc_realparent: if p_oppid does not match pid of the current parent
for non-orphaned process, return reaper instead of init.

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

3 years agoImprove ddb 'show pgrpdump' command.
Konstantin Belousov [Wed, 16 Sep 2020 21:34:18 +0000 (21:34 +0000)]
Improve ddb 'show pgrpdump' command.

Use ddb pager.
Make lines more compact.
Eliminate unneeded casts.
Print more job-control related info when reporting process group.

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

3 years agotmpfs: restore atime updates for reads from page cache.
Konstantin Belousov [Wed, 16 Sep 2020 21:28:18 +0000 (21:28 +0000)]
tmpfs: restore atime updates for reads from page cache.

Split TMPFS_NODE_ACCCESSED bit into dedicated byte that can be updated
atomically without locks or (locked) atomics.

tn_update_getattr() change also contains unrelated bug fix.

Reported by: lwhsu
PR: 249362
Reviewed by: markj (previous version)
Discussed with: mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26451

3 years agoStyle.
Konstantin Belousov [Wed, 16 Sep 2020 21:24:34 +0000 (21:24 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Wed, 16 Sep 2020 16:58:29 +0000 (16:58 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc2-91-g6e042866c30.

MFC after: 6 weeks
X-MFC-With: r364284

3 years agoif_media: definitions for 40GE LM4 ethernet media type
Mitchell Horne [Wed, 16 Sep 2020 14:45:16 +0000 (14:45 +0000)]
if_media: definitions for 40GE LM4 ethernet media type

Reviewed by: erj
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26276

3 years agoMove PLTs to the beginning of amd64 kernel modules.
Mark Johnston [Wed, 16 Sep 2020 13:51:47 +0000 (13:51 +0000)]
Move PLTs to the beginning of amd64 kernel modules.

As with .text, the aim is to ensure that executable sections are
segregated from the rest, to avoid creation of writeable and executable
mappings.  Recent versions of LLVM emit a PLT in firmware modules.

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

3 years agoTemporarily skip sys.fs.tmpfs.times_test.{empty,non_empty} in CI
Li-Wen Hsu [Wed, 16 Sep 2020 09:58:15 +0000 (09:58 +0000)]
Temporarily skip sys.fs.tmpfs.times_test.{empty,non_empty} in CI

PR: 249362
Sponsored by: The FreeBSD Foundation

3 years agoUpdate to 2020.08.19
Baptiste Daroussin [Wed, 16 Sep 2020 07:30:18 +0000 (07:30 +0000)]
Update to 2020.08.19

MFC after: 3 days

3 years agoUse standard bool type, instead of non-standard boolean_t
Warner Losh [Wed, 16 Sep 2020 06:02:30 +0000 (06:02 +0000)]
Use standard bool type, instead of non-standard boolean_t

3 years agoFix a LOR between the NFS server and server side krpc.
Rick Macklem [Wed, 16 Sep 2020 02:25:18 +0000 (02:25 +0000)]
Fix a LOR between the NFS server and server side krpc.

Recent testing of the NFS-over-TLS code found a LOR between the mutex lock
used for sessions and the sleep lock used for server side krpc socket
structures.
The code in nfsrv_checksequence() would call SVC_RELEASE() with the mutex
held.  Normally this is ok, since all that happens is SVC_RELEASE()
decrements a reference count.  However, if the socket has just been shut
down, SVC_RELEASE() drops the reference count to 0 and acquires a sleep
lock during destruction of the server side krpc structure.

This patch fixes the problem by moving the SVC_RELEASE() call in
nfsrv_checksequence() down a few lines to below where the mutex is released.

MFC after: 1 week

3 years agoFix locking in uipc_accept().
Mark Johnston [Tue, 15 Sep 2020 23:03:56 +0000 (23:03 +0000)]
Fix locking in uipc_accept().

Reported by: cy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoAdd tmpfs page cache read support.
Konstantin Belousov [Tue, 15 Sep 2020 22:19:16 +0000 (22:19 +0000)]
Add tmpfs page cache read support.

Or it could be explained as lockless (for vnode lock) reads.  Reads
are performed from the node tn_obj object.  Tmpfs regular vnode object
lifecycle is significantly different from the normal OBJT_VNODE: it is
alive as far as ref_count > 0.

Ensure liveness of the tmpfs VREG node and consequently v_object
inside VOP_READ_PGCACHE by referencing tmpfs node in tmpfs_open().
Provide custom tmpfs fo_close() method on file, to ensure that close
is paired with open.

Add tmpfs VOP_READ_PGCACHE that takes advantage of all tmpfs quirks.
It is quite cheap in code size sense to support page-ins for read for
tmpfs even if we do not own tmpfs vnode lock.  Also, we can handle
holes in tmpfs node without additional efforts, and do not have
limitation of the transfer size.

Reviewed by: markj
Discussed with and benchmarked by: mjg (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26346

3 years agoMicrooptimize tmpfs node ref/unref by using atomics.
Konstantin Belousov [Tue, 15 Sep 2020 22:13:21 +0000 (22:13 +0000)]
Microoptimize tmpfs node ref/unref by using atomics.

Avoid tmpfs mount and node locks when ref count is greater than zero,
which is the case until node is being destroyed by unlink or unmount.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26346