]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agorc.conf.5: add .Xr to firewall(7), growfs(7), and tuning(7)
Ceri Davies [Thu, 1 Jul 2021 21:35:14 +0000 (22:35 +0100)]
rc.conf.5: add .Xr to firewall(7), growfs(7), and tuning(7)

3 years agocd(9): correct minor typo in manpage.
Ceri Davies [Thu, 1 Jul 2021 21:10:34 +0000 (22:10 +0100)]
cd(9): correct minor typo in manpage.

3 years agopfctl: cache getprotobynumber results
Mateusz Guzik [Thu, 1 Jul 2021 19:25:43 +0000 (21:25 +0200)]
pfctl: cache getprotobynumber results

As for example pfctl -ss keeps calling it, it saves a lot of overhead
from elided parsing of /etc/nsswitch.conf and /etc/protocols.

Sample result when running a pre-nvlist binary with nfs root and dumping
7 mln states:
before: 24.817u 62.993s 1:28.52 99.1%
after: 8.064u 1.117s 0:18.87 48.5%

Idea by Jim Thompson

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agomrsas(4): Report more correct maximum I/O size.
Alexander Motin [Thu, 1 Jul 2021 19:28:55 +0000 (15:28 -0400)]
mrsas(4): Report more correct maximum I/O size.

Subtract one SGE for the case of misaligned address.  Also take into
account maximum number of sectors reported by firmware, that gives
nicer 256KB limit instead of 276KB calculated from the SGE limit.

While there, remove number of I/O size checks, duplicating what is
already checked by CAM and busdma(9).

MFC after: 1 month
Sponsored by: iXsystems, Inc.

3 years agopf tests: ftp-proxy test
Kristof Provost [Thu, 1 Jul 2021 15:15:36 +0000 (17:15 +0200)]
pf tests: ftp-proxy test

Basic test case for ftp-proxy

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

3 years agoftp-proxy: Revert incorrect migration to libpfctl
Kristof Provost [Thu, 1 Jul 2021 15:16:10 +0000 (17:16 +0200)]
ftp-proxy: Revert incorrect migration to libpfctl

libpfctl supports creating rules, but not (yet) adding addresses to a
pool. Adding addresses certainly does not work through adding a rule.

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

3 years agodummynet: fix sysctls
Kristof Provost [Thu, 1 Jul 2021 07:42:34 +0000 (09:42 +0200)]
dummynet: fix sysctls

The sysctl nodes which use V_dn_cfg must be marked as CTLFLAG_VNET so
that we use the correct per-vnet offset

PR: 256819
Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30974

3 years agoofw_pci: fix probing for non-DT cases
Kornel Duleba [Thu, 1 Jul 2021 18:27:41 +0000 (20:27 +0200)]
ofw_pci: fix probing for non-DT cases

phandle_t is a uint32_t type, <= 0 comparison doesn't work with it as intended.
This caused the ofw_pci code to attach to PCI bus on ACPI based systems.
Since 3eae4e106ac7 ("Fix error value returned by ofw_bus_gen_get_node().")
ofw subsystem can only return -1 for invalid nodes. Use that.

MFC after: 4 weeks
Reviewed by: mw
Differential revision: https://reviews.freebsd.org/D30953

3 years agodts: fsl-ls1028a: Correct ECAM PCIE window ranges
Kornel Duleba [Thu, 1 Jul 2021 18:21:17 +0000 (20:21 +0200)]
dts: fsl-ls1028a: Correct ECAM PCIE window ranges

Currently all PCIE windows point to bus address 0x0, which does not match
the values obtained from hardware during EA.
Replace those values with CPU addresses, since in reality we
have a 1:1 mapping between the two.

This patch is queued for Linux v5.14 in linux-next tree:
6bee93d93111 "arm64: dts: fsl-ls1028a: Correct ECAM PCIE window ranges"

3 years agotegra_pcie: use switch instead of if in tegra_pcib_pex_ctrl
Ferhat Gecdogan [Thu, 1 Jul 2021 18:09:46 +0000 (20:09 +0200)]
tegra_pcie: use switch instead of if in tegra_pcib_pex_ctrl

Simplify obtaining per-port data in tegra_pcib_pex_ctrl() routine.

Reviewed by:    imp, mw
Pull Request:   https://github.com/freebsd/freebsd-src/pull/481

3 years agodts: Bump the freebsd branding version to 5.13
Emmanuel Vadot [Thu, 1 Jul 2021 16:48:44 +0000 (18:48 +0200)]
dts: Bump the freebsd branding version to 5.13

Sponsored by: Diablotin Systems

3 years agoarm64: allwinner: Add r_intc driver
Emmanuel Vadot [Thu, 1 Jul 2021 16:41:05 +0000 (18:41 +0200)]
arm64: allwinner: Add r_intc driver

The r intc interrupt controller seems to do a lot of things :
- It can handle the NMI interrupt
- It have local interrupts for some device that also can be muxed with GIC
- It can serve as an forwarder for the GIC

It's mostly used for deepsleep/wakeup if I understood correctly and we do not
support this on arm64.

For now just forward everything to the GIC so interrupts works again for device
which now have this interrupts controller set since dts v5.12

Sponsored by: Diablotin Systems

3 years agobuild.7: remove documentation of "make update"
Ceri Davies [Thu, 1 Jul 2021 15:04:33 +0000 (16:04 +0100)]
build.7: remove documentation of "make update"

update target was removed in e290182bcf3895ca659dff111bca6a077c4708b1

3 years agoImport device-tree files from Linux 5.13
Emmanuel Vadot [Thu, 1 Jul 2021 15:50:54 +0000 (17:50 +0200)]
Import device-tree files from Linux 5.13

Sponsored by: Diablotin Systems

3 years agoImport device-tree files from Linux 5.13
Emmanuel Vadot [Thu, 1 Jul 2021 15:50:17 +0000 (17:50 +0200)]
Import device-tree files from Linux 5.13

3 years agoImport device-tree files from Linux 5.12
Emmanuel Vadot [Thu, 1 Jul 2021 15:41:47 +0000 (17:41 +0200)]
Import device-tree files from Linux 5.12

Sponsored by: Diablotin Systems

3 years agoImport device-tree files from Linux 5.12
Emmanuel Vadot [Thu, 1 Jul 2021 15:39:42 +0000 (17:39 +0200)]
Import device-tree files from Linux 5.12

3 years agohz.9: update stathz for current usage
Warner Losh [Thu, 1 Jul 2021 15:32:40 +0000 (09:32 -0600)]
hz.9: update stathz for current usage

Update the stathz description to reflect reality. profhz is the only
thing we should deprecate. Add some implementation notes that describe
the optimizations made to date.

Discusssed with: emaste
Reviewed by: kib (prior), jhb (prior), gbe
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30815

3 years agoImport device-tree files from Linux 5.11
Emmanuel Vadot [Thu, 1 Jul 2021 15:20:05 +0000 (17:20 +0200)]
Import device-tree files from Linux 5.11

Sponsored by: Diablotin Systems

3 years agoSwitch the order of the ID_AA64PFR1_EL1 fields
Andrew Turner [Thu, 1 Jul 2021 00:45:39 +0000 (00:45 +0000)]
Switch the order of the ID_AA64PFR1_EL1 fields

This makes them consistent with the fields in other registers.

Sponsored by: The FreeBSD Foundation

3 years agofortune: correct documentation of default FORTUNE_PATH.
Ceri Davies [Thu, 1 Jul 2021 13:00:06 +0000 (14:00 +0100)]
fortune: correct documentation of default FORTUNE_PATH.

While here, fix a typo in a comment relating to FORTUNE_PATH

3 years agoprocctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS
Edward Tomasz Napierala [Thu, 1 Jul 2021 08:11:11 +0000 (09:11 +0100)]
procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS

This introduces a new, per-process flag, "NO_NEW_PRIVS", which
is inherited, preserved on exec, and cannot be cleared.  The flag,
when set, makes subsequent execs ignore any SUID and SGID bits,
instead executing those binaries as if they not set.

The main purpose of the flag is implementation of Linux
PROC_SET_NO_NEW_PRIVS prctl(2), and possibly also unpriviledged
chroot.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30939

3 years agolinux(4): revert arm64 part of 447636e43c0
Edward Tomasz Napierala [Thu, 1 Jul 2021 08:28:01 +0000 (08:28 +0000)]
linux(4): revert arm64 part of 447636e43c0

The arm64 part of the patch was incomplete and prevented
linux64.ko from loading due to missing symbol.

Sponsored By: EPSRC

3 years agonfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message
Rick Macklem [Wed, 30 Jun 2021 22:15:41 +0000 (15:15 -0700)]
nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message

When the setting of kern.ipc.maxsockbuf is less than what is
desired for I/O based on vfs.maxbcachebuf and vfs.nfs.bufpackets,
a console message of "Consider increasing kern.ipc.maxsockbuf".
is printed.

This patch modifies the message to provide a suggested value
for kern.ipc.maxsockbuf.
Note that the setting is only needed when the NFS rsize/wsize
is set to vfs.maxbcachebuf.

While here, make nfs_bufpackets global, so that it can be used
by a future patch that adds a sysctl to set the NFS server's
maximum I/O size.  Also, remove "sizeof(u_int32_t)" from the maximum
packet length, since NFS_MAXXDR is already an "overestimate"
of the actual length.

MFC after: 2 weeks

3 years agolinux(4): implement coredump support
Edward Tomasz Napierala [Wed, 30 Jun 2021 16:45:21 +0000 (17:45 +0100)]
linux(4): implement coredump support

Implement dumping core for Linux binaries on amd64, for both
32- and 64-bit executables.  Some bits are still missing.

This is based on a prototype by chuck@.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30019

3 years agolibpmc: Import AMD Zen 3 PMU events
Greg V [Wed, 30 Jun 2021 21:15:21 +0000 (18:15 -0300)]
libpmc: Import AMD Zen 3 PMU events

Reviewed by: mav, mhorne
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30965

3 years agohwpmc_arm64: add a PMCDBG to the interrupt handler
Mitchell Horne [Wed, 19 May 2021 16:29:59 +0000 (13:29 -0300)]
hwpmc_arm64: add a PMCDBG to the interrupt handler

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoarm: Make sure we can handle a thumb entry point.
Olivier Houchard [Wed, 30 Jun 2021 20:56:50 +0000 (22:56 +0200)]
arm: Make sure we can handle a thumb entry point.

Similarly to what's been done on arm64 with commit
712c060c94fd447c91b0e6218c12a431206b487a, when executing a binary, if the
entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise
the CPU will interpret it in ARM mode, and that will likely leads to an
undefined instruction.

PR: 256899
MFC after:  1 week

3 years agoObsoleteFiles.inc: add a few missed files
Antoine Brodin [Wed, 30 Jun 2021 20:34:01 +0000 (20:34 +0000)]
ObsoleteFiles.inc: add a few missed files

3 years agoAdd Thomas Munro to the committers graph
Allan Jude [Wed, 30 Jun 2021 20:09:18 +0000 (20:09 +0000)]
Add Thomas Munro to the committers graph

Reported by: gnn

3 years agolibpmc: enable pmu_utils on arm64
Mitchell Horne [Thu, 27 May 2021 20:02:04 +0000 (17:02 -0300)]
libpmc: enable pmu_utils on arm64

This allows supported libpmc to query/select from the pmu-events table,
which may have a more complete set of events than what we define
manually. A future update to these definitions should greatly improve
this support. The alias table is empty for now, until this future import
is complete.

Add the Foundation's copyright for recent work on this file.

Reviewed by: ray (slightly earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30603

3 years agohwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE
Mitchell Horne [Wed, 19 May 2021 16:11:33 +0000 (13:11 -0300)]
hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE

Make it possible to specify event codes without an offset of
PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is
required to make use of event definitions from pmu-events.

Reviewed by: ray (slightly earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30602

3 years agohwpmc_arm64: fill kern.hwpmc.cpuid
Mitchell Horne [Thu, 1 Apr 2021 13:19:43 +0000 (10:19 -0300)]
hwpmc_arm64: fill kern.hwpmc.cpuid

This will be used to detect supported pmu events. The expected format is
the MIDR register with the revision and variant fields masked. See also:
lib/libpmc/pmu-events/arch/arm64/mapfile.csv.

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

3 years agohwpmc_arm64.c: fix return style
Mitchell Horne [Mon, 14 Jun 2021 15:21:08 +0000 (12:21 -0300)]
hwpmc_arm64.c: fix return style

In accordance to style(9).

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoamd64: a simplication to pmap_remove_{all,write}
Alan Cox [Wed, 30 Jun 2021 05:59:21 +0000 (00:59 -0500)]
amd64: a simplication to pmap_remove_{all,write}

Eliminate some unnecessary unlocking and relocking when we have to retry
the operation to avoid deadlock.  (All of the other pmap functions that
iterate over a PV list already implemented retries without these same
unlocking and relocking operations.)

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

3 years agorelease: Remove C-like string comparison operator
Jose Luis Duran [Sun, 20 Jun 2021 00:00:19 +0000 (21:00 -0300)]
release: Remove C-like string comparison operator

Per [(1), i.e. test(1), the string comparison operator should be `=`,
not `==` in sh(1) scripts.

No functional change. FreeBSD's test accepts `==` as an alias for `=`
for compatibility with gnu test's `==` extension.

Reviewed by: imp@, gjb@
Pull Request: https://github.com/freebsd/freebsd-src/pull/485

3 years agobsdinstall: Also copy /var/db/zoneinfo
Jose Luis Duran [Sun, 20 Jun 2021 02:22:48 +0000 (23:22 -0300)]
bsdinstall: Also copy /var/db/zoneinfo

Per tzsetup(8), /etc/localtime and /var/db/zoneinfo go hand in hand.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/486

3 years agosysbuild: Also copy /var/db/zoneinfo
Jose Luis Duran [Sun, 20 Jun 2021 02:19:00 +0000 (23:19 -0300)]
sysbuild: Also copy /var/db/zoneinfo

Per tzsetup(8), /etc/localtime and /var/db/zoneinfo go hand in hand.
Remove extra white spaces as well.

Reviewed by: imp@, phk@ (informal no objection email)
Pull Request: https://github.com/freebsd/freebsd-src/pull/486

3 years agoarm64: Make sure COMPAT_FREEBSD32 handles thumb entry point.
Olivier Houchard [Wed, 30 Jun 2021 12:50:47 +0000 (14:50 +0200)]
arm64: Make sure COMPAT_FREEBSD32 handles thumb entry point.

If the entry point for the binary executed is a thumb 2 entry point, make
sure we set the PSR_T bit, or the CPU will interpret it as arm32 code and
bad things will happen.

PR: 256899
MFC after: 1 week

3 years agoarm: Garbage collect _arm_memcpy/_arm_bzero.
Olivier Houchard [Fri, 25 Jun 2021 23:06:26 +0000 (01:06 +0200)]
arm: Garbage collect _arm_memcpy/_arm_bzero.

Remove any attempt to use _arm_memcpy and _arm_bzero. It was used by some
xscale platforms to provide functions to use the DMA engine for big
zeroing/copying work, but those platforms are long gone, and it's unlikely
anything else will use those.

3 years agoman: Build manpages for all architectures
Fernando Apesteguía [Wed, 9 Jun 2021 10:58:04 +0000 (12:58 +0200)]
man: Build manpages for all architectures

Building and installing architecture-specific man pages only raises a number of
problems:

 * The https://www.freebsd.org/cgi/man.cgi is incomplete. As an
   example, it does not show results for pae(4). The reason for this is
   that the cgi interface runs on FreeBSD amd64.

 * In FreeBSD amd64 some manual pages have broken X-refs. See hptrr(4)
   for an example.

 * Also, we have broken links in our Release Notes. This is a
   consequence of the first point. See
   https://www.freebsd.org/releases/13.0R/hardware/#proc-i386.

Make MAN_ARCH default to 'all' so we build all the man pages for all the
architectures. The difference in disk space is negligible. Also link
architecture-specific man pages to their own section while keeping their own
namespace.

PR: 212290
Reported by: mj@bsdops.com
Approved by: ceri@, wosch@
MFC after: 4 weeks

3 years agozfs: update zfs_config.h (missing in 2617128a2)
Martin Matuska [Wed, 30 Jun 2021 06:34:36 +0000 (08:34 +0200)]
zfs: update zfs_config.h (missing in 2617128a2)

3 years agozfs: merge openzfs/zfs@4694131a0 (master) into main
Martin Matuska [Wed, 30 Jun 2021 06:02:44 +0000 (08:02 +0200)]
zfs: merge openzfs/zfs@4694131a0 (master) into main

Notable upstream pull request merges:
  #12253 module/zfs: simplify ddt_stat_add() loop
  #12288 Avoid 64bit division in multilist index functions

Obtained from: OpenZFS
OpenZFS commit: 4694131a0a05b6db2727c9801f9729b9378d3064

3 years agotop(1): support command name and argument grepping
John Grafton [Wed, 16 Jun 2021 19:40:21 +0000 (15:40 -0400)]
top(1): support command name and argument grepping

Obtained from:  OpenBSD
Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/479

3 years agoChange strmode argument type to mode_t for crossbuild
Alfonso Gregory [Fri, 25 Jun 2021 15:30:57 +0000 (11:30 -0400)]
Change strmode argument type to mode_t for crossbuild

To match the libc changes.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/493

3 years agoChange strmode argument type to mode_t
Alfonso Gregory [Fri, 25 Jun 2021 15:35:14 +0000 (11:35 -0400)]
Change strmode argument type to mode_t

Finally, we have the correct function definition for strmode.  NetBSD/OpenBSD
did this many years ago. This code is weird sign extension safe.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/493

3 years agofsck_ffs: don't try to write in read-only mode
Chuck Silvers [Tue, 29 Jun 2021 21:29:15 +0000 (14:29 -0700)]
fsck_ffs: don't try to write in read-only mode

Skip trying to change fs_mtime for SU+J if we are running read-only.

Reviewed by:    mckusick
Sponsored by: Netflix

3 years agoLinux 5.13 compat: META
Brian Behlendorf [Tue, 29 Jun 2021 20:16:38 +0000 (13:16 -0700)]
Linux 5.13 compat: META

Increase the Linux-Maximum version in the META file to 5.13.
All of the required compatibility patches have been merged
and the 5.13 kernel has been officially released.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
3 years agozed: fix sending emails (#12292)
Laurențiu Nicola [Tue, 29 Jun 2021 19:33:49 +0000 (22:33 +0300)]
zed: fix sending emails (#12292)

Commit 6fc3099 broke the quoting when invoking the mail program, revert
that change.

Signed-off-by: Laurențiu Nicola <lnicola@dend.ro>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
3 years agoportsnap: Remove superfluous semicolons
Colin Percival [Tue, 29 Jun 2021 17:59:59 +0000 (10:59 -0700)]
portsnap: Remove superfluous semicolons

Submitted by: des

3 years agoportsnap: Shorten 'Skipping' output lines
Colin Percival [Tue, 29 Jun 2021 17:45:46 +0000 (10:45 -0700)]
portsnap: Shorten 'Skipping' output lines

Portsnap uses patches opportunistically to reduce download bandwidth: It
attempts to fetch patches which could be useful, and then makes use of
whichever patches it actually gets.  (This solves the otherwise O(n^2)
issue for the server to build patches between every pair of versions.)

During the process of applying patches, portsnap prints lines of the
form "Skipping XXX-YYY (123 of 4567).\r", where the \r serves to allow
each of these (potentially many) lines to overwrite the previous one
on the console.  Unfortunately, XXX and YYY here are SHA256 hashes,
resulting in these lines wrapping on reasonable-width consoles.

Replace the hashes with abbreviations of the form "0123...cdef"
(cutting 64 characters down to 11) in order to keep lines to a
reasonable length.

The rather ugly shell code here is used to avoid forking additional
processes; it would be much cleaner using sed(1), but in my testing
the sed-based alternative increases CPU time consumption by 50%.

Requested by: des

3 years agoLinuxKPI: Rename a short description of the kmalloc type.
Dmitry Chagin [Tue, 29 Jun 2021 17:20:01 +0000 (20:20 +0300)]
LinuxKPI: Rename a short description of the kmalloc type.

To avoid duplication in the vmstat -m output rename the kmalloc type short
description to 'lkpikmalloc' as the Linux emulation layer historically names
its linux malloc type as 'linux'.

Reviewed by: hselasky, kib, emaste
Differential Revision: https://reviews.freebsd.org/D30928
MFC after: 2 weeks

3 years agoLinuxKPI: Put compat code under appropriate condition.
Dmitry Chagin [Tue, 29 Jun 2021 17:19:17 +0000 (20:19 +0300)]
LinuxKPI: Put compat code under appropriate condition.

Reviewed by: hselasky, emaste, kib
Differential Revision: https://reviews.freebsd.org/D30927
MFC after: 2 weeks

3 years agoEliminate p_elf_machine from struct proc.
Dmitry Chagin [Tue, 29 Jun 2021 17:18:29 +0000 (20:18 +0300)]
Eliminate p_elf_machine from struct proc.

Instead of p_elf_machine use machine member of the Elf_Brandinfo which is now
cached in the struct proc at p_elf_brandinfo member.

Note to MFC: D30918, KBI

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30926
MFC after: 2 weeks

3 years agoLinuxKPI: Use the proper API to determine the ABI of the running process.
Dmitry Chagin [Tue, 29 Jun 2021 17:17:16 +0000 (20:17 +0300)]
LinuxKPI: Use the proper API to determine the ABI of the running process.

Reviewed by: markj, hselasky, kib
Differential Revision: https://reviews.freebsd.org/D30924
MFC after: 2 weeks

3 years agoAdd a link to the Elf_Brandinfo into the struc proc.
Dmitry Chagin [Tue, 29 Jun 2021 17:15:08 +0000 (20:15 +0300)]
Add a link to the Elf_Brandinfo into the struc proc.

To allow the ABI to make a dicision based on the Brandinfo add a link
to the Elf_Brandinfo into the struct proc. Add a note that the high 8 bits
of Elf_Brandinfo flags is private to the ABI.

Note to MFC: it breaks KBI.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30918
MFC after: 2 weeks

3 years agomodule/zfs: simplify ddt_stat_add() loop
Alexander [Tue, 29 Jun 2021 14:26:11 +0000 (16:26 +0200)]
module/zfs: simplify ddt_stat_add() loop

LLVM's Polly (ISL to be precise) is unhappy with the loop from
ddt_stat_add():

  CC [M]  fs/zfs/zfs/ddt.o
../lib/External/isl/isl_schedule_node.c:2470: cannot insert node
between set or sequence node and its filter children

(building with the custom patch which adds Polly support to Kbuild)

The mentioned loop is rather suboptimal. All that we need is to just
treat ddt_stat_t as an array of u64 and perform 1:1 addition or
substraction. This can be done in simpler for-loop with the
determined index and bounds. Compiler will expand d_end - d into
a number of ddt_stat_t fields at compile time.
This prevents Polly from failing on this file.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Closes #12253

3 years agomac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit
Mateusz Guzik [Tue, 29 Jun 2021 12:56:19 +0000 (14:56 +0200)]
mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit

Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agounionfs: release parent vnodes in deferred context
Jason A. Harmening [Sat, 12 Jun 2021 19:45:18 +0000 (12:45 -0700)]
unionfs: release parent vnodes in deferred context

Each unionfs node holds a reference to its parent directory vnode.
A single open file reference can therefore end up keeping an
arbitrarily deep vnode hierarchy in place.  When that reference is
released, the resulting VOP_RECLAIM call chain can then exhaust the
kernel stack.

This is easily reproducible by running the unionfs.sh stress2 test.
Fix it by deferring recursive unionfs vnode release to taskqueue
context.

PR: 238883
Reviewed By: kib (earlier version), markj
Differential Revision: https://reviews.freebsd.org/D30748

3 years agoAvoid 64bit division in multilist index functions
Alexander Motin [Tue, 29 Jun 2021 12:59:14 +0000 (08:59 -0400)]
Avoid 64bit division in multilist index functions

The number of sublists in a multilist is relatively small. We dont need
64 bits to calculate an index. 32 bits is sufficient and makes the
code more efficient.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12288

3 years agoAdd infrastructure required for Linux coredump support
Edward Tomasz Napierala [Tue, 29 Jun 2021 07:49:04 +0000 (08:49 +0100)]
Add infrastructure required for Linux coredump support

This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`,
and `sv_elf_core_prepare_notes` fields to `struct sysentvec`,
and modifies imgact_elf.c to make use of them instead
of hardcoding FreeBSD-specific values.  It also updates all
of the ABI definitions to preserve current behaviour.

This makes it possible to implement non-native ELF coredump
support without unnecessary code duplication.  It will be used
for Linux coredumps.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30921

3 years agopf: make sure the dtrace probe has safe access to state
Mateusz Guzik [Mon, 28 Jun 2021 19:32:20 +0000 (21:32 +0200)]
pf: make sure the dtrace probe has safe access to state

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: revert: Use counter(9) for pf_state byte/packet tracking
Mateusz Guzik [Mon, 28 Jun 2021 18:50:56 +0000 (20:50 +0200)]
pf: revert: Use counter(9) for pf_state byte/packet tracking

stats are not shared and consequently per-CPU counters only waste
memory.

No slowdown was measured when passing over 20M pps.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: deduplicate V_pf_state_z handling with pfsync
Mateusz Guzik [Mon, 28 Jun 2021 18:18:26 +0000 (20:18 +0200)]
pf: deduplicate V_pf_state_z handling with pfsync

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: fix error-case leaks in pf_create_state
Mateusz Guzik [Mon, 28 Jun 2021 18:29:58 +0000 (20:29 +0200)]
pf: fix error-case leaks in pf_create_state

The hand-rolled clean up failed to free counters.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agomd5: Improve compatibility with coreutils and format fix
Stefan Eßer [Tue, 29 Jun 2021 07:01:13 +0000 (09:01 +0200)]
md5: Improve compatibility with coreutils and format fix

The previous changes that added support for the coreutils -c option
modified the output generated by passing -r to match that of the
coreutils versions. The difference is that coreutils separates the
hash from the file name by two blanks "  " (or a blank followed by
an asterisk " *" with the -b option denoting).

While most scripts or users will not notice the difference, it might
be considered a violation of POLA and this commit reverts the change
for the non-sum programs. These will print a single blank " " as the
separator, as they die before the previous commit.

In order to still generate output that is identical to that of the
coreutils programs, this commit generates the "  " or " *" separator
used by them for the -sum versions, depending on the presence of the
-b option.

MFC after: 3 days

3 years agoarm64: a few simplications to pmap_remove_{all,write}
Alan Cox [Tue, 29 Jun 2021 02:57:04 +0000 (21:57 -0500)]
arm64: a few simplications to pmap_remove_{all,write}

Eliminate some unnecessary unlocking and relocking when we have to retry
the operation to avoid deadlock.  (All of the other pmap functions that
iterate over a PV list already implemented retries without these same
unlocking and relocking operations.)

Avoid a pointer dereference by using an existing local variable that
already holds the desired value.

Eliminate some unnecessary repetition of code on a failed fcmpset.
Specifically, there is no point in retesting the DBM bit because it
cannot change state while the pmap lock is held.

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

3 years agoUPDATING: Fix typos / improve langauge
Maigurs Stalidzans [Tue, 29 Jun 2021 01:27:30 +0000 (19:27 -0600)]
UPDATING: Fix typos / improve langauge

This fixes a couple of typos in older entries, and clarifies the
language of a newer one. It also removes a joke that trips up
foreign readers due its use of faux archaic English.

Reviewed by: imp@

3 years agoued may be NULL here which will cause a panic... reproducable by
John-Mark Gurney [Tue, 29 Jun 2021 01:09:14 +0000 (18:09 -0700)]
ued may be NULL here which will cause a panic... reproducable by
simply doing a usbconfig reset on a device which doesn't reset itself
properly...

3 years agoClarify notice for profiled libraries in FreeBSD 14
Ed Maste [Mon, 28 Jun 2021 21:30:48 +0000 (17:30 -0400)]
Clarify notice for profiled libraries in FreeBSD 14

Reported by: kevans
Fixes: 175841285e28 ("Add deprecation notice for...")
Sponsored by: The FreeBSD Foundation

3 years agocam: Fix GENERIC-MMCCAM build
Warner Losh [Mon, 28 Jun 2021 23:22:35 +0000 (17:22 -0600)]
cam: Fix GENERIC-MMCCAM build

Fix forgotten argument and type error. MMCCAM isn't enabled by default,
and I'd mistakenly thought it was, so these went undetected precommit.

Sponsored by: Netflix

3 years agocam_sim: remove unused sim_doneq member
Warner Losh [Mon, 28 Jun 2021 22:04:54 +0000 (16:04 -0600)]
cam_sim: remove unused sim_doneq member

Its use was removed in 227d67aa54 by mav when locking was revamped.

Reviewed by: scottl@, mav@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30890

3 years agocam: change xpt_clone_path to return int
Warner Losh [Mon, 28 Jun 2021 22:04:02 +0000 (16:04 -0600)]
cam: change xpt_clone_path to return int

xpt_clone_path originally returned a cam_status, but it doesn't do I/O
and should return an errno instead. I added it last year and it's only
used in one place. It's not yet documented, so no doc changes are
nneeded.

Reviewed by: scottl@, mav@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30884

3 years agocam: Remove CAM_TRUE and CAM_FALSE, they are unused and duplicate bool
Warner Losh [Mon, 28 Jun 2021 22:03:01 +0000 (16:03 -0600)]
cam: Remove CAM_TRUE and CAM_FALSE, they are unused and duplicate bool

These were in the original CAM commit in 3.0, but were not used there,
nor have they been used since then. They also duplicate the now-standard
bool type. Remove them.

Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30879

3 years agocam: fix xpt_bus_register and xpt_bus_deregister return errno
Warner Losh [Mon, 28 Jun 2021 22:01:30 +0000 (16:01 -0600)]
cam: fix xpt_bus_register and xpt_bus_deregister return errno

xpt_bus_register and xpt_bus_deregister returns a hybrid error that's
neither a cam_status, nor an errno, but a mix of both.  Update
xpt_bus_register and xpt_bus_deregister to return an errno. The vast
majority of current users compare against zero, which can also be
spelled CAM_SUCCESS. Nobody uses CAM_FAILURE, so remove that symbol
to prevent comfusion (nothing returns it either).

Where the return value is saved, ensure that the variable 'error' is
used to store an errno and 'status' is used to store a cam_status where
it makes the code clearer (usually just in functions that already mix
and match). Where the return value isn't used at all, avoid storing it
at all.

Reviewed by: scottl@, mav@ (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30860

3 years agocam: delete cam_sim_alloc_dev
Warner Losh [Mon, 28 Jun 2021 22:00:44 +0000 (16:00 -0600)]
cam: delete cam_sim_alloc_dev

cam_sim_alloc_dev was only used internally by the MMC system. That has
been convered to using xpt_path_device() and has stopped using this
interface, so this can be retired.

Reviewed by: scottl@, mav@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30858

3 years agosdhci: stop using cam_sim_alloc_dev
Warner Losh [Mon, 28 Jun 2021 22:00:37 +0000 (16:00 -0600)]
sdhci: stop using cam_sim_alloc_dev

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

3 years agommc_sim: stop using cam_sim_alloc_dev
Warner Losh [Mon, 28 Jun 2021 22:00:20 +0000 (16:00 -0600)]
mmc_sim: stop using cam_sim_alloc_dev

Use the vanilla flavor of cam_sim_alloc. Now that sdiob has been
converted to get the device_t from the cam_path, this data is no longer
necessary.

Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30856

3 years agosdiob: get the device_t from periph's path
Warner Losh [Mon, 28 Jun 2021 22:00:09 +0000 (16:00 -0600)]
sdiob: get the device_t from periph's path

Use the new xpt_path_device to get the device_t using the periph's path.

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

3 years agocam mmc: Assert that the xpt_bus_register registered a device_t
Warner Losh [Mon, 28 Jun 2021 21:59:04 +0000 (15:59 -0600)]
cam mmc: Assert that the xpt_bus_register registered a device_t

Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30854

3 years agocam: add xpt_path_sim_device to return device_t associated with a path
Warner Losh [Mon, 28 Jun 2021 21:57:51 +0000 (15:57 -0600)]
cam: add xpt_path_sim_device to return device_t associated with a path

Return the device associated with the sim's bus when it called
xpt_bus_register, if any. Most real SIMs in the tree set this device,
but some virtual ones do not have a device_t assocaited with them.

Reviewed by: scottl@, mav@ (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30853

3 years agocam: Group all xpt_path*() functions together in cam_xpt.h
Warner Losh [Mon, 28 Jun 2021 21:56:55 +0000 (15:56 -0600)]
cam: Group all xpt_path*() functions together in cam_xpt.h

Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30852

3 years agocam: fix UB behavior
Warner Losh [Mon, 28 Jun 2021 21:56:08 +0000 (15:56 -0600)]
cam: fix UB behavior

The trick of subtracting one from the poitner returned from malloc
results in undefined behavior:

>>C89: 3.3.6 Unless both the pointer operand and the result point to a
>>member of the same array object, or one past the last member of the
>>array object, the behavior is undefined.

Instead, allocate 1 extra element and stop adjusting the pointer. While
a little wasteful, the extra is in the noise on today's systems.

Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30847

3 years agocam: save parent_dev in xpt_bus_register
Warner Losh [Mon, 28 Jun 2021 21:55:02 +0000 (15:55 -0600)]
cam: save parent_dev in xpt_bus_register

Reviewed by: scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30846

3 years agocam: kill trailing white space in two spots
Warner Losh [Fri, 25 Jun 2021 21:33:31 +0000 (15:33 -0600)]
cam: kill trailing white space in two spots

3 years agovn_isdisk(9): update after r364372
Robert Wing [Mon, 28 Jun 2021 18:27:27 +0000 (10:27 -0800)]
vn_isdisk(9): update after r364372

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

3 years agopf: assert that sizeof(struct pf_state) <= 312
Mateusz Guzik [Mon, 28 Jun 2021 12:49:40 +0000 (14:49 +0200)]
pf: assert that sizeof(struct pf_state) <= 312

To prevent accidentally going over a threshold which makes UMA fit only
12 objects per page instead of 13.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: factor out state allocation into pf_alloc_state
Mateusz Guzik [Mon, 28 Jun 2021 12:22:31 +0000 (14:22 +0200)]
pf: factor out state allocation into pf_alloc_state

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: add pf_release_staten and use it in pf_unlink_state
Mateusz Guzik [Mon, 28 Jun 2021 12:18:43 +0000 (14:18 +0200)]
pf: add pf_release_staten and use it in pf_unlink_state

Saves one atomic op.

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoAdd deprecation notice for WITH_PROFILE option
Ed Maste [Sun, 27 Jun 2021 17:21:26 +0000 (13:21 -0400)]
Add deprecation notice for WITH_PROFILE option

As discussed on freebsd-current [1] and freebsd-arch [2] and review
D30833, FreeBSD 14 will ship without the _p.a libraries built with -pg.
Both upstream and base system (in commit b762974cf4b9) Clang have been
modified to remove the special case for linking against these libraries.

Clang's -pg support and mcount() remain, so building with -pg can still
be used on code that the user builds; we just do not provide prebuilt
libraries compiled with -pg.  A similar change is still needed for GCC.

[1]  https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html
[2] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agonet80211: ieee80211_probereq_ie fix length calculation for hw scans
Bjoern A. Zeeb [Fri, 18 Jun 2021 09:57:16 +0000 (09:57 +0000)]
net80211: ieee80211_probereq_ie fix length calculation for hw scans

c338cf2c6d5eacdee813191d5976aa531d450ee7 split up ieee80211_probereq_ie().
For HW scans we usually do not want to add a SSID to the IEs.
During that split we allocate memory based on the length which will
always include the length of the SSID and only later we reduced the
length but never updated the value passed back to the caller.
Split the SSID handling up and reduce the length before malloc().
This not only makes us not over-allocate in these situatoins but also
fixes the length returned to the caller and with that usually directly
passed to firmware.

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

3 years agoLinuxKPI: firmware, implement deferred loading for "nowait"
Bjoern A. Zeeb [Sun, 20 Jun 2021 13:49:46 +0000 (13:49 +0000)]
LinuxKPI: firmware, implement deferred loading for "nowait"

Change linuxkpi_request_firmware_nowait() to deferred firmware loading
scheduling a task.  This changes behaviour in some cases that we
return from loading the driver before the driver is finished
initialising if the driver does not deal with it (wait).
This brings the behaviour one would expect from when this function is
called and I implemented it to see if it would help a specific case.

Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Reviewed by: hselasky, imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D30830

3 years agoLinuxKPI: pci re-add pci_free_irq_vectors()
Bjoern A. Zeeb [Mon, 28 Jun 2021 12:09:16 +0000 (12:09 +0000)]
LinuxKPI: pci re-add pci_free_irq_vectors()

Re-add pci_free_irq_vectors() accidentally removed in
d4a4960c6559caa890af0901a21296e75b961210 and now needed by drm-kmod v5.5.

Reported by: wulf
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC with: d4a4960c6559caa890af0901a21296e75b961210

3 years agoipsec: globalize lft zone and zero out buffers at allocation time
Mateusz Guzik [Thu, 24 Jun 2021 11:19:09 +0000 (13:19 +0200)]
ipsec: globalize lft zone and zero out buffers at allocation time

Creation of a zone is expensive and there is no need to have one for
every vnet. Moreover, this wastes memory as these separate zones
cannot use the same per-cpu caches. Finally, this is a step towards
replacing the custom zone with pcpu-16.

Two counter_u64_zero calls induce back-to-back IPIs to zero everything
out. Instead, pass the M_ZERO flag to let uma just iterate all buffers.
The counter(9) API abstraction is already violated by not using
counter_u64_alloc.

Reviewed by: ae
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30916

3 years agobhyve: Fix NVMe iovec construction for large IOs
Chuck Tuffli [Sun, 27 Jun 2021 22:14:52 +0000 (15:14 -0700)]
bhyve: Fix NVMe iovec construction for large IOs

The UEFI driver included with Rocky Linux 8.4 uncovered an existing bug
in the NVMe emulation's construction of iovec's.

By default, NVMe data transfer operations use a scatter-gather list in
which all entries point to a fixed size memory region. For example, if
the Memory Page Size is 4KiB, a 2MiB IO requires 512 entries. Lists
themselves are also fixed size (default is 512 entries).

Because the list size is fixed, the last entry is special. If the IO
requires more than 512 entries, the last entry in the list contains the
address of the next list of entries. But if the IO requires exactly 512
entries, the last entry points to data.

The NVMe emulation missed this logic and unconditionally treated the
last entry as a pointer to the next list. Fix is to check if the
remaining data is greater than the page size before using the last entry
as a pointer to the next list.

PR: 256422
Reported by: dave@syix.com
Tested by: jason@tubnor.net
MFC after: 5 days
Relnotes: yes
Reviewed by: imp, grehan
Differential Revision: https://reviews.freebsd.org/D30897

3 years agosctp: initialize sequence numbers for ECN correctly
Michael Tuexen [Sun, 27 Jun 2021 18:14:48 +0000 (20:14 +0200)]
sctp: initialize sequence numbers for ECN correctly

MFC after: 3 days
Reported by: Junseok Yang (for the userland stack)

3 years agosrc.conf.5: regen after RISC-V OPENMP (aa033e0b14f2)
Ed Maste [Sun, 27 Jun 2021 17:29:32 +0000 (13:29 -0400)]
src.conf.5: regen after RISC-V OPENMP (aa033e0b14f2)

Sponsored by: The FreeBSD Foundation

3 years agoclang: stop linking _p libs for -pg as of FreeBSD 14
Ed Maste [Sat, 26 Jun 2021 23:58:16 +0000 (19:58 -0400)]
clang: stop linking _p libs for -pg as of FreeBSD 14

In FreeBSD 14 we will stop providing _p libraries (compiled with -pg).

Reviewed by: dim (upstream)
Obtained from: LLVM 699d47472c3f
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30861

3 years agoimgact_elf.c: style, remove unnecessary casts
Edward Tomasz Napierala [Tue, 22 Jun 2021 12:18:49 +0000 (13:18 +0100)]
imgact_elf.c: style, remove unnecessary casts

Remove unnecessary type casts and redundant brackets.
No functional changes.

Suggested By: kib
Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30841

3 years agosctp: Fix length check for ECNE chunks
Michael Tuexen [Sun, 27 Jun 2021 14:10:39 +0000 (16:10 +0200)]
sctp: Fix length check for ECNE chunks

MFC after: 3 days