]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUpgrade to version 3.2.3
Stefan Eßer [Sun, 6 Dec 2020 11:49:21 +0000 (11:49 +0000)]
Upgrade to version 3.2.3

3 years agoImport version 3.2.3
Stefan Eßer [Sun, 6 Dec 2020 11:38:46 +0000 (11:38 +0000)]
Import version 3.2.3

3 years agoMove V4L feature declarations and DTrace provider definitions from
Tijl Coosemans [Sun, 6 Dec 2020 10:58:55 +0000 (10:58 +0000)]
Move V4L feature declarations and DTrace provider definitions from
linux_common.c to linux_util.c so they become available on i386.

linux_common.c defines the linux_common kernel module but this module does
not exist on i386 and linux_common.c is not included in the linux module.
linux_util.c is included in the linux_common module on amd64 and the linux
module on i386.

Remove linux_common.c from files.i386 again.  It was added recently in
r367433 when the DTrace provider definitions were moved.

The V4L feature declarations were moved to linux_common in r283423.

3 years agovfs: factor buffer allocation/copyin out of namei
Mateusz Guzik [Sun, 6 Dec 2020 04:59:24 +0000 (04:59 +0000)]
vfs: factor buffer allocation/copyin out of namei

3 years agoatkbd(4): Just use nitems() for quirk enumeration
Conrad Meyer [Sat, 5 Dec 2020 22:04:30 +0000 (22:04 +0000)]
atkbd(4): Just use nitems() for quirk enumeration

Reviewed by: imp, wulf
X-MFC-With: r368365
Differential Revision: https://reviews.freebsd.org/D27489

3 years agoRemove remaning definition of GFB_<foo> options.
Michal Meloun [Sat, 5 Dec 2020 19:44:00 +0000 (19:44 +0000)]
Remove remaning definition of GFB_<foo> options.
They are not used in source files.
This fixes build of some arm boards after r368159.

Reported by: mjg

3 years agoFix i386 linux module after r367395.
Tijl Coosemans [Sat, 5 Dec 2020 14:53:24 +0000 (14:53 +0000)]
Fix i386 linux module after r367395.

In r367395 parts of machine dependent linux_dummy.c were moved to a new
machine independent file sys/compat/linux/linux_dummy.c and the existing
linux_dummy.c was renamed to linux_dummy_machdep.c.

Add linux_dummy_machdep.c to the linux module for i386.
Rename sys/amd64/linux32/linux_dummy.c for consistency.
Add the new linux_dummy.c to the linux module for i386.

3 years agolibc: regex: partial revert of r368358
Kyle Evans [Sat, 5 Dec 2020 14:38:46 +0000 (14:38 +0000)]
libc: regex: partial revert of r368358

Part of the libregex functionality leaked into the tests it shares with
the standard regex(3). Introduce a P flag to set the REG_POSIX cflag to
indicate that libc regex should effectively do nothing while libregex should
specifically run it in non-extended mode.

This unbreaks the libc/regex test run.

Reported by: Jenkins

3 years agoSimplify startup of secondary cores and store MPIDR register to pcpu.
Michal Meloun [Sat, 5 Dec 2020 14:06:01 +0000 (14:06 +0000)]
Simplify startup of secondary cores and store MPIDR register to pcpu.

 - record MPIDR for all started cores in pcpu, they will be used as link
   between physical locality of given core, ID in external description
   (FDT or ACPI) and cupid.
 - because of above, cpuid can (and should) be freely assigned, only boot
   CPU  must have cpuid 0. Simplify startup code according this.

Please note that pure cpuid is not sufficient instrument to hold any
information about core or cluster topology, nor to determistically iterate
over subpart of cores in CPU (iterate over all cores in single cluster for
example). Situation is more complicated by fact that PSCI can reject start
of core without reporting error (because power budget for example), or by
fact that is possible that we booted on non-first core in cluster (thus with
cpuid 0 assigned to random core).

Given cores topology should be exhibited to other parts of system
(for example to scheduler for big.little or multicluster systems) by using
smp_topo interface.

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

3 years agoAdd basic support for Freescale LX2160A SoC.
Michal Meloun [Sat, 5 Dec 2020 12:08:37 +0000 (12:08 +0000)]
Add basic support for Freescale LX2160A SoC.
All peripherals but the network processor are supported.

3 years agoepoch(9): Fix a few mandoc related issues
Gordon Bergling [Sat, 5 Dec 2020 11:18:37 +0000 (11:18 +0000)]
epoch(9): Fix a few mandoc related issues

- sections out of conventional order: Sh EXAMPLES
- sections out of conventional order: Sh SEE ALSO
- skipping end of block that is not open: El

3 years agoConnect DTB files based on LX2160A SoC to build.
Michal Meloun [Sat, 5 Dec 2020 11:17:54 +0000 (11:17 +0000)]
Connect DTB files based on LX2160A SoC to build.
Mainly LX2K Honeycomb and ClearFog-CX boards.

3 years agoig4(4): Add PCI IDs for Intel Tiger Lake
Vladimir Kondratyev [Sat, 5 Dec 2020 10:57:15 +0000 (10:57 +0000)]
ig4(4): Add PCI IDs for Intel Tiger Lake

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D27483

3 years agoatkbd(4): Change quirk table end-of-list marker to NULL vendor/maker/product
Vladimir Kondratyev [Sat, 5 Dec 2020 10:55:14 +0000 (10:55 +0000)]
atkbd(4): Change quirk table end-of-list marker to NULL vendor/maker/product

This fixes regression introduced in r367349 which effectively resulted in
truncation of quirk table.

PR: 250711
Submitted by: grembo
Reported by: Matthias Apitz <guru@unixarea.de>
X-MFC with: r367349

3 years agoDesignWare PCIe driver: Don't call bus_generic_attach() twice.
Michal Meloun [Sat, 5 Dec 2020 10:55:09 +0000 (10:55 +0000)]
DesignWare PCIe driver: Don't call bus_generic_attach() twice.
bus_generic_attach() should be called from the attach function of the real
implementation, not from the common init function.

MFC after: 1 week

3 years agoConnect RK3288 to GENERIC kernel.
Michal Meloun [Sat, 5 Dec 2020 10:10:25 +0000 (10:10 +0000)]
Connect RK3288 to GENERIC kernel.

3 years agoAlso build DTB files for Asus Tinker board (RK3288 based).
Michal Meloun [Sat, 5 Dec 2020 10:00:39 +0000 (10:00 +0000)]
Also build DTB files for Asus Tinker board (RK3288 based).

3 years agovfs: keep bad ops on vnode reclaim
Mateusz Guzik [Sat, 5 Dec 2020 05:56:23 +0000 (05:56 +0000)]
vfs: keep bad ops on vnode reclaim

They were only modified to accomodate a redundant assertion.

This runs into problems as lockless lookup can still try to use the vnode
and crash instead of getting an error.

The bug was only present in kernels with INVARIANTS.

Reported by: kevans

3 years agolibc: regex: retire internal EMPTBR ("Empty branch present")
Kyle Evans [Sat, 5 Dec 2020 03:18:48 +0000 (03:18 +0000)]
libc: regex: retire internal EMPTBR ("Empty branch present")

It was realized just a little too late that this was a hack that belonged in
individual regex(3)-using applications. It was surrounded in NOTYET and not
implemented in the engine, so remove it.

3 years agolibregex: implement \b and \B (word boundary, not word boundary)
Kyle Evans [Sat, 5 Dec 2020 03:16:05 +0000 (03:16 +0000)]
libregex: implement \b and \B (word boundary, not word boundary)

This is the last of the needed GNU expressions before we can unleash bsdgrep
by default. \b is effectively an agnostic equivalent of \< and \>, while
\B will match every space that isn't making a transition from
nonchar -> char or char -> nonchar.

3 years agolibregex: implement \` and \' (begin-of-subj, end-of-subj)
Kyle Evans [Sat, 5 Dec 2020 03:13:47 +0000 (03:13 +0000)]
libregex: implement \` and \' (begin-of-subj, end-of-subj)

These are GNU extensions, generally equivalent to ^ and $ except that the
new syntax will not match beginning of line after the first in a multi-line
expression or the end of line before absolute last in a multi-line
expression.

3 years agolibc: regex: factor out ISBOW/ISEOW macros
Kyle Evans [Sat, 5 Dec 2020 02:23:11 +0000 (02:23 +0000)]
libc: regex: factor out ISBOW/ISEOW macros

These will be reused for \b (word boundary, which matches both sides).

No functional change.

3 years agoRetire GNU_GREP_COMPAT knob
Kyle Evans [Sat, 5 Dec 2020 02:21:58 +0000 (02:21 +0000)]
Retire GNU_GREP_COMPAT knob

This was introduced and then disabled by default primarily to avoid dealing
with bugs in libgnuregex. rS363823 switched to using libregex for it, so
let's just rip the option out now so we can make sure we're getting tested
with libregex via bsdgrep.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D27476

3 years agoAdd CFI start/end proc directives to arm64, i386, and ppc
Conrad Meyer [Sat, 5 Dec 2020 00:33:28 +0000 (00:33 +0000)]
Add CFI start/end proc directives to arm64, i386, and ppc

Follow-up to r353959 and r368070: do the same for other architectures.

arm32 already seems to use its own .fnstart/.fnend directives, which
appear to be ARM-specific variants of the same thing.  Likewise, MIPS
uses .frame directives.

Reviewed by: arichardson
Differential Revision: https://reviews.freebsd.org/D27387

3 years agoExpose nonstandard IPv6 kernel definitions to standalone builds.
Hans Petter Selasky [Fri, 4 Dec 2020 21:51:47 +0000 (21:51 +0000)]
Expose nonstandard IPv6 kernel definitions to standalone builds.
No functional change.

Reviewed by: bz@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agonvme: Remove a wmb() that's not necessary.
Warner Losh [Fri, 4 Dec 2020 21:34:48 +0000 (21:34 +0000)]
nvme: Remove a wmb() that's not necessary.

bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can
be DMA'd immediately after it returns. The details differ, but this
mirrors atomic thread release semantics, at least for the buffers
synced.

For non-x86 platforms, bus_dmamap_sync() has the right syncing and
fences. So in the past, wmb() had been omitted for them.

For x86 platforms, the memory ordering is already strong enough to
ensure DMA to the device sees the current contents. As such, we don't
need the wmb() here. It translates to an sfence which is only needed
for writes to regions that have the write combining attribute set or
when some exotic opcodes are used. The nvme driver does neither of
these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we
can be assured any optimizer won't reorder the bus_dmamap_sync and the
bus_space_write operations. The wmb() was a vestiage of the pre-busdma
version initially committed to the tree.

Reviewed by: kib@, gallatin@, chuck@, mav@
Differential Revision: https://reviews.freebsd.org/D27448

3 years agobusdma: Annotate bus_dmamap_sync() with fence
Warner Losh [Fri, 4 Dec 2020 21:34:04 +0000 (21:34 +0000)]
busdma: Annotate bus_dmamap_sync() with fence

Add an explicit thread fence release before returning from
bus_dmamap_sync. This should be a no-op in practice, but makes
explicit that all ordinary stores will be completed before subsequent
reads/writes to ordinary device memory. On x86, normal memory ordering
is strong enough to generally guarantee this. The fence keeps the
optimizer (likely LTO) from reordering other calls around this.
The other architectures already have calls, as appropriate, that
are equivalent.

Note: On x86, there is one exception to this rule. If you've mapped
memory as write combining, then you will need to add a sfence or
similar. Normally, though, busdma doesn't operate on such memory, and
drivers that do already cope appropriately.

Reviewed by: kib@, gallatin@, chuck@, mav@
Differential Revision: https://reviews.freebsd.org/D27448

3 years agoossl: port to arm64
Mitchell Horne [Fri, 4 Dec 2020 21:12:17 +0000 (21:12 +0000)]
ossl: port to arm64

Enable in-kernel acceleration of SHA1 and SHA2 operations on arm64 by adding
support for the ossl(4) crypto driver. This uses OpenSSL's assembly routines
under the hood, which will detect and use SHA intrinsics if they are
supported by the CPU.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27390

3 years agoossl: split out x86 bits to x86/ossl_cpuid.c
Mitchell Horne [Fri, 4 Dec 2020 20:54:20 +0000 (20:54 +0000)]
ossl: split out x86 bits to x86/ossl_cpuid.c

Make room for adding arm64 support to this driver by moving the
x86-specific feature parsing to a separate file.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27388

3 years agoping(8): Fix a few mandoc related issues
Gordon Bergling [Fri, 4 Dec 2020 20:47:56 +0000 (20:47 +0000)]
ping(8): Fix a few mandoc related issues

- new sentence, new line

3 years agoVarious fixes for the MIPS DDB stack unwinder.
John Baldwin [Fri, 4 Dec 2020 20:14:25 +0000 (20:14 +0000)]
Various fixes for the MIPS DDB stack unwinder.

- Fix kernel stack unwinding end-of-function false-positive

  The kernel stack unwinder assumes that any jr $ra indicates the end
  of the current function. However, modern compilers generate code
  that contains jr $ra at various places inside the function.

- Handle LLD inter-function padding when looking for the start of a
  function.

- Use call site for symbol name/offset when unwinding

  Currently we use the return address, which will normally just give
  an output that's off by 8 from the actual call site.  However, for
  tail calls, this is particularly bad, as we end up printing the
  symbol name for the function that comes after the one that made the
  call.  Instead we should go back two instructions from the return
  address for the unwound program counter.

Submitted by:   arichardson (1, 2), jrtc27 (3)
Reviewed by: arichardson
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27363

3 years agoRevert r366857.
Cy Schubert [Fri, 4 Dec 2020 19:31:16 +0000 (19:31 +0000)]
Revert r366857.

r366857 created a number of problems, tearing down interfaces too
early in shutdown. This resulted in:

- hung ssh sessions when shutting down or rebooting remotely using
  shutdown (I've used exec shutdown, for years, as apposed to simply
  shutdown).

- NFS mounted filesystems "disappear" prior to unmount.

- dhclient attached to a VLAN on an interface who's parent interface
  has already shut down prints errors.

The path forward is to teach lagg(4) and vlan(4) about WOL.

PR: 251531, 251540
PR: 158734, 109980 are broken again
Reported by: jhb, emaste, jtl, Helge Oldach<freebsd_oldach.net>
Martin Birgmeier <d8zNeCFG_aon.at>
MFC after:      Immediately
Discussion at: https://reviews.freebsd.org/D27459

3 years agoRegen
Konstantin Belousov [Fri, 4 Dec 2020 18:58:27 +0000 (18:58 +0000)]
Regen

3 years agoFix compat32 for ntp_adjtime(2).
Konstantin Belousov [Fri, 4 Dec 2020 18:57:58 +0000 (18:57 +0000)]
Fix compat32 for ntp_adjtime(2).

struct timex is not 32-bit safe, it uses longs for members.
Provide translation.

Reviewed by: brooks, cy
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27471

3 years agoAdd kern_ntp_adjtime(9).
Konstantin Belousov [Fri, 4 Dec 2020 18:56:44 +0000 (18:56 +0000)]
Add kern_ntp_adjtime(9).

Reviewed by: brooks, cy
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27471

3 years agoFix mis-spelled macro in the kernel shim.
Hans Petter Selasky [Fri, 4 Dec 2020 16:51:59 +0000 (16:51 +0000)]
Fix mis-spelled macro in the kernel shim.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd support for RK3288 SoC.
Michal Meloun [Fri, 4 Dec 2020 16:24:44 +0000 (16:24 +0000)]
Add support for RK3288 SoC.

3 years agomake.py: Also pass STRIPBIN
Alex Richardson [Fri, 4 Dec 2020 15:53:44 +0000 (15:53 +0000)]
make.py: Also pass STRIPBIN

This is required for cross-building to allow stripping the installed binaries.

Submitted By: Henry Vogt <hv@tue.mpg.de>

3 years agocrunchgen: fix NULL-deref bug introduced in r364647
Alex Richardson [Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)]
crunchgen: fix NULL-deref bug introduced in r364647

While porting over the local changes from CheriBSD for upstreaming, I
accidentally committed a broken version of find_entry_point(): we have to
return NULL if the value is not found instead of a value with
ep->name == NULL, since the checks in main were changed to check ep instead
of ep->name for NULL.

This only matters if the crunched tool cannot be found using normal lookup
and one of the fallback paths is used, so it's unlikely to be triggered
in rescue. However, I noticed that one of our CheriBSD test scripts was
failing to run commands under `su` on minimal disk images where all
binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen.

This also updates the bootstrapping check in Makefile.inc1 to bootstrap
crunchgen up to the next version bump.

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

3 years agoAllow the rbtree header file in the LinuxKPI to be used in standalone code.
Hans Petter Selasky [Fri, 4 Dec 2020 15:50:44 +0000 (15:50 +0000)]
Allow the rbtree header file in the LinuxKPI to be used in standalone code.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAllow the list header file in the LinuxKPI to be used in standalone code.
Hans Petter Selasky [Fri, 4 Dec 2020 15:46:48 +0000 (15:46 +0000)]
Allow the list header file in the LinuxKPI to be used in standalone code.
Some style and spelling nits while at it.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd a driver for FAN53555 based PMIC.
Michal Meloun [Fri, 4 Dec 2020 15:23:43 +0000 (15:23 +0000)]
Add a driver for FAN53555 based PMIC.

3 years agognu: don't build libgnuregex for WITH_GNU_GREP_COMPAT
Kyle Evans [Fri, 4 Dec 2020 15:21:12 +0000 (15:21 +0000)]
gnu: don't build libgnuregex for WITH_GNU_GREP_COMPAT

bsdgrep switched over to libregex back in r363823 to fill
WITH_GNU_GREP_COMPAT, since libgnuregex in base is quite buggy and libregex
is somewhat functional. Don't build libgnuregex on our account, please.

3 years agoAdd a driver for HYM8563 based RTC.
Michal Meloun [Fri, 4 Dec 2020 15:09:42 +0000 (15:09 +0000)]
Add a driver for HYM8563 based RTC.

3 years agoAdd a driver for ACT8846 used as PMIC for RK3288 SoC.
Michal Meloun [Fri, 4 Dec 2020 14:57:12 +0000 (14:57 +0000)]
Add a driver for ACT8846 used as PMIC for RK3288 SoC.

3 years agoAdd more macros, types and prototypes for building kernel code into bootloaders.
Hans Petter Selasky [Fri, 4 Dec 2020 14:52:41 +0000 (14:52 +0000)]
Add more macros, types and prototypes for building kernel code into bootloaders.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel
Hans Petter Selasky [Fri, 4 Dec 2020 14:50:55 +0000 (14:50 +0000)]
Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel
shim code in line with the rest of the kernel, sys/x86/include/_types.h.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd TCP feature Proportional Rate Reduction (PRR) - RFC6937
Richard Scheffenegger [Fri, 4 Dec 2020 11:29:27 +0000 (11:29 +0000)]
Add TCP feature Proportional Rate Reduction (PRR) - RFC6937

PRR improves loss recovery and avoids RTOs in a wide range
of scenarios (ACK thinning) over regular SACK loss recovery.

PRR is disabled by default, enable by net.inet.tcp.do_prr = 1.
Performance may be impeded by token bucket rate policers at
the bottleneck, where net.inet.tcp.do_prr_conservate = 1
should be enabled in addition.

Submitted by: Aris Angelogiannopoulos
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D18892

3 years agokern: soclose: don't sleep on SO_LINGER w/ timeout=0
Kyle Evans [Fri, 4 Dec 2020 04:39:48 +0000 (04:39 +0000)]
kern: soclose: don't sleep on SO_LINGER w/ timeout=0

This is a valid scenario that's handled in the various protocol layers where
it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it
indicates we should immediately drop the connection, it makes little sense
to sleep on it.

This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this
could result in the thread hanging until a signal interrupts it if the
protocol does not mark the socket as disconnected for whatever reason.

Reported by: syzbot+e625d92c1dd74e402c81@syzkaller.appspotmail.com
Reviewed by: glebius, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27407

3 years agoAdd IPv4/IPv6 rtentry prefix accessors.
Alexander V. Chernikov [Thu, 3 Dec 2020 22:23:57 +0000 (22:23 +0000)]
Add IPv4/IPv6 rtentry prefix accessors.

Multiple consumers like ipfw, netflow or new route lookup algorithms
 need to get the prefix data out of struct rtentry.
Instead of providing direct access to the rtentry, create IPv4/IPv6
 accessors to abstract struct rtentry internals and avoid including
 internal routing headers for external consumers.

While here, move struct route_nhop_data to the public header, so external
 customers can actually use lookup functions returning rt&nhop data.

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

3 years agoClear TLS offload mode if a TLS socket hangs without receiving data.
John Baldwin [Thu, 3 Dec 2020 22:06:08 +0000 (22:06 +0000)]
Clear TLS offload mode if a TLS socket hangs without receiving data.

By default, if a TOE TLS socket stops receiving data for more than 5
seconds, revert the connection back to plain TOE mode.  This provides
a fallback if the userland SSL library does not support KTLS.  In
addition, for client TLS 1.3 sockets using connect(), the TOE socket
blocks before the handshake has completed since the socket option is
only invoked for the final handshake.

The timeout defaults to 5 seconds, but can be changed at boot via the
hw.cxgbe.toe.tls_rx_timeout tunable or for an individual interface via
the dev.<nexus>.toe.tls_rx_timeout sysctl.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27470

3 years agocxgbe(4): Fix vertical alignment in sysctl_cpl_stats.
Navdeep Parhar [Thu, 3 Dec 2020 22:04:23 +0000 (22:04 +0000)]
cxgbe(4): Fix vertical alignment in sysctl_cpl_stats.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoDon't transmit mbufs that aren't yet ready on TOE sockets.
John Baldwin [Thu, 3 Dec 2020 22:01:13 +0000 (22:01 +0000)]
Don't transmit mbufs that aren't yet ready on TOE sockets.

This includes mbufs waiting for data from sendfile() I/O requests, or
mbufs awaiting encryption for KTLS.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27469

3 years agocxgbe(4): two new debug sysctls.
Navdeep Parhar [Thu, 3 Dec 2020 22:00:41 +0000 (22:00 +0000)]
cxgbe(4): two new debug sysctls.

dev.<nexus>.<instance>.misc.tid_stats
dev.<nexus>.<instance>.misc.tnl_stats

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoClear TLS offload mode for unsupported cipher suites and versions.
John Baldwin [Thu, 3 Dec 2020 21:59:47 +0000 (21:59 +0000)]
Clear TLS offload mode for unsupported cipher suites and versions.

If TOE TLS is requested for an unsupported cipher suite or TLS
version, disable TLS processing and fall back to plain TOE.  In
addition, if an error occurs when saving the decryption keys in the
card's memory, disable TLS processing and fall back to plain TOE.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27468

3 years agoFix downgrading of TOE TLS sockets to plain TOE.
John Baldwin [Thu, 3 Dec 2020 21:49:20 +0000 (21:49 +0000)]
Fix downgrading of TOE TLS sockets to plain TOE.

If a TOE TLS socket ends up using an unsupported TLS version or
ciphersuite, it must be downgraded to a "plain" TOE socket with TLS
encryption/decryption performed on the host.  The previous
implementation of this fallback was incomplete and resulted in hung
connections.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27467

3 years agoFix typo in kern_testfrwk.9.
Navdeep Parhar [Thu, 3 Dec 2020 21:38:00 +0000 (21:38 +0000)]
Fix typo in kern_testfrwk.9.

3 years agoMerge commit d989ffd10 from llvm git (by Dimitry Andric):
Dimitry Andric [Thu, 3 Dec 2020 19:29:18 +0000 (19:29 +0000)]
Merge commit d989ffd10 from llvm git (by Dimitry Andric):

  Implement computeHostNumHardwareThreads() for FreeBSD

  This retrieves CPU affinity via FreeBSD's cpuset(2) API, and makes
  LLVM respect affinity settings configured by the user via the
  cpuset(1) command.

  In particular, this allows to reduce the number of threads used on
  machines with high core counts, which can interact badly with
  parallelized build systems. This is particularly noticable with lld,
  which spawns lots of threads even for linking e.g. hello_world!

  This fix is related to PR48193, but does not adress the more
  fundamental problem, which is that LLVM by default grabs as many CPUs
  and/or threads as possible.

  Reviewed By: MaskRay

  Differential Revision: https://reviews.llvm.org/D92271

Originally by: mjg
MFC after: 1 week

3 years agoRevert r367815, so we can apply the slightly different version that
Dimitry Andric [Thu, 3 Dec 2020 19:26:21 +0000 (19:26 +0000)]
Revert r367815, so we can apply the slightly different version that
landed upstream:

For llvm's internal function which retrieves the number of available
"hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will
honor processor sets configured by the cpuset(1) command.

This should make it possible to avoid e.g. lld creating a huge number of
threads on a machine with many cores, even for linking simple programs.

This will also be submitted upstream.

Submitted by: mjg

3 years agoAlways use 64-bit physical addresses for dump_avail[] in minidumps
Mark Johnston [Thu, 3 Dec 2020 17:12:31 +0000 (17:12 +0000)]
Always use 64-bit physical addresses for dump_avail[] in minidumps

As of r365978, minidumps include a copy of dump_avail[].  This is an
array of vm_paddr_t ranges.  libkvm walks the array assuming that
sizeof(vm_paddr_t) is equal to the platform "word size", but that's not
correct on some platforms.  For instance, i386 uses a 64-bit vm_paddr_t.

Fix the problem by always dumping 64-bit addresses.  On platforms where
vm_paddr_t is 32 bits wide, namely arm and mips (sometimes), translate
dump_avail[] to an array of uint64_t ranges.  With this change, libkvm
no longer needs to maintain a notion of the target word size, so get rid
of it.

This is a no-op on platforms where sizeof(vm_paddr_t) == 8.

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

3 years agosdt: Create providers and probes in separate passes when loading sdt.ko
Mark Johnston [Thu, 3 Dec 2020 17:10:00 +0000 (17:10 +0000)]
sdt: Create providers and probes in separate passes when loading sdt.ko

The sdt module's load handler iterates over SDT linker sets for the
kernel and all loaded modules to create probes and providers defined by
SDT(9).  Probes in one module may belong to a provider in a different
module, but when a probe is created we assume that the provider is
already defined.  To maintain this invariant, modify the load handler to
perform two separate passes over loaded modules: one to define providers
and the other to define probes.

The problem manifests when loading linux.ko, which depends on
linux_common.ko, which defines providers used by probes defined in
linux.ko.

Reported by: gallatin
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years ago[axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue
Adrian Chadd [Thu, 3 Dec 2020 16:54:59 +0000 (16:54 +0000)]
[axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue

* uninitialised variable use
* Using AXGBE_SET_ADV() where it was intended; using AXGBE_ADV()
  seems wrong and also causes a compiler warning.

Reviewed by: rpokala
Differential Revision:   https://reviews.freebsd.org/D26839

3 years agoaddr2line: fix allocation leak in error path
Ed Maste [Thu, 3 Dec 2020 14:41:11 +0000 (14:41 +0000)]
addr2line: fix allocation leak in error path

CID: 1437677
Reported by: Coverity Scan
Sponsored by: The FreeBSD Foundation

3 years agodtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T
Andriy Gapon [Thu, 3 Dec 2020 11:59:40 +0000 (11:59 +0000)]
dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T

Note that the public documentation on dtrace.org fails to mention %T and
incorrectly documents %Y.  The latter actually uses format "%Y %b %e %T"
where %b is always in C locale.

Discussed with: markj
MFC after: 1 month
Sponsored by: Panzura

3 years agoif_dwc: Honor snps,pbl property
Emmanuel Vadot [Thu, 3 Dec 2020 11:15:49 +0000 (11:15 +0000)]
if_dwc: Honor snps,pbl property

DTS node can have this property which configure the burst length
for both TX and RX if it's the same.
This unbreak if_dwc on Allwinner A20 and possibly other boards that
uses this prop.

Reported by: qroxana <qroxana@mail.ru>

3 years agocxgbe(4): Stop but don't free netmap queues when netmap is switched off.
Navdeep Parhar [Thu, 3 Dec 2020 08:30:29 +0000 (08:30 +0000)]
cxgbe(4): Stop but don't free netmap queues when netmap is switched off.

It is common for freelists to be starving when a netmap application
stops.  Mailbox commands to free queues can hang in such a situation.
Avoid that by not freeing the queues when netmap is switched off.
Instead, use an alternate method to stop the queues without releasing
the context ids.  If netmap is enabled again later then the same queue
is reinitialized for use.  Move alloc_nm_rxq and txq to t4_netmap.c
while here.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoRemove trailing whitespace.
Cy Schubert [Thu, 3 Dec 2020 05:49:59 +0000 (05:49 +0000)]
Remove trailing whitespace.

MFC after: 1 week

3 years agoAdd support for hw.physmem tunable for ARM/ARM64/RISC-V platforms
Oleksandr Tymoshenko [Thu, 3 Dec 2020 05:39:27 +0000 (05:39 +0000)]
Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms

hw.physmem tunable allows to limit number of physical memory available to the
system. It's handled in machdep files for x86 and PowerPC. This patch adds
required logic to the consolidated physmem management interface that is used by
ARM, ARM64, and RISC-V.

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

3 years ago[PowerPC64LE] Fix LE VSX/fpr interop
Brandon Bergren [Thu, 3 Dec 2020 01:39:59 +0000 (01:39 +0000)]
[PowerPC64LE] Fix LE VSX/fpr interop

In the PCB struct, we need to match the VSX register file layout
correctly, as the VSRs shadow the FPRs.

In LE, we need to have a dword of padding before the fprs so they end up
on the correct side, as the struct may be manipulated by either the FP
routines or the VSX routines.

Additionally, when saving and restoring fprs, we need to explicitly target
the fpr union member so it gets offset correctly on LE.

Fixes weirdness with FP registers in VSX-using programs (A FPR that was
saved by the FP routines but restored by the VSX routines was becoming 0
due to being loaded to the wrong side of the VSR.)

Original patch by jhibbits.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D27431

3 years agoFix r368197: suppress error printing for the "check" command.
Gleb Smirnoff [Wed, 2 Dec 2020 21:53:28 +0000 (21:53 +0000)]
Fix r368197: suppress error printing for the "check" command.

Reviewed by: kevans

3 years agouart: allow UART_DEV_DBGPORT for fdt consoles
Mitchell Horne [Wed, 2 Dec 2020 21:01:52 +0000 (21:01 +0000)]
uart: allow UART_DEV_DBGPORT for fdt consoles

Allow fdt devices to be used as debug ports for gdb(4).

A debug console can be specified with the "freebsd,debug-path" property
in the device tree's /chosen node, or using the environment variable
hw.fdt.dbgport.

The device should be specified by its name in the device tree, for
example hw.fdt.dbgport="serial2".

PR: 251053
Submitted by: Dmitry Salychev <dsl@mcusim.org>
Submitted by:   stevek (original patch, D5986)
Reviewed by: andrew, mhorne
Differential Revision: https://reviews.freebsd.org/D27422

3 years agocxgbe(4): Revert r367917.
Navdeep Parhar [Wed, 2 Dec 2020 20:54:03 +0000 (20:54 +0000)]
cxgbe(4): Revert r367917.

r367917 fixed the backpressure on the netmap rxq being stopped but that
doesn't help if some other netmap rxq is starved (because it is stopping
too although the driver doesn't know this yet) and blocks the pipeline.
An alternate fix that works in all cases will be checked in instead.

Sponsored by: Chelsio Communications

3 years agocrashinfo: Add references to the gdb port/package
Ed Maste [Wed, 2 Dec 2020 19:58:50 +0000 (19:58 +0000)]
crashinfo: Add references to the gdb port/package

We intend to remove the obsolete GDB 6.1.1 from FreeBSD before FreeBSD 13.

Reviewed by jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27447

3 years agoem: fix a null de-reference in em_free_pci_resources
Mitchell Horne [Wed, 2 Dec 2020 17:37:32 +0000 (17:37 +0000)]
em: fix a null de-reference in em_free_pci_resources

A failure in iflib_device_register() can result in
em_free_pci_resources() being called after receive queues have already
been freed. In particular, a failure to allocate IRQ resources will goto
fail_queues, where IFDI_QUEUES_FREE() will be called via
iflib_tx_structures_free(), preceding the call to IFDI_DETACH().

Cope with this by checking adapter->rx_queues before dereferencing it.
A similar check is present in ixgbe(4) and ixl(4).

MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27260

3 years agoaddr2line: rework check_range conditions
Ed Maste [Wed, 2 Dec 2020 17:22:29 +0000 (17:22 +0000)]
addr2line: rework check_range conditions

Simplify logic and reduce indentation for DW_AT_low_pc case.

Reviewed by: Tiger Gao, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27426

3 years agoNVME: Multiple busdma related fixes.
Michal Meloun [Wed, 2 Dec 2020 16:54:24 +0000 (16:54 +0000)]
NVME: Multiple busdma related fixes.
- in nvme_qpair_process_completions() do dma sync before completion buffer
  is used.
- in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm
  and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure
  that all CPU stores are visible to external (including DMA) observers.
- Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems,
  buffers continuously owned (and accessed) by DMA must be allocated with this
  flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems
  (or coherent buses in mixed systems).

MFC after: 4 weeks
Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D27446

3 years agortsold: Fix bugs reported by Coverity
Mark Johnston [Wed, 2 Dec 2020 16:46:45 +0000 (16:46 +0000)]
rtsold: Fix bugs reported by Coverity

- Avoid leaking a socket if llflags_get() fails.
- Avoid leaking a file handle if rtsold_init_dumpfile() fails.
- Tighten the check in if_nametosdl() which determines whether we failed
  to find the specified interface.
- Fix errno handling in an error path in rtsock_open().

MFC after: 1 week

3 years agopf tests: Test case for bug #251414
Kristof Provost [Wed, 2 Dec 2020 16:33:23 +0000 (16:33 +0000)]
pf tests: Test case for bug #251414

Changing a table from not having counters to having counters (or vice versa)
may trigger panics.

PR: 251414
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27441

3 years agopf: Fix table entry counter toggling
Mark Johnston [Wed, 2 Dec 2020 16:01:43 +0000 (16:01 +0000)]
pf: Fix table entry counter toggling

When updating a table, pf will keep existing table entry structures
corresponding to addresses that are in both of the old and new tables.
However, the update may also enable or disable per-entry counters which
are allocated separately.  Thus when toggling PFR_TFLAG_COUNTERS, the
entries may be missing counters or may have unused counters allocated.

Fix the problem by modifying pfr_ina_commit() to transfer counters
from or to entries in the shadow table.

PR: 251414
Reported by: sigsys@gmail.com
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27440

3 years agonvme: Fix typo in definition
Chuck Tuffli [Wed, 2 Dec 2020 15:59:08 +0000 (15:59 +0000)]
nvme: Fix typo in definition

Change occurrences of "selt test" to "self tests in the NVMe header
file.

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

3 years agovt/fonts: fix typo
Toomas Soome [Wed, 2 Dec 2020 09:42:02 +0000 (09:42 +0000)]
vt/fonts: fix typo

add missing 'is'.

Reported by: bcr

3 years agoFix r368153. Wrong branch of #ifdef __ARMEB__ was deleted.
Michal Meloun [Wed, 2 Dec 2020 08:14:56 +0000 (08:14 +0000)]
Fix r368153. Wrong branch of #ifdef __ARMEB__ was deleted.

3 years agoAIO tests: update expected failure messages after r368265
Alan Somers [Wed, 2 Dec 2020 00:53:03 +0000 (00:53 +0000)]
AIO tests: update expected failure messages after r368265

PR: 220398, 251515
MFC after: 1 week
MFC-With: r368265

3 years agoselect: make sure there are no wakeup attempts after selfdfree returns
Mateusz Guzik [Wed, 2 Dec 2020 00:48:15 +0000 (00:48 +0000)]
select: make sure there are no wakeup attempts after selfdfree returns

Prior to the patch returning selfdfree could still be racing against doselwakeup
which set sf_si = NULL and now locks stp to wake up the other thread.

A sufficiently unlucky pair can end up going all the way down to freeing
select-related structures before the lock/wakeup/unlock finishes.

This started manifesting itself as crashes since select data started getting
freed in r367714.

3 years agoFix syntax
Konstantin Belousov [Tue, 1 Dec 2020 23:51:48 +0000 (23:51 +0000)]
Fix syntax

3 years agoImprove man page for AmazonEFS mounts.
Rick Macklem [Tue, 1 Dec 2020 23:33:10 +0000 (23:33 +0000)]
Improve man page for AmazonEFS mounts.

PR#250770 was actually just a misunderstanding of what
NFS mount options are needed for AmazonEFS mounts.
This patch attempts to clarify the manpage to clarify this.

This is a content change.

PR: 250770
Reviewed by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27430

3 years agoadd documentation that the rules need to be reloaded, and how to do it...
John-Mark Gurney [Tue, 1 Dec 2020 23:25:21 +0000 (23:25 +0000)]
add documentation that the rules need to be reloaded, and how to do it...

MFC after: 1 week

3 years agoficl: make dump a bit friendlier
Toomas Soome [Tue, 1 Dec 2020 23:07:05 +0000 (23:07 +0000)]
ficl: make dump a bit friendlier

would be nice to have dump to output hex and ascii.

3 years agolio_listio(2): send signal even if number of jobs is zero.
Konstantin Belousov [Tue, 1 Dec 2020 22:53:33 +0000 (22:53 +0000)]
lio_listio(2): send signal even if number of jobs is zero.

Right now, if lio registered zero jobs, syscall frees lio job
structure, cleaning up queued ksi.  As result, the realtime signal is
dequeued and never delivered.

Fix it by allowing sendsig() to copy ksi when job count is zero.

PR: 220398
Reported and reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27421

3 years agovfs_aio.c: style.
Konstantin Belousov [Tue, 1 Dec 2020 22:46:51 +0000 (22:46 +0000)]
vfs_aio.c: style.

Mostly re-wrap conditions to split after binary ops.

Reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27421

3 years agoFix syntax
Konstantin Belousov [Tue, 1 Dec 2020 22:44:23 +0000 (22:44 +0000)]
Fix syntax

3 years agovfs_aio.c: correct comment.
Konstantin Belousov [Tue, 1 Dec 2020 22:30:32 +0000 (22:30 +0000)]
vfs_aio.c: correct comment.

Reviewed by: asomers
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27421

3 years agoficl: instead of pad, emit can use local variable
Toomas Soome [Tue, 1 Dec 2020 22:28:02 +0000 (22:28 +0000)]
ficl: instead of pad, emit can use local variable

Pad in forth is used as "scratchpad" and internal implementations
should not use it. Ficl does not really follow this rule and this can fire back.
emit has no need to use pad, we can use local variable instead.

3 years agortld: bump r_debug.r_version to 1 from current 0.
Konstantin Belousov [Tue, 1 Dec 2020 22:28:01 +0000 (22:28 +0000)]
rtld: bump r_debug.r_version to 1 from current 0.

Add r_ldbase.

Requested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27429

3 years ago[arm64] Parse ACPI _PXM property on ARM64 platform
Oleksandr Tymoshenko [Tue, 1 Dec 2020 20:27:06 +0000 (20:27 +0000)]
[arm64] Parse ACPI _PXM property on ARM64 platform

Enable devices' NUMA proximity infromation parsing on ARM64 systems

Sponsored by: Ampere Computing
Submitted by: Klara, Inc.

3 years ago[arm64] Bump MAXMEMDOM value to 8 to match amd64
Oleksandr Tymoshenko [Tue, 1 Dec 2020 20:10:55 +0000 (20:10 +0000)]
[arm64] Bump MAXMEMDOM value to 8 to match amd64

On some of the server-grade ARM64 machines the number of NUMA domains is higher
than 2. When booting GENERIC kernel on such machines the SRAT parser fails
leaving the system with a single domain. To make GENERIC kernel usable on those
server, match the parameter value with the one for amd64 arch.

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

3 years agortsold: Fix multiple buffer overflows
Mark Johnston [Tue, 1 Dec 2020 19:34:44 +0000 (19:34 +0000)]
rtsold: Fix multiple buffer overflows

Approved by: so
Security: CVE-2020-25577
MFC after: now

3 years agoFix a couple of typos.
John Baldwin [Tue, 1 Dec 2020 18:57:37 +0000 (18:57 +0000)]
Fix a couple of typos.

Submitted by: rmacklem

3 years agoUSB umass: add quirk to not probe
Bjoern A. Zeeb [Tue, 1 Dec 2020 18:24:06 +0000 (18:24 +0000)]
USB umass: add quirk to not probe

Some USB WLAN devices have "on-board" storage showing up as umass
and making the root mount wait for a very long time.
The WLAN drivers know how to deal with that an issue an eject
command later when attaching themselves.
Introduce a quirk to not probe these devices as umass and avoid
hangs and confusion altogether.

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

3 years agoUse uintptr_t instead of uint64_t for pointers in stack frames.
John Baldwin [Tue, 1 Dec 2020 18:22:34 +0000 (18:22 +0000)]
Use uintptr_t instead of uint64_t for pointers in stack frames.

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