]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoena: change ENA C++-style comment into C-style
Marcin Wojtas [Mon, 14 Jun 2021 08:57:45 +0000 (10:57 +0200)]
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.

2 years agoIntroduce LS1028A PCI MDIO driver.
Marcin Wojtas [Wed, 19 May 2021 14:35:19 +0000 (16:35 +0200)]
Introduce LS1028A PCI MDIO driver.

Implement support for the NXP LS1028A SoC MDIO controller.
It is attached to the internal PCI root complex.
The controller is used to communicate with PHYs of ports connected
to the internal switch.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30731

2 years agoIntroduce new driver for NXP Ethernet controller
Marcin Wojtas [Wed, 7 Apr 2021 14:39:58 +0000 (16:39 +0200)]
Introduce new driver for NXP Ethernet controller

ENETC it a gigabit Ethernet controller found on the LS1028A board.
It supports basic VLAN offloads - tag extraction, injection and hardware
filtering. Inband MDIO connectivity is used for link status
monitoring through the miibus interface. Fixed-link mode is also
supported, which allows for operation of internal cpu to switch port.
Since no admin interrupts are present in hardware, link status polling
has to be used.
Due to a hardware bug software reset of the NIC results in a external
abort. Because of that most of the hardware initialization is done
during attach. This also means that in the case of an fatal error full
board reset is required.
The enetc_hw.h header was imporoted from Linux. It is dual licensed.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30729

2 years agoIntroduce MDIO read/write functions for LS1028A.
Marcin Wojtas [Wed, 19 May 2021 14:31:35 +0000 (16:31 +0200)]
Introduce MDIO read/write functions for LS1028A.

Provide common MDIO code for two LS1028 ENETC controllers -
an external one found on the PCI bus and internal one found in ENETC.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30730

2 years agoiflib: Add a new quirk
Marcin Wojtas [Wed, 19 May 2021 09:09:16 +0000 (11:09 +0200)]
iflib: Add a new quirk

ENETC NIC found in LS1028A has a bug where clearing TX pidx/cidx
causes the ring to hang after being re-enabled.
Add a new flag, if set iflib will preserve the indices during restart.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: gallatin, erj
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30728

2 years agoFix error value returned by ofw_bus_gen_get_node().
Michal Meloun [Thu, 24 Jun 2021 09:56:20 +0000 (11:56 +0200)]
Fix error value returned by ofw_bus_gen_get_node().

By definition ofw_bus_get_node() should  consistently return -1 when there
is no associated OF node.

MFC after: 4 weeks
Discussed with: nwhitehorn
Analyzed in:  https://reviews.freebsd.org/D30761

2 years agolibsa: Add tslog support for arm64
Colin Percival [Thu, 24 Jun 2021 05:21:23 +0000 (22:21 -0700)]
libsa: Add tslog support for arm64

The original code only supported x86 and used rdtsc(); we now also
support arm64 and use the CNTVCT_EL0 special register.

2 years agoarm64: Instrument initarm with TSLOG
Colin Percival [Thu, 24 Jun 2021 05:17:55 +0000 (22:17 -0700)]
arm64: Instrument initarm with TSLOG

The "function entry" needs to be recorded with TSRAW() rather than
TSENTER() since curthread is not yet defined.  (The same approach
is taken in amd64's hammer_time.)

2 years agoarm64: Disable early printf if TSLOG
Colin Percival [Thu, 24 Jun 2021 05:10:26 +0000 (22:10 -0700)]
arm64: Disable early printf if TSLOG

The warning message "ERROR loading DTB" (for systems without a device
tree blob) is printed extremely early in the boot process -- among
other things, before curthread or other pcpu data has been set up.
Unfortunately, printf is instrumented with TSLOG, which cannot run
quite this early.

Wrap the printf in #ifndef TSLOG; the situations where the printf
will be useful are not ones where TSLOG would be in use.

2 years agoarm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2()
Alan Cox [Wed, 23 Jun 2021 19:14:31 +0000 (14:14 -0500)]
arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2()

Revise pmap_remove_l2() to use the constant-time function page_to_pvh()
instead of the linear-time function pa_to_pvh().

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

2 years agoamd64: do not touch BIOS reset flag halfword, unless we boot through BIOS
Konstantin Belousov [Sun, 20 Jun 2021 14:58:11 +0000 (17:58 +0300)]
amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS

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

2 years agovdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME...
Konstantin Belousov [Tue, 22 Jun 2021 23:24:08 +0000 (02:24 +0300)]
vdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME_FAST

so that libc vdso and kernel syscall give closer results.

Reported by: dchagin
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30873

2 years agovdso gettimeofday: minor restructuring
Konstantin Belousov [Tue, 22 Jun 2021 23:58:32 +0000 (02:58 +0300)]
vdso gettimeofday: minor restructuring

Call binuptime inside switch statement, instead of pre-calculating
the abs argument.
Change the type of the abs argument to bool.

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

2 years agobsdinstall: Avoid double-mounting /dev
Ryan Moeller [Wed, 23 Jun 2021 13:42:43 +0000 (13:42 +0000)]
bsdinstall: Avoid double-mounting /dev

After 34766aa8cb514472c571f8b0e90e833833acef51 we are mounting and
unmounting devfs elsewhere already.

Reviewed by: nwhitehorn
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D30877

2 years agoffs_softdep: force sync if journal is low in journal_check_space
Konstantin Belousov [Tue, 15 Jun 2021 10:27:37 +0000 (13:27 +0300)]
ffs_softdep: force sync if journal is low in journal_check_space

This effectively causes syncing of the mount point from softdep_prealloc(),
softdep_prerename(), and softdep_prelink().  Typically it avoids the need
for journal suspension at this point, at all.

Suggested and reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoffs_softdep.c: add journal_check_space() helper
Konstantin Belousov [Tue, 15 Jun 2021 10:23:44 +0000 (13:23 +0300)]
ffs_softdep.c: add journal_check_space() helper

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agosoftdep_prelink(): only do sync if other thread changed the vnode metadata since...
Konstantin Belousov [Sat, 1 May 2021 21:53:21 +0000 (00:53 +0300)]
softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink

We call into softdep_prerename() and softdep_prelink() when there is
low free space in the journal. Functions sync all vnodes participating
in the VOP, in the hope that this would reduce journal utilization. But
if the vnodes are already synced, doing sync would only spend writes,
journal is filled not due to the records from modifications of our
vnodes.

Remember original seqc numbers for vnodes, and only initiate syncs when
seqc changed.

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoufs_rename(): only do softdep_prerename() when other thread changed a vnode
Konstantin Belousov [Thu, 29 Apr 2021 22:39:57 +0000 (01:39 +0300)]
ufs_rename(): only do softdep_prerename() when other thread changed a vnode

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoffs: mark block (re-)allocations as seqc writes
Konstantin Belousov [Fri, 21 May 2021 14:12:08 +0000 (17:12 +0300)]
ffs: mark block (re-)allocations as seqc writes

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoufs_rename(): softdep_prerename() does something only for SU+J
Konstantin Belousov [Thu, 29 Apr 2021 22:23:38 +0000 (01:23 +0300)]
ufs_rename(): softdep_prerename() does something only for SU+J

so call it only in SU+J case

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoffs: reduce number of dvp relocks in softdep_prelink()
Konstantin Belousov [Thu, 29 Apr 2021 22:21:33 +0000 (01:21 +0300)]
ffs: reduce number of dvp relocks in softdep_prelink()

If vp == NULL, we unlocked and then immediately relocked dvp there.

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoufs_vnops.c: style
Konstantin Belousov [Sat, 1 May 2021 21:40:50 +0000 (00:40 +0300)]
ufs_vnops.c: style

Wrap too long functions declarations.

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agounionfs: do not use bare struct componentname
Konstantin Belousov [Mon, 14 Jun 2021 18:45:23 +0000 (21:45 +0300)]
unionfs: do not use bare struct componentname

Allocate nameidata on stack and NDPREINIT() it, for compatibility with
assumptions from other filesystems' lookup code.

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agonamei: add NDPREINIT() macro
Konstantin Belousov [Mon, 14 Jun 2021 19:03:41 +0000 (22:03 +0300)]
namei: add NDPREINIT() macro

Its intent is to do the initialization of the future part of struct nameidata
which should be used across several namei() and VOPs.  Right now it is NOP.

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoseqc: add symbolic name for in-modify bit
Konstantin Belousov [Thu, 29 Apr 2021 22:39:23 +0000 (01:39 +0300)]
seqc: add symbolic name for in-modify bit

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30041

2 years agoarm64: remove an unneeded test from pmap_clear_modify()
Alan Cox [Wed, 23 Jun 2021 05:10:20 +0000 (00:10 -0500)]
arm64: remove an unneeded test from pmap_clear_modify()

The page table entry for a 4KB page mapping must be valid if a PV entry
for the mapping exists, so there is no point in testing each page table
entry's validity when iterating over a PV list.

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

2 years agonet/bpf: Fix writing of buffer bigger than PAGESIZE
Florian Florensa [Fri, 16 Feb 2018 09:53:22 +0000 (10:53 +0100)]
net/bpf: Fix writing of buffer bigger than PAGESIZE

When allocating the mbuf we used m_get2 which fails
if len is superior to MJUMPAGESIZE, if its the case,
use m_getjcl instead.

Reviewed by: kp@
PR: 205164
Pull Request: https://github.com/freebsd/freebsd-src/pull/131

2 years agodevctl: add ADDR_ADD and ADDR_DEL devctl event for IFNET
Rozhuk Ivan [Wed, 23 Jun 2021 16:20:10 +0000 (10:20 -0600)]
devctl: add ADDR_ADD and ADDR_DEL devctl event for IFNET

Add devd event on network iface address add/remove.  Can be used to
automate actions on any address change.

Reviewed by: imp@ (and minor style tweaks)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30840

2 years agodevctl: add RENAME devctl event for IFNET
Rozhuk Ivan [Wed, 23 Jun 2021 16:15:11 +0000 (10:15 -0600)]
devctl: add RENAME devctl event for IFNET

Add devd event on network iface rename.

Reviewed by: imp@,asomers@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30839

2 years agomdconfig tests: Correct a copy-pasted test description
Mark Johnston [Wed, 23 Jun 2021 14:37:40 +0000 (10:37 -0400)]
mdconfig tests: Correct a copy-pasted test description

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agorpc.lockd: Use libc strnlen() instead of reimplementing it
Mark Johnston [Wed, 23 Jun 2021 14:06:57 +0000 (10:06 -0400)]
rpc.lockd: Use libc strnlen() instead of reimplementing it

No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoip_mroute: initialize vif ifnet properly
Wojciech Macek [Wed, 2 Jun 2021 06:46:29 +0000 (08:46 +0200)]
ip_mroute: initialize vif ifnet properly

Use if_alloc to ensure all fields of ifnet are allocated
properly

Reported by:   Damien Deville
Sponsored by:  Stormshield
Obtained from: Semihalf
Reviewed by:   mw
Differential revision: https://reviews.freebsd.org/D30608

2 years agolibalias: Fix compile time warning about unused functions
Lutz Donnerhacke [Mon, 21 Jun 2021 15:19:35 +0000 (17:19 +0200)]
libalias: Fix compile time warning about unused functions

Compiling libalias results in warnings about unused functions.
Those warnings are caused by clang's heuristic to consider an inline
function as in use, iff the declaration is in a *.c file.
Declarations in *.h files do not emit those warnings.

Hence the declarations must be moved to an extra *.h file.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30844

2 years agobus_child_pnpinfo: fix two stragglers
Warner Losh [Wed, 23 Jun 2021 04:10:31 +0000 (22:10 -0600)]
bus_child_pnpinfo: fix two stragglers

ddfc9c4c59e2 was missing changes to two files to complete the
bus_child_pnpinfo_str->bus_child_pnpinfo. This fixes the broken kernel
builds.

Sponsored by: Netflix

2 years agonewbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location...
Warner Losh [Wed, 23 Jun 2021 02:27:57 +0000 (20:27 -0600)]
newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf

Now that the upper layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.

Reviewed by: jhb, bcr
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29937

2 years agotoe: Read-lock the inp in toe_4tuple_check().
John Baldwin [Tue, 22 Jun 2021 23:31:01 +0000 (16:31 -0700)]
toe: Read-lock the inp in toe_4tuple_check().

tcp_twcheck now expects a read lock on the inp for the SYN case
instead of a write lock.

Reviewed by: np
Fixes: 1db08fbe3ffa tcp_input: always request read-locking of PCB for any pure SYN segment.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D30782

2 years agocxgbei: Better handle new tasks and transfers when disconnecting.
John Baldwin [Fri, 18 Jun 2021 23:15:50 +0000 (16:15 -0700)]
cxgbei: Better handle new tasks and transfers when disconnecting.

If the connection is in the process of disconnecting, ic_socket can be
NULL.  For icl_cxgbei_conn_transfer_setup(), lock the connection and
check ic_socket before using it.  For icl_cxgbei_conn_task_setup(),
the caller already holds the connection lock, so assert it and bail
early with ECONNRESET if the connection is disconnecting.

Reported by: Jithesh Arakkan @ Chelsio
Fixes:   f949967c8eb3 cxgbei: Fix a race between transfer setup and a peer reset.

2 years agoUnbreak TFO, that was broken with 8d5719aa74f. These two assignments
Gleb Smirnoff [Tue, 22 Jun 2021 23:03:44 +0000 (16:03 -0700)]
Unbreak TFO, that was broken with 8d5719aa74f.  These two assignments
are unneccessary and used to be there before TFO as an invariant.  With
TFO and after 8d5719aa74f the "so" value is still needed.

Reported & tested by: tuexen
Fixes: 8d5719aa74f1d1441ee5ee365d45d53f934e81d6

2 years agoDisable llvm generating 128-bit multiply libcalls on 32-bit ARM
Dimitry Andric [Tue, 22 Jun 2021 20:26:13 +0000 (22:26 +0200)]
Disable llvm generating 128-bit multiply libcalls on 32-bit ARM

Merge commit 789708617d20 from llvm git (Koutheir Attouchi):

  Do not generate calls to the 128-bit function __multi3() on 32-bit ARM

  Re-applying this patch after bots failures. Should be fine now.

  The function __multi3() is undefined on 32-bit ARM, so a call to it should
  never be emitted. Instead, plain instructions need to be generated to
  perform 128-bit multiplications.

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

Reported by: mmel
MFC after: 3 days

2 years agoFix failures in libm's lround_test after clang 12 import
Dimitry Andric [Tue, 22 Jun 2021 16:38:27 +0000 (18:38 +0200)]
Fix failures in libm's lround_test after clang 12 import

It turned out that the (type)DTYPE_MAX conversions at the top of
s_lround.c are now emitted as cvtsi2sd instructions, at least on SSE
capable CPUs. This caused the FE_INEXACT flag to always be set, at least
for the double and float variants. Under clang 11, the whole INRANGE()
comparisons were still optimized away, but this has "improved" in clang
12, due to stricter adherence to the -ffp-exception-behavior=maytrap
compiler flag.

To avoid run-time integer to float conversions, use static constants
instead, so they are computed at compile time, and the INRANGE()
statements are optimized away again, if applicable.

While here, use an integer instead of a floating type to store the test
results in lround_test.c, as this is more appropriate, and we can also
drop the volatile hack.

Reported by: arichardson
MFC after: 3 days

2 years agoUPDATING: Fix typo
Maigurs Stalidzans [Tue, 22 Jun 2021 14:45:35 +0000 (08:45 -0600)]
UPDATING: Fix typo

Revired by: imp@
Sponsored by: Netflix

2 years agortld-elf: Check the return value of obj_enforce_relro()
Alex Richardson [Tue, 22 Jun 2021 08:09:44 +0000 (09:09 +0100)]
rtld-elf: Check the return value of obj_enforce_relro()

The mprotect() call was failing on CheriBSD when changing rtld's relro
page permissions due to missing CHERI capability permissions on the
mprotect() argument but did not report an error since the return value
was being ignored. It should never fail on any supported FreeBSD
architecture, but checking the return value seems like a good
sanity check to me.

Reviewed By: kib, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30820

2 years agomkimg: Add fat32lba partition type
Jose Luis Duran [Fri, 18 Jun 2021 14:55:24 +0000 (11:55 -0300)]
mkimg: Add fat32lba partition type

Syntactic sugar for a `gpart add -t '!12' ...` equivalent.

Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/484

2 years agoMerge tag 'vendor/NetBSD/vis/20210621' into vis
Warner Losh [Mon, 21 Jun 2021 23:56:21 +0000 (17:56 -0600)]
Merge tag 'vendor/NetBSD/vis/20210621' into vis

Bring in NetBSD's vis as of 2021-06-21

Man page fixes, -M, -N and -S support for shell meta characters (all or some)
and no locale.

Discussed with: emaste@
Differential Revision: https://reviews.freebsd.org/D25358

2 years agoImport vis(1) from NetBSD as of 20210621
Warner Losh [Mon, 21 Jun 2021 23:51:00 +0000 (17:51 -0600)]
Import vis(1) from NetBSD as of 20210621

2 years agoEC2: Tell gptboot to skip its 3 second wait
Colin Percival [Mon, 21 Jun 2021 22:35:16 +0000 (15:35 -0700)]
EC2: Tell gptboot to skip its 3 second wait

Nobody is going to hit a key to tell gptboot to select another disk,
so there's no point waiting.

2 years agoarm64: Use page_to_pvh() when the vm_page_t is known
Alan Cox [Mon, 21 Jun 2021 07:45:21 +0000 (02:45 -0500)]
arm64: Use page_to_pvh() when the vm_page_t is known

When support for a sparse pv_table was added, the implementation of
pa_to_pvh() changed from a simple constant-time calculation to iterating
over the array vm_phys_segs[].  To mitigate this issue, an alternative
function, page_to_pvh(), was introduced that still runs in constant time
but requires the vm_page_t to be known.  However, three cases where the
vm_page_t is known were not converted to page_to_pvh().  This change
converts those three cases.

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

2 years agosdhci_fdt: Add gpio_if.h to the source
Emmanuel Vadot [Mon, 21 Jun 2021 19:55:03 +0000 (21:55 +0200)]
sdhci_fdt: Add gpio_if.h to the source

Otherwise if we compile a kernel without gpio support this file isn't compiled.
Also it's needed so it's good to list all deps.

PR: 256756

2 years agoFix clang assertion while building recent www/chromium
Dimitry Andric [Mon, 21 Jun 2021 18:46:34 +0000 (20:46 +0200)]
Fix clang assertion while building recent www/chromium

Merge commit c8227f06b335 from llvm git (by Arthur Eubanks):

  [clang] Don't assert in EmitAggregateCopy on trivial_abi types

  Fixes PR42961.

  Reviewed By: rnk

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

PR: 256721, 255570
Reported by: jbeich
MFC after: 3 days

2 years agoaacraid: ignore data overrun on INQUIRY
Leandro Lupori [Mon, 21 Jun 2021 18:13:13 +0000 (15:13 -0300)]
aacraid: ignore data overrun on INQUIRY

The INQUIRY command may return a CAM_DATA_RUN_ERR code, even when
it succeeds. This happens during driver startup, causing the
current and further inquiries to be aborted, resulting in some
missing information about the controller.

Reviewed by:            imp
Sponsored by:           Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:  https://reviews.freebsd.org/D30843

2 years agoaacraid: reduce max I/O size to avoid DMA issues
Leandro Lupori [Mon, 21 Jun 2021 18:04:43 +0000 (15:04 -0300)]
aacraid: reduce max I/O size to avoid DMA issues

Reserve one page for the DMA subsystem, that may need it when the I/O
buffer is not page aligned.

Without this change, writes with the maximum allowed size failed, if:
- physical memory was fragmented, making it necessary to use one DMA
  segment for each page
- the buffer to be written was not page aligned, causing the DMA
  subsystem to need one extra segment

In the scenario above, the DMA subsystem would run out of segments,
resulting in a write with no SG segments, that would fail.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D30798

2 years agolinux(4): Retire unused declaration.
Dmitry Chagin [Tue, 22 Jun 2021 05:41:33 +0000 (08:41 +0300)]
linux(4): Retire unused declaration.

MFC after: 2 weeks

2 years agolinux(4): Retire a now unused include.
Dmitry Chagin [Tue, 22 Jun 2021 05:39:47 +0000 (08:39 +0300)]
linux(4): Retire a now unused include.

MFC after: 2 weeks

2 years agolinux(4): Do not specify shared page for aout binaries.
Dmitry Chagin [Tue, 22 Jun 2021 05:38:45 +0000 (08:38 +0300)]
linux(4): Do not specify shared page for aout binaries.

In Linux vDSO is a small shared ELF library, so it is not intended
for aout binaries. This was added on 64-bit Linuxulator import by mistake.

MFC after: 2 weeks

2 years agolinux(4): Retire linux_kplatform.
Dmitry Chagin [Tue, 22 Jun 2021 05:36:21 +0000 (08:36 +0300)]
linux(4): Retire linux_kplatform.

Assuming we can't run on i486, i586 class cpu, retire linux_kplatform var
and use hardcoded 'machine' value in linux_newuname().

I have added linux_kplatform for consistency with linux_platform which is
placed in to vdso to avoid excess copyout it on stack for AT_PLATFORM at
exec time.

This is the first stage of Linuxulator's vdso revision.

Reviewed by: trasz, imp
Differential Revision: https://reviews.freebsd.org/D30774
MFC after: 2 weeks

2 years agolinux(4): Get rid of Linuxulator kernel build options.
Dmitry Chagin [Tue, 22 Jun 2021 05:32:39 +0000 (08:32 +0300)]
linux(4): Get rid of Linuxulator kernel build options.

Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel
build options. Since we have 32 and 64 bit Linux emulators, we can't build both
emulators together into the kernel. I don't think it matters, Linux emulation
depends on loadable modules (via rc).

Cut LINPROCFS and LINSYSFS for consistency.

PR: 215061
Reviewed by: bcr (manpages), trasz
Differential Revision: https://reviews.freebsd.org/D30751
MFC after: 2 weeks

2 years agolinux: reduce differences between rt_sendsig() and sendsig()
Edward Tomasz Napierala [Mon, 21 Jun 2021 16:13:53 +0000 (17:13 +0100)]
linux: reduce differences between rt_sendsig() and sendsig()

This makes it easier to compare the two.  This involves moving
the mutex slightly lower down, but there should be no functional
changes.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30541

2 years agolinux(4): Regen for linux_poll system call.
Dmitry Chagin [Tue, 22 Jun 2021 05:09:55 +0000 (08:09 +0300)]
linux(4): Regen for linux_poll system call.

MFC after: 2 weeks

2 years agolinux(4): Implement poll system call via linux_common_ppol()
Dmitry Chagin [Tue, 22 Jun 2021 05:07:46 +0000 (08:07 +0300)]
linux(4): Implement poll system call via linux_common_ppol()
for the sake of converting events to/from native.

MFC after: 2 weeks

2 years agolinux(4): Rework Linux ppoll system call.
Dmitry Chagin [Tue, 22 Jun 2021 05:06:05 +0000 (08:06 +0300)]
linux(4): Rework Linux ppoll system call.

For now the Linux emulation layer uses in kernel ppoll(2) without
conversion of user supplied fd 'events', and does not convert the
kernel supplied fd 'revents'.

At least POLLRDHUP is handled by FreeBSD differently than by
Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's
unlike FreeBSD, which does more strictly check and fails.

Rework the Linux ppoll, using kern_poll and converting 'events'
and 'revents' values.
While here, move poll events defines to the MI part of code as they
mostly identical on all arches except arm.

Differential Revision: https://reviews.freebsd.org/D30716
MFC after: 2 weeks

2 years agotelnet(1): add quiet mode ("telnet -Q")
Edward Tomasz Napierala [Mon, 21 Jun 2021 16:07:39 +0000 (17:07 +0100)]
telnet(1): add quiet mode ("telnet -Q")

Reviewed By: imp, phk
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #54
Differential Revision: https://reviews.freebsd.org/D30819

2 years agoimgact_elf: compute auxv buffer size instead of using magic value
Edward Tomasz Napierala [Mon, 21 Jun 2021 14:34:19 +0000 (15:34 +0100)]
imgact_elf: compute auxv buffer size instead of using magic value

The new buffer is somewhat larger, but there should be no functional
changes.

Reviewed By: kib, imp
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30821

2 years agoEmit an error when we seen absolute paths to .o files
Alex Richardson [Mon, 21 Jun 2021 13:58:01 +0000 (14:58 +0100)]
Emit an error when we seen absolute paths to .o files

This is usually an error caused by using an absolute path in SRCS. This
happened to me in 83c20b8a2da0 due to changing LDADD to SRCS.
I did not notice that this had created a .o file inside the source tree
since .gitignore contains "*.o" and therefore git did not report any
changes.

Adding this warning message to bsd.lib.mk/bsd.prog.mk should prevent
issues like this in the future.

There was exactly one case of an absolute OBJS path in the current source
tree but that was removed in e713d3a013882893fceb84dd14569052271497a9.

Reviewed By: emaste (earlier version), imp
Differential Revision: https://reviews.freebsd.org/D28467

2 years agodiff tests: Require root for report_identical
Mark Johnston [Mon, 21 Jun 2021 15:00:50 +0000 (11:00 -0400)]
diff tests: Require root for report_identical

This test switches users and either hangs or fails when run as an
unprivileged user.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoRetore the vnet before returning an error.
George V. Neville-Neil [Mon, 21 Jun 2021 14:46:20 +0000 (10:46 -0400)]
Retore the vnet before returning an error.

Obtained from: Kanndula, Dheeraj <Dheeraj.Kandula@netapp.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30741

2 years agobanner: Correct history.
Warner Losh [Mon, 21 Jun 2021 14:16:10 +0000 (08:16 -0600)]
banner: Correct history.

Banner appeared in the 6th edition of AT&T Research unit. It was
subsequently on all the Berkeley tapes, as well as PWB, System III and
System V. The PWB/AT&T and BSD banner programs were different, and the
current FreeBSD banner program shares many elements of the 3BSD one,
though the font has changed.

Sponsored by: Netflix

2 years agovmstat: correct history
Warner Losh [Mon, 21 Jun 2021 14:29:57 +0000 (08:29 -0600)]
vmstat: correct history

vmstat dates back to 3BSD, but wasn't in 32V nor the 7th edition. It
does not seem to have been in AT&T's commercial offerings at all.

Sponsored by: Netflix

2 years agobasename: fix history
Warner Losh [Mon, 21 Jun 2021 14:23:34 +0000 (08:23 -0600)]
basename: fix history

Basename(1) first appeared in the 7th edition. It was not in the 6th
edition, or PWB releases. It's on all the subsequent descendants.

Dirname(1) first appeared in System III, and was later picked up in
4.3-Reno and 8th edition research unix (though was not in 4.1BSD where
the bulk of 8th edition came from). In System III and V8 it was a shell
script, though the BSD version is in C.

Sponsored by: Netflix

2 years agortwn: make sure to not write in upper bits of txdseq
Andriy Gapon [Mon, 21 Jun 2021 08:05:04 +0000 (11:05 +0300)]
rtwn: make sure to not write in upper bits of txdseq

ni_txseqs is kept as 16-bit counter, but we need to trim the upper four
bits as they may have special meanings for the firmware / hardware.
For instance, bit 15 enables hardware / firmware generation of sequence
numbers that overrides sequence numbers programmed by the driver.

Reviewed by: adrian
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30814

2 years agoloader: Use tslog to instrument some functions
Colin Percival [Mon, 31 May 2021 00:01:25 +0000 (00:01 +0000)]
loader: Use tslog to instrument some functions

In my initial testing, these are the functions which showed up as
being worth instrumenting.  More may be added later.

common/console.c: cons_probe
common/gfx_fb.c: read_list, insert_font, autoload_font
common/interp.c: interact
common/interp_lua.c: interp_init, interp_run
efi/libefi/efipart.c: efipart_readwrite
i386/libi386/biosdisk.c: bd_init, bd_open, bd_edd_io, bd_chs_io, bd_io
libsa/open.c: open
libsa/read.c: read
libsa/twiddle.c: twiddle

Note that profiling interp_run may be of questionable utility as it
may depend on user behaviour (e.g. pressing keys).

Reviewed by: kevans (earlier version)

2 years agokern_tslog: Include tslog data from loader
Colin Percival [Sun, 30 May 2021 23:25:01 +0000 (23:25 +0000)]
kern_tslog: Include tslog data from loader

The i386 loader (and hopefully others to come) now passes tslog data
as a "preloaded module".  Include this in the data returned by the
debug.tslog sysctl.

Reviewed by: kevans

2 years agostand/common command_boot: Pass tslog to kernel
Colin Percival [Sun, 30 May 2021 23:22:28 +0000 (23:22 +0000)]
stand/common command_boot: Pass tslog to kernel

Pass the recorded tslog buffer to the kernel as a "preloaded module".

Reviewed by: kevans

2 years agoefi/loader: Call tslog_init
Colin Percival [Mon, 21 Jun 2021 01:31:27 +0000 (18:31 -0700)]
efi/loader: Call tslog_init

This allows the EFI loader to start recording timestamps.

2 years agoi386/loader: Call tslog_init
Colin Percival [Sun, 30 May 2021 23:21:31 +0000 (23:21 +0000)]
i386/loader: Call tslog_init

This allows the i386 loader to start recording timestamps.

Reviewed by: kevans

2 years agostand/common: Add support for timestamp logging (tslog)
Colin Percival [Sun, 30 May 2021 20:30:28 +0000 (20:30 +0000)]
stand/common: Add support for timestamp logging (tslog)

This adds tslog_init, which allocates a 2MB buffer for recording
timestamped events; and tslog_publish, which takes the buffer and
passes it to the kernel as a "preloaded module".  These functions
will be used in a later commit.

Reviewed by: kevans

2 years agolibsa: Add support for timestamp logging (tslog)
Colin Percival [Sun, 30 May 2021 20:20:50 +0000 (20:20 +0000)]
libsa: Add support for timestamp logging (tslog)

At present this only supports x86, due to the use of the rdtsc
instruction; and is inert unless a buffer is allocated and passed to
the tslog code (which will be done by a future commit).

Reviewed by: kevans

2 years agostand/common: Add file_addbuf()
Colin Percival [Sun, 30 May 2021 20:17:11 +0000 (20:17 +0000)]
stand/common: Add file_addbuf()

This provides an interface for a memory buffer to be passed from the loader
to the kernel as a "preloaded module".

Reviewed by: kevans

2 years agocam: Set the CAM_QOS_VALID when valid
Warner Losh [Fri, 18 Jun 2021 17:57:57 +0000 (11:57 -0600)]
cam: Set the CAM_QOS_VALID when valid

When the elapsed time of the operation is complete and stored in the QOS
field, set the CAM_QOS_VALID bit.  In iosched, test to make sure it's
set before using it.

Sponsored by: Netflix

2 years agogenet: Fix potential crash during attach
Mike Karels [Sun, 20 Jun 2021 16:10:26 +0000 (11:10 -0500)]
genet: Fix potential crash during attach

As pointed out in the bug, the genet driver (RPi4 Ethernet) was
attaching the interrupts before the data structures were fully
initialized, causing a crash if an interrupt came in during the
attach.  Fix by reordering code blocks.

PR: 256334
Reported by: < ghuckriede at blackberry.com >
Reviewed by: < ghuckriede at blackberry.com > (informally)
MFC after: 3 days

2 years agozfs: add version update missing in 0d8fe2373
Martin Matuska [Sun, 20 Jun 2021 08:04:52 +0000 (10:04 +0200)]
zfs: add version update missing in 0d8fe2373

2 years agozfs: merge openzfs/zfs@c4c162c1e (master) into main
Martin Matuska [Sun, 20 Jun 2021 07:18:44 +0000 (09:18 +0200)]
zfs: merge openzfs/zfs@c4c162c1e (master) into main

Notable upstream pull request merges:
  #12054 Avoid deadlock when removing L2ARC devices under I/O
  #12172 Use wmsum for arc, abd, dbuf and zfetch statistics
  #12221 vdev_draid_min_asize() ignores reserved space

Obtained from: OpenZFS
OpenZFS commit: c4c162c1e8ff9ce8833014711875d18df520096c

2 years agofusefs: ensure that FUSE ops' headers' unique values are actually unique
Alan Somers [Fri, 18 Jun 2021 00:04:59 +0000 (18:04 -0600)]
fusefs: ensure that FUSE ops' headers' unique values are actually unique

Every FUSE operation has a unique value in its header.  As the name
implies, these values are supposed to be unique among all outstanding
operations.  And since FUSE_INTERRUPT is asynchronous and racy, it is
desirable that the unique values be unique among all operations that are
"close in time".

Ensure that they are actually unique by incrementing them whenever we
reuse a fuse_dispatcher object, for example during fsync, write, and
listextattr.

PR: 244686
MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D30810

2 years agofusefs: also debug INIT operations in the test suite
Alan Somers [Thu, 17 Jun 2021 22:06:43 +0000 (16:06 -0600)]
fusefs: also debug INIT operations in the test suite

MFC after: 2 weeks
Reviewed by: pfg

2 years agofusefs: delete dead code
Alan Somers [Fri, 18 Jun 2021 00:14:57 +0000 (18:14 -0600)]
fusefs: delete dead code

It was always dead, accidentally included in SVN r345876.

MFC after: 2 weeks
Reviewed by: pfg

2 years agolibalias: Switch to efficient data structure for incoming traffic
Lutz Donnerhacke [Fri, 28 May 2021 20:36:59 +0000 (22:36 +0200)]
libalias: Switch to efficient data structure for incoming traffic

Current data structure is using a hash of unordered lists.  Those
unordered lists are quite efficient, because the least recently
inserted entries are most likely to be used again.  In order to avoid
long search times in other cases, the lists are hashed into many
buckets.  Unfortunatly a search for a miss needs an exhaustive
inspection and a careful definition of the hash.

Splay trees offer a similar feature: Almost O(1) for access of the
least recently used entries, and amortized O(ln(n)) for almost all
other cases.  Get rid of the hash.

Now the data structure should able to quickly react to external
packets without eating CPU cycles for breakfast, preventing a DoS.

PR: 192888
Discussed with: Dimitry Luhtionov
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30536

2 years agolibalias: Switch to efficient data structure for outgoing traffic
Lutz Donnerhacke [Thu, 27 May 2021 21:42:54 +0000 (23:42 +0200)]
libalias: Switch to efficient data structure for outgoing traffic

Current data structure is using a hash of unordered lists.  Those
unordered lists are quite efficient, because the least recently
inserted entries are most likely to be used again.  In order to avoid
long search times in other cases, the lists are hashed into many
buckets.  Unfortunatly a search for a miss needs an exhaustive
inspection and a careful definition of the hash.

Splay trees offer a similar feature - almost O(1) for access of the
least recently used entries), and amortized O(ln(n) - for almost all
other cases.  Get rid of the hash.

Discussed with: Dimitry Luhtionov
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30516

2 years agolibalias: Restructure - Finalize
Lutz Donnerhacke [Mon, 31 May 2021 16:52:29 +0000 (18:52 +0200)]
libalias: Restructure - Finalize

Note, that the restructuring is done.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30582

2 years agolibalias: Restructure - Remove temporary state deleteAllLinks from global struct
Lutz Donnerhacke [Tue, 1 Jun 2021 18:28:42 +0000 (20:28 +0200)]
libalias: Restructure - Remove temporary state deleteAllLinks from global struct

The entry deleteAllLinks in the struct libalias is only used to signal
a state between internal calls.  It's not used between API calls.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30604

2 years agolibalias: Restructure - Use AliasRange instead of PORT_BASE
Lutz Donnerhacke [Fri, 28 May 2021 17:17:40 +0000 (19:17 +0200)]
libalias: Restructure - Use AliasRange instead of PORT_BASE

Get rid of PORT_BASE, replace by AliasRange. Simplify code.
Factor out the search for a new port. Improves the perfomance a bit.

Discussed with: Dimitry Luhtionov
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30581

2 years agolibalias: Restructure - Table for PPTP
Lutz Donnerhacke [Thu, 27 May 2021 18:27:25 +0000 (20:27 +0200)]
libalias: Restructure - Table for PPTP

Let PPTP use its own data structure.
Regroup and rename other lists, which are not PPTP.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30580

2 years agolibalias: Restructure - Group expire handling entries
Lutz Donnerhacke [Mon, 31 May 2021 16:06:29 +0000 (18:06 +0200)]
libalias: Restructure - Group expire handling entries

Reorder the internal structure semantically.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30575

2 years agolibalias: Restructure - Group incoming links
Lutz Donnerhacke [Wed, 26 May 2021 18:48:56 +0000 (20:48 +0200)]
libalias: Restructure - Group incoming links

Reorder incoming links by grouping of common search terms.
Significant performance improvement for incoming (missing) flows.

Remove LSNAT from outgoing search.
Slight speedup due to less comparsions in the loop.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30574

2 years agolibalias: Restructure - Cleanup and Use for links
Lutz Donnerhacke [Wed, 26 May 2021 09:03:07 +0000 (11:03 +0200)]
libalias: Restructure - Cleanup and Use for links

Factor out a common idiom to return found links.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30573

2 years agolibalias: Restructure - Outgoing search
Lutz Donnerhacke [Wed, 26 May 2021 07:09:19 +0000 (09:09 +0200)]
libalias: Restructure - Outgoing search

Factor out the outgoing search function.
Preparation for a new data structure.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30572

2 years agolibalias: Restructure - Cleanup _FindLinkIn
Lutz Donnerhacke [Tue, 25 May 2021 17:08:48 +0000 (19:08 +0200)]
libalias: Restructure - Cleanup _FindLinkIn

Simplify program flow in function _FindLinkIn.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30571

2 years agoMerge llvm-project 12.0.1 rc2
Dimitry Andric [Sat, 19 Jun 2021 10:06:00 +0000 (12:06 +0200)]
Merge llvm-project 12.0.1 rc2

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2.

PR: 255570
MFC after: 6 weeks

2 years agolibalias: Restructure - Table for partially links
Lutz Donnerhacke [Tue, 25 May 2021 16:27:33 +0000 (18:27 +0200)]
libalias: Restructure - Table for partially links

Separate the partially specified links into a separate data structure.

This would causes a major parformance impact, if there are many of
them.  Use a (smaller) hash table to speed up the partially link
access.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30570

2 years agotcp: Add PRR cwnd reduction for non-SACK loss
Richard Scheffenegger [Sat, 19 Jun 2021 17:06:48 +0000 (19:06 +0200)]
tcp: Add PRR cwnd reduction for non-SACK loss

This completes PRR cwnd reduction in all circumstances
for the base TCP stack (SACK loss recovery, ECN window reduction,
non-SACK loss recovery), preventing the arriving ACKs to
clock out new data at the old, too high rate. This
reduces the chance to induce additional losses while
recovering from loss (during congested network conditions).

For non-SACK loss recovery, each ACK is assumed to have
one MSS delivered. In order to prevent ACK-split attacks,
only one window worth of ACKs is considered to actually
have delivered new data.

MFC after: 6 weeks
Reviewed By: rrs, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29441

2 years agolibalias: Restructure - Separate fully qualified search
Lutz Donnerhacke [Tue, 25 May 2021 13:44:34 +0000 (15:44 +0200)]
libalias: Restructure - Separate fully qualified search

Search fully specified links first.  Some performance loss due to need
to revisit the db twice, if not found.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30569

2 years agommc_sim: Make XPT_MMC_GET_TRAN_SETTINGS fully async
Emmanuel Vadot [Thu, 17 Jun 2021 18:09:52 +0000 (20:09 +0200)]
mmc_sim: Make XPT_MMC_GET_TRAN_SETTINGS fully async

Sponsored by: Diablotin Systems