]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agogcore: Remove unused typedefs.
John Baldwin [Thu, 30 Jun 2022 17:03:32 +0000 (10:03 -0700)]
gcore: Remove unused typedefs.

These are no longer needed after commit 4965ac059da1 which used
PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.

Reviewed by: markj, emaste
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35665

(cherry picked from commit d2a3c30a511d4802412a102e9fa44f810605a872)

2 years agox86 mptable: Include <x86/legacvar.h> for legacy_get_pcibus().
John Baldwin [Thu, 23 Jun 2022 22:00:12 +0000 (15:00 -0700)]
x86 mptable: Include <x86/legacvar.h> for legacy_get_pcibus().

Fixes: b076d8d54c2f mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

(cherry picked from commit 15a6642da6b0b97de580e06349706cf7e660986c)

2 years agomptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.
John Baldwin [Thu, 23 Jun 2022 17:49:09 +0000 (10:49 -0700)]
mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

The mptable_hostb driver is a child of legacy0 and has legacy bus
ivars, not PCI or PCI bridge ivars.

PR: 264819
Reported by: Dennis Clarke <dclarke@blastwave.org>
Diagnosed by: avg
Reviewed by: avg
Differential Revision: https://reviews.freebsd.org/D35548

(cherry picked from commit b076d8d54c2fd91a35aad6931d0bfa2aa0122036)

2 years agopmcannotate: Don't increment end address passed to objdump -d.
John Baldwin [Tue, 14 Jun 2022 17:52:54 +0000 (10:52 -0700)]
pmcannotate: Don't increment end address passed to objdump -d.

libpmc already returns an end address that is after the end of the
last instruction of a function (on both amd64 and arm64) as the end
address written to the annotate map file is computed as the start
address of the symbol plus the size.

Adding one could result in a curious failure where an entire
function's contents in assembly was reduced instead to only the first
instruction.  The reason is that when the end instruction is bumped by
one, objdump -d can append the first instruction of the next function
in its output.  However, since pmcannotate concatenates all of the
objdump -d output from various functions into a single file which it
then searches to find the assembly for a given file, if this
additional trailer was earlier in the file than the full function, the
trailer was chosen to represent the entire function resulting in the
truncated listing of the function.

Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D35399

(cherry picked from commit 73702c398046d8e01e6a0f5860b7e75cd37a9518)

2 years agonewvers.sh: Don't use return to exit.
John Baldwin [Tue, 14 Jun 2022 17:51:39 +0000 (10:51 -0700)]
newvers.sh: Don't use return to exit.

Commit acfb506b3d00 replaced an exit 0 when using -V with a return
instead.  FreeBSD's sh treats a return outside of a function like
exit, but this is a non-portable extension.  Other Bourne shells only
permit return to be used within a function and continue execution
(possibly with a warning).

To fix, don't reuse VARS_ONLY (which is intended to be set by other
scripts before sourcing newvers.sh directly) and instead use a new
variable (VARS_ONLY_EXIT) to restore the use of exit for the
non-sourced case.

Reviewed by: emaste
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35481

(cherry picked from commit 6ab35c78fb5af66d586d4846e2d81e020331ad3f)

2 years agofirmware: Map '@' in filenames to '_' in symbols.
John Baldwin [Tue, 14 Jun 2022 17:50:51 +0000 (10:50 -0700)]
firmware: Map '@' in filenames to '_' in symbols.

'@' is not a valid character in symbol names and can sometimes appear
in path names.

Reviewed by: imp, markj
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35480

(cherry picked from commit 628a4156a761d3daac8a4adc0e675c6e6064fd5a)

2 years agorc.d/ntpd: Restart ntpd when resuming from sleep.
John Baldwin [Tue, 14 Jun 2022 17:42:51 +0000 (10:42 -0700)]
rc.d/ntpd: Restart ntpd when resuming from sleep.

ntpd does not always gracefully handle clock steps during resume.
This is probably most useful in conjunction with
ntpd_sync_on_start=YES which will work around any clock skew while
suspended.

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

(cherry picked from commit 1442fed7e25e9856464a0b0ce522ffc8cb473593)

2 years agoktls_test: Permit an option to skip tests not using ifnet TLS.
John Baldwin [Tue, 14 Jun 2022 17:35:01 +0000 (10:35 -0700)]
ktls_test: Permit an option to skip tests not using ifnet TLS.

If ktls.require_ifnet is set to true, then check the TLS offload mode
for tests sending and receiving records and skip the test if the
offload mode is not ifnet mode.

This can be used along with ktls.host to run KTLS tests against a NIC
supporting ifnet TLS and verify that expected cipher suites and
directions used ifnet TLS rather than software TLS.  Receive tests may
result in a false positive as receive ifnet TLS can use software as a
fallback.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35427

(cherry picked from commit ea4ebdcb4da94a30fae53da74eda302aaa4ff1f3)

2 years agoktls_test: Permit connecting to a remote echo server for tests.
John Baldwin [Tue, 14 Jun 2022 17:34:51 +0000 (10:34 -0700)]
ktls_test: Permit connecting to a remote echo server for tests.

Previously ktls tests always executed over a local socket pair.
ktls.host can be set to a host to connect to with a single socket
instead.  The remote end is expected to echo back any data received
(such as the echo service).  The port can be set with ktls.port which
defaults to "echo".

This is primarily useful to permit testing NIC TLS offload use cases
where the traffic needs to transit the NIC.

Note that the variables must be set via
'kyua -v test_suites.FreeBSD.ktls.host=host'.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35426

(cherry picked from commit 2400a7b18f984664638cbf978687e6d2c00da2e7)

2 years agoktls_test: Add a helper function to close sockets.
John Baldwin [Tue, 14 Jun 2022 17:34:38 +0000 (10:34 -0700)]
ktls_test: Add a helper function to close sockets.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35425

(cherry picked from commit 2c1052053340af562e3121a41545419fa71e65f7)

2 years agohwpmc: Permit the minimum sampling count to be set as a sysctl.
John Baldwin [Thu, 9 Jun 2022 18:05:34 +0000 (11:05 -0700)]
hwpmc: Permit the minimum sampling count to be set as a sysctl.

A rarely occurring event (e.g. an event that occurs less than 1000
times during execution of a program) may require a lower minimum
threshold than 1000.  Replace the hardcoded 1000 with a sysctl that
the administrator can use to permit smaller sampling count values.

Reviewed by: mhorne, mav
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D35400

(cherry picked from commit ca341f3cf52f8cb036d93cd611d8f3f5b552ea8e)

2 years agogcore: Don't hardcode VM write permissions.
John Baldwin [Mon, 6 Jun 2022 23:43:02 +0000 (16:43 -0700)]
gcore: Don't hardcode VM write permissions.

This ensures read-only PT_LOAD segments are not marked as writable in
the phdr flags.

Reviewed by: markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35398

(cherry picked from commit 81c857dd7e6a83924a8e45684fb94024fc3c929b)

2 years agogcore: Remove unused elf_note_arm_vfp function.
John Baldwin [Mon, 6 Jun 2022 18:06:49 +0000 (11:06 -0700)]
gcore: Remove unused elf_note_arm_vfp function.

Fixes: add00c381e5c Use a regset for NT_ARM_VFP.
(cherry picked from commit ad52a7bb0393163eb4e749005be0f6ca3c2c51c0)

2 years agovmm: Destroy character devices synchronously.
John Baldwin [Fri, 20 May 2022 16:53:43 +0000 (09:53 -0700)]
vmm: Destroy character devices synchronously.

This fixes a userland race where bhyveload or bhyve can fail to reuse
a VM name after bhyvectl --destroy has returned.

Reported by: Michael Dexter
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D35186

(cherry picked from commit 7a0c23da4eaa63f00e53aa18f3ab1f2bb32f593a)

2 years agoDon't implicitly pull in most of 'device crypto' for 'options IPSEC'.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
Don't implicitly pull in most of 'device crypto' for 'options IPSEC'.

options IPSEC is already documented as requiring 'device crypto' and
duplicating the dependencies is harder to read and not always
consistent.

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

(cherry picked from commit 1d95c6f9c0f20ac287c50e0d31e909b35f28a05f)

2 years agocheck/delete-old: Auto-generate lib32 entries for libraries.
John Baldwin [Thu, 20 Jan 2022 22:09:57 +0000 (14:09 -0800)]
check/delete-old: Auto-generate lib32 entries for libraries.

- Add usr/lib32/libfoo.so.N for lib/libfoo.so.N.

- Add usr/lib32/foo for usr/lib/foo.

- Treat casper libraries special since they are installed to
  /usr/lib32 instead of /usr/lib32/casper and thus map
  usr/lib/casper/foo to usr/lib32/foo.

Note that OLD_DIRS and MOVED_LIBS entries are not duplicated, only
OLD_FILES and OLD_LIBS.

Reviewed by: imp, emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33324

(cherry picked from commit 77da558ceb0949b60b566da61cb8d9b9634ca862)

2 years agoObsoleteFiles: move libelf.so.2 to MOVED_LIBS
Ed Maste [Sun, 30 Jan 2022 21:34:07 +0000 (16:34 -0500)]
ObsoleteFiles: move libelf.so.2 to MOVED_LIBS

5a536241ea2b moved it from /usr/lib to /lib.  This case is now handled
using MOVED_LIBS.

Reported by: dim
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 42818aba8d4d5212b3b536f52b9f4e3559d091b7)

2 years agoUse MOVED_LIBS for the libalias modules being moved to /lib.
John Baldwin [Thu, 20 Jan 2022 20:48:24 +0000 (12:48 -0800)]
Use MOVED_LIBS for the libalias modules being moved to /lib.

This is a bit more unusual in that the modules dropped their major
version suffix at the same time, so the old files being removed by
MOVED_LIBS in this case are the symlinks to the old libraries.

Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33849

(cherry picked from commit f033840b253ebb28eee25beafde4d6863f5f6e57)

2 years agoUse MOVED_LIBS for libraries moved between /usr/lib and /lib.
John Baldwin [Thu, 20 Jan 2022 20:47:43 +0000 (12:47 -0800)]
Use MOVED_LIBS for libraries moved between /usr/lib and /lib.

Add a MOVED_LIBS variable similar to OLD_LIBS except that MOVED_LIBS
is used for the cases that a library's name doesn't change, but it
just moves between /usr/lib and /lib.  This will be used by a future
change to auto-generate lib32 old files entries for which these cases
need to be ignored (a moved library remains in /usr/lib32).

Suggested by: emaste
Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33848

(cherry picked from commit 57ba3f00f5e9bb6ea2eff5124077508f7a3f40df)

2 years agoRework documentation of OLD_*.
John Baldwin [Thu, 20 Jan 2022 20:46:29 +0000 (12:46 -0800)]
Rework documentation of OLD_*.

- Be more explicit in the difference between OLD_DIRS and OLD_FILES
  (the former is only in delete-old-libs whereas the latter is in
  delete-old).

- Document that debug symbols in /usr/lib/debug/ for files in
  OLD_FILES and OLD_LIBS are removed as well.

Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33847

(cherry picked from commit c96dfb2156fa8a83dd225d1a9b31070123469288)

2 years agoObsoleteFiles.inc: Add comment regarding optional files
Stefan Eßer [Sun, 11 Apr 2021 21:00:39 +0000 (23:00 +0200)]
ObsoleteFiles.inc: Add comment regarding optional files

I had added entries that depended on some build option to this file
and have been informed, that those go into a different file in another
directory.

Mentioning /usr/src/tools/build/mk/OptionalObsoleteFiles.inc in this
file should help other committers (and me) to not repeat that mistake.

MFC after: 1 week

(cherry picked from commit 2a47875ea6a8359fd329ef1760da91b54396436f)

2 years agoRemove lib32 versions of libl.
John Baldwin [Thu, 13 Jan 2022 22:48:32 +0000 (14:48 -0800)]
Remove lib32 versions of libl.

Reviewed by: imp, emaste
Fixes: eb61f7bdf266 Stop building libl and liby
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33851

(cherry picked from commit cc8af33eb340d5ee0c755fb3eb9dc07f0819afdc)

2 years agoRemove a duplicate entry for libgpib_p.a.
John Baldwin [Thu, 13 Jan 2022 22:47:13 +0000 (14:47 -0800)]
Remove a duplicate entry for libgpib_p.a.

Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33850

(cherry picked from commit 768563cf23353ede05645c4dd6d40fe826613997)

2 years agoRemove redundant OLD_FILES entries for debug symbols.
John Baldwin [Tue, 11 Jan 2022 19:38:45 +0000 (11:38 -0800)]
Remove redundant OLD_FILES entries for debug symbols.

Entries for foo.debug files matching an existing entry in OLD_FILES or
OLD_LIBS are unnecessary as they are auto-generated.

Reviewed by: imp, emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33777

(cherry picked from commit ebc1c246955d798d51749ec7d51147385b71a3f1)

2 years agoAdd list-old-{dirs,files,libs} targets.
John Baldwin [Tue, 11 Jan 2022 19:38:11 +0000 (11:38 -0800)]
Add list-old-{dirs,files,libs} targets.

These targets generate a raw list of the candidate old files roughly
corresponding to the values of OLD_DIRS, OLD_FILES, and OLD_LIBS.
Currently list-old-files also includes uncompressed manpages in
addition to compressed manpages.

Use these targets in the implementation of check-old-* and
delete-old-* to replace duplicated logic.

Reviewed by: imp, emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33327

(cherry picked from commit 21baf42c57f080835496c5f4f349e9523d22a956)

2 years agonetstat -i: do not truncate interface names
Mike Karels [Sat, 2 Jul 2022 16:03:36 +0000 (11:03 -0500)]
netstat -i: do not truncate interface names

The field for interface names for netstat -i was 5 characters by
default, which is no longer sufficient with names like "vlan1234"
and "vtnet0".  netstat -iW computed the necessary field width, but
also enlarged the address field by a lot (especially with IPv6 enabled).
Make netstat -i compute the field width for interface names with or
without -W.  Note that the existing default output does not fit in
80 columns in any case.  Update the man page accordingly, documenting
the remaining effect of -W with -i.  Also add -W to the list of
General Options, as there are numerous pointers to this.

Reported by: Chris Ross
Reviewed by: melifaro, rgrimes, cy
Differential Revision: https://reviews.freebsd.org/D35703

(cherry picked from commit 231092bb6fda75b922fc324edef6523e78e9e8ed)

2 years agoamd64: Reload CPU ext features after resume or cr4 changes
Dmitry Chagin [Wed, 29 Jun 2022 07:34:43 +0000 (10:34 +0300)]
amd64: Reload CPU ext features after resume or cr4 changes

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D35555
MFC after: 2 weeks

(cherry picked from commit 050f5a8405c63dadaf522d27c3d4f2a2ae522bf6)

2 years agolinprocfs: Decode SGX CPU feature in cpuinfo
Dmitry Chagin [Wed, 29 Jun 2022 07:37:52 +0000 (10:37 +0300)]
linprocfs: Decode SGX CPU feature in cpuinfo

MFC after: 2 weeks

(cherry picked from commit c8e7070ce3d98c3aa0b08249afe1d6d887f37f31)

2 years agolinprocfs: Decode more CPU flags in cpuinfo
Dmitry Chagin [Wed, 29 Jun 2022 07:37:30 +0000 (10:37 +0300)]
linprocfs: Decode more CPU flags in cpuinfo

Differential revision: https://reviews.freebsd.org/D35556
MFC after: 2 weeks

(cherry picked from commit 7ab03740ae87f23250f2a0f0d5991e9989ddddfe)

2 years agolinprocfs: Decode constant_tsc CPU feature
Dmitry Chagin [Wed, 29 Jun 2022 07:34:04 +0000 (10:34 +0300)]
linprocfs: Decode constant_tsc CPU feature

Differential revision: https://reviews.freebsd.org/D35554
MFC after: 2 weeks

(cherry picked from commit 8da00a514e699e4fa788109cf36f3b02168b39d7)

2 years agolastcomm/sa: Remove sparc64 tests, they aren't needed.
Warner Losh [Mon, 4 Oct 2021 16:38:37 +0000 (10:38 -0600)]
lastcomm/sa: Remove sparc64 tests, they aren't needed.

Fix delete-old, since 22375931 MFC, annoy to delete them manually
every make delete-old.

These tests will run only on a sparc64 system, and so never run anymore.

Sponsored by: Netflix

(cherry picked from commit d6dffbae96621a6fbc804c5f31dff6648e0a122c)

2 years agoufs_rename(): revert the bump of fvp nlink count in case of EMLINK for tdvp
Konstantin Belousov [Mon, 4 Jul 2022 10:28:49 +0000 (13:28 +0300)]
ufs_rename(): revert the bump of fvp nlink count in case of EMLINK for tdvp

(cherry picked from commit 513e1bbc739239c9479367b15e5f863a5f891d66)

2 years agoufs_rename(): do not treat ERELOOKUP specially
Konstantin Belousov [Sat, 2 Jul 2022 13:15:57 +0000 (16:15 +0300)]
ufs_rename(): do not treat ERELOOKUP specially

(cherry picked from commit ab5ef5fb6355489e6a960b4d107e6767e2336ea2)

2 years agoUFS rename: make it reliable when using SU and reaching nlink limit
Konstantin Belousov [Wed, 22 Jun 2022 13:54:01 +0000 (16:54 +0300)]
UFS rename: make it reliable when using SU and reaching nlink limit

PR: 165392

(cherry picked from commit bc6d0d72f4f4e96b24d0ad558b271cb6f483801e)

2 years agomips busdma: expunge an extra closing brace
Doug Moore [Tue, 12 Jul 2022 18:45:30 +0000 (13:45 -0500)]
mips busdma: expunge an extra closing brace

A merge left a dangling right brace unaccounted for.
Delete it.

Reported by: jenkins

2 years agoApply tentative llvm fix for avoiding fma on PowerPC SPE
Dimitry Andric [Sat, 9 Jul 2022 13:03:54 +0000 (15:03 +0200)]
Apply tentative llvm fix for avoiding fma on PowerPC SPE

Merge llvm review D77558, by Justin Hibbits:

  PowerPC: Don't hoist float multiply + add to fused operation on SPE

  SPE doesn't have a fmadd instruction, so don't bother hoisting a
  multiply and add sequence to this, as it'd become just a library call.
  Hoisting happens too late for the CTR usability test to veto using the CTR
  in a loop, and results in an assert "Invalid PPC CTR loop!".

Reported by: alfredo
Obtained from: https://reviews.llvm.org/D77558
MFC after: 3 days

(cherry picked from commit 9ef1127008ce94cf626daed346a3c1ee03063617)

2 years agoApply clang fix for assertion building llvm with libc++ 15
Dimitry Andric [Sun, 3 Jul 2022 19:33:22 +0000 (21:33 +0200)]
Apply clang fix for assertion building llvm with libc++ 15

Merge commit f1b0a4fc540f from llvm git (by Richard Smith):

  An expression should only contain an unexpanded parameter pack if it
  lexically contains a mention of the pack.

  Systematically distinguish between syntactic and semantic references to
  packs, especially when propagating dependence from a type into an
  expression. We should consult the type-as-written when computing
  syntactic dependence and should consult the semantic type when computing
  semantic dependence.

  Fixes #54402.

MFC after: 3 days

(cherry picked from commit 3b7f365e4d1bf67d2841d02f18a998c70c27c0a0)

2 years agoiommu_gas: Drop needless bound check in lowermatch
Doug Moore [Tue, 21 Jun 2022 00:34:46 +0000 (19:34 -0500)]
iommu_gas: Drop needless bound check in lowermatch

The loop iteration in iommu_gas_lowermatch checks the bound
a->common->lowaddr twice per loop iteration. Rewrite to test only once
per iteration.  Do not worry about passing to iommu_gas_match_one a
range wholly beyond lowaddr. Since that function checks the upper end
of the range against lowaddr, it'll get rejected there.

Reviewed by: alc
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35522

(cherry picked from commit 70b5d8fa0f9457833027e4a1c57b4e68a9351cac)

2 years agomips_busdma: fix mips errors after merge
Doug Moore [Tue, 12 Jul 2022 17:33:20 +0000 (12:33 -0500)]
mips_busdma: fix mips errors after merge

The change "vm_extern: use standard address checkers everywhere"
introduced bugs, as well as features, into head. After it was
introduced, but before those bugs were addressed, mips support was
dropped from head, so those mips bugs were never fixed in head. Now,
that change and those fixes have been merged into stable/13. This
change fixes two of those bugs that were fixed everywhere else but
never in mips.

Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D35793

2 years agovm_addr_ok: add power2 invariant check
Doug Moore [Mon, 10 Jan 2022 07:17:25 +0000 (01:17 -0600)]
vm_addr_ok: add power2 invariant check

With INVARIANTS defined, have vm_addr_align_ok and vm_addr_bound_ok
panic when passed an alignment/boundary parameter that is not a power
of two.

Reviewed by: alc
Suggested by: kib, se
Differential Revision: https://reviews.freebsd.org/D33725

(cherry picked from commit ae13829ddce0b5fbf12f2b240a26414b41def8ba)

2 years agobusdma: _bus_dmamap_addseg repaired
Doug Moore [Sun, 2 Jan 2022 18:37:05 +0000 (12:37 -0600)]
busdma: _bus_dmamap_addseg repaired

A recent change introduced a one-off error into a test allowing
coalescing chunks into segments.  This fixes that error.

broke a check in _bus_dmamap_addseg on many architectures. This change makes it clear that it is not a particular range that is being boundary-checked, but the proposed union of the two adjacent ranges.
Reported by: se
Reviewed by: se
Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere
Differential Revision: https://reviews.freebsd.org/D33715

(cherry picked from commit f1e7a532d1ee23033fe0f3beb8eee80c412eeefe)

2 years agox86-busdma - Add missing paren
Doug Moore [Fri, 31 Dec 2021 08:33:54 +0000 (02:33 -0600)]
x86-busdma - Add missing paren

Reported by: jenkins
Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere

(cherry picked from commit b7810e05ff1dc23c65ef74447556a764a6a60982)

2 years agoriscv-busdma: Balance parens.
Doug Moore [Fri, 31 Dec 2021 07:59:53 +0000 (01:59 -0600)]
riscv-busdma: Balance parens.
Reported by: jenkins
Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere

(cherry picked from commit b4961268860857e7343f6e7342d34f6a621546d5)

2 years agoiommu_gas: Rename a function missed earlier
Doug Moore [Fri, 31 Dec 2021 07:48:11 +0000 (01:48 -0600)]
iommu_gas: Rename a function missed earlier

Reported by: jenkins
Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere

(cherry picked from commit cfb2aa3f530f45897c1059a45ab82479d90d63fc)

2 years agovm_reserv: #include vm_extern.h explicitly, for arm.
Doug Moore [Fri, 31 Dec 2021 06:40:25 +0000 (00:40 -0600)]
vm_reserv: #include vm_extern.h explicitly, for arm.

Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere
(cherry picked from commit f76916c0956d8318412e7aa30711b8411864ef21)

2 years agovm_phys: convert error back to warning
Doug Moore [Fri, 31 Dec 2021 06:23:46 +0000 (00:23 -0600)]
vm_phys: convert error back to warning

Move an assignment back to where it was before, to turn the
defined-but-not-used error back into a set-but-not-used warning.

Fixes: 01e115ab83a4 vm_phys: #include vm_extern
(cherry picked from commit e6930b1c5f8f9307f72eda1b5b3c504dc009cbc6)

2 years agovm_phys: #include vm_extern
Doug Moore [Fri, 31 Dec 2021 05:31:18 +0000 (23:31 -0600)]
vm_phys: #include vm_extern

Arm64 and powerpc don't include vm_extern.h indirectly in vm_phys.c, which
means that for the sake of those architectures, it must be included explicitly.

Also, fix a set-unused warning that jenkins also found.

Reported by: Jenkins
Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere

(cherry picked from commit 01e115ab83a4b82216e02198dbcc7c794a752711)

2 years agovm_extern: use standard address checkers everywhere
Doug Moore [Fri, 31 Dec 2021 04:09:08 +0000 (22:09 -0600)]
vm_extern: use standard address checkers everywhere

Define simple functions for alignment and boundary checks and use them
everywhere instead of having slightly different implementations
scattered about. Define them in vm_extern.h and use them where
possible where vm_extern.h is included.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D33685

(cherry picked from commit c606ab59e7f9423f7027320e9a4514c7db39658d)

2 years agoftp: Use /var/spool/ftp as ftp's home consistently
Mateusz Piotrowski [Tue, 28 Jun 2022 13:13:39 +0000 (15:13 +0200)]
ftp: Use /var/spool/ftp as ftp's home consistently

The home directory of the ftp user is /var/spool/ftp according to
hier(7). Update the manual page of ftpd(8) to reflect that.

MFC after: 2 weeks

(cherry picked from commit bad2f716f4d3453fb9156b603cfaca44ea30fa31)

2 years agosesutil.8: Polish
Mateusz Piotrowski [Tue, 5 Jul 2022 14:37:18 +0000 (16:37 +0200)]
sesutil.8: Polish

- Use right mdoc macros
- Fix synopsis. Some of the optional command modifiers were not optional
  after all.
- Sort options

MFC after: 1 week

(cherry picked from commit 4e3dc91e4c0750cf39c0a1fefe7435b5b5532f67)

2 years agolinux(4): Implement __vdso_time
Dmitry Chagin [Mon, 4 Jul 2022 20:41:32 +0000 (23:41 +0300)]
linux(4): Implement __vdso_time

PR: 240769
MFC after: 3 days

(cherry picked from commit 42317e642645b36e711b5dd560d06a303a492e0f)

2 years agolinux(4): Use saved cpu feature bits
Dmitry Chagin [Mon, 4 Jul 2022 20:42:07 +0000 (23:42 +0300)]
linux(4): Use saved cpu feature bits

MFC after: 3 days

(cherry picked from commit 03473e8ec8fa8d0f1ea30f85d8796ea9bf94bf29)

2 years agoCatch up with 2004 and improve markup.
Dag-Erling Smørgrav [Thu, 30 Jun 2022 13:36:05 +0000 (13:36 +0000)]
Catch up with 2004 and improve markup.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35676

(cherry picked from commit 42db2dbbc51bffa90dc594f728976dcdb646c2b6)

2 years agoEnable CRC64 checksums in xz.
Dag-Erling Smørgrav [Wed, 29 Jun 2022 20:11:42 +0000 (20:11 +0000)]
Enable CRC64 checksums in xz.

Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35668

(cherry picked from commit 038405f32f71ad8ba0280ae066417f986ede79db)

2 years agounbound: Vendor import 1.16.0
Cy Schubert [Wed, 8 Jun 2022 22:08:42 +0000 (15:08 -0700)]
unbound: Vendor import 1.16.0

Merge commit '5f9f82264b91e041df7cba2406625146e7268ce4' into main

(cherry picked from commit a39a5a6905612447def27b66ffe73b9d11efd80c)

2 years agomountd startup: enable NFSv4 if needed on restart
Mike Karels [Sun, 3 Jul 2022 23:04:41 +0000 (18:04 -0500)]
mountd startup: enable NFSv4 if needed on restart

The mountd script in rc.d sets vfs.nfsd.server_max_nfsvers correctly
when it is run at system startup, relying on the kernel default.
However, if NFSv4 was enabled in /etc/rc.conf later, and the script
was re-run to restart mountd, the sysctl was still set to 3.
Set the sysctl to the right value in all cases.

Reviewed by: rmacklem

(cherry picked from commit 1cf8e6339e9add47107a6c9988a0f509225b7ef6)

2 years agobitstring: fix ff_area() when start!=0
Doug Moore [Tue, 10 May 2022 16:53:52 +0000 (11:53 -0500)]
bitstring: fix ff_area() when start!=0

commit 84e2ae64c597000a0 introduced an error in the ff*_area_at
functions for nonzero start parameters when the bit range sought was
found immediately. It mistakenly replaced '_value = _start' with
'_value = 0' in initialization. Undo that mistake.

Reported by: markj
Reviewed by: markj
Tested by: markj
Fixes: 84e2ae64c597 vm_reserv: use enhanced bitstring for popmaps
Differential Revision: https://reviews.freebsd.org/D35157

(cherry picked from commit 6e7a585348d5b9b96d16c1d76a994236560203c1)

2 years ago<sys/bitstring.h>: Cast _BITSTR_BITS to int in a ternary operator.
John Baldwin [Tue, 1 Feb 2022 17:45:11 +0000 (09:45 -0800)]
<sys/bitstring.h>: Cast _BITSTR_BITS to int in a ternary operator.

This fixes a -Wsign-compare error reported by GCC due to the two
results of the ternary operator having differing signedness.

Reviewed by: dougm, rlibby
Differential Revision: https://reviews.freebsd.org/D34122

(cherry picked from commit 8a67a1a9646ef516fe84ecfa7ec3467b15b9e0cc)

2 years agovm_reserv: use enhanced bitstring for popmaps
Doug Moore [Wed, 12 Jan 2022 17:03:53 +0000 (11:03 -0600)]
vm_reserv: use enhanced bitstring for popmaps

vm_reserv.c uses its own bitstring implemenation for popmaps. Using
the bitstring_t type from a standard header eliminates the code
duplication, allows some bit-at-a-time operations to be replaced with
more efficient bitstring range operations, and, in
vm_reserv_test_contig, allows bit_ffc_area_at to more efficiently
search for a big-enough set of consecutive zero-bits.

Make bitstring changes improve the vm_reserv code.  Define a bit_ntest
method to test whether a range of bits is all set, or all clear.
Define bit_ff_at and bit_ff_area_at to implement the ffs and ffc
versions with a parameter to choose between set- and clear- bits.
Improve the area_at implementation.  Modify the bit_nset and
bit_nclear implementations to allow code optimization in the cases
when start or end are multiples of _BITSTR_BITS.

Add a few new cases to bitstring_test.

Discussed with: alc
Reviewed by: markj
Tested by: pho (earlier version)
Differential Revision: https://reviews.freebsd.org/D33312

(cherry picked from commit 84e2ae64c597000a0152c6772b2c8925773c6f6c)

2 years agovm: alloc pages from reserv before breaking it
Doug Moore [Fri, 24 Dec 2021 18:59:16 +0000 (12:59 -0600)]
vm: alloc pages from reserv before breaking it

Function vm_reserv_reclaim_contig breaks a reservation with enough
free space to satisfy an allocation request and returns the free space
to the buddy allocator. Change the function to allocate the request
memory from the reservation before breaking it, and return that memory
to the caller. That avoids a second call to the buddy allocator and
guarantees successful allocation after breaking the reservation, where
that success is not currently guaranteed.

Reviewed by: alc, kib (previous version)
Differential Revision: https://reviews.freebsd.org/D33644

(cherry picked from commit 0d5fac287294490ac488d74e598e019334610bdb)

2 years agoFix clerical error in page alloc
Doug Moore [Fri, 24 Dec 2021 08:47:21 +0000 (02:47 -0600)]
Fix clerical error in page alloc

Fix a very recent change that introduced a page accounting error in
case of a reserveration being broken.
Reviewed by: alc
Fixes: fb38b29b5609 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
Differential Revision: https://reviews.freebsd.org/D33645

(cherry picked from commit 184c63db3c949d8ba766dc7b2bd2f082404e169d)

2 years agovm_page: Remove extra test from page alloc
Doug Moore [Fri, 24 Dec 2021 04:45:47 +0000 (22:45 -0600)]
vm_page: Remove extra test from page alloc

Extract code from vm_page_alloc_contig_domain into a new function.  Do
so in a way that eliminates a bound-to-fail reservation test after a
reservation is broken by a call from vm_page_alloc_contig_domain.

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

(cherry picked from commit fb38b29b5609b0c0769b2b2e1d6c917c0799f2a0)

2 years agovm_phys: hide vm_phys_set_pool
Doug Moore [Wed, 29 Dec 2021 17:10:31 +0000 (11:10 -0600)]
vm_phys: hide vm_phys_set_pool

It is only called in the file that defines it, so make it static and
remove the declaration from the header.

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

(cherry picked from commit 8119cdd38b4f3ebdba92d8d0658fabbc04a1f238)

2 years agoipmi: do not omit lun in BMC addresses
Yuri [Mon, 4 Jul 2022 06:29:52 +0000 (14:29 +0800)]
ipmi: do not omit lun in BMC addresses

Some systems put sensors on non-0 lun, so we should not omit it.  This
was the only difference with the Linux driver, where DIMM sensors could
be queried, but not on FreeBSD.

See this report[1] on the FreeBSD forums:
https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/

Reviewed by: philip
Tested by: Andrey Lanin[1]
Differential Revision: https://reviews.freebsd.org/D35612

(cherry picked from commit 177f8b3294ef5717060c287fe1206c52ba3ecc53)

2 years agoipmi: correctly handle ipmb requests
Yuri [Mon, 4 Jul 2022 04:55:18 +0000 (12:55 +0800)]
ipmi: correctly handle ipmb requests

Handle IPMB requests using SEND_MSG (sent as driver request as we do not
need to return anything back to userland for this) and GET_MSG (sent as
usual request so we can return the data for RECEIVE_MSG ioctl) pair.

This fixes fetching complete sensor data from boards (e.g. HP ProLiant
DL380 Gen10).

Reviewed by: philip
Differential Revision: https://reviews.freebsd.org/D35605

(cherry picked from commit 18db96dbfd4a09063a0abcefd51fa8d2aeb115d6)
(cherry picked from commit c4995b69db93fdab5fe375eae129aeff1cbca1bb)

2 years agotree.3: document RB_AUGMENT
Doug Moore [Sun, 19 Jun 2022 16:55:44 +0000 (11:55 -0500)]
tree.3: document RB_AUGMENT

Document the RB_AUGMENT macro, and provide an example of its use.
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35518

(cherry picked from commit a8380d272ae791e5de1bc56c761d15ba9b00899f)

2 years agoCorrectly update fs_dsize in growfs(8)
Kirk McKusick [Tue, 28 Jun 2022 04:46:15 +0000 (21:46 -0700)]
Correctly update fs_dsize in growfs(8)

When growing a UFS/FFS filesystem, the size of the summary information
may expand into additional blocks. These blocks must be removed from
fs_dsize which records the number of blocks in the filesystem that can
be used to hold filesystem data.

While here also update the fs_old_dsize and fs_old_size fields for
compatibility with kernels that were compiled before the addition
of UFS2.

(cherry picked from commit 2049cc3218151f8d4108d878196905c34bbf15bc)

2 years agoEliminate set but not used variable.
Kirk McKusick [Tue, 28 Jun 2022 04:37:09 +0000 (21:37 -0700)]
Eliminate set but not used variable.

No functional change intended.

(cherry picked from commit 78dfcf256a443df2a43bdfcce6b7d7af143d964f)

2 years agorc.8: Reference the article about rc scripting
Mateusz Piotrowski [Mon, 4 Jul 2022 10:54:57 +0000 (12:54 +0200)]
rc.8: Reference the article about rc scripting

MFC after: 3 days

(cherry picked from commit 604bc078a502fd188063d4d737763a56484d2c23)

2 years agotslog.4: Document what TSLOG excels at
Mateusz Piotrowski [Fri, 1 Jul 2022 09:17:12 +0000 (11:17 +0200)]
tslog.4: Document what TSLOG excels at

Based on an email mhorne@ sent to arch@.

Reviewed by: debdrup, pauamma_gundo.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34565

(cherry picked from commit 9e337d53dee685327961b8a070d477ef97b85b86)

2 years agobuild(7): fix references to svn(1) and svnlite(1)
Dmitry Morozovsky [Fri, 8 Jul 2022 08:58:18 +0000 (11:58 +0300)]
build(7): fix references to svn(1) and svnlite(1)

Replace them with references to Git.

PR: 254937
Reported by: m.bueker@berlin.de
Differential Revision: https://reviews.freebsd.org/D29949

(cherry picked from commit e444a4c677ee3e86038ba2179c4838f5f4b778cd)

2 years agosnmp_hostres(3): Fix a typo in a debug message
Gordon Bergling [Sun, 3 Jul 2022 12:57:12 +0000 (14:57 +0200)]
snmp_hostres(3): Fix a typo in a debug message

- s/atempt/attempt/

(cherry picked from commit c7b9006af57e453fe5fcb37a98edf61b5c7750f2)

2 years agoaic7xxx: Fix a few common typos in source code comments
Gordon Bergling [Sun, 3 Jul 2022 12:06:48 +0000 (14:06 +0200)]
aic7xxx: Fix a few common typos in source code comments

- s/ingnore/ignore/
- s/ingnored/ignored/

(cherry picked from commit 9bfefcea43efceaeb18e3965af4e84827158aa40)

2 years agofreescale: Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 11:55:40 +0000 (13:55 +0200)]
freescale: Fix a typo in a source code comment

- s/transistions/transitions/

(cherry picked from commit f1334ab76bab083d4e5181e1d7f1b91a533f0392)

2 years agosockatmark(3): Add references to 4.4BSD IPC tutorials
Gordon Bergling [Sun, 3 Jul 2022 13:56:42 +0000 (15:56 +0200)]
sockatmark(3): Add references to 4.4BSD IPC tutorials

Obtained from: NetBSD

(cherry picked from commit 6cea3be922110647df84a08e3a57cc395bec1d24)

2 years agopmc(3): Fix a common typo in a description
Gordon Bergling [Sun, 3 Jul 2022 11:53:01 +0000 (13:53 +0200)]
pmc(3): Fix a common typo in a description

- s/transistioned/transitioned/

(cherry picked from commit a4adfaf712694ce7923d5309cf87d0cd2a598953)

2 years agoata(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 13:12:26 +0000 (15:12 +0200)]
ata(4): Fix a typo in a source code comment

- s/fuctions/functions/

(cherry picked from commit 23781068af7ae7af1fc99126f38fc97e3722633d)

2 years agojme(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 13:13:01 +0000 (15:13 +0200)]
jme(4): Fix a typo in a source code comment

- s/fuctions/functions/

(cherry picked from commit 015d570cc929b7cdc45756aaeb6c870ac5f8ab22)

2 years agoaic7xxx: Fix a few common typo in source code comments
Gordon Bergling [Sun, 3 Jul 2022 12:10:30 +0000 (14:10 +0200)]
aic7xxx: Fix a few common typo in source code comments

- s/irrespecitve/irrespective/

Obtained from: NetBSD

(cherry picked from commit 66147d138ad0c5f7c2db3bca73f47baa6ef9e813)

2 years agopci(4): Fix a common typo in source code comments
Gordon Bergling [Sun, 3 Jul 2022 11:43:44 +0000 (13:43 +0200)]
pci(4): Fix a common typo in source code comments

- s/transistions/transitions/

(cherry picked from commit 00c00c3824cb32abf732a8eb177eaba9385dab8b)

2 years agocrypto: Fix the NULL_HMAC finalizer
Mark Johnston [Fri, 1 Jul 2022 15:04:15 +0000 (11:04 -0400)]
crypto: Fix the NULL_HMAC finalizer

The current implementation leaves the digest buffer partially
uninitialized.

Reported by: syzkaller
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8179db52c2c8692cdabf818bf1b7fdf3ad43b2db)

2 years agorc.subr: use _pidcmd to determine pid for protect
Mariusz Zaborski [Thu, 24 Jun 2021 18:14:31 +0000 (20:14 +0200)]
rc.subr: use _pidcmd to determine pid for protect

This is a more reliable method that accounts for existing pidfiles,
procname and interpreter settings.

Current method of obtaining the pid for oomprotect="YES"|"ALL" processes
in certain cases fails to find a unique pid.

One such case are rc.d scripts defining command as:
command="daemon"

which results in all processes started via daemon being selected and
passed to protect(1) which fails and prints usage:

$ /etc/rc.d/exampled restart
Stopping exampled.
Starting exampled.
usage: protect [-i] command
   protect [-cdi] -g pgrp | -p pid

Running the same with -x reveals what happens:

+ pid='3051 4268 4390 4421 4427 4470 4588 4733 4740 4870 4949 4954 4979
5835 5866 55487 55583 56525 57643 57789 57882 58072 58167 99419'
+ /usr/bin/protect -p 3051 4268 4390 4421 4427 4470 4588 4733 4740 4870
4949 4954 4979 5835 5866 55487 55583 56525 57643 57789 57882 58072 58167
99419
usage: protect [-i] command
   protect [-cdi] -g pgrp | -p pid

We have a more reliable way of obtaining pid already defined in rc.subr
and available when protect(1) needs it. We can simply `eval $_pidcmd`
which also invokes `check_process` but properly accounts for existing
pidfile, procname and interpreter settings.

With the change the pidfile is properly obtained.

Submitted by: Adam Wolk <a.wolk at fudosecurity.com>
Sponsored by: Fudo Security
Differential Revision: https://reviews.freebsd.org/D30367

Approved by: oshogbo

(cherry picked from commit 6ba108e52d175b6833437c8627ae5d0546a4e102)

2 years agolibsysdecode: Grab some more ioctl definitions from CAM
Mark Johnston [Thu, 30 Jun 2022 14:22:38 +0000 (10:22 -0400)]
libsysdecode: Grab some more ioctl definitions from CAM

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ec014502eee7a7d3a7e4d71e41a1e1dbc8a69dce)

2 years agowait.2: Remove sys/types.h from the list of required headers
Mark Johnston [Thu, 30 Jun 2022 14:23:07 +0000 (10:23 -0400)]
wait.2: Remove sys/types.h from the list of required headers

wait.h is self-contained.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b8ec0ce5b4845f74fb230651dfc031afccbcab81)

2 years agohier.7: Document /nonexistent
Mateusz Piotrowski [Thu, 30 Jun 2022 19:58:01 +0000 (21:58 +0200)]
hier.7: Document /nonexistent

MFC after: 1 week

(cherry picked from commit 606cdb2ef3a2574de0934f657eeb018ca6a470cc)

2 years agohier.7: Remove a.out lib directories
Mateusz Piotrowski [Thu, 30 Jun 2022 13:53:53 +0000 (15:53 +0200)]
hier.7: Remove a.out lib directories

Fixes: 76b4234537b2 BSD.usr.dist: remove aout
MFC after: 1 week

(cherry picked from commit d5a381f8c7bcf9ec391540158a3859d8bcd1d007)

2 years agopkg.7: Clean up mdoc
Mateusz Piotrowski [Thu, 30 Jun 2022 13:46:54 +0000 (15:46 +0200)]
pkg.7: Clean up mdoc

MFC after: 1 week

(cherry picked from commit 3beedc3840c29f3f728ed28cbc1450e1b9999f61)

2 years agosysctl.8: Reference sysctl(9)
Mateusz Piotrowski [Thu, 30 Jun 2022 13:34:58 +0000 (15:34 +0200)]
sysctl.8: Reference sysctl(9)

MFC after: 1 week

(cherry picked from commit 0438e9beb552b5e33c5d54748395429c6f9b8075)

2 years agobusdma_iommu: Fine-grained locking for the dmamap's map list
Alan Cox [Wed, 22 Jun 2022 21:51:47 +0000 (16:51 -0500)]
busdma_iommu: Fine-grained locking for the dmamap's map list

Introduce fine-grained locking on the dmamap's list of map entries,
replacing the use of the domain lock.  This is not the most significant
source of lock contention, but it is the easiest to address.

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

(cherry picked from commit eeb46578c21ad37866f49f3bbb3ac738b44abbf6)

2 years agoiommu_gas: Eliminate unnecessary wrappers
Alan Cox [Tue, 14 Jun 2022 19:01:36 +0000 (14:01 -0500)]
iommu_gas: Eliminate unnecessary wrappers

Eliminate trivial wrappers for several iommu_gas functions that serve
no functional purpose.

Reviewed by: br, dougm, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35487

(cherry picked from commit fc2e4f15a9047bbf546cd675ed590b88e54362bd)

2 years agoiommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT
Alan Cox [Sun, 26 Jun 2022 16:48:12 +0000 (11:48 -0500)]
iommu_gas: Fix a recent regression with IOMMU_MF_CANSPLIT

As of 19bb5a7244ff, the IOMMU_MF_CANSPLIT case in iommu_gas_match_one()
must take into account the specified offset.  Otherwise, the recently
changed end calculation in iommu_gas_match_insert() could produce an
end address that crosses the specified boundary by one page.

Reviewed by: dougm
MFC with: 19bb5a7244ff

(cherry picked from commit 7b39a9bc1df37502e8186593f3427b7ff0e4cc71)

2 years agoiommu_gas: Tidy up
Alan Cox [Sun, 26 Jun 2022 05:44:47 +0000 (00:44 -0500)]
iommu_gas: Tidy up

Move a comment to the code that it describes.  Improve the wording.

Style fixes.

MFC after: 2 weeks

(cherry picked from commit da33f6d76b9d0c00649c692f6cb2b3b33bf5af30)

2 years agoiommu_gas: Add a missing error-case unlock
Alan Cox [Tue, 21 Jun 2022 04:48:31 +0000 (23:48 -0500)]
iommu_gas: Add a missing error-case unlock

Release the domain lock when iommu_gas_reserve_region_extend()'s call to
iommu_gas_reserve_region_locked() fails.

MFC after: 2 weeks

(cherry picked from commit 0ba1d8608234eee767b475627da6e5903ce7536a)

2 years agobusdma_iommu: Eliminate a redundant trunc_page()
Alan Cox [Mon, 20 Jun 2022 18:40:42 +0000 (13:40 -0500)]
busdma_iommu: Eliminate a redundant trunc_page()

Since OFF_TO_IDX() inherently truncates the given value, there is no
need to perform trunc_page() on it.

MFC after: 2 weeks

(cherry picked from commit 32e82bcc152783dfe0d03ffdd864cedfddbc80d7)

2 years agoiommu_gas: Eliminate a stale comment
Alan Cox [Mon, 20 Jun 2022 17:14:53 +0000 (12:14 -0500)]
iommu_gas: Eliminate a stale comment

As of 19bb5a7244ff, the size passed to iommu_gas_map is no longer
required to be a multiple of the CPU page size.

MFC after: 2 weeks

(cherry picked from commit 164491fb038724405b9e38355b569ef8dd4ad068)

2 years agoiommu_gas: Correct a broken KASSERT
Alan Cox [Fri, 17 Jun 2022 17:03:06 +0000 (12:03 -0500)]
iommu_gas: Correct a broken KASSERT

If iommu_gas_find_space() ever called iommu_gas_uppermatch(), and it
succeeded in allocating space, then the subsequent KASSERT would be
triggered.  Change that KASSERT to accept either success or ENOMEM.

MFC after: 1 week

(cherry picked from commit e6775534aee1963a39e5ee762b8eab1d7dfb1b6b)

2 years agoiommu_gas: make iommu_gas_lowermatch non-recursive
Doug Moore [Wed, 15 Jun 2022 16:32:56 +0000 (11:32 -0500)]
iommu_gas: make iommu_gas_lowermatch non-recursive

Change the recursive implementation to one that uses parent pointers
to walk back up the rb-tree, to slightly improve performance.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35486

(cherry picked from commit f979ad00306508f0c9fc925ec05b2413b70ab5f1)

2 years agoiommu_gas: use to first-fit search for lowermatch
Doug Moore [Tue, 14 Jun 2022 05:47:22 +0000 (00:47 -0500)]
iommu_gas: use to first-fit search for lowermatch

Reverse the order of the search for a free space in lowermatch, to
make it a first-fit search. Iommu_gas_match_one always allocates from
the beginning of the free gap discovered from searching the tree, so
the current code isn't really allocating in a reverse first-fit
anyway, and making the search first-fit reduces the number of iommu
page table pages that are used.

Reported by: alc
Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35458

(cherry picked from commit 975715b78819c6de68df15a6dd78157c6dba0fcb)

2 years agoiommu_gas: pass size to iommu_map without rounding
Doug Moore [Fri, 10 Jun 2022 18:56:54 +0000 (13:56 -0500)]
iommu_gas: pass size to iommu_map without rounding

Let the caller to iommu_map pass the size parameter without rounding
it up to a multiple of page size.  Let iommu_map round it up when
necessary, which is not all of the time, so that in some cases less
space is reserved.

Reviewed by: alc, kib (previous version)
Tested by: pho, br
Discussed with: andrew
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35424

(cherry picked from commit 19bb5a7244ff0374f44068a20df9393a1c88de5d)

2 years agoCheck if iommu ctx is valid before passing it to functions.
Ruslan Bukin [Sat, 7 May 2022 09:27:17 +0000 (10:27 +0100)]
Check if iommu ctx is valid before passing it to functions.

Differential Revision: https://reviews.freebsd.org/D35130
Sponsored by: UKRI

(cherry picked from commit 8b8e56dd5bc781b7d1c7185cd267b0b16a637aa2)