]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoDeclare time()
Warner Losh [Fri, 28 Aug 2020 05:40:02 +0000 (05:40 +0000)]
Declare time()

Time is used and was accidentally brought in through header
pollution. Declare it in stand.h directly instead.

3 years agoAdd a new line to force a commit to verify if lwhsu did indeed
Glen Barber [Fri, 28 Aug 2020 02:09:10 +0000 (02:09 +0000)]
Add a new line to force a commit to verify if lwhsu did indeed
fix the jenkins build by adding git to the dependency list.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoAdd flags to enable NFS over TLS to the NFS client and server.
Rick Macklem [Thu, 27 Aug 2020 23:57:30 +0000 (23:57 +0000)]
Add flags to enable NFS over TLS to the NFS client and server.

An Internet Draft titled "Towards Remote Procedure Call Encryption By Default"
(soon to be an RFC I think) describes how Sun RPC is to use TLS with NFS
as a specific application case.
Various commits prepared the NFS code to use KERN_TLS, mainly enabling use
of ext_pgs mbufs for large RPC messages.
r364475 added TLS support to the kernel RPC.

This commit (which is the final one for kernel changes required to do
NFS over TLS) adds support for three export flags:
MNT_EXTLS - Requires a TLS connection.
MNT_EXTLSCERT - Requires a TLS connection where the client presents a valid
            X.509 certificate during TLS handshake.
MNT_EXTLSCERTUSER - Requires a TLS connection where the client presents a
            valid X.509 certificate with "user@domain" in the otherName
            field of the SubjectAltName during TLS handshake.
Without these export options, clients are permitted, but not required, to
use TLS.

For the client, a new nmount(2) option called "tls" makes the client do
a STARTTLS Null RPC and TLS handshake for all TCP connections used for the
mount. The CLSET_TLS client control option is used to indicate to the kernel RPC
that this should be done.

Unless the above export flags or "tls" option is used, semantics should
not change for the NFS client nor server.

For NFS over TLS to work, the userspace daemons rpctlscd(8) { for client }
or rpctlssd(8) daemon { for server } must be running.

3 years agoAdd a comment to clarify when and why cached names are deleted
Kirk McKusick [Thu, 27 Aug 2020 22:14:58 +0000 (22:14 +0000)]
Add a comment to clarify when and why cached names are deleted
during pathname lookup.

Reviewed by:  kib
MFC after:    3 days
Sponsored by: Netflix

3 years agoZFS: remove duplicate "com.datto:encryption" from loader
Matt Macy [Thu, 27 Aug 2020 21:37:35 +0000 (21:37 +0000)]
ZFS: remove duplicate "com.datto:encryption" from loader

3 years agoMerge the projects/release-git branch to head.
Glen Barber [Thu, 27 Aug 2020 21:19:16 +0000 (21:19 +0000)]
Merge the projects/release-git branch to head.
This allows building 13.x from Git instead of Subversion.

No MFC to stable branches is planned at this time. [1]

Discussed with: git working group [1]
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFH
Glen Barber [Thu, 27 Aug 2020 20:25:33 +0000 (20:25 +0000)]
MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoFix tiny style nit.
Warner Losh [Thu, 27 Aug 2020 17:46:13 +0000 (17:46 +0000)]
Fix tiny style nit.

3 years agoFix writing of the final block of encrypted, compressed kernel dumps.
Mark Johnston [Thu, 27 Aug 2020 17:36:06 +0000 (17:36 +0000)]
Fix writing of the final block of encrypted, compressed kernel dumps.

Previously any residual data in the final block of a compressed kernel
dump would be written unencrypted.  Note, such a configuration already
does not work properly when using AES-CBC since the compressed data is
typically not a multiple of the AES block length in size and EKCD does
not implement any padding scheme.  However, EKCD more recently gained
support for using the ChaCha20 cipher, which being a stream cipher does
not have this problem.

Submitted by: sigsys@gmail.com
Reviewed by: cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26188

3 years agoAdd note about NO_CLEAN build.
Warner Losh [Thu, 27 Aug 2020 17:30:57 +0000 (17:30 +0000)]
Add note about NO_CLEAN build.

NO_CLEAN doesn't quite work for some scenarios when rebuilding older
kernels, but the kernels build w/o NO_CLEAN.

3 years agoDisregard jails in jail.conf that have bad parameters (parameter/variable
Jamie Gritton [Thu, 27 Aug 2020 17:04:55 +0000 (17:04 +0000)]
Disregard jails in jail.conf that have bad parameters (parameter/variable
clash, or redefining name/jid).  The current behvaior, of merely warning
and moving on, can lead to unexpected behavior when a jail is created
without the offending parameter defined at all.

3 years agosnd_ich(4): Handle errors from ich_init() properly during resume.
Mark Johnston [Thu, 27 Aug 2020 16:36:07 +0000 (16:36 +0000)]
snd_ich(4): Handle errors from ich_init() properly during resume.

ich_init() returns an errno value or 0, but ich_pci_resume() was
comparing the return value with -1 to determine whether an error had
occurred.

PR: 248941
Submitted by: Tong Zhang <ztong0001@gmail.com>
MFC after: 1 week

3 years agofdc(4): Handle errors from fdc_in() properly.
Mark Johnston [Thu, 27 Aug 2020 16:34:33 +0000 (16:34 +0000)]
fdc(4): Handle errors from fdc_in() properly.

fdc_in() returns only 0 and 1, some callers were checking incorrectly
for failure.

PR: 248940
Submitted by: Tong Zhang <ztong0001@gmail.com>
MFC after: 1 week

3 years agoasmc(4): Handle errors from asmc_key_read() properly.
Mark Johnston [Thu, 27 Aug 2020 16:34:20 +0000 (16:34 +0000)]
asmc(4): Handle errors from asmc_key_read() properly.

asmc_key_read() returns only 0 and 1, some callers were checking
incorrectly for failure.

PR: 248939
Submitted by: Tong Zhang <ztong0001@gmail.com>
MFC after: 1 week

3 years agoCorrect the conditional evaluating if git exists.
Glen Barber [Thu, 27 Aug 2020 14:36:00 +0000 (14:36 +0000)]
Correct the conditional evaluating if git exists.

Pointyhat to: gjb (myself)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years ago/etc/zfs/zpool.cache is the preferred (and new) location of zpool.cache.
Cy Schubert [Thu, 27 Aug 2020 14:33:46 +0000 (14:33 +0000)]
/etc/zfs/zpool.cache is the preferred (and new) location of zpool.cache.
Check for it first. Only use /boot/zfs/zpool.cache if the /etc/zfs
version is not found and good.

Reported by: avg
Suggested by: avg, kevans

3 years agoDo not unconditionally build git from ports if it already exists.
Glen Barber [Thu, 27 Aug 2020 14:29:06 +0000 (14:29 +0000)]
Do not unconditionally build git from ports if it already exists.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoAdjust the logic to locating GIT_CMD.
Glen Barber [Thu, 27 Aug 2020 13:33:21 +0000 (13:33 +0000)]
Adjust the logic to locating GIT_CMD.
Use 'git -C' instead of cd(1). [1]

Suggested by: garga [1]
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agolibzfs: Also add the crypto dependency to Makefile.inc1
Ryan Moeller [Thu, 27 Aug 2020 13:26:36 +0000 (13:26 +0000)]
libzfs: Also add the crypto dependency to Makefile.inc1

Reported by: kevans
Discussed with: kevans
Sponsored by: iXsystems, Inc.

3 years agoFix passing OPTIONS_UNSET with multiple options to make(1).
Glen Barber [Thu, 27 Aug 2020 13:25:24 +0000 (13:25 +0000)]
Fix passing OPTIONS_UNSET with multiple options to make(1).
While here, adjust the copyright.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agolibzfs: Add missing crypto dependency
Ryan Moeller [Thu, 27 Aug 2020 13:05:41 +0000 (13:05 +0000)]
libzfs: Add missing crypto dependency

libzfs_crypto.c uses PKCS5_PBKDF2_HMAC_SHA1 from libcrypto.

Reported by: John Kennedy
Sponsored by: iXsystems, Inc.

3 years agoImplement extensible arrays API using the existing radix tree implementation
Hans Petter Selasky [Thu, 27 Aug 2020 10:28:12 +0000 (10:28 +0000)]
Implement extensible arrays API using the existing radix tree implementation
in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D25101
Reviewed by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoarm: ti: Fix Beaglebone black MMC after DTS update
Emmanuel Vadot [Thu, 27 Aug 2020 08:08:49 +0000 (08:08 +0000)]
arm: ti: Fix Beaglebone black MMC after DTS update

After DTS sync with Linux kernel 5.8 this patch was included:
"ARM: dts: Move am33xx and am43xx mmc nodes to sdhci-omap driver"
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/am33xx-l4.dtsi?h=v5.9-rc2&id=0b4edf111870b83ea77b1d7e16b8ceac29f9f388

Current will not load any driver for MMC and not mount the rootfs.
Simple patch add "ti,am335-sdhci" to compability strings in ti_sdhci.c

Submitted by: oskar.holmlund@ohdata.se
Reported by: phk
X-MFC-With: 363853

3 years agocache: don't update timestmaps on found entry
Mateusz Guzik [Thu, 27 Aug 2020 06:31:55 +0000 (06:31 +0000)]
cache: don't update timestmaps on found entry

3 years agocache: assorted clean ups
Mateusz Guzik [Thu, 27 Aug 2020 06:31:27 +0000 (06:31 +0000)]
cache: assorted clean ups

In particular remove spurious comments, duplicate assertions and the
inconsistently done KTR support.

3 years agocache: ncp = NULL early to account for sdt probes in ailure path
Mateusz Guzik [Thu, 27 Aug 2020 06:30:40 +0000 (06:30 +0000)]
cache: ncp = NULL early to account for sdt probes in ailure path

CID: 1432106

3 years agoImplement FLUSHO
Warner Losh [Thu, 27 Aug 2020 05:11:15 +0000 (05:11 +0000)]
Implement FLUSHO

Turn FLUSHO on/off with ^O (or whatever VDISCARD is). Honor that to
throw away output quickly. This tries to remain true to 4.4BSD
behavior (since that was the origin of this feature), with any
corrections NetBSD has done. Since the implemenations are a little
different, though, some edge conditions may be handled differently.

Reviewed by: kib, kevans
Differential Review: https://reviews.freebsd.org/D26148

3 years agoUpdate Hong Kong Liberation Day (hah!)
Greg Lehey [Thu, 27 Aug 2020 03:50:34 +0000 (03:50 +0000)]
Update Hong Kong Liberation Day (hah!)

3 years agoDon't allow jail.conf variables to have the same names as jail parameters.
Jamie Gritton [Thu, 27 Aug 2020 00:17:17 +0000 (00:17 +0000)]
Don't allow jail.conf variables to have the same names as jail parameters.
It was already not allowed in many cases, but crashed instead of giving an
error.

PR: 248444

3 years agoName the on-stack union of compat thunks.
John Baldwin [Wed, 26 Aug 2020 22:36:08 +0000 (22:36 +0000)]
Name the on-stack union of compat thunks.

C does not permit an anonymous union at a top-level scope.

Pointy hat to: jhb

3 years agoFix a "v_seqc_users == 0 not met" panic when VFS_STATFS() fails during mount.
Rick Macklem [Wed, 26 Aug 2020 21:49:43 +0000 (21:49 +0000)]
Fix a "v_seqc_users == 0 not met" panic when VFS_STATFS() fails during mount.

r363210 introduced v_seqc_users to the vnodes.  This change requires
a vn_seqc_write_end() to match the vn_seqc_write_begin() in
vfs_cache_root_clear().
mjg@ provided this patch which seems to fix the panic.

Tested for an NFS mount where the VFS_STATFS() call will fail.

Submitted by: mjg
Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D26160

3 years agoAdd freebsd32 compat support for CIOCCRYPTAEAD.
John Baldwin [Wed, 26 Aug 2020 21:28:47 +0000 (21:28 +0000)]
Add freebsd32 compat support for CIOCCRYPTAEAD.

Reviewed by: markj (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26179

3 years agoSimplify compat shims for /dev/crypto.
John Baldwin [Wed, 26 Aug 2020 21:17:18 +0000 (21:17 +0000)]
Simplify compat shims for /dev/crypto.

- Make session handling always use the CIOGSESSION2 structure.
  CIOGSESSION requests use a thunk similar to COMPAT_FREEBSD32 session
  requests.  This permits the ioctl handler to use the 'crid' field
  unconditionally.

- Move COMPAT_FREEBSD32 handling out of the main ioctl handler body
  and instead do conversions in/out of thunk structures in dedicated
  blocks at the start and end of the ioctl function.

Reviewed by: markj (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26178

3 years agofuse: unbreak after r364814
Mateusz Guzik [Wed, 26 Aug 2020 21:13:36 +0000 (21:13 +0000)]
fuse: unbreak after r364814

Reported by: kevans

3 years agoAdd MNT_EXTLSxxx flags that will be used for NFS over TLS exports.
Rick Macklem [Wed, 26 Aug 2020 20:56:05 +0000 (20:56 +0000)]
Add MNT_EXTLSxxx flags that will be used for NFS over TLS exports.

These flags are not currently used, but will be used by future commits to
implement export(5) requirements for the use of NFS over TLS by clients.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D26180

3 years agoTo avoid breakage for those who build/install without ZFS only
Cy Schubert [Wed, 26 Aug 2020 20:30:00 +0000 (20:30 +0000)]
To avoid breakage for those who build/install without ZFS only
rely on rc.d/zpool's BEFORE specification.

Reported by: rpokala

3 years agoEach entry in UPDATING needs a date
Warner Losh [Wed, 26 Aug 2020 19:32:28 +0000 (19:32 +0000)]
Each entry in UPDATING needs a date

It's rare for there to be two updating entries on the same day (once a
decade or so), but we have that here. Add the date to the second one
since devd and zfs are unrelated.

3 years ago[PowerPC] Fix build failure in sec.c
Brandon Bergren [Wed, 26 Aug 2020 19:30:42 +0000 (19:30 +0000)]
[PowerPC] Fix build failure in sec.c

Fix a typo in r364799 that was breaking powerpc and powerpcspe build.

MFC with: 364799

3 years agoRemove whitespace which accidentaly snuck into r364831.
Colin Percival [Wed, 26 Aug 2020 19:28:30 +0000 (19:28 +0000)]
Remove whitespace which accidentaly snuck into r364831.

3 years agoAdd -w option to lockf(1).
Colin Percival [Wed, 26 Aug 2020 19:26:48 +0000 (19:26 +0000)]
Add -w option to lockf(1).

By default, lockf(1) opens its lock file O_RDONLY|O_EXLOCK.  On NFS, if the
file already exists, this is split into opening the file read-only and then
requesting an exclusive lock -- and the second step fails because NFS does
not permit exclusive locking on files which are opened read-only.

The new -w option changes the open flags to O_WRONLY|O_EXLOCK, allowing it
to work on NFS -- at the cost of not working if the file cannot be opened
for writing.

(Whether the traditional BSD behaviour of allowing exclusive locks to be
obtained on a file which cannot be opened for writing is a good idea is
perhaps questionable since it may allow less-privileged users to perform
a local denial of service; however this behaviour has been present for a
long time and changing it now seems like it would cause problems.)

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D26005

3 years agoMove zstd sources from libzfs to libzpool
Ryan Moeller [Wed, 26 Aug 2020 19:03:15 +0000 (19:03 +0000)]
Move zstd sources from libzfs to libzpool

zstd is kernel code that was not supposed to be in libzfs.

libzpool provides userland shims for kernel code and is where the
zstd code needs to be included.

Reported by: John Kennedy
Discussed with: mmacy
Sponsored by: iXsystems, Inc.

3 years agoTidy up libzpool Makefile
Ryan Moeller [Wed, 26 Aug 2020 19:00:17 +0000 (19:00 +0000)]
Tidy up libzpool Makefile

Sponsored by: iXsystems, Inc.

3 years agoBack out r364791 to unbreak jails. Lesson learned: "compile and test" means
Jamie Gritton [Wed, 26 Aug 2020 18:35:32 +0000 (18:35 +0000)]
Back out r364791 to unbreak jails.  Lesson learned: "compile and test" means
running the test on the same executable that you just compiled.

PR: 248444
Pointy hat to: jamie

3 years agolibsa: only skein_block.c is using SKEIN_LOOP
Toomas Soome [Wed, 26 Aug 2020 17:52:32 +0000 (17:52 +0000)]
libsa: only skein_block.c is using SKEIN_LOOP

Only use SKEIN_LOOP while compiling skein_block.c

3 years agoMake sbuf_setpos match the implementation.
Warner Losh [Wed, 26 Aug 2020 17:06:16 +0000 (17:06 +0000)]
Make sbuf_setpos match the implementation.

sbuf_setpos can only be used to truncate the buffer, never to make it
longer. Update the documentation to reflect this.

Reviewed By: allanjude, phk
Differential Revision: https://reviews.freebsd.org/D26198

3 years agoRegen X86 assembly files after r364822.
Jung-uk Kim [Wed, 26 Aug 2020 16:56:44 +0000 (16:56 +0000)]
Regen X86 assembly files after r364822.

3 years agoFix Clang version detection.
Jung-uk Kim [Wed, 26 Aug 2020 16:55:28 +0000 (16:55 +0000)]
Fix Clang version detection.

We prepend "FreeBSD" to Clang version string.  This broke compiler test for
AVX instruction support.

Reported by: jhb

3 years agoInstall zfs-events.5
Ryan Moeller [Wed, 26 Aug 2020 15:43:44 +0000 (15:43 +0000)]
Install zfs-events.5

Sponsored by: iXsystems, Inc.

3 years agoUse a large kmem arena import size on NUMA systems.
Mark Johnston [Wed, 26 Aug 2020 14:31:48 +0000 (14:31 +0000)]
Use a large kmem arena import size on NUMA systems.

This helps minimize internal fragmentation that occurs when 2MB imports
are interleaved across NUMA domains.  Virtually all KVA allocations on
direct map platforms consume more than one page, so the fragmentation
manifests as runs of 511 4KB page mappings in the kernel.

Reviewed by: alc, kib
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26050

3 years agovmem: Avoid allocating span tags when segments are never released.
Mark Johnston [Wed, 26 Aug 2020 14:31:35 +0000 (14:31 +0000)]
vmem: Avoid allocating span tags when segments are never released.

vmem uses span tags to delimit imported segments, so that they can be
released if the segment becomes free in the future.  However, the
per-domain kernel KVA arenas never release resources, so the span tags
between imported ranges are unused when the ranges are contiguous.
Furthermore, such span tags prevent coalescing of free segments across
KVA_QUANTUM boundaries, resulting in internal fragmentation which
inhibits superpage promotion in the kernel map.

Stop allocating span tags in arenas that never release resources.  This
saves a small amount of memory and allows free segements to coalesce
across import boundaries.  This manifests as improved kernel superpage
usage during poudriere runs, which also helps to reduce physical memory
fragmentation by reducing the number of broken partially populated
reservations.

Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24548

3 years agoefibootmgr: wrong check for opts.order
Toomas Soome [Wed, 26 Aug 2020 14:02:38 +0000 (14:02 +0000)]
efibootmgr: wrong check for opts.order

opts.order && !(opts.order) does not really make sense.

Reported by: swildner

3 years agoAs of r364746 (OpenZFS import) existing ZPOOLs are not imported
Cy Schubert [Wed, 26 Aug 2020 13:13:57 +0000 (13:13 +0000)]
As of r364746 (OpenZFS import) existing ZPOOLs are not imported
prior to zvol and mountcritlocal resulting in ZVOLs (swap and
virtual machine UFS filesystems) being unavailable, leading to
boot failures.

We move the zpool import from zfs to a new zpool script, with the
-N option to avoid mounting datasets while making the ZPOOL's
datasets available for "legacy" mount (mountpoint=legacy) and ZVOLs
available for subsequent use for swap (in the zvol rc sript) or
for UFS or other filesystems in fstab(5), mounted by mountcritlocal.

Reviewed by: freqlabs (previous version)
Differential Revision: https://reviews.freebsd.org/D26185

3 years agocache: relock on failure in cache_zap_locked_vnode
Mateusz Guzik [Wed, 26 Aug 2020 12:54:18 +0000 (12:54 +0000)]
cache: relock on failure in cache_zap_locked_vnode

This gets rid of bogus scheme of yielding in hopes the blocking thread will
make progress.

3 years agocache: stop null checking in cache_free
Mateusz Guzik [Wed, 26 Aug 2020 12:53:16 +0000 (12:53 +0000)]
cache: stop null checking in cache_free

3 years agocache: make it mandatory to request both timestamps or neither
Mateusz Guzik [Wed, 26 Aug 2020 12:52:54 +0000 (12:52 +0000)]
cache: make it mandatory to request both timestamps or neither

3 years agocache: convert bucketlocks to a mutex
Mateusz Guzik [Wed, 26 Aug 2020 12:52:17 +0000 (12:52 +0000)]
cache: convert bucketlocks to a mutex

By now bucket locks are almost never taken for anything but writing and
converting to mutex simplifies the code.

3 years agocache: only evict negative entries on CREATE when ISLASTCN is set
Mateusz Guzik [Wed, 26 Aug 2020 12:50:57 +0000 (12:50 +0000)]
cache: only evict negative entries on CREATE when ISLASTCN is set

3 years agocache: decouple smr and locked lookup in the slowpath
Mateusz Guzik [Wed, 26 Aug 2020 12:50:10 +0000 (12:50 +0000)]
cache: decouple smr and locked lookup in the slowpath

Tested by: pho

3 years agocache: factor dotdot lookup out of cache_lookup
Mateusz Guzik [Wed, 26 Aug 2020 12:49:39 +0000 (12:49 +0000)]
cache: factor dotdot lookup out of cache_lookup

Tested by: pho

3 years agoAvoid recomputing COMPILER_/LINKER_ variables when set explicitly
Alex Richardson [Wed, 26 Aug 2020 10:21:38 +0000 (10:21 +0000)]
Avoid recomputing COMPILER_/LINKER_ variables when set explicitly

I noticed that when we build libraries for a different ABI (in CheriBSD) we
were calling ${XCC}/${LD} --version for every directory. It turns out that
this was caused by bsd.compat.mk explicitly setting (X_)COMPILER variables
for that build stage and this stops the _can_export logic from working.
To fix this, we change the check to only set _can_export=no if the variable
is set and it is set to a different value than the cached value.
This noticeably speeds up the tree walk while building compat libraries.
During an upstream amd64 buildworld this also removes 8 --version calls.

Obtained from: CheriBSD
Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D25986

3 years agoMove libsqlite3 to the top of the SUBDIR list
Alex Richardson [Wed, 26 Aug 2020 09:19:49 +0000 (09:19 +0000)]
Move libsqlite3 to the top of the SUBDIR list

In parallel builds, this should allow sqlite to start building earlier and
increase parallelism when building lib/. Looking at htop output during
buildworld/tinderbox, there are long phases where only one CPU is active
optimizing the massive sqlite3.c file since the build of libsqlite3 is
started quite late.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D26169

3 years agoFix builds that set LD=ld.lld after r364761
Alex Richardson [Wed, 26 Aug 2020 09:19:44 +0000 (09:19 +0000)]
Fix builds that set LD=ld.lld after r364761

When using relative paths for the linker we have to transform the name
since clang does not like -fuse-ld=ld.lld and instead requires -fuse-ld=lld
(the same also applies for ld.bfd).

3 years agoremove pragma ident lines
Toomas Soome [Wed, 26 Aug 2020 07:29:17 +0000 (07:29 +0000)]
remove pragma ident lines

The #pragma ident is historical relict and not needed any more, this
pragma is actually unknown for common compilers and is only causing
trouble.

3 years agoremove left over empty directory
Toomas Soome [Wed, 26 Aug 2020 07:00:07 +0000 (07:00 +0000)]
remove left over empty directory

364746 did leave empty directory around.

3 years agoApply a big hammer for stale pre-OpenZFS files
Ed Maste [Wed, 26 Aug 2020 04:01:06 +0000 (04:01 +0000)]
Apply a big hammer for stale pre-OpenZFS files

-DNO_CLEAN builds have had trouble across the OpenZFS import.  It's not
worth the effort to try to address this with any granularity; instead,
just trigger on a .depend file indicating a tree from before the import,
and remove the whole cddl object tree.

Reviewed by: mmacy, kevans
Differential Revision: https://reviews.freebsd.org/D26189

3 years agodepend-cleanup.sh: add a note about removing old entries
Ed Maste [Wed, 26 Aug 2020 03:41:29 +0000 (03:41 +0000)]
depend-cleanup.sh: add a note about removing old entries

3 years agogeli: use unmapped I/O
Alan Somers [Wed, 26 Aug 2020 02:44:35 +0000 (02:44 +0000)]
geli: use unmapped I/O

Use unmapped I/O for geli. Unlike most geom providers, geli needs to
manipulate data on every read or write. Previously it would always map bios.

On my 16-core, dual socket server using geli atop md(4) devices, with 512B
sectors, this change increases geli IOPs by about 3x.

Note that geli still can't use unmapped I/O when data integrity verification
is enabled (but it could, with a little more work).  And it can't use
unmapped I/O in combination with ZFS, because ZFS uses mapped bios.

Reviewed by: markj, kib, jhb, mjg, mat, bcr (manpages)
MFC after: 1 week
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25671

3 years agocrypto(9): add CRYPTO_BUF_VMPAGE
Alan Somers [Wed, 26 Aug 2020 02:37:42 +0000 (02:37 +0000)]
crypto(9): add CRYPTO_BUF_VMPAGE

crypto(9) functions can now be used on buffers composed of an array of
vm_page_t structures, such as those stored in an unmapped struct bio.  It
requires the running to kernel to support the direct memory map, so not all
architectures can use it.

Reviewed by: markj, kib, jhb, mjg, mat, bcr (manpages)
MFC after: 1 week
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25671

3 years agoarm64: Increase dmap size to 95 TiB
D Scott Phillips [Wed, 26 Aug 2020 02:13:27 +0000 (02:13 +0000)]
arm64: Increase dmap size to 95 TiB

The Ampere Altra has physical memory populated sparsely within the
physical address space. Increase the size of the dmap to cover all
physical memory.

Reviewed by: andrew
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing, Inc.
Differential Revision: https://reviews.freebsd.org/D26134

3 years agoarm64/acpi: Give the real PA limit to ACPI
D Scott Phillips [Wed, 26 Aug 2020 02:12:15 +0000 (02:12 +0000)]
arm64/acpi: Give the real PA limit to ACPI

Read PA bits from ID_AA64MMFR0_EL1.PARange.

Reviewed by: andrew, markj
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing, Inc.
Differential Revision: https://reviews.freebsd.org/D26133

3 years agobitset: add BIT_FFS_AT() for finding the first bit set greater than a start bit
D Scott Phillips [Wed, 26 Aug 2020 02:07:46 +0000 (02:07 +0000)]
bitset: add BIT_FFS_AT() for finding the first bit set greater than a start bit

Reviewed by: kib
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing, Inc.
Differential Revision: https://reviews.freebsd.org/D26128

3 years agoefibootmgr: Add option to request booting to the firmware user interface
D Scott Phillips [Wed, 26 Aug 2020 02:05:58 +0000 (02:05 +0000)]
efibootmgr: Add option to request booting to the firmware user interface

The OsIndications UEFI variable can request the firware to stop at
its UI instead of continuing with boot. Add flags for setting and
clearing this request.

Reviewed by: manu, bcr (manpages)
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing, Inc.
Differential Revision: https://reviews.freebsd.org/D25839

3 years agoarm64: Make local stores observable before sending IPIs
D Scott Phillips [Wed, 26 Aug 2020 02:04:04 +0000 (02:04 +0000)]
arm64: Make local stores observable before sending IPIs

Add a synchronizing instruction to flush and wait until the local
CPU's writes are observable to other CPUs before sending IPIs.

This fixes an issue where recipient CPUs doing a rendezvous could
enter the rendezvous handling code before the initiator's writes
to the smp_rv_* variables were visible. This manifested as a
system hang, where a single CPU's increment of smp_rv_waiters[0]
actually happened "before" the initiator's zeroing of that field,
so all CPUs were stuck with the field appearing to be at
ncpus - 1.

Reviewed by: andrew, markj
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing, Inc.
Differential Revision: https://reviews.freebsd.org/D25798

3 years agoHandle jail.conf variables that have the same names as parameters.
Jamie Gritton [Wed, 26 Aug 2020 00:42:59 +0000 (00:42 +0000)]
Handle jail.conf variables that have the same names as parameters.

PR: 248444
Submitted by: Akos Somfai
Reported by: Markus Stoff

3 years agodate.1: note possibly surprising behaviour of -j -f
Ed Maste [Wed, 26 Aug 2020 00:31:59 +0000 (00:31 +0000)]
date.1: note possibly surprising behaviour of -j -f

PR: 248918
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoZFS: band-aid for -DNO_CLEAN
Matt Macy [Tue, 25 Aug 2020 23:35:55 +0000 (23:35 +0000)]
ZFS:  band-aid for -DNO_CLEAN

Submitted by: Neal Chauhan
Approved by: imp@
Differential Revision: https://reviews.freebsd.org/D26183

3 years agoZFS: whitelist zstd and encryption in the loader
Matt Macy [Tue, 25 Aug 2020 23:26:52 +0000 (23:26 +0000)]
ZFS: whitelist zstd and encryption in the loader

Please note that neither zstd nor encryption is
supported by the loader at this instant. This
change makes it safe to use those features in
one's root pool, but not in one's root dataset.

3 years agovm_pageout: Scale worker threads with CPUs
Conrad Meyer [Tue, 25 Aug 2020 21:36:56 +0000 (21:36 +0000)]
vm_pageout: Scale worker threads with CPUs

Autoscale vm_pageout worker threads from r364129 with CPU count.  The
default is arbitrarily chosen to be 16 CPUs per worker thread, but can
be adjusted with the vm.pageout_cpus_per_thread tunable.

There will never be less than 1 thread per populated NUMA domain, and
the previous arbitrary upper limit (at most ncpus/2 threads per NUMA
domain) is preserved.

Care is taken to gracefully handle asymmetric NUMA nodes, such as empty
node systems (e.g., AMD 2990WX) and systems with nodes of varying size
(e.g., some larger >20 core Intel Haswell/Broadwell Xeon).

Reviewed by: kib, markj
Sponsored by: Isilon
Differential Revision: https://reviews.freebsd.org/D26152

3 years agobsdinstall: Update loader.conf for new OpenZFS deps
Ryan Moeller [Tue, 25 Aug 2020 21:07:27 +0000 (21:07 +0000)]
bsdinstall: Update loader.conf for new OpenZFS deps

zfs.ko now includes the SPL but relies on cryptodev instead.

Reported by: D Scott Phillips
Sponsored by: iXsystems, Inc.

3 years agoAfter r364423, which ensures the callbacks that dl_iterate_phdr(3)
Dimitry Andric [Tue, 25 Aug 2020 20:07:11 +0000 (20:07 +0000)]
After r364423, which ensures the callbacks that dl_iterate_phdr(3)
performs are protected by an exclusive lock, even for statically linked
programs, it is safe to re-enable libunwind's FrameHeaderCache, which I
temporarily disabled in r364263.

Meanwhile upstream has also used the _LIBUNWIND_USE_FRAME_HEADER_CACHE
for this purpose, so the only thing needed is to add this as a
compile-time command line flag.

While here, reformat the CFLAGS lines a little bit.

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

3 years agoSkip zpool_clear_005_pos test until bug fixed
Ryan Moeller [Tue, 25 Aug 2020 20:04:35 +0000 (20:04 +0000)]
Skip zpool_clear_005_pos test until bug fixed

Messing with gnop devices under a zpool fails in this test, causing
the pool to be suspended and eventually the system to deadlock.

Skip the test for now until the issue is resolved.

PR: tests/248910
Discussed with: lwhsu
Sponsored by: iXsystems, Inc.

3 years agoAfter r364753, there should be no need to suppress -Watomic-alignment
Dimitry Andric [Tue, 25 Aug 2020 19:57:11 +0000 (19:57 +0000)]
After r364753, there should be no need to suppress -Watomic-alignment
warnings anymore for compiler-rt's atomic.c. This occurred because the
IS_LOCK_FREE_8 macro was not correctly defined to 0 for mips, and this
caused the compiler to emit a runtime call to __atomic_is_lock_free(),
and that triggers the warning.

MFC after: 2 weeks
X-MFC-With: r364753

3 years ago[PowerPC] More preemptive powerpcspe ZFS build fixes
Brandon Bergren [Tue, 25 Aug 2020 19:04:54 +0000 (19:04 +0000)]
[PowerPC] More preemptive powerpcspe ZFS build fixes

I went through the merge and found the rest of the instances where
${MACHINE_ARCH} == "powerpc" was being used to detect 32-bit and adjusted
the rest of the instances to also check for powerpcspe.

mips32* will probably want to do the same.

Sponsored by: Tag1 Consulting, Inc.

3 years ago[PowerPC] Apply the ppc32 GOT overflow fix to powerpcspe
Brandon Bergren [Tue, 25 Aug 2020 18:54:10 +0000 (18:54 +0000)]
[PowerPC] Apply the ppc32 GOT overflow fix to powerpcspe

powerpcspe is also a 32 bit ppc platform, and also needs to be -fPIC to
avoid overflowing the GOT.

Sponsored by: Tag1 Consulting, Inc.

3 years agosdhci(4): Recognize the Texas Instruments PCIxx12 card reader.
Mark Johnston [Tue, 25 Aug 2020 18:32:43 +0000 (18:32 +0000)]
sdhci(4): Recognize the Texas Instruments PCIxx12 card reader.

PR: 248650
Submitted by: Lars Herschke <lhersch@dssgmbh.de>
MFC after: 1 week

3 years agoFix the current working directory when setting GITREV and
Glen Barber [Tue, 25 Aug 2020 18:30:12 +0000 (18:30 +0000)]
Fix the current working directory when setting GITREV and
GITBRANCH.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoFix zstd in OpenZFS module with CPUTYPE?=<something with BMI>
Ryan Moeller [Tue, 25 Aug 2020 18:22:30 +0000 (18:22 +0000)]
Fix zstd in OpenZFS module with CPUTYPE?=<something with BMI>

The build breaks when something adds -march=<something with BMI> to the
compiler flags, for example CPUTYPE?=native.  When the arch supports BMI,
__BMI__ is defined and zstd.c tries to include immintrin.h, which is not
present when building the kernel.

Disable experimental BMI intrinsics in zstd in the OpenZFS kernel module
by explicitly undefining __BMI__ for zstd.c.

A similar fix was needed for the original zstd import, done in r327738.

Reported by: Jakob Alvermark
Discussed with: mmacy
Sponsored by: iXsystems, Inc.

3 years agolibbe: lift the WARNS post-OpenZFS merge
Kyle Evans [Tue, 25 Aug 2020 18:16:40 +0000 (18:16 +0000)]
libbe: lift the WARNS post-OpenZFS merge

sys/ccompile.h no longer uses #pragma ident, so we no longer need to worry
about unknown pragmas.

I fixed one WARNS issue in r363409 by annotating be_is_auto_snapshot_name's
lbh parameter __unused, then upstreamed the following changes to OpenZFS
that rode in with the merge:
- zfs_path_to_zhandle now takes a const char *path rather than a char *path,
  since it won't be mutating the string it receives and I had no reason to
  believe it will need to in the future. [OpenZFS PR #10605]
- Annotated some unused parameters on definitions inlined into headers as
  such. [OpenZFS PR #10606]

3 years agoFix userboot after r364355
Matt Macy [Tue, 25 Aug 2020 17:23:33 +0000 (17:23 +0000)]
Fix userboot after r364355

r364355 replaced init_zfs_bootenv with init_zfs_boot_options and
neglected to update userboot in the process.

3 years agoGive stronger guidance with regards to upgrading root pools
Matt Macy [Tue, 25 Aug 2020 17:19:15 +0000 (17:19 +0000)]
Give stronger guidance with regards to upgrading root pools

3 years agortsol(d): add script for "M bit"
Bjoern A. Zeeb [Tue, 25 Aug 2020 16:09:23 +0000 (16:09 +0000)]
rtsol(d): add script for "M bit"

While we do support the "O bit" running a script (usually to start a
dhcpv6 client) we have no options for setups which set the "M bit" for,
e.g., static address assignment as in EC2.

Duplicate most of the "O bit" logic to also start a script for the
"M bit" with the one difference: if the "M bit" is set we will not
start the script for the "O bit" as well (per RFC 4861, Section 4.2).

Reviewed by: hrs, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26099

3 years agoiflib: netmap: publish all the receive buffer
Vincenzo Maffione [Tue, 25 Aug 2020 15:19:45 +0000 (15:19 +0000)]
iflib: netmap: publish all the receive buffer

At initialization time, the netmap RX refill function used to
prepare the NIC RX ring with N-1 buffers rather than N (with
N equal to the number of descriptors in the NIC RX ring).
This is not how netmap is supposed to work, as it would keep
kring->nr_hwcur not in sync with the NIC "next index to refill"
(i.e., fl->ifl_pidx). Instead we prepare N buffers, although we
still publish (with isc_rxd_flush()) only the first N-1 buffers,
to avoid the NIC producer pointer to overrun the NIC consumer
pointer (for NICs where this is a real issue, e.g. Intel ones).

MFC after: 2 weeks

3 years agovfs: respect PRIV_VFS_LOOKUP in vaccess_smr
Mateusz Guzik [Tue, 25 Aug 2020 14:18:50 +0000 (14:18 +0000)]
vfs: respect PRIV_VFS_LOOKUP in vaccess_smr

Reported by: novel

3 years agoPermit vm_page_wire() to be called on pages not belonging to an object.
Mark Johnston [Tue, 25 Aug 2020 13:45:06 +0000 (13:45 +0000)]
Permit vm_page_wire() to be called on pages not belonging to an object.

For such pages ref_count is effectively a consumer-managed field, but
there is no harm in calling vm_page_wire() on them.
vm_page_unwire_noq() handles them as well.  Relax the vm_page_wire()
assertions to permit this case which is triggered by some out-of-tree
code. [1]

Also guard a conditional assertion with INVARIANTS.  Otherwise the
conditions are evaluated even though the result is unused. [2]

Reported by: bz, cem [1], kib [2]
Reviewed by: dougm, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26173

3 years agoFix -Wundef warnings when building liblua
Alex Richardson [Tue, 25 Aug 2020 13:30:34 +0000 (13:30 +0000)]
Fix -Wundef warnings when building liblua

We need to define the LUA_FLOAT_INT64 macro even if we don't use it (copied
from stand/luaconf.h). While touching luaconf.h.dist also sync it with the
the 5.3.5 release version (matches the one in lib/liblua).

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D25977

3 years agostyle.Makefile: list CSTD between WARNS and CFLAGS
Alex Richardson [Tue, 25 Aug 2020 13:30:29 +0000 (13:30 +0000)]
style.Makefile: list CSTD between WARNS and CFLAGS

This was suggested by emaste in https://reviews.freebsd.org/D25928 and
matches most uses in the tree.

3 years agoFix makefs bootstrap on macOS after D25563
Alex Richardson [Tue, 25 Aug 2020 13:30:24 +0000 (13:30 +0000)]
Fix makefs bootstrap on macOS after D25563

The macOS assert.h header does not define static_assert when compiling in
C99 mode. To fix this compile with -std=c11.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D25928

3 years agoFix typo in r364325 that broke tinderbox with -DBUILD_WITH_STRICT_TMPPATH
Alex Richardson [Tue, 25 Aug 2020 13:30:19 +0000 (13:30 +0000)]
Fix typo in r364325 that broke tinderbox with -DBUILD_WITH_STRICT_TMPPATH

${TARGET_ARCH} is empty here which results in empy MAKE_PARAMS being
passed to the buildkernel phase. This breaks the build when using the
strict TMPPATH since cc will not be included in $PATH.

Reviewed By: jhb

3 years agoUse bootstrapped install(1) install of tools/install.sh in world stage
Alex Richardson [Tue, 25 Aug 2020 13:30:14 +0000 (13:30 +0000)]
Use bootstrapped install(1) install of tools/install.sh in world stage

This should be noticeably faster due to fewer processes being forked and
also handles other flags such as -S or writing to METALOG.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D26039

3 years agoFix running the builddtb target on a noexec file system
Alex Richardson [Tue, 25 Aug 2020 13:30:09 +0000 (13:30 +0000)]
Fix running the builddtb target on a noexec file system

Obtained from: CheriBSD