]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agousr.bin/gh-bc, contrib/bc: update to version 5.0.0
Stefan Eßer [Tue, 10 Aug 2021 08:42:54 +0000 (10:42 +0200)]
usr.bin/gh-bc, contrib/bc: update to version 5.0.0

Merge commit 2f57ecae4b98e76e5d675563785a7e6c59c868c4

This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.

MFC after: 1 week

(cherry picked from commit 44d4804d1945435745518cd09eb8ae6ab22ecef4)

vendor/bc: update to upstream version 5.0.2

(cherry picked from commit a60ef1802a36f2f2a5611564191440ea1c1e2f17)
(cherry picked from commit 662087dfd0668dee82ed20d00ced662aa3595059)

contrib/bc: remove files ommitted from the release

A number of files have been removed from the release distribution of
this bc implementation. They were mostly relevant for pre release
testing and benchmarking to identify regressions. The Markdown
sources of the man pages are only relevant for combinations of build
options not used in FreeBSD and need non-default conversion tools
(available as ports in FreeBSD).

All the omitted files can be found in the upstream git repository,
and they are fetched when building this software as a port. But they
have never been used in the FreeBSD base system.

(cherry picked from commit ea31d1a5c490193348e0b71fdda6d08a2c80a2eb)

Remove files that were checked in with wrong .gitattributes

These files will be added back in updated form, but are only relevant
for the Windows platform, anyway.

(cherry picked from commit d6c323eda215d05091f56d02a8274eb50c244a6f)

contrib/bc: merge version 5.1.0 from vendor branch

This version adds options and functions that allow to print numbers
in the open interval (-1 .. 1) with or without a leading 0 digit.

Additionally, an option has been added to prevent line wrap and
allows to print arbitrarily long results on a single line.

Merge commit '5d58a51571721190681c50d4bd3a1f45e6282d72'

(cherry picked from commit d43fa8ef534ac87a16843d45264f56cf11e0fcbc)

contrib/bc: update to version 5.1.1

Merge commit '6f49f5cdde1c62c4e5a743e895f3afe592b5c0e5'

(cherry picked from commit a30efc5ca7272e446abb71f0d72c76539f267bb6)

contrib/bc: temporarily disconnect the tests for 5.0.2

The tests that come with version 5.0.2 have been extended to cover the
line editing functions. It has been found that these tests generate
false negative results in FreeBSD, most likely due to an issue in the
pexpect functionality used.

These history tests are skipped on systems that do not have python and
py-pexpect installed (and thus are unlikely to cause CI test failures),
but in order to not cause irritating failures on systems were these
packages are in fact installed, I temporarily disconnect them.

I had planned to skip this version due to the issue with the history
tests, but some committer has asked me to go ahead since the currently
used version 5.0.0 contains a macro name that collides with a project
he is working on.

No MFC of this version is planned. A version 5.0.3 is expected to be
released soon, and that version will allow to reconnect the tests and
will be MFCed.

(cherry picked from commit f774652b0e837be415abd20935eae3466ea34a20)

Add back Windows only VCXProj files

(cherry picked from commit ded0d3d486eba766f613070de0ed12029a9a3816)

contrib/bc: re-enable tests after the import of version 5.1.0

The tests have been fixed to not write any data outside of the
temporary work directory provided by the test framework.

MFC after: 3 days

(cherry picked from commit b8d895faf47afb8f3b31055e2ec2db8d0df5db23)

Revert erroneous commit ded0d3d486eba

These files came from a prior commit to contrib/bc and seem to have
been placed in the top of the source tree by a failed git rebase.

Reported by: markj

(cherry picked from commit f902ca97bdbceccf62b4b02b0321af91ea398925)

2 years agomlx4en(4): Fix wrong mbuf cluster size in mlx4_en_debugnet_init()
Hans Petter Selasky [Tue, 5 Oct 2021 08:46:56 +0000 (10:46 +0200)]
mlx4en(4): Fix wrong mbuf cluster size in mlx4_en_debugnet_init()

This fixes an "invalid cluster size" panic when debugnet is activated.

panic()
m_getzone()
debugnet_mbuf_reinit()
debugnet_any_ifnet_update()
ifhwioctl()
ifioctl()

Submitted by: ae@
PR: 258923
Sponsored by: NVIDIA Networking

(cherry picked from commit 5a7de2b42caf6241e87b417a0521e9ab303989d7)

2 years agosound(4): Implement mixer mute control for feeder channels.
Hans Petter Selasky [Tue, 28 Sep 2021 07:41:18 +0000 (09:41 +0200)]
sound(4): Implement mixer mute control for feeder channels.

PR: 258711
Differential Revision: https://reviews.freebsd.org/D31636
Sponsored by: NVIDIA Networking

(cherry picked from commit 4a83ca1078e3ec70159741b51a6b48e844ada9f5)

2 years agoObsoleteFiles.inc: stop removing pthread_mutexattr_get/setpshared.3
Konstantin Belousov [Sun, 10 Oct 2021 14:38:20 +0000 (17:38 +0300)]
ObsoleteFiles.inc: stop removing pthread_mutexattr_get/setpshared.3

(cherry picked from commit 24b51c7295db6b316250f0288aaf05660a81063e)

2 years agomlx5_en: fix use of CALLOUT_DIRECT
Konstantin Belousov [Wed, 8 Sep 2021 15:37:20 +0000 (18:37 +0300)]
mlx5_en: fix use of CALLOUT_DIRECT

(cherry picked from commit 0eb2dcd32ea6fb59661d709872e02ea6b3e7b9e2)

2 years agoRemove obsolete amd(8) rc.conf configuration
Tom Hukins [Tue, 5 Oct 2021 14:34:52 +0000 (14:34 +0000)]
Remove obsolete amd(8) rc.conf configuration

The script that used these was removed in 13f7dbe822d5f along with amd
itself.

Fixes: 13f7dbe822d5 ("retire amd(8)")
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/548

(cherry picked from commit 70ffa69e1bc7d6acbe061315743b1407b7d722d8)

2 years agoRPCBIND: skip ipv6 link local when request is not from link local address
David Bright [Mon, 4 Oct 2021 15:43:41 +0000 (08:43 -0700)]
RPCBIND: skip ipv6 link local when request is not from link local address

RPCINFO on macOS behaves different compared to other linux clients and
doesn't provide request address in rpcb structure of the
RPCBPROC_GETADDRLIST call which doesn't seem to be forbidden.

In this case RPCBIND uses RPC call's source address and picks a
closest corresponding local address. If there are no addresses in the
same subnet as the source address, return of RPCBIND may vary
depending on the order of addresses returned in getifaddrs. If a link
local precedes global address it may be returned even if the request
comes from neither a link local nor from link local in a different
scope, which will prevent services like nfs from working in tpc6
scenario on macOS clients. Issue can be seen only on FreeBSD rpcbind
port due to changes in workflow of addrmerge call.

Submitted by: Dmitry Ovsyannikov (Dmitry.Ovsyannikov@dell.com)
Sponsored by: Dell EMC

(cherry picked from commit d18c9a91979543adc182c7b28819691b64fda388)

2 years agoFix the arm64 L2_BLOCK_MASK definition
Andrew Turner [Tue, 21 Sep 2021 13:46:10 +0000 (13:46 +0000)]
Fix the arm64 L2_BLOCK_MASK definition

It was missing the top 16 bits.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5a619ca07a2d6614b7b4ecbb7078d0949702dcd2)

2 years agoAdd ELF macros found in the aaelf64 spec
Andrew Turner [Mon, 20 Sep 2021 08:55:44 +0000 (08:55 +0000)]
Add ELF macros found in the aaelf64 spec

The arm64 aaelf64 spec [0] has DT_AARCH64_ that could be used with
dynamic linking. It also adds GNU_PROPERTY_AARCH64_FEATURE_1_AND used
to tell the kernel which CPU features the binary is compatible with,
but does not require to execute correctly.

Add these values so the kernel and elf tools can make use of them.

[0] https://github.com/ARM-software/abi-aa/blob/2021Q1/aaelf64/aaelf64.rst

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b94d360e4aa66d626ad5a0acde683ae9a9c71729)

2 years agoUse a 64 bit read to access GICR_TYPER
Andrew Turner [Wed, 15 Sep 2021 09:13:41 +0000 (09:13 +0000)]
Use a 64 bit read to access GICR_TYPER

The GICv3 ITS only needs to implement 32 bit access to the GICR_TYPER
when the CPU implements AArch32. As this may not always be the case
use a 64 bit read when checking if the ITS is enabled on the CPU.

PR: 258217
Reported by: Olivier Delande <olivier.delande@provenrun.com>
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1896a0094317c80d46beff5ad42b68215513c996)

2 years agovfs: hoist cn_thread assert in namei
Mateusz Guzik [Fri, 1 Oct 2021 21:13:38 +0000 (23:13 +0200)]
vfs: hoist cn_thread assert in namei

Making it condtional on whether ktrace happens to be enabled makes no
sense.

(cherry picked from commit c9536389d732feecf61afa4632397d67b04b2ab4)

2 years agolinprocfs: find cwd and root handling
Mateusz Guzik [Thu, 30 Sep 2021 10:50:18 +0000 (12:50 +0200)]
linprocfs: find cwd and root handling

The code would incorrectly use curthread instead of the target proc to
resolve vnodes.

Fixes: 8d03b99b9dafe928 ("fd: move vnodes out of filedesc into a dedicated structure")
PR: 258729
Noted by:  Damjan Jovanovic <damjan.jov@gmail.com>

(cherry picked from commit 69ab52838655912cf89699e0b2d21d244d3b9b27)

2 years agofd: add pwd_hold_proc
Mateusz Guzik [Thu, 30 Sep 2021 10:49:51 +0000 (12:49 +0200)]
fd: add pwd_hold_proc

(cherry picked from commit 85c855d31b18d7a8ab534259f27444c81b6ec797)

2 years agommc: fix 1-byte reallocs (when it should have been sizeof device_t)
Mateusz Guzik [Sat, 25 Sep 2021 12:49:43 +0000 (14:49 +0200)]
mmc: fix 1-byte reallocs (when it should have been sizeof device_t)

Reported by KASAN:
panic: ASan: Invalid access, 8-byte write at 0xfffffe00f0992610, RedZonePartial(1)
panic() at panic+0xb5/frame 0xffffffff86a595b0
__asan_store8_noabort() at __asan_store8_noabort+0x376/frame 0xffffffff86a59670
mmc_go_discovery() at mmc_go_discovery+0x6c61/frame 0xffffffff86a5a790
mmc_delayed_attach() at mmc_delayed_attach+0x35/frame 0xffffffff86a5a7b0
[snip]

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

(cherry picked from commit 13c63ae08df43d4e662b73ea3e05137fff88e639)

2 years agofifo: support flock
Mateusz Guzik [Sat, 25 Sep 2021 12:24:39 +0000 (14:24 +0200)]
fifo: support flock

This evens it up with Linux.

Original patch by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D24255#565302

(cherry picked from commit d71e1a883c92b8b166eea59734850acd54048d72)

2 years agoipsec: enter epoch before calling into ipsec_run_hhooks
Mateusz Guzik [Fri, 17 Sep 2021 12:00:20 +0000 (14:00 +0200)]
ipsec: enter epoch before calling into ipsec_run_hhooks

pfil_run_hooks which eventually can get called asserts on it.

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

(cherry picked from commit 590d0715b348d0d8da0c0355cebd9dff18e39831)

2 years agovfs: add missing VIRF_MOUNTPOINT in vfs_mountroot_shuffle
Mateusz Guzik [Sat, 18 Sep 2021 08:13:33 +0000 (10:13 +0200)]
vfs: add missing VIRF_MOUNTPOINT in vfs_mountroot_shuffle

Reported by: mav

(cherry picked from commit 7b2ac8eb9be76c96356b6e9a7c06a8080ea841ae)

2 years agovfs: add the missing vnode interlock in vfs_mountroot_shuffle
Mateusz Guzik [Sat, 18 Sep 2021 08:12:27 +0000 (10:12 +0200)]
vfs: add the missing vnode interlock in vfs_mountroot_shuffle

Around v_mountedhere assignment.

(cherry picked from commit 0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f)

2 years agolockmgr: fix lock profiling of face adaptive spinning
Mateusz Guzik [Sat, 11 Sep 2021 18:23:51 +0000 (18:23 +0000)]
lockmgr: fix lock profiling of face adaptive spinning

(cherry picked from commit f902e4bb04ad717935a97ce1ae59e2dd389d940d)

2 years agocache: count vnodes in cache_purgevfs
Mateusz Guzik [Sat, 18 Sep 2021 08:30:15 +0000 (10:30 +0200)]
cache: count vnodes in cache_purgevfs

(cherry picked from commit a2cb65b8fe975a8f228258e3057b62e068dbf8e2)

2 years agovfs: retire VNODE_REFCOUNT_FENCE_* macros
Mateusz Guzik [Sat, 18 Sep 2021 08:14:35 +0000 (10:14 +0200)]
vfs: retire VNODE_REFCOUNT_FENCE_* macros

They are unused as of last year.

(cherry picked from commit 5d8e32a66c1700323c570d25b03672f35f4e0110)

2 years agoprometheus_sysctl_exporter(8): filter output using a regex
Robert Wing [Fri, 8 Oct 2021 01:00:27 +0000 (17:00 -0800)]
prometheus_sysctl_exporter(8): filter output using a regex

Add two options, -i and -e, for filtering prometheus metrics.

Each option takes a regular expression as an argument. The provided
regex will be tested against the prometheus metric name.

The -i option includes metrics matching the given regex.
The -e option excludes metrics matching the given regex.

Sponsored by:   Modirum MDPay
Sponsored by:   Klara Inc.
Reviewed by: 0mp, debdrup
Differential Revision: https://reviews.freebsd.org/D32269

(cherry picked from commit 8ff2b52241400f2b5c2287b91e6e12b97ffd5773)

2 years agokern_ctf: Use zlib's uncompress function for simpler code.
Yoshihiro Ota [Sun, 26 Sep 2021 06:28:43 +0000 (23:28 -0700)]
kern_ctf: Use zlib's uncompress function for simpler code.

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

2 years agopci_pci: Support growing bus ranges in bus_adjust_resource for NEW_PCIB
Jessica Clarke [Sun, 3 Oct 2021 18:35:26 +0000 (19:35 +0100)]
pci_pci: Support growing bus ranges in bus_adjust_resource for NEW_PCIB

This is the same underlying problem as 262459806433, just for bus ranges
rather than windows. SiFive's HiFive Unmatched has the following
topology:

  Root Port <---> Bridge <---> Bridge <-+-> Bridge <---> (Unused)
   (pcib0)        (pcib1)      (pcib2)  |   (pcib3)
                                        +-> Bridge <---> xHCI
                                        |   (pcib4)
                                        +-> Bridge <---> M.2 E-key
                                        |   (pcib5)
                                        +-> Bridge <---> M.2 M-key
                                        |   (pcib6)
                                        +-> Bridge <---> x16 slot
                                            (pcib7)

If a device is plugged into the x16 slot that itself has a bridge, such
as many graphics cards, we currently fail to allocate a bus number for
its child bus (and so pcib_attach_child skips adding a child bus for
further enumeration) as, when the new child bridge attaches, it attempts
to allocate a bus number from its parent (pcib7) which in turn attempts
to grow its own bus range by calling bus_adjust_resource on its own
parent (pcib2) whose bus rman cannot accommodate the request and needs
to itself be extended by calling its own parent (pcib1). Note that
pcib3-7 do not face the same issue when they attach since pcib1 ends up
managing bus numbers 1-255 from the beginning and so never needs to grow
its own range.

Reviewed by: jhb, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32011

(cherry picked from commit 31776afdc79d5fb1ea211cc2a69c17c62b3dc8ff)

2 years agoriscv: Add vt and kbdmux to GENERIC for video console support
Jessica Clarke [Sun, 3 Oct 2021 18:34:53 +0000 (19:34 +0100)]
riscv: Add vt and kbdmux to GENERIC for video console support

No in-tree drivers are supported for RISC-V (given it supports UEFI we
could enable the EFI framebuffer, but U-Boot has very limited hardware
support and EDK2 remains a work in progress), but drm-kmod exists with
drivers for video cards that can be used with the HiFive Unmatched.

Reviewed by: imp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32001

(cherry picked from commit 2404f03fca7e5f62946d0da0f614c9db75a0df09)

2 years agoLinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards
Jessica Clarke [Sun, 3 Oct 2021 18:34:40 +0000 (19:34 +0100)]
LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards

One of the three uses is already guarded; this guards the remaining ones
to support architectures like riscv that do not provide write-combining,
and is needed to build drm-kmod on riscv.

Reviewed by: hselasky, manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31999

(cherry picked from commit 8167c92f65bc20145467b3b98c842cde57736900)

2 years agolibgcc_s: Export 64-bit int to 128-bit float functions
Jessica Clarke [Sun, 3 Oct 2021 18:34:25 +0000 (19:34 +0100)]
libgcc_s: Export 64-bit int to 128-bit float functions

The corresponding 32-bit int and 128-bit int functions were added in
790a6be5a169, as were all combinations of the float to int functions,
but these two were overlooked. __floatditf is needed to build curl for
riscv as there's a signed 64-bit int to 128-bit float conversion in
lib/progress.c's trspeed as of 7.77.0.

Reviewed by: dim
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31997

(cherry picked from commit 7047568821a9019359a8518e1f1481f73d6e5445)

2 years agoriscv: Add a stub pmap_change_attr implementation
Jessica Clarke [Sun, 3 Oct 2021 18:33:47 +0000 (19:33 +0100)]
riscv: Add a stub pmap_change_attr implementation

pmap_change_attr is required by drm-kmod so we need the function to
exist. Since the Svpbmt extension is on the horizon we will likely end
up with a real implementation of it, so this stub implementation does
all the necessary page table walking to validate the input, ensuring
that no new errors are returned once it's implemented fully (other than
due to out of memory conditions when demoting L2 entries) and providing
a skeleton for that future implementation.

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

(cherry picked from commit 1be2e16df1d29148aee83964330a71ae403c6078)

2 years agollvm-objcopy: Install llvm-strip link
Jessica Clarke [Mon, 13 Sep 2021 20:52:40 +0000 (21:52 +0100)]
llvm-objcopy: Install llvm-strip link

Just as elftoolchain's objcopy doubles as strip, so does LLVM's. Note
that we do not currently have a committed copy of the manpage generated
from the rST source so no manpage is installed for llvm-strip.

(Note this is only a partial MFC, as WITH_LLVM_BINUTILS was not MFC'ed)

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
Tested by: Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after: 1 week

(cherry picked from commit f28c1d0c5c6c6532df0dfa38eaf804343988d163)

2 years agolibc: Fix build on case-insensitive file systems
Jessica Clarke [Fri, 10 Sep 2021 00:19:38 +0000 (01:19 +0100)]
libc: Fix build on case-insensitive file systems

On case-insensitive file systems (most likely to be seen on macOS, where
it is the default), _Fork.o for the new POSIX _Fork function conflicts
with _fork.o for the PSEUDO file. This results in non-determinsitic
behaviour in terms of which ends up being present; if _Fork.o wins then
the build fails to link libc.so due to missing __sys_fork, and if
_fork.o wins then libc silently fails to include the implementation of
_Fork. A similar issue occurred in the past for C99's _Exit conflicting
with exit(2) and was fixed in cb1cb6a2a83f, so this adds a fix based on
that.

As a longer-term solution it might be better to instead make the
generated files use a different prefix that's less likely to conflict
with other things (such as __sys_foo.o given they always contain that)
but that's a rather more invasive change.

Fixes: 49ad342cc10c ("Add _Fork()")
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31895

(cherry picked from commit 877175a17a0a5da3f4f43ca9f38adb04042f4cf5)

2 years agoreadlinkat(2): allow O_PATH fd
Konstantin Belousov [Sat, 9 Oct 2021 05:12:05 +0000 (08:12 +0300)]
readlinkat(2): allow O_PATH fd

PR: 258856

(cherry picked from commit 5fb54d2fc845464ea809e6a1a69380693943cf51)

2 years agovm_fault: do not trigger OOM too early
Konstantin Belousov [Mon, 4 Oct 2021 06:36:02 +0000 (09:36 +0300)]
vm_fault: do not trigger OOM too early

(cherry picked from commit 174aad047e12e8f30f9a5919ca1c08919441a217)

2 years agoMake core dump writes interruptible with SIGKILL
Konstantin Belousov [Tue, 5 Oct 2021 05:11:32 +0000 (08:11 +0300)]
Make core dump writes interruptible with SIGKILL

(cherry picked from commit b5cadc643e853fa4cb23e5315e6f40bf9979a9c0)

2 years agocore(5): explicitly mention the core file size limit name
Konstantin Belousov [Tue, 5 Oct 2021 14:52:44 +0000 (17:52 +0300)]
core(5): explicitly mention the core file size limit name

(cherry picked from commit 2ec505d2b863ca03d542a94e8417358e48e2606d)

2 years agoAdd curproc_sigkilled()
Konstantin Belousov [Tue, 5 Oct 2021 05:08:51 +0000 (08:08 +0300)]
Add curproc_sigkilled()

(cherry picked from commit 244ab56611c15e737b76cb3950c32e37b67c26fc)

2 years agosys/proc.h: remove dead prototype
Konstantin Belousov [Tue, 5 Oct 2021 05:07:27 +0000 (08:07 +0300)]
sys/proc.h: remove dead prototype

(cherry picked from commit 7a9775e9d06f629c5441124204d68d43a9f326dc)

2 years agokern_sig.c: Remove unused SIGPROP_CANTMASK
Konstantin Belousov [Tue, 5 Oct 2021 04:55:54 +0000 (07:55 +0300)]
kern_sig.c: Remove unused SIGPROP_CANTMASK

(cherry picked from commit dc2d0899bba62d79083daeb83c6fac49abf28c3b)

2 years agoWhen queuing ignored signal, only abort target thread' sleep if it is inside sigwait()
Konstantin Belousov [Sun, 3 Oct 2021 02:03:59 +0000 (05:03 +0300)]
When queuing ignored signal, only abort target thread' sleep if it is inside sigwait()

(cherry picked from commit 9b86d3e5de1997ed8d3153d4530bcb981e6602b9)

2 years agoWhen sending ignored signal, arrange for zero return code from sleep
Konstantin Belousov [Fri, 1 Oct 2021 06:59:02 +0000 (09:59 +0300)]
When sending ignored signal, arrange for zero return code from sleep

(cherry picked from commit f17eb93d5540ec2bf422d96195820bba5021fa9c)

2 years agoMove td_pflags2 TDP2_SIGWAIT to td_flags TDF_SIGWAIT
Konstantin Belousov [Sun, 3 Oct 2021 01:52:39 +0000 (04:52 +0300)]
Move td_pflags2 TDP2_SIGWAIT to td_flags TDF_SIGWAIT

(cherry picked from commit b599982b65e36523a8aa828a9d504135144158db)

2 years agoFix mistakes in link(2) and shm_open(2)
Konstantin Belousov [Wed, 6 Oct 2021 03:38:26 +0000 (06:38 +0300)]
Fix mistakes in link(2) and shm_open(2)

PR: 258957

(cherry picked from commit 8d3cd7767a2ea1816c31e1dbe7957253e723e559)

2 years agoamd64 efirt: do not flush cache for runtime pages
Konstantin Belousov [Tue, 5 Oct 2021 14:14:11 +0000 (17:14 +0300)]
amd64 efirt: do not flush cache for runtime pages

(cherry picked from commit ce21d4bff1bc7e562471eeab6fb012b35029bf50)

2 years agoamd64: add pmap_page_set_memattr_noflush()
Konstantin Belousov [Tue, 5 Oct 2021 14:12:05 +0000 (17:12 +0300)]
amd64: add pmap_page_set_memattr_noflush()

(cherry picked from commit 33c17670afdb008097858d2fff8d4c4a47d68158)

2 years agoapic: initialize lapic_paddr statically
Konstantin Belousov [Tue, 5 Oct 2021 13:19:56 +0000 (16:19 +0300)]
apic: initialize lapic_paddr statically

(cherry picked from commit f8d3368b4346237deeaaaa91308ce78f8e2ea820)

2 years agoamd64 sendsig: fix context corruption
Konstantin Belousov [Mon, 27 Sep 2021 16:57:25 +0000 (19:57 +0300)]
amd64 sendsig: fix context corruption

(cherry picked from commit b1e2f063ae912dc5b7a7f6638ccb3aff14f299cf)

2 years agoRevert "linux32: add a hack to avoid redefining the type of the savefpu tag"
Konstantin Belousov [Wed, 22 Sep 2021 18:54:39 +0000 (21:54 +0300)]
Revert "linux32: add a hack to avoid redefining the type of the savefpu tag"

(cherry picked from commit e36d0e86e3282cde5a12b6a623e6deefaabfd0c4)

2 years agoia32_get_fpcontext(): xfpusave can be legitimately NULL
Konstantin Belousov [Tue, 21 Sep 2021 21:09:34 +0000 (00:09 +0300)]
ia32_get_fpcontext(): xfpusave can be legitimately NULL

(cherry picked from commit c2ee4dfd04970f1597eea58bb30eb93e1ed5a491)

2 years agoamd64: consistently use uprintf() to report weird situations in sigreturn
Konstantin Belousov [Thu, 16 Sep 2021 13:48:27 +0000 (16:48 +0300)]
amd64: consistently use uprintf() to report weird situations in sigreturn

(cherry picked from commit 2e79a216329f62a78dbbc72256e782353e220968)

2 years agoamd64: eliminate td_md.md_fpu_scratch
Konstantin Belousov [Wed, 15 Sep 2021 18:37:47 +0000 (21:37 +0300)]
amd64: eliminate td_md.md_fpu_scratch

(cherry picked from commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2)

2 years agoamd64: stop using top of the thread' kernel stack for FPU user save area
Konstantin Belousov [Mon, 13 Sep 2021 21:05:47 +0000 (00:05 +0300)]
amd64: stop using top of the thread' kernel stack for FPU user save area

MFC note: this commit changes layout of td_md for amd64, resulting in
static checks for struct thread ABI in kern_thread.c to fail.  Next
two commits restore the layout, I decided to not overcomplicate the
merge and not do the work that is going to be overwritten immediately.

(cherry picked from commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1)

2 years agolinux32: add a hack to avoid redefining the type of the savefpu tag
Konstantin Belousov [Mon, 13 Sep 2021 21:40:02 +0000 (00:40 +0300)]
linux32: add a hack to avoid redefining the type of the savefpu tag

(cherry picked from commit 0f6829488ef32142b9ea1c0806fb5ecfe0872c02)

2 years agoexec_machdep.c: some style, use ANSI C definition for sys_sigreturn()
Konstantin Belousov [Mon, 13 Sep 2021 20:37:26 +0000 (23:37 +0300)]
exec_machdep.c: some style, use ANSI C definition for sys_sigreturn()

(cherry picked from commit 9151abe323034275014dcfffb4a793bc5032bf87)

2 years agoamd64: move signal handling and register structures manipulations into exec_machdep.c
Konstantin Belousov [Mon, 13 Sep 2021 20:33:37 +0000 (23:33 +0300)]
amd64: move signal handling and register structures manipulations into exec_machdep.c

(cherry picked from commit 12ca33f44fc76890336f517ace402b47b9afb134)

2 years agoamd64: centralize definitions of CS_SECURE and EFL_SECURE
Konstantin Belousov [Tue, 14 Sep 2021 16:07:31 +0000 (19:07 +0300)]
amd64: centralize definitions of CS_SECURE and EFL_SECURE

(cherry picked from commit a42d362bb54af91d8b82dca086fa656f4624bae2)

2 years agolibc: vDSO timekeeping: Add pvclock support
Adam Fenn [Sat, 7 Aug 2021 20:11:29 +0000 (13:11 -0700)]
libc: vDSO timekeeping: Add pvclock support

(cherry picked from commit a3d932dfef5edc9d1c947b02fb93a64d63a291cb)

2 years agopvclock: Add vDSO support
Adam Fenn [Sat, 7 Aug 2021 20:10:04 +0000 (13:10 -0700)]
pvclock: Add vDSO support

(cherry picked from commit d4b2d3035a23d5dc468d41151487a8299bf45cdc)

2 years agokvm_clock: KVM paravirtual clock support
Adam Fenn [Wed, 4 Aug 2021 15:42:48 +0000 (08:42 -0700)]
kvm_clock: KVM paravirtual clock support

(cherry picked from commit 6c69c6bb4c7ffde48b130df707799d4eca21ca9f)

2 years agopvclock: Add 'struct pvclock' API
Adam Fenn [Sat, 7 Aug 2021 20:01:46 +0000 (13:01 -0700)]
pvclock: Add 'struct pvclock' API

(cherry picked from commit 0b3382b863f3195d88b99f94d5af7fe4a7b9726a)

2 years agox86: files: Make sys/x86/x86/pvclock.c optional
Adam Fenn [Wed, 4 Aug 2021 15:10:43 +0000 (08:10 -0700)]
x86: files: Make sys/x86/x86/pvclock.c optional

(cherry picked from commit 346f5a0c483b7c159efd7c8faf4a18f3e3f77158)

2 years agox86: cpufunc: Add rdtsc_ordered()
Adam Fenn [Wed, 28 Jul 2021 17:12:00 +0000 (10:12 -0700)]
x86: cpufunc: Add rdtsc_ordered()

(cherry picked from commit 652ae7b11485d9f991ea66a56aa79d4dd9cd1103)

2 years agox86: cpufunc: Add rdtscp_aux()
Adam Fenn [Mon, 26 Jul 2021 19:59:55 +0000 (12:59 -0700)]
x86: cpufunc: Add rdtscp_aux()

(cherry picked from commit 908e277230ef1a80589f85687f5b422b0e863e79)

2 years agonemtap: lb app: Validate ihl field when hashing packet
Vincenzo Maffione [Sun, 26 Sep 2021 13:44:51 +0000 (13:44 +0000)]
nemtap: lb app: Validate ihl field when hashing packet

MFC after: 1 week

(cherry picked from commit f7cef43aa9a357582a703c75dafa4a44c1b2f28c)

2 years agoti(4): Fix a typo in an error message
Gordon Bergling [Sat, 2 Oct 2021 08:51:29 +0000 (10:51 +0200)]
ti(4): Fix a typo in an error message

- s/chanels/channels/

(cherry picked from commit 42dfad2ef12755d27e0e34656a2624f0dac2c502)

2 years agoqlnxe: Fix typos in two error messages
Gordon Bergling [Sat, 2 Oct 2021 08:49:51 +0000 (10:49 +0200)]
qlnxe: Fix typos in two error messages

- s/erorr/error/

(cherry picked from commit 957d9ba0c3f908462915c9aed6900c50c8c76210)

2 years agoe1000: Function prototype cleanup
Kevin Bowling [Wed, 6 Oct 2021 21:03:38 +0000 (14:03 -0700)]
e1000: Function prototype cleanup

Drop arguments of function prototypes since the file is mixed between
listing arg names and not.

No functional changes

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D32329

(cherry picked from commit 28ccd780a96fe49364072955636829cff1589cfb)

2 years agologin: use sizeof(audit_cond) consistently, NFC
Kyle Evans [Wed, 6 Oct 2021 04:24:24 +0000 (23:24 -0500)]
login: use sizeof(audit_cond) consistently, NFC

The other three instances were already converted to use audit_cond, this
one was just changed from sizeof(long) -> sizeof(int).

(cherry picked from commit 7f4bb501768b9b3f856f91fbc8b9c80a2a4aaa04)

2 years agovfs: remove dead fifoop VOP_KQFILTER implementations
Kyle Evans [Sat, 2 Oct 2021 05:17:57 +0000 (00:17 -0500)]
vfs: remove dead fifoop VOP_KQFILTER implementations

These began to become obsolete in d6d64f0f2c26 (r137739) and the deal
was later sealed in 003e18aef4c4 (r137801) when vfs.fifofs.fops was
dropped and vop-bypass for pipes became mandatory.

PR: 225934

(cherry picked from commit 6b88668f0bfcca09035549e25d0f3c181cd537c8)

2 years agoar: provide error exit status upon failure
Ed Maste [Tue, 3 Aug 2021 18:30:06 +0000 (14:30 -0400)]
ar: provide error exit status upon failure

Previously ar and ranlib returned with exit status 0 (success) in the
case of a missing file or other error.  Update to use error handling
similar to that added by ELF Tool Chain after that project forked
FreeBSD's ar.

PR: PR257599 [exp-run]
Reported by: Shawn Webb, gehmehgeh (on HardenedBSD IRC)
Reviewed by: markj
Obtained from: elftoolchain
MFC after: 2 months
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31402

(cherry picked from commit 38911b3c2c7dbb9a097b44856472ebbbedde71fc)

2 years agosrc.conf.5: Regen.
John Baldwin [Fri, 8 Oct 2021 18:31:17 +0000 (11:31 -0700)]
src.conf.5: Regen.

2 years agoFlip the default for OPENSSL_KTLS to arm64
Allan Jude [Thu, 28 Jan 2021 21:28:18 +0000 (21:28 +0000)]
Flip the default for OPENSSL_KTLS to arm64

This is required to make use of KERN_TLS

Reviewed by: jhb
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28405

(cherry picked from commit e6b7809cdfc4389d2fc1df2c7fdff08a4a110c77)

2 years agoRevert "Disable MK_OPENSSL_KTLS for stable/13."
John Baldwin [Fri, 8 Oct 2021 18:28:23 +0000 (11:28 -0700)]
Revert "Disable MK_OPENSSL_KTLS for stable/13."

No further issues with the KTLS support in OpenSSL have been seen
since the serf/apache bugs which motivated disabling KTLS.  In
addition, the KTLS API in OpenSSL is now finalized since it has been
released in OpenSSL 3.0.

This reverts commit 3cf25a7802a26ae3be9159c585fda6aea3d0dc08.

Approved by: jkim (maintainer), emaste
Sponsored by: Netflix

2 years agofreebsd-update(8): Add -j flag to support jails
Faraz Vahedi [Fri, 1 Oct 2021 18:48:57 +0000 (13:48 -0500)]
freebsd-update(8): Add -j flag to support jails

Make freebsd-update(8) support jails by adding the -j flag which takes
a jail jid or name as an argument. This takes advantage of the recently
added -j support to freebsd-version(8) in order to get the version of
the installed userland.

Reviewed by: dteske, kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25711

(cherry picked from commit c76da1f01064b2b9a1903b30d4b4c444b85f8724)

2 years agofreebsd-version(1): Add -j flag to support jails
Faraz Vahedi [Fri, 1 Oct 2021 18:46:23 +0000 (13:46 -0500)]
freebsd-version(1): Add -j flag to support jails

Make freebsd-version(1) support jails by adding the -j flag which takes
a jail jid or name as an argument. As with other options, -j
flags stack and display in the order requested.

Reviewed by: bcr (manpages), kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25705

(cherry picked from commit f54b18fc4d72c566912b9a41601ed87a852960e7)

2 years agotests/sys/fs/fusefs/read.cc: fix build on powerpc64
Konstantin Belousov [Wed, 22 Sep 2021 22:47:10 +0000 (01:47 +0300)]
tests/sys/fs/fusefs/read.cc: fix build on powerpc64

There sig_atomic_t is shorter than void *.
As result, it cannot keep pointer.

Assigning to void * is actually safe for us in a signal handler.

(cherry picked from commit 3fcbde5e883a253f631082b128dcdf77c840d4c0)

2 years agoReverted: Split out the loader efifb setup to a new function
Andrew Turner [Fri, 26 Feb 2021 11:47:34 +0000 (11:47 +0000)]
Reverted: Split out the loader efifb setup to a new function

(cherry picked from commit c8db60c0673d4bb7a3a3e2c043804e1ed1108c2f)
(cherry picked from commit 773fc43fb060149f8e59c183e5da79feaf118c8c)

2 years agopthread_mutexattr(3): document each pthread_mutexattr_set/get* function
Konstantin Belousov [Fri, 1 Oct 2021 01:39:39 +0000 (04:39 +0300)]
pthread_mutexattr(3): document each pthread_mutexattr_set/get* function

(cherry picked from commit be6116fdfc4d292b77b3df7d4dda029d26a73d65)

2 years agolibthr(3): explain some internals of the locks implementation
Konstantin Belousov [Fri, 1 Oct 2021 01:17:02 +0000 (04:17 +0300)]
libthr(3): explain some internals of the locks implementation

(cherry picked from commit f5b9747075a9b489226e2a911f8a1597f4b9d072)

2 years agopthread_mutexattr(3): install pthread_mutexattr_get/setpshared links
Konstantin Belousov [Fri, 1 Oct 2021 00:53:44 +0000 (03:53 +0300)]
pthread_mutexattr(3): install pthread_mutexattr_get/setpshared links

(cherry picked from commit 6bda192013fc8e6c994098fe262f2a74f424cb57)

2 years agopthread_mutexattr(3): document pthread_mutexattr_set/getpshared
Konstantin Belousov [Fri, 1 Oct 2021 00:46:16 +0000 (03:46 +0300)]
pthread_mutexattr(3): document pthread_mutexattr_set/getpshared

(cherry picked from commit 0a6e5fc29b43778bd004f7754c730e41a9ce2675)

2 years agopthread_mutexattr(3): use .Fo/.Fc to avoid too long lines
Konstantin Belousov [Fri, 1 Oct 2021 00:40:19 +0000 (03:40 +0300)]
pthread_mutexattr(3): use .Fo/.Fc to avoid too long lines

(cherry picked from commit 9f3b6cdbe87cf92d4099f3f5ff8eff3030a8076b)

2 years agoAvoid "consumer not attached in g_io_request" panic when disk lost
Kirk McKusick [Tue, 28 Sep 2021 03:03:43 +0000 (20:03 -0700)]
Avoid "consumer not attached in g_io_request" panic when disk lost
while using a UFS snapshot.

Differential revision: https://reviews.freebsd.org/D32150
Sponsored by: Netflix

(cherry picked from commit 4a365e863f209b0c82641c909a858dab53b19134)

2 years agoBring the tags and links entries for amd64 up to date.
Kirk McKusick [Thu, 23 Sep 2021 23:38:37 +0000 (16:38 -0700)]
Bring the tags and links entries for amd64 up to date.

Sponsored by: Netflix

(cherry picked from commit 1c8d670cb633d39cea68cdeecab507d2ee264705)

2 years agofusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES
Alan Somers [Thu, 16 Sep 2021 19:19:21 +0000 (13:19 -0600)]
fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES

During VOP_GETPAGES, fusefs needs to determine the file's length, which
could require a FUSE_GETATTR operation.  If that fails, it's better to
SIGBUS than panic.

Sponsored by: Axcient
Reviewed by:  markj, kib
Differential Revision: https://reviews.freebsd.org/D31994

(cherry picked from commit 4f917847c9037d9b76de188c03e13b81224431b2)

2 years agotools/test/upsdl: fix compiler warnings
Alan Somers [Tue, 14 Sep 2021 20:50:01 +0000 (14:50 -0600)]
tools/test/upsdl: fix compiler warnings

Sponsored by: Axcient

(cherry picked from commit 5dc5f849be9047309d32c4df8e7ee617c27ec43f)

2 years agoses: Guard the elm_type_names declaration by _KERNEL
Alan Somers [Mon, 30 Aug 2021 20:45:13 +0000 (14:45 -0600)]
ses: Guard the elm_type_names declaration by _KERNEL

Sponsored by: Axcient

(cherry picked from commit cc2d08d3880c2e726849ab2aa23b3d15f8aa3938)

2 years agoses: Correct spelling of "Temperature Sensor"
Alan Somers [Mon, 30 Aug 2021 19:59:32 +0000 (13:59 -0600)]
ses: Correct spelling of "Temperature Sensor"

According to SES 4 revision 2 table 71, it should be singular.

Sponsored by: Axcient

(cherry picked from commit 1fb52e4373e7f645d71059a6a403469f059044c8)

2 years agoaio: revert the workaround for bug 251828 in the tests
Alan Somers [Fri, 13 Aug 2021 22:59:10 +0000 (16:59 -0600)]
aio: revert the workaround for bug 251828 in the tests

This bug is no longer reproducible in 14.0-CURRENT and 13.0-RELEASE

PR: 251828
Reported by: markj
Reviewed by: markj
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D31535

(cherry picked from commit 825fb07c55986971b1a20e40a73c12eb0ff432e0)

2 years ago[skip ci] unix(4): LOCAL_PEERCRED works on SOCK_SEQPACKET, too.
Alan Somers [Tue, 10 Aug 2021 13:29:06 +0000 (07:29 -0600)]
[skip ci] unix(4): LOCAL_PEERCRED works on SOCK_SEQPACKET, too.

MFC after: 2 weeks
Reviewed By: dchagin
Differential Revision: https://reviews.freebsd.org/D31456

(cherry picked from commit 518e697f2accf3769dc986e254a4c79db7ec5a06)

2 years agoMFC uipc_shm: Fix kern.ipc.posix_shm_list for jails
Jamie Gritton [Wed, 29 Sep 2021 17:20:36 +0000 (10:20 -0700)]
MFC uipc_shm: Fix kern.ipc.posix_shm_list for jails

Fix error return of kern.ipc.posix_shm_list, which caused it (and thus
"posixshmcontrol ls") to fail for all jails that didn't happen to own
the last shm object in the list.

(cherry picked from commit 747a47261eee59b6e9c437cd2c1b3979df5c32ac)

2 years agoUpgrade ENA to v2.4.1
Marcin Wojtas [Fri, 23 Jul 2021 22:31:32 +0000 (15:31 -0700)]
Upgrade ENA to v2.4.1

ena: Remove redundant declaration of ena_log_level.

GCC6 raises a -Wredundant-decl error due to duplicate declarations
in ena_fbsd_log.h and ena_plat.h.

Sponsored by: Chelsio Communications

(cherry picked from commit 8843787aa1bdbd10de6ba47a04489179ec2d2d3c)

ena: Avoid unnecessary mbuf collapses for LLQ condition

In case of Low-latency Queue, one small enough descriptor can be pushed
directly to the ENA hw, thus saving one fragment. Check for this
condition before performing collapse.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit c81f8c26115a64b9a97ecdb2a64e824dd839ee73)

ena: Trigger reset on ena_com_prepare_tx failure

All ena_com_prepare_tx errors other than ENA_COM_NO_MEM are fatal and
require device reset.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 36130d2979d695dd439bc607feb00dcdb9a1937b)

ena: Prevent reset after device destruction

Check for ENA_FLAG_TRIGGER_RESET inside a locked context in order to
avoid potential race conditions with ena_destroy_device. This aligns the
reset task logic with the Linux driver.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 433ab9b6987b42b3e5b25b8b5dc7e5178c7ef9bb)

ena: Add extra log messages

Stay aligned with the Linux driver by adding the following logs:
* inform the user about retrying queue creation
* warn on non-empty ena_tx_buffer.mbuf prior to ena_tx_map_mbuf

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 77160654a162b5faa8ad7a02e18d2bef2589f868)

ena: Add locking assertions

ENA silently assumed that ena_up, ena_down and ena_start_xmit routines
should be called within locked context. Driver's logic heavily assumes
on concurrent access to those routines, so for safety and better
documentation about this assumption, the locking assertions were added
to the above functions.

The assertion was added only for the main steps (skipping the helper
functions) which can be called from multiple places including the kernel
and the driver itself.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit cb98c439d66c303353a9f4abbbe9ddb51559c638)

ena: Move RSS logic into its own source files

Delegate RSS related functionality into separate .c/.h files in
preparation for the full RSS support.

While at it, reorder functions and remove prototypes for ones with
internal linkage.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 986e7b9227668caf9620f207e3c1d708c87b634d)

ena: Disable meta descriptor caching for netmap

If LLQ is being used, `ena_tx_ctx.meta_valid` must stay enabled. This
fixes netmap support on latest generation ENA HW and aligns it with the
core driver behavior.

As netmap doesn't support any csum offloads, the
`adapter->disable_meta_caching` value can be simply passed to the HW.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit a831466830de6ab55fc03170290b313157196e81)

ena: Share ena_global_lock between driver instances

In order to use `ena_global_lock` in sysctl context, it must be kept
outside the driver instance's software context, as sysctls can be called
before attach and after detach, leading to lock use before sx_init and
after sx_destroy otherwise.
Solve this issue by turning `ena_global_lock` into a file scope
variable, shared between all instances of the driver and associated
sysctl context, and in turn initialized/destroyed in dedicated
SYSINIT/SYSUNINIT functions.
As a side effect, this change also fixes existing race in the reset
routine, when simultaneously accessing sysctl exposed properties.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 07aff471c0de2de9a1dc5c7749c46b525bdd0201)

ena: Add missing statistics

Provide the following sysctl statistics in order to stay aligned with
the Linux driver:
* rx_ring.csum_good
* tx_ring.unmask_interrupt_num

Also rename the 'bad_csum' statistic name to 'csum_bad' for alignment.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 223c8cb12e951c63807300a0cbdc4a1569520b4b)

ena: Implement full RSS reconfiguration

Bind RX/TX queues and MSI-X vectors to matching CPUs based on the RSS
bucket entries.

Introduce sysctls for the following RSS functionality:
- rss.indir_table:      indirection table mapping
- rss.indir_table_size: indirection table size
- rss.key:              RSS hash key (if Toeplitz used)

Said sysctls are only available when compiled without `option RSS`, as
kernel-side RSS support currently doesn't offer RSS reconfiguration.

Migrate the hash algorithm from CRC32 to Toeplitz and change the initial
hash value to 0x0 in order to match the standard Toeplitz implementation.
Provide helpers for hash key inversion required for HW operations.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 6d1ef2abd330fac4057f092abbbdc28a568b4327)

ena: fix building in-kernel driver

When building ENA as compiled into the kernel, the driver would fail to
build. Resolve the problem by introducing the following changes:
1. Add missing `ena_rss.c` entry in `sys/conf/files`.
2. Prevent SYSCTL_ADD_INT from throwing an assert due to an extra
CTLTYPE_INT flag.

Fixes: 986e7b92276 ("ena: Move RSS logic into its own source files")
Fixes: 6d1ef2abd33 ("ena: Implement full RSS reconfiguration")
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
MFC after: 1 week

(cherry picked from commit a3f0d18237bdcf272461d3b4b682de384c572144)

ena: Update driver version to v2.4.1

Some of the changes in this release:
* Hardware RSS hash key reconfiguration and indirection table
reconfiguration support.
* Full kernel RSS support.
* Extra statistic counters.
* Netmap support for ENAv3.
* Locking assertions.
* Extra log messages.
* Reset handling fixes.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 42c7760be3ea420668f625f2064ae347aa7e818e)

2 years agoUpgrade ENA to v2.4.0
Marcin Wojtas [Mon, 14 Jun 2021 08:57:45 +0000 (10:57 +0200)]
Upgrade ENA to v2.4.0

ena: change ENA C++-style comment into C-style

According to man style(9), only C-style comments should be used.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 438c9e3cf89403628ec237cfecdd0538f208087b)

ena: add support for the large LLQ headers in ENA

Default LLQ (Low-latency queue) maximum header size is 96 bytes and can
be too small for some types of packets - like IPv6 packets with multiple
extension. This can be fixed, by using large LLQ headers.

If the device supports larger LLQ headers, the user can activate this
feature by setting sysctl tunable 'hw.ena.force_large_llq_header' to '1'
in the /boot/loader.conf file.

In case the device isn't supporting this feature, the default value (96B)
will be used.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit beaadec9eaec8e6b266faff3b0880a141728fcef)

ena: remove surplus NULL checks when freeing ENA resources

Calling free on a NULL pointer is valid, as appropriate check is already
done internally:

/* free(NULL, ...) does nothing */
if (addr == NULL)
    return;

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit ddec69e6a796283497ebada0569f34bd41bbdf37)

ena: hide sysctl nodes for unused ENA queues

IO queue related attributes are registered statically at driver attach
with the rest of the ENA specific sysctl nodes. However, the number of
queues can be changed at runtime via the `ena_sysctl_io_queues_nb`
request, leading to a potential exposure of attributes for non-existing
queues.

Introduce a new `ena_sysctl_update_queue_node_nb` function, which
updates the sysctl nodes after the number of queues is altered.
This happens by either registering or unregistering node specific oids,
based on a delta between the previous and current queue count.

NOTE: All unregistered oids must be registered again before the driver
detach, e.g. by another call to this function.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 0e7d31f63b9db869c91228d8ed1e984bdee2b931)

Merge tag 'vendor/ena-com/2.4.0'

Update the driver in order not to break its compilation
and make use of the new ENA logging system

Migrate platform code to the new logging system provided by ena_com
layer.

Make ENA_INFO the new default log level.

Remove all explicit use of `device_printf`, all new logs requiring one
of the log macros to be used.

(cherry picked from commit 3fc5d816f8831d6fc2816ac97bd78dc486cd080c)

Update ENA driver man page

Bring the obsolete man page up to date:
* update diagnostic error messages
* add documentation of loader tunables
* document netmap support
* add a driver history section
* update the contact information

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit e34856a2c44a45512463aed0d1794f34258c66ee)

Update ENA version to v2.4.0

Some of the changes in this release:
* Large LLQ headers,
* Bug/stability fixes,
* Change of the README/Documentation.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 93f0df457bf1d0e5f71839ab969c94d1f95813fb)

2 years agommc_fdt_helper: correct typo in DT property name
Marcin Wojtas [Thu, 15 Jul 2021 15:08:16 +0000 (17:08 +0200)]
mmc_fdt_helper: correct typo in DT property name

'no-1-8-v' is a proper name according to the DT binding
documentation
(https://www.kernel.org/doc/Documentation/devicetree/bindings/mmc/mmc-controller.yaml).

Fixes: e63fbd7bb7a25
Submitted by: Bartlomiej Grzesik <bag@semihalf.com>
Sponsored by: Semihalf

(cherry picked from commit d8789cd0ae278a86f92247a87d98bb54f15b5592)

2 years agohpen(4): removed leftover hpen_final_digi_cb declaration
Mateusz Guzik [Sun, 5 Sep 2021 17:30:51 +0000 (17:30 +0000)]
hpen(4): removed leftover hpen_final_digi_cb declaration

(cherry picked from commit 007724cbca6f6d91b8c3450bd4a11f3ea2bb647a)

2 years agosocket: Avoid clearing SS_ISCONNECTING if soconnect() fails
Mark Johnston [Tue, 7 Sep 2021 18:51:54 +0000 (14:51 -0400)]
socket: Avoid clearing SS_ISCONNECTING if soconnect() fails

This behaviour appears to date from the 4.4 BSD import.  It has two
problems:

1. The update to so_state is not protected by the socket lock, so
   concurrent updates to so_state may be lost.
2. Suppose two threads race to call connect(2) on a socket, and one
   succeeds while the other fails.  Then the failing thread may
   incorrectly clear SS_ISCONNECTING, confusing the state machine.

Simply remove the update.  It does not appear to be necessary:
pru_connect implementations which call soisconnecting() only do so after
all failure modes have been handled.  For instance, tcp_connect() and
tcp6_connect() will never return an error after calling soisconnected().
However, we cannot correctly assert that SS_ISCONNECTED is not set after
an error from soconnect() since the socket lock is not held across the
pru_connect call, so a concurrent connect(2) may have set the flag.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a8aa6f1f784b91acb4ef9387a28c78311493eb66)

2 years agosocket: Rename sb(un)lock() and interlock with listen(2)
Mark Johnston [Tue, 7 Sep 2021 18:49:31 +0000 (14:49 -0400)]
socket: Rename sb(un)lock() and interlock with listen(2)

In preparation for moving sockbuf locks into the containing socket,
provide alternative macros for the sockbuf I/O locks:
SOCK_IO_SEND_(UN)LOCK() and SOCK_IO_RECV_(UN)LOCK().  These operate on a
socket rather than a socket buffer.  Note that these locks are used only
to prevent concurrent readers and writters from interleaving I/O.

When locking for I/O, return an error if the socket is a listening
socket.  Currently the check is racy since the sockbuf sx locks are
destroyed during the transition to a listening socket, but that will no
longer be true after some follow-up changes.

Modify a few places to check for errors from
sblock()/SOCK_IO_(SEND|RECV)_LOCK() where they were not before.  In
particular, add checks to sendfile() and sorflush().

Reviewed by: tuexen, gallatin
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f94acf52a408316ed61ba94705d7ec0a69ba5ec8)

2 years agosyslogd: undo regression after r326573
Eugene Grosbein [Mon, 27 Sep 2021 07:25:21 +0000 (14:25 +0700)]
syslogd: undo regression after r326573

Restore ability for our syslogd to collect pre-RFC3164 formatted
messages from remote hosts that was broken with r326573.

Note that parsing of RFC5424 format not changed.

(cherry picked from commit 3b4cc56e524ac947ba0e6571e2c455139c2839ec)

2 years agoFix busdma resource leak on usb device detach.
Ian Lepore [Tue, 28 Sep 2021 19:29:10 +0000 (13:29 -0600)]
Fix busdma resource leak on usb device detach.

When a usb device is detached, usb_pc_dmamap_destroy() called
bus_dmamap_destroy() while the map was still loaded. That's harmless on x86
architectures, but on all other platforms it causes bus_dmamap_destroy() to
return EBUSY and leak away any memory resources (including bounce buffers)
associated with the mapping, as well as any allocated map structure itself.

This change introduces a new is_loaded flag to the usb_page_cache struct to
track whether a map is loaded or not. If the map is loaded,
bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking
away resources.

Differential Revision: https://reviews.freebsd.org/D32208

(cherry picked from commit dc91a9715f8fda4b3633388830a28a99f73cbe59)

2 years agopf tests: Basic adaptive mode syncookie test
Kristof Provost [Sat, 25 Sep 2021 13:05:02 +0000 (15:05 +0200)]
pf tests: Basic adaptive mode syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32139

(cherry picked from commit 2f20d80692ceb584842a7642562fc9f610a5b661)

2 years agopf tests: Basic syncookie test
Kristof Provost [Sat, 10 Jul 2021 11:20:44 +0000 (13:20 +0200)]
pf tests: Basic syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32138

(cherry picked from commit dc0636636bb1937283d4f218732ac2357f4ec4f1)

2 years agopf.conf: document syncookies
Kristof Provost [Sat, 14 Aug 2021 08:42:03 +0000 (10:42 +0200)]
pf.conf: document syncookies

Reviewed by: bcr
Obtained from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32137

(cherry picked from commit 20f015f08d66d0d953e49245cb95c81c118b9ee9)