Commit Graph

267131 Commits

Author SHA1 Message Date
Eric van Gyzen
ea0e1b19f2 aio_md_test: NUL-terminate result of readlink
readlink does not NUL-terminate the output buffer.  This led to spurious
failures to destroy the md device because the unit number was garbage.
NUL-terminate the output buffer.

Reported by:	ASLR
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2021-07-23 09:19:29 -05:00
Eric van Gyzen
c6f92e64b6 aio_md_test: fix cleanup
ATF cleanup functions cannot use functions such as ATF_REQUIRE
and atf_tc_fail.  These functions assert that a test case is
currently running, which is not true during cleanup, so the
process aborts.  Change the cleanup function to simply print
to stderr and return.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2021-07-23 09:19:28 -05:00
Andrew Turner
a93941b439 Switch to an ifunc in the kernel for crc32c
There is no need to read the same variable to check if the CPU supports
crc32c instructions.

Reviewed by:	arichardson, kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31274
2021-07-22 20:54:21 +00:00
Kyle Evans
4d15976919 init: execute /etc/rc.final after all user processes have terminated
This can be useful for, e.g., unmounting filesystems that were needed
for shutdown.

Reviewed by:	kib
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#63
Differential Revision:	https://reviews.freebsd.org/D31230
2021-07-22 23:26:11 -05:00
Martin Matuska
67a51854e8 zfs: update zfs_gitrev.h
From now on, every merge from vendor/openzfs/master should come
with an updated zfs_config.h and zfs_gitrev.h
2021-07-23 03:24:30 +02:00
Martin Matuska
3f9d360c82 zfs: merge openzfs/zfs@14b43fbd9 (master) into main
Notable upstream pull request merges:
  #12271 Tinker with slop space accounting with dedup
  #12279 Fix ARC ghost states eviction accounting
  #12284 Add Module Parameter Regarding Log Size Limit
  #12300 Introduce dsl_dir_diduse_transfer_space()
  #12314 Optimize allocation throttling
  #12348 Minor ARC optimizations
  #12350 Detect HAVE_LARGE_STACKS at compile time
  #12356 Use SET_ERROR for more errors in FreeBSD vnops
  #12375 FreeBSD: Ignore make_dev_s() errors
  #12378 FreeBSD: Switch from MAXPHYS to maxphys on FreeBSD 13+

Obtained from:	OpenZFS
OpenZFS commit:	14b43fbd9c
2021-07-23 02:50:13 +02:00
Ryan Moeller
14b43fbd9c
zloop: Add a max iterations option, use default run/pass times
It is useful to have control over the number of iterations of zloop so
we can easily produce "x core dumps found *in y iterations*" metrics.

Using random values for run/pass times doesn't improve coverage in a
meaningful way.

Randomizing run time could be seen as a compromise between running a
greater variety of shorter tests versus a smaller variety of longer
tests within a fixed time span.  However, it is not desirable when
running a fixed number of iterations.

Pass time already incorporates randomness within ztest.

Either parameter can be passed to ztest explicitly if the defaults are
not satisfactory.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12411
2021-07-22 15:29:27 -06:00
Renato Botelho
95f0da5be1 bsdinstall: Only show menu if there are more items to be installed
MFC after:	3 days
Obtained from:	Rubicon Communications, LLC ("Netgate")
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-22 16:02:34 -04:00
Pedro F. Giffuni
c384a27805 patch: cleanup variable initialization a bit.
musl libc fgetln is a bit more pickier.

Hinted by:	chimera-linux (git 31491e1de2e1241885984cd9e4b978965f14eda4)
2021-07-22 14:23:22 -05:00
Jessica Clarke
4a23504908 riscv: Fix pmap_kextract racing with concurrent superpage promotion/demotion
This repeats amd64's cfcbf8c6fd (r180498) and i386's cf3508519c
(r202894) but for riscv; pmap_kextract must be lock-free and so it can
race with superpage promotion and demotion, thus the L2 entry must only
be loaded once to avoid using inconsistent state.

PR:	250866
Reviewed by:	markj, mhorne
Tested by:	David Gilbert <dgilbert@daveg.ca>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31253
2021-07-22 20:02:14 +01:00
Yang Zhong
d5341d72a1 mmc: Drain the intrhook in mmc_detach()
Buggy SD card drivers may attach and detach a mmc(4) driver instance in
quick succession.  In this case mmc(4) must disestablish its intrhook
callback during detach.  Thus, this change adds a call to
config_intrhook_drain(), which blocks or does nothing if the intrhook is
running or has already ran (the SD card was plugged in), and
disestablishes the hook if it hasn't ran yet (the SD card was not
plugged in).

PR:		254373
Reviewed by:	imp, manu, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31262
2021-07-22 13:50:10 -04:00
Mark Johnston
fd5827b178 man9: Update guarantees for userspace fetch/store operations
Platforms may either silently handle unaligned accesses or return an
error.  Atomicity is not guaranteed in this case, however.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31282
2021-07-22 13:40:39 -04:00
Alexander Motin
ab38c12b4a vmci(4): Shorten interrupt descriptions.
We have no space there for such a long strings.  Also it makes no
sense to set description if there is only one interrupt.

MFC after:	2 weeks
2021-07-22 13:02:23 -04:00
Alan Somers
4f831830fa [skip ci] fix syntax in CODEOWNERS
* Fix invalid usernames
  - Fix spelling of ngie-eign
  - Delete users who aren't members of the FreeBSD org
* Fix spelling of usr.bin/fetch in CODEOWNERS
* rm "a directory anywhere in the repo" patterns from CODEOWNERS
  Even though they're documented as working, in practice they don't.
  https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners#codeowners-file-location

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D30849
2021-07-22 10:58:54 -06:00
Mark Johnston
18c696c001 man9: Remove stray .In macros
Fixes:		9c11d8d483
MFC after:	1 week
2021-07-22 12:47:43 -04:00
Alan Somers
6c95065590 Escape any '.' characters in sysctl node names
ZFS creates some sysctl nodes that include a pool name, and '.' is an
allowed character in pool names.  But it's the separator in the sysctl
tree, so it can't be included in a sysctl name.  Replace it with "%25".
Handily, "%" is illegal in ZFS pool names, so there's no ambiguity
there.

PR:		257316
MFC after:	3 weeks
Sponsored by:	Axcient
Reviewed by:	freqlabs
Differential Revision: https://reviews.freebsd.org/D31265
2021-07-22 10:22:48 -06:00
Alexander Motin
46197dc858
FreeBSD: Ignore make_dev_s() errors
Since errors returned by zvol_create_minor_impl() are ignored by the
common code, it is more convenient to ignore make_dev_s() errors there.
It allows, for example, to get device created for the zvol after later
rename instead of having it further stuck in half-created state.
zvol_rename_minor() already ignores those errors.

While there, switch from MAXPHYS to maxphys in FreeBSD 13+.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12375
2021-07-22 10:22:14 -06:00
Ceri Davies
a52936f1d5 man9/VOP_LISTEXTATTR.9: correct grammar in .Nd 2021-07-22 16:43:46 +01:00
Ceri Davies
b578d2a77e man/man7/development.7: correct typo in manpage. 2021-07-22 16:43:46 +01:00
Emmanuel Vadot
990a1dbf6f dwmmc: Fix MMCCAM block size support
When using SDIO the block size if per function and most of the time
not equal to MMC_SECTOR_SIZE, fix sdio on dwmmc by setting the correct
block size in the mmc registers.

MFC after:    1 month
Sponsored by:	Diablotin Systems
2021-07-22 17:03:14 +02:00
Emmanuel Vadot
bce17068ac arm: allwinner: cir: Reduce verbosity
IR can be noisy in dmesg if it "receive" some unwanted data.
Add a tunable hw.aw_cir.debug to enable those message that are
only useful if one wants to debug the driver.

Sponsored by:	Diablotin Systems
Differential Revision:	  https://reviews.freebsd.org/D30972
Reviewed by: 		  ganbold
MFC after:		  1 month
2021-07-22 14:55:03 +02:00
Emmanuel Vadot
50e0dc0c4b fdt: Expose the model, compatible and freebsd dts brandind as sysctl
This make it easier for script to get the hardware on which they are running.

MFC after:	1 month
Sponsored by:	Diablotin Systems
Differential Revision:	  https://reviews.freebsd.org/D31205
Reviewed by: 		  imp
Should be ok on powerpc:  jhibbits (over irc)
2021-07-22 14:53:32 +02:00
Konstantin Belousov
1db1e58d93 mlx5en: vxlan: do not report TCP inner packet as UDP for software parser
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies // NVIDIA Networking
MFC after:	1 week
2021-07-22 15:34:24 +03:00
Baptiste Daroussin
d6ed0d3d31 ports.7: catchup with the package extension name since pkg 1.17
MFC After:	3 days
2021-07-22 10:50:19 +02:00
Emmanuel Vadot
6cafdee71d pkgbase: Track pkg 1.17
With pkg 1.17 the extention is always .pkg, packing_format is also now deprecated.
2021-07-22 10:19:02 +02:00
Fernando Apesteguía
8539518055 Remove manpages from OLD_FILES
Remove apm.8 and apmconf.8 from OLD_FILES in the relevant Makefiles.

These pages are now installed unconditionally as per 0a0f748641

PR:	257228
Reported by:	yasu@utahime.org, wosch@
Approved by:	imp@, wosch@
Fixes:	0a0f748641 - Build manpages for all architectures
MFH:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D31256
2021-07-22 08:09:45 +02:00
Warner Losh
5ab82b00cc awk: Remove last markings we have on awk
We normally don't add $FreeBSD$ to contrib software. However, these
changes date back to the CVS era of source code management and have been
overlooked. Now that all these files are back to the same as the
upstream bsd-features branch, remove the FreeBSD specific changes, which
are now just $FreeBSD$ and the (FreeBSD) in the version string.

MFC After:		2 weeks
Sponsored by:		Netflix
2021-07-21 20:24:57 -06:00
Warner Losh
628bd30ab5 awk: revert to upstream behavior for ranges for gawk compatibility
In 2005, FreeBSD changed one-true-awk to honor the locale's collating
order. This was billed as a temporary patch. It was also compatible with
the then-current behavior of gawk. That temporary patch has lasted 16
years now.

However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular
expressions outside of the "C" and "POSIX" locales to be undefined.

Starting in 2011, gawk 4.0 stopped using the locale for the range
regular expressions and used the traditional behavior only. The
maintainer had grown weary of answering why '[A-Z]' would sometimes
match lower-case expressions. The details about are explained here:
https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html

To restore compatibility with other implementaitons of awk, revert this
patch. FreeBSD is the odd-system out. It also has the nice side effect
of eliminating the last of our differences with upstream one-true-awk.

Reviewed by:		cy, rgrimes
MFC After:		2 weeks
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31114
2021-07-21 20:22:43 -06:00
Jorgen Lundman
c14ad80fcb
Remove old orig_fd variable from zfs send
Possibly required in the past, but is currently fills no purpose.
Ordinarily such tiny cleanup is not generally worth it, however
on the macOS port, in a future commit, we do unspeakable things to the
"fd" for send/recv, and it would be easier to only have to deal with
one "fd" instead of two.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #12404
2021-07-21 20:22:27 -06:00
Warner Losh
2929813c4f Revert "awk: Issue a warning for old hex behavior."
This reverts commit acf9cf323f. It warns
about too many false positive cases.

Sponsored by:		Netflix
2021-07-21 20:17:50 -06:00
Warner Losh
2b720db8d4 type: becauce -> because
Noticed by:	Piotr P. Stefaniak
Sponsored by:	Netflix
2021-07-21 20:03:35 -06:00
Warner Losh
acf9cf323f awk: Issue a warning for old hex behavior.
Since FreeBSD has allowed "0x" hex strings to be converted to integers
for a long time, and since upstream has killed that behavior, warn about
this issue. This will allow us to deprecate this behavior for 14.0 while
giving our users of 12.x and 13.x fair warning.

Sponsored by:		Netflix
2021-07-21 20:03:35 -06:00
Kyle Evans
51221b68fb tuntap: clean up cc --analyze
One complaint of a dead-store, smack it with a __diagused.
2021-07-21 19:14:43 -05:00
Mitchell Horne
27ea55fc65 libpmc/hwpmc: fix issues with arm64 pmu-events support
Due to a mis-merge, the changes committed to libpmc never called
pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be
used to carry the actual pmc event code anyway, as it is expected to
contain the index into the pmu event array (otherwise, it breaks event
name lookup in pmclog_get_event()). Add a new MD field,
pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc().

Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as
this is a union, not a struct. Restore the proper padding size.

Reviewed by:	luporl, ray, andrew
Fixes:		28dd6730a5 ("libpmc: enable pmu_utils on arm64")
Fixes:		8cc3815f02 ("hwpmc_arm64: accept raw event codes...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31221
2021-07-21 20:18:00 -03:00
Alexander Motin
3a57f08b50 Fix race between first rand(3) calls with _once().
Before this patch there was a chance for thread that called rand(3)
slightly later to see rand3_state already allocated, but not yet
initialized.  While this API is not expected to be thread-safe, it
is not expected to crash.  ztest on 64-thread system reproduced it
reliably for me.

Submitted by:	avg@
MFC after:	1 month
2021-07-21 11:32:22 -04:00
Alexander Motin
2ae65d449f Revert "Fix race between first rand(3) calls."
It is going to be reimplemented with _once().

This reverts commit 28d70deaaf.

MFC after:	1 month
2021-07-21 11:32:22 -04:00
Kyle Evans
23ecfa9d5b kern: mountroot: avoid fd leak in .md parsing
parse_dir_md() opens /dev/mdctl but only closes the resulting fd on
success, not upon failure of the ioctl or when we exceed the md unit
max.

Reviewed by:	kib (slightly previous version)
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#62
Differential Revision:	https://reviews.freebsd.org/D31229
2021-07-21 10:18:09 -05:00
Mark Johnston
fa46a46a82 arm64: Print CPU features slightly earlier
In particular, print them before we release APs.  Otherwise they tend to
get mixed with other kernel messages.

Reviewed by:	andrew, manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31242
2021-07-21 09:00:55 -04:00
Alexander Motin
1b50749ce9
Optimize allocation throttling
Remove mc_lock use from metaslab_class_throttle_*().  The math there
is based on refcounts and so atomic, so the only race possible there
is between zfs_refcount_count() and zfs_refcount_add().  But in most
cases metaslab_class_throttle_reserve() is called with the allocator
lock held, which covers the race.  In cases where the lock is not
held, GANG_ALLOCATION() or METASLAB_MUST_RESERVE are set, and so we
do not use zfs_refcount_count().  And even if we assume some other
non-existing scenario, the worst that may happen from this race is
few more I/Os get to allocation earlier, that is not a problem.

Move locks and data of different allocators into different cache
lines to avoid false sharing.  Group spa_alloc_* arrays together
into single array of aligned struct spa_alloc spa_allocs.  Align
struct metaslab_class_allocator.

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Don Brady <don.brady@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12314
2021-07-21 06:40:36 -06:00
Edward Tomasz Napierala
8bc3dc0100 Regen after 2561da0636. 2021-07-21 12:26:31 +00:00
Edward Tomasz Napierala
2561da0636 linux: Fix declaration of rt_sigreturn() on arm64
On Linux, this syscall doesn't take any arguments; instead
it assumes the context was put on the stack.

Reviewed By:	dchagin
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D31251
2021-07-21 12:21:28 +00:00
Edward Tomasz Napierala
616a676a05 cam: clear stack-allocated CCB in the target layer
Note that, as pointed out by scottl@, this code should really look
a bit different, in that the stack allocations should be replaced
with dynamic allocation, and the periph creation should be moved
to a context where one can use M_WAITOK.  See the review for more
details.  For now let's go with a minimal fix until we're done with
UMA CCBs.

Reviewed By:	mav, imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D30298
2021-07-21 10:18:28 +01:00
Edward Tomasz Napierala
0634390572 chroot: fix typo in usage
While here also fix typo in a variable name.

Reported By:	oshogbo
2021-07-21 10:16:11 +01:00
Edward Tomasz Napierala
a157196713 sesutil: Fix status checking
Previously we would display "OK, Swapped" for swapped disks,
instead of the usual disk size.

Reviewed By:	allanjude
Differential Revision:	https://reviews.freebsd.org/D31219
2021-07-21 10:14:26 +01:00
Hans Petter Selasky
575945f10b Update the mlx5en(4) manual page.
Differential Revision:	https://reviews.freebsd.org/D31228
Reviewed by:	kib@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-07-21 11:10:31 +02:00
Hans Petter Selasky
0f8dafb458 Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.
These two ioctls are not part of the current version of OSS and were
considered obsolete. However, their behaviour is not the same as their
old one, so this implementation is specific to FreeBSD.

Older OSS versions had the MUTE ioctls take and return an integer with
a value of 0 or 1, which meant that the _whole_ mixer is unmuted or
muted respectively. In my implementation, the ioctl takes and returns
a bitmask that tells us which devices are muted.

This allows us to mute and unmute only the devices we want, instead of the
whole mixer. The bitmask works the same way as in DEVMASK, RECMASK and
RECSRC.

Integrated the hardware volume feature with the new mute system.

Submitted by:	Christos Margiolis <christos@freebsd.org>
Differential Revision:	https://reviews.freebsd.org/D31130
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-07-21 11:10:30 +02:00
Jessica Clarke
8c439847f0 riscv: Include spibus and spigen in GENERIC
We already attempt to enable the SiFive SPI controller, but since spibus
isn't enabled it isn't actually built.

Reviewed by:	kp, philip
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31027
2021-07-21 06:46:09 +01:00
Jessica Clarke
4707bb0430 pci_dw: Detect number of outbound regions automatically
Currently we use the num-viewports property to decide how many outbound
regions there are we can use, defaulting to 2. However, Linux has
stopped using that and so it no longer appears in new device trees, such
as for the SiFive FU740. Instead, it's possible to just probe the
hardware directly.

Reviewed by:	mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31030
2021-07-21 05:51:20 +01:00
Jessica Clarke
f240dfff22 pci_dw: Support modern "unroll" iATU mode
This supersedes the old legacy mode where a viewport register was used
to mux multiple regions behind a single set of registers, and is used on
the SiFive FU740.

Reviewed by:	mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31029
2021-07-21 05:50:50 +01:00
Jessica Clarke
f8c1701f23 pci_dw: Support multiple memory windows
Currently we assume there is only one memory and one prefetch memory
window, and ignore the latter. However, the SiFive FU740 has two normal
memory windows.

As part of this, the viewports are rearranged. Previously the viewports
were memory, config then optionally I/O. Both to simplify the config
index calculation and to ensure it can always be mapped even if we have
too many memory windows for the number of viewports, config is moved to
being the first viewport.

This generalisation now also naturally supports mapping prefetch memory
windows.

Reviewed by:	mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31028
2021-07-21 05:50:24 +01:00