]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Thu, 1 Oct 2020 19:06:07 +0000 (19:06 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc5-0-g60a25202a7d.

MFC after: 4 weeks
X-MFC-With: r364284

3 years agoDon't ignore the return value from gethostname(3). It probably
Edward Tomasz Napierala [Thu, 1 Oct 2020 18:56:44 +0000 (18:56 +0000)]
Don't ignore the return value from gethostname(3).  It probably
cannot happen, but it silences Coverity.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26606

3 years agoOnly clear TDP_NERRNO when needed, ie when it's previously been set.
Edward Tomasz Napierala [Thu, 1 Oct 2020 18:45:31 +0000 (18:45 +0000)]
Only clear TDP_NERRNO when needed, ie when it's previously been set.

Reviewed by: kib
Tested by: pho
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26612

3 years agoVendor import of llvm-project branch release/11.x
Dimitry Andric [Thu, 1 Oct 2020 17:48:15 +0000 (17:48 +0000)]
Vendor import of llvm-project branch release/11.x
llvmorg-11.0.0-rc5-0-g60a25202a7d.

3 years agobhyve: Fix build with option BHYVE_SNAPSHOT
John Baldwin [Thu, 1 Oct 2020 17:16:05 +0000 (17:16 +0000)]
bhyve: Fix build with option BHYVE_SNAPSHOT

'ident' was replaced with 'ata_ident' in revision r363596.

Submitted by: Vitaliy Gusev <gusev.vitaliy_gmail.com>
Reviewed by: Darius Mihai
Differential Revision:  https://reviews.freebsd.org/D26263

3 years agoichsmb_pci: convert to pci_device_table / add PCI_PNP_INFO
Emmanuel Vadot [Thu, 1 Oct 2020 16:55:01 +0000 (16:55 +0000)]
ichsmb_pci: convert to pci_device_table / add PCI_PNP_INFO

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D25260

3 years agoClear the upper 32-bits of registers in x86_emulate_cpuid().
John Baldwin [Thu, 1 Oct 2020 16:45:11 +0000 (16:45 +0000)]
Clear the upper 32-bits of registers in x86_emulate_cpuid().

Per the Intel manuals, CPUID is supposed to unconditionally zero the
upper 32 bits of the involved (rax/rbx/rcx/rdx) registers.
Previously, the emulation would cast pointers to the 64-bit register
values down to `uint32_t`, which while properly manipulating the lower
bits, would leave any garbage in the upper bits uncleared.  While no
existing guest OSes seem to stumble over this in practice, the bhyve
emulation should match x86 expectations.

This was discovered through alignment warnings emitted by gcc9, while
testing it against SmartOS/bhyve.

SmartOS bug: https://smartos.org/bugview/OS-8168
Submitted by: Patrick Mooney
Reviewed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D24727

3 years agoEliminate duplicate `afterinstallconfigs` target
Enji Cooper [Thu, 1 Oct 2020 16:37:49 +0000 (16:37 +0000)]
Eliminate duplicate `afterinstallconfigs` target

Define separate dependent targets which `afterinstallconfigs` relies on, in
order to modify `${DESTDIR}/etc/master.passwd` and
`${DESTDIR}/etc/nsswitch.conf`.

Mark these targets .PHONY, since they manipulate configurations on the fly and
the generation logic isn't 100% defined in terms of the source files/logic,
and is variable, based on MK_foo flags.

MFC after: 2 weeks
Reviewed by: bapt, brd
Differential Revision: https://reviews.freebsd.org/D20330

3 years agoUpgrade to version 3.1.6
Stefan Eßer [Thu, 1 Oct 2020 15:45:07 +0000 (15:45 +0000)]
Upgrade to version 3.1.6

This upgrade addresses one (benign) compiler warning when building with
LLVM-12.

3 years agoUpdate to version 3.1.6
Stefan Eßer [Thu, 1 Oct 2020 15:40:24 +0000 (15:40 +0000)]
Update to version 3.1.6

3 years agoriscv: Add memmmap so we can mmap /dev/mem
Kristof Provost [Thu, 1 Oct 2020 15:04:55 +0000 (15:04 +0000)]
riscv: Add memmmap so we can mmap /dev/mem

Reviewed by: mhorne
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26622

3 years agolualoader: clear up some luacheck warnings
Kyle Evans [Thu, 1 Oct 2020 14:20:36 +0000 (14:20 +0000)]
lualoader: clear up some luacheck warnings

- One (1) unused argument
- One (1) trailing whitespace
- Two (2) "non-standard global" (curenv, rewind)

tools/boot/lua-lint.sh is once again happy.

3 years agoAdd cd device to arm64 GENERIC
Ed Maste [Thu, 1 Oct 2020 13:29:29 +0000 (13:29 +0000)]
Add cd device to arm64 GENERIC

Big-iron arm64 machines might have a CD, possibly provided by some IPMI
emulation.

Reported by: scottph

3 years agoFix the inverted condition in mtx_asserts.
Michal Meloun [Thu, 1 Oct 2020 09:50:08 +0000 (09:50 +0000)]
Fix the inverted condition in mtx_asserts.
Mutex should be owned in affected functions.

Reborted by: emaste
MFC after: 4 weeks
MFC with: r366161

3 years agoRemove nfsstat. Running nfsstat in crashinfo will give the stats of the
Alexander Leidinger [Thu, 1 Oct 2020 08:57:36 +0000 (08:57 +0000)]
Remove nfsstat. Running nfsstat in crashinfo will give the stats of the
running kernel instead of the stats of the crashed kernel. The current
version uses sysctls to query the stats and does not work at all (anymore)
on crash dumps.

3 years agocache: properly report ENOTDIR on foo/bar lookups where foo is a file
Mateusz Guzik [Thu, 1 Oct 2020 08:46:21 +0000 (08:46 +0000)]
cache: properly report ENOTDIR on foo/bar lookups where foo is a file

Reported by: fernape

3 years agoUpdate nvi to 2.2.0-05ed8b9
Baptiste Daroussin [Thu, 1 Oct 2020 04:46:23 +0000 (04:46 +0000)]
Update nvi to 2.2.0-05ed8b9

This version incorporates many fixes in particular a fix for vi -w
Another approach was proposed to merge those fixes (see review), I find
it easier to track changes if we keep importing snapshot on regular
basis

PR: 241985
Reported by: fernape
Differential Revision: https://reviews.freebsd.org/D26158

3 years agoImport nvi 2.2.0-05ed8b9
Baptiste Daroussin [Thu, 1 Oct 2020 04:25:54 +0000 (04:25 +0000)]
Import nvi 2.2.0-05ed8b9

This snapshot just brings a bunch of fixes in particular a fix for vi -w

PR: 241985
Reported by: fernape

3 years agoDo a sweep and remove most WARNS=6 settings
Kyle Evans [Thu, 1 Oct 2020 01:10:51 +0000 (01:10 +0000)]
Do a sweep and remove most WARNS=6 settings

Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.

3 years agoModify the NFSv4.2 VOP_COPY_FILE_RANGE() client call to return after one
Rick Macklem [Thu, 1 Oct 2020 00:47:35 +0000 (00:47 +0000)]
Modify the NFSv4.2 VOP_COPY_FILE_RANGE() client call to return after one
successful RPC.

Without this patch, the NFSv4.2 VOP_COPY_FILE_RANGE() client call would
loop until the copy "len" was completed.  The problem with doing this is
that it might take a considerable time to complete for a large "len".
By returning after a single successful Copy RPC that copied some of the
data, the application that did the copy_file_range(2) syscall will be
more responsive to signal delivery for large "len" copies.

3 years agoClip the "len" argument to vn_generic_copy_file_range() at a
Rick Macklem [Thu, 1 Oct 2020 00:33:44 +0000 (00:33 +0000)]
Clip the "len" argument to vn_generic_copy_file_range() at a
hole size boundary.

By clipping the len argument of vn_generic_copy_file_range() to end at
an exact multiple of hole size, holes are more likely to be maintained
during the copy.
A hole can still straddle the boundary at the end of the
copy range, resulting in a block being allocated in the
output file as it is being grown in size, but this will reduce the
likelyhood of this happening.

While here, also modify setting of blksize to better handle the
case where _PC_MIN_HOLE_SIZE is returned as 1.

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D26570

3 years agopciconf: print PCIe CTL max read request.
Konstantin Belousov [Wed, 30 Sep 2020 21:12:14 +0000 (21:12 +0000)]
pciconf: print PCIe CTL max read request.

To not complicate existing parsers, the value is printed on a new
output line.

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

3 years agoAvoid a dubious assignment to bio_data in aio_qbio().
John Baldwin [Wed, 30 Sep 2020 17:49:06 +0000 (17:49 +0000)]
Avoid a dubious assignment to bio_data in aio_qbio().

A user pointer is not a suitable value for bio_data and the next block
of code always overwrites bio_data anyway.  Just use cb->aio_buf
directly in the call to vm_fault_quick_hold_pages().

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26595

3 years agoahci_generic: add quirk for NXP0004 (NXP Layerscape LX2160A)
Emmanuel Vadot [Wed, 30 Sep 2020 17:10:49 +0000 (17:10 +0000)]
ahci_generic: add quirk for NXP0004 (NXP Layerscape LX2160A)

This fixes this error :
(aprobe3:ahcich3:0:15:0): NOP FLUSHQUEUE. ACB: 00 00 00 00 00 00 00 00 00 00 00 00
(aprobe3:ahcich3:0:15:0): CAM status: Command timeout
(aprobe3:ahcich3:0:15:0): Error 5, Retries exhausted

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: imp, mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25157

3 years agoacpi_resource: support multiple IRQs
Emmanuel Vadot [Wed, 30 Sep 2020 17:09:17 +0000 (17:09 +0000)]
acpi_resource: support multiple IRQs

Some DSDT entries have multiple interrupts for one device.
Add support for it.

This fixes ahci on NXP LS2160 and genet on RPi4

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25145

3 years agocache: push the lock into cache_purge_impl
Mateusz Guzik [Wed, 30 Sep 2020 17:08:34 +0000 (17:08 +0000)]
cache: push the lock into cache_purge_impl

3 years agogdb(4): Don't escape GDB special characters at application layer
Conrad Meyer [Wed, 30 Sep 2020 14:55:54 +0000 (14:55 +0000)]
gdb(4): Don't escape GDB special characters at application layer

In r351368, we introduced this XML- and GDB-encoded data.  The protocol
'offset' should reflex the logical XML data offset, but unfortunately we
counted the GDB escapes as well.

In fact, we cannot safely do GDB character escaping at this layer at
all, because we don't know what will be flushed in a packet.  It is
bogus to send only the first character of a two-character escape
sequence.

This patch "corrects" the problem by squashing these characters in the
transmitted XML document.  It would be nice to transmit the characters
faithfully, but that is a more complicated change.  Thread names are a
nice convenience feature for the GDB client, but one can always inspect
td_name or p_comm directly to find the true name.

Reported by: Ka Ho Ng <khng300 AT gmail.com>
Tested by: Ka Ho Ng
Reviewed by: emaste, markj, rlibby
Differential Revision: https://reviews.freebsd.org/D26599

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
Cy Schubert [Wed, 30 Sep 2020 08:26:25 +0000 (08:26 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 1 week

3 years agoipfilter getifname ifdef cleanup.
Cy Schubert [Wed, 30 Sep 2020 08:26:22 +0000 (08:26 +0000)]
ipfilter getifname ifdef cleanup.

MFC after: 2 months

3 years agoResurrect ipfilter's getifname, replacing the stub with the real
Cy Schubert [Wed, 30 Sep 2020 08:26:00 +0000 (08:26 +0000)]
Resurrect ipfilter's getifname, replacing the stub with the real
function.

MFC after: 2 months

3 years agoriscv: Panic on PMP errors
Kristof Provost [Wed, 30 Sep 2020 08:23:43 +0000 (08:23 +0000)]
riscv: Panic on PMP errors

Load/store/fetch access exceptions always indicate a violation of a PMP
rule. We can't treat those as page faults, because updating the page
table and trying again will only result in exactly the same access
exception recurring. This leaves us in an endless exception loop.

We cannot recover from these exceptions, so panic instead.

Reviewed by: jhb
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26544

3 years agocache: use cache_has_entries where appropriate instead of opencoding it
Mateusz Guzik [Wed, 30 Sep 2020 04:27:38 +0000 (04:27 +0000)]
cache: use cache_has_entries where appropriate instead of opencoding it

3 years agoriscv: Define __PCI_REROUTE_INTERRUPT
Jessica Clarke [Wed, 30 Sep 2020 02:21:38 +0000 (02:21 +0000)]
riscv: Define __PCI_REROUTE_INTERRUPT

Every other architecture defines this and this is required for
interrupts to work when using QEMU's PCI VirtIO devices (which all
report an interrupt line of 0) for two reasons.

Firstly, interrupt line 0 is wrong; they use one of 0x20-0x23 with the
lines being cycled across devices like normal. Moreover, RISC-V uses
INTRNG, whose IRQs are virtual as indices into its irq_map, so even if
we have the right interrupt line we still need to try and route the
interrupt in order to ultimately call into intr_map_irq and get back a
unique index into the map for the given line, otherwise we will use
whatever happens to be in irq_map[line] (which for QEMU where the line
is initialised to 0 results in using the first allocated interrupt,
namely the RTC on IRQ 11 at time of commit).

Note that pci_assign_interrupt will still do the wrong thing for INTRNG
when using a tunable, as it will bypass INTRNG entirely and use the
tunable's value as the index into irq_map, when it should instead
(indirectly) call intr_map_irq to allocate a new entry for the given
IRQ and treat the tunable as stating the physical line in use, which is
what one would expect. This, however, is a problem shared by all INTRNG
architectures, and not exclusive to RISC-V.

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

3 years agoMake copy_file_range(2) Linux compatible for overflow of offset + len.
Rick Macklem [Wed, 30 Sep 2020 02:18:09 +0000 (02:18 +0000)]
Make copy_file_range(2) Linux compatible for overflow of offset + len.

Without this patch, if a call to copy_file_range(2) specifies an input file
offset + len that would wrap around, EINVAL is returned.
I thought that was the Linux behaviour, but recent testing showed that
Linux accepts this case and does the copy_file_range() to EOF.

This patch changes the FreeBSD code to exhibit the same behaviour as
Linux for this case.

Reviewed by: asomers, kib
Differential Revision: https://reviews.freebsd.org/D26569

3 years agoMakefile.inc1: sysent: allow subordinate sysent targets to run in parallel
Kyle Evans [Wed, 30 Sep 2020 00:47:57 +0000 (00:47 +0000)]
Makefile.inc1: sysent: allow subordinate sysent targets to run in parallel

makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in
parallel, so let's do it.

This is a trivial difference because runtime per-target is pretty small, but
I like seeing it run in parallel when my muscle memory types `make -sj4`.

Reviewed by: brooks, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26594

3 years agoHoist comment on fixup of ld path
Brooks Davis [Tue, 29 Sep 2020 23:48:05 +0000 (23:48 +0000)]
Hoist comment on fixup of ld path

Reported by: jrtc27
Differential Revision: https://reviews.freebsd.org/D26591

3 years agoarm64: set the correct HWCAP
Mitchell Horne [Tue, 29 Sep 2020 23:21:56 +0000 (23:21 +0000)]
arm64: set the correct HWCAP

This appears to be a typo. The AdvSIMD field encodes support for
half-precision floating point SIMD instructions, which corresponds to
HWCAP_ASIMDHP, not HWCAP_ASIMDDP.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoPrefer --ld-path=/path/to/ld on clang >= 12
Brooks Davis [Tue, 29 Sep 2020 22:30:15 +0000 (22:30 +0000)]
Prefer --ld-path=/path/to/ld on clang >= 12

Clang 12 warns about passing a path to -fuse-ld and -Werror makes that
an error preventing building world without this change.

Reviewed by: arichardson, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26591

3 years agoFallback to software for more GCM and CCM requests.
John Baldwin [Tue, 29 Sep 2020 21:51:32 +0000 (21:51 +0000)]
Fallback to software for more GCM and CCM requests.

ccr(4) uses software to handle GCM and CCM requests not supported by
the crypto engine (e.g. with only AAD and no payload).  This change
adds a fallback for a few more requests such as those with more SGL
entries than can fit in a work request (this can happen for GCM when
decrypting a TLS record split across 15 or more packets).

Reported by: Chelsio QA
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D26582

3 years agortwn: narrow the epoch area
Bjoern A. Zeeb [Tue, 29 Sep 2020 20:46:25 +0000 (20:46 +0000)]
rtwn: narrow the epoch area

Rather than placing the epoch around the entire receive loop which
might call into rtwn_rx_frame() and USB and sleep, split the loop
into two[1] and leave us with one unlock/lock cycle as well.

PR: 249925
Reported by: thj, (rkoberman gmail.com)
Tested by: thj
Suggested by: adrian [1]
Reviewed by: adrian
MFC after: 3 days
Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host)
Differential Revision: https://reviews.freebsd.org/D26554

3 years agoRename kernel option ACPI_DMAR to IOMMU.
Ruslan Bukin [Tue, 29 Sep 2020 20:29:07 +0000 (20:29 +0000)]
Rename kernel option ACPI_DMAR to IOMMU.
This is mostly needed for a common arm64/amd64 iommu code.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D26587

3 years agoUpdates to chroot(2) docs
Warner Losh [Tue, 29 Sep 2020 18:13:54 +0000 (18:13 +0000)]
Updates to chroot(2) docs

1. Note what settings give historic behavior
2. Recommend jail under security considerations.

3 years agoStandalone SX shims
Warner Losh [Tue, 29 Sep 2020 18:06:02 +0000 (18:06 +0000)]
Standalone SX shims

Create a do-nothing version of SX locks. OpenZFS needs them. However,
since the boot loader is single threaded, they can be nops.

3 years agokldconfig(8): Add EXAMPLES to the man page
Fernando Apesteguía [Tue, 29 Sep 2020 17:52:15 +0000 (17:52 +0000)]
kldconfig(8): Add EXAMPLES to the man page

Add EXAMPLES section to the man page showing the use of all flags except for
-S.

While here, clarify -f description. It not only suppresses diagnostic messages
but it also affects the exit status of the command itself. This is shown in two
of the examples.

Approved by: bcr@
Differential Revision: https://reviews.freebsd.org/D26588

3 years agoImplement some time variables from kernel
Warner Losh [Tue, 29 Sep 2020 16:29:50 +0000 (16:29 +0000)]
Implement some time variables from kernel

OpenZFS will start using some of the kernel timekeeping bits
shortly. This implements the bare minimum of that which currently
is just the time_seconds variable.

3 years agoo Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
Ruslan Bukin [Tue, 29 Sep 2020 15:10:56 +0000 (15:10 +0000)]
o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
  This function isn't ACPI dependent and we may use it on FDT systems
  as well.
o Don't repeat the function declaration, include iommu.h instead.

Reviewed by: andrew, kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D26584

3 years agoZFS: Fix a logic bug in the FreeBSD getpages VOP
Mark Johnston [Tue, 29 Sep 2020 13:41:47 +0000 (13:41 +0000)]
ZFS: Fix a logic bug in the FreeBSD getpages VOP

This was introduced when I merged r361287 to OpenZFS and has been fixed
there already, commit 3f6bb6e43fd68e.

Reported by: swills
Reviewed by: allanjude, freqlabs, mmacy

3 years agoBuild debug kernels with -O2.
Edward Tomasz Napierala [Tue, 29 Sep 2020 11:48:22 +0000 (11:48 +0000)]
Build debug kernels with -O2.

LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted
in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining
disabled, causing severe performance hit.

The -O2 was already being used for building amd64, powerpc, and powerpcspe.

Discussed with: jrtc27, arichardson, bdragon, jhibbits
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26471

3 years agoUse the 'traced' variable instead of comparing p->p_flag again.
Edward Tomasz Napierala [Tue, 29 Sep 2020 11:18:48 +0000 (11:18 +0000)]
Use the 'traced' variable instead of comparing p->p_flag again.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26577

3 years agoBump manual page date after 366243
Mateusz Piotrowski [Tue, 29 Sep 2020 10:07:46 +0000 (10:07 +0000)]
Bump manual page date after 366243

While here, address mandoc warnings.

3 years agoImprove the input validation and processing of cookies.
Michael Tuexen [Tue, 29 Sep 2020 09:36:06 +0000 (09:36 +0000)]
Improve the input validation and processing of cookies.
This avoids setting the association in an inconsistent
state, which could result in a use-after-free situation.
This can be triggered by a malicious peer, if the peer
can modify the cookie without the local endpoint recognizing
it.
Thanks to Ned Williamson for reporting the issue.

MFC after: 3 days

3 years agocxgbe(4): Avoid unnecessary work in the firmware during netmap tx.
Navdeep Parhar [Tue, 29 Sep 2020 09:25:52 +0000 (09:25 +0000)]
cxgbe(4): Avoid unnecessary work in the firmware during netmap tx.

Bind the netmap tx queues to a special '0xff' scheduling class which
makes the firmware skip some processing related to rate limiting on the
outgoing traffic.  Future firmwares will do this automatically.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoRemove duplicate line.
Navdeep Parhar [Tue, 29 Sep 2020 09:11:51 +0000 (09:11 +0000)]
Remove duplicate line.

3 years agocxgbe(4): adjust the doorbell threshold for netmap freelists to match the
Navdeep Parhar [Tue, 29 Sep 2020 07:51:06 +0000 (07:51 +0000)]
cxgbe(4): adjust the doorbell threshold for netmap freelists to match the
maximum burst size used when fetching descriptors from the list.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agocxgbe(4): display an error message when netmap cannot be enabled because
Navdeep Parhar [Tue, 29 Sep 2020 07:36:21 +0000 (07:36 +0000)]
cxgbe(4): display an error message when netmap cannot be enabled because
the interface is down.

MFC after: 1 week

3 years agoDocument the fact (bug?) that the -a option will normally process
Greg Lehey [Tue, 29 Sep 2020 05:49:45 +0000 (05:49 +0000)]
Document the fact (bug?) that the -a option will normally process
root's calendar files three times, once each for root, toor and
daemon.

This relates to bug 246943, but does not solve it.  See discussion in
bug report for more details.

PR: 246943
Reported by: wcarson.bugzilla@disillusion.net

3 years agocxgbe(4): fixes for netmap operation with only some queues active.
Navdeep Parhar [Tue, 29 Sep 2020 05:08:45 +0000 (05:08 +0000)]
cxgbe(4): fixes for netmap operation with only some queues active.

- Only active netmap receive queues should be in the RSS lookup table.

- The RSS table should be restored for NIC operation when the last
  active netmap queue is switched off, not the first one.

- Support repeated netmap ON/OFF on a subset of the queues.  This works
  whether the the queues being enabled and disabled are the only ones
  active or not.  Some kring indexes have to be reset in the driver for
  the second case.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoprocstat: Fix regression after 365880.
Konstantin Belousov [Tue, 29 Sep 2020 00:20:58 +0000 (00:20 +0000)]
procstat: Fix regression after 365880.

Basically it reverts one chunk that reversed the parsing logic, making
legacy variants of invocation, like `procstat -a -f', non-operational.

Reported and tested by: Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoAddress whitespace nits in subr_rtc.c
Kyle Evans [Mon, 28 Sep 2020 17:19:57 +0000 (17:19 +0000)]
Address whitespace nits in subr_rtc.c

These were separated out from a nearby patch from Andrew Gierth.

MFC after: 3 days

3 years agoadd SIOCGIFDATA ioctl
Ed Maste [Mon, 28 Sep 2020 16:54:39 +0000 (16:54 +0000)]
add SIOCGIFDATA ioctl

For interfaces that do not support SIOCGIFMEDIA (for which there are
quite a few) the only fallback is to query the interface for
if_data->ifi_link_state.  While it's possible to get at if_data for an
interface via getifaddrs(3) or sysctl, both are heavy weight mechanisms.

SIOCGIFDATA is a simple ioctl to retrieve this fast with very little
resource use in comparison.  This implementation mirrors that of other
similar ioctls in FreeBSD.

Submitted by: Roy Marples <roy@marples.name>
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26538

3 years agoFor mulitcons boot, report it and which console is primary
Warner Losh [Mon, 28 Sep 2020 16:19:29 +0000 (16:19 +0000)]
For mulitcons boot, report it and which console is primary

Until we can do proper /etc/rc output on both consoles in multicons
boot (or all of them if we ever generalize), report when we are
booting multicons. Also report the primary console. This will be a big
hint why output stops after this line (though some slow USB discovery
still happens after mountroot / init starts).

Reviewed by: scottl@, tsoome@
Differential Revision: https://reviews.freebsd.org/D26574

3 years agoReport the kernel console on the boot screen
Warner Losh [Mon, 28 Sep 2020 16:19:21 +0000 (16:19 +0000)]
Report the kernel console on the boot screen

Report what console the boot loader is telling the kernel to use:
o Dual (Serial Primary)
o Dual (Video Primary)
o Serial
o Video

This allows the user to interrupt the boot and tweak the cosnole, if
needed, in a trivial way. Useful for installs where the default
selected may not be quite what you want, or when you are running a
dual setup and need to toggle over to the other console being primary.
The 'c'/'C' keys will do the cycling through the consoles.  Note:
you'll still have to drop into the loader to set details about serial
consoles. And this doesn't change the console the loader is using.

Reviewed by: kevans@
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D26573

3 years agoMinor cleanup.
Michael Tuexen [Mon, 28 Sep 2020 14:11:53 +0000 (14:11 +0000)]
Minor cleanup.

MFC after: 3 days

3 years agoFix booting arm64 EFI with LINUX_BOOT_ABI enabled.
Michal Meloun [Mon, 28 Sep 2020 09:16:27 +0000 (09:16 +0000)]
Fix booting arm64 EFI with LINUX_BOOT_ABI enabled.
Use address of the pointer passed to kernel to determine whether the pointer
is a FDT block (physical address) or a module pointer (virtual kernel address).
This fragment was supposed to be committed before r366196, but I accidentally
skipped it in a patch series.

Reported by: bz

3 years agoSpeciy the dev in an easily changed variable
Warner Losh [Mon, 28 Sep 2020 06:00:56 +0000 (06:00 +0000)]
Speciy the dev in an easily changed variable

Rather than hard coding ada0 everywhere, use ${dev}. Also, set
dev=vtbd0 since both qemu and bhyve support this. More work
should be done to use labels instead for fstab.

qemu scripts likely need adjustment. And we should also
likely generate byhve scripts too.

3 years agoFix video on PCI heuristic
Warner Losh [Mon, 28 Sep 2020 06:00:39 +0000 (06:00 +0000)]
Fix video on PCI heuristic

The video on PCI heuristic was broken. It was supposed to infer a
video device when the last element of the path was a PCI DEVICE PATH
node. However, the last node in the device path is an END node, so
this heuristic never fired.

This leads, among other things, to bhyve only producing output in the
serial connection once we leave the boot loader. This restores the
dual headed boot on bhyve + UEFI (as we did in 11.2), but will favor
serial in the absence of other config which may be a change from 11.2.

MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D26572

3 years agoUse %ju and cast to (uintmax_t) to avoid using PRI* macros.
Xin LI [Mon, 28 Sep 2020 04:30:31 +0000 (04:30 +0000)]
Use %ju and cast to (uintmax_t) to avoid using PRI* macros.

Suggested by: kevlo

3 years agoConsistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.
Konstantin Belousov [Sun, 27 Sep 2020 23:01:54 +0000 (23:01 +0000)]
Consistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.

Submitted by: Juraj Lutter <juraj@lutter.sk>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26568

3 years agoMisc compiler warning fixes in lib/libc
Alan Somers [Sun, 27 Sep 2020 22:26:41 +0000 (22:26 +0000)]
Misc compiler warning fixes in lib/libc

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

3 years agoAdd DSCP support for network QoS to iscsi target.
Richard Scheffenegger [Sun, 27 Sep 2020 21:43:19 +0000 (21:43 +0000)]
Add DSCP support for network QoS to iscsi target.

In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this adds the dscp value
directly to the portal group (where TCP sessions are accepted).

The incoming iSCSI session is first handled by ctld for any
CHAP authentication and the socket is then handed off to the
in-kernel iscsi driver without modification of the socket
parameters. Simply setting up the socket in ctld is sufficient
to keep sending outgoing iSCSI related traffic with the
configured DSCP value.

Reviewed by: mav, trasz
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26385

3 years agoGet rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.
Edward Tomasz Napierala [Sun, 27 Sep 2020 18:47:06 +0000 (18:47 +0000)]
Get rid of sa->narg.  It serves no purpose; use sa->callp->sy_narg instead.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26458

3 years agoRemove extraneous bracket.
Cy Schubert [Sun, 27 Sep 2020 18:39:15 +0000 (18:39 +0000)]
Remove extraneous bracket.

MFC after: 3 days

3 years agoRemove Linux and IRIX specific files.
Cy Schubert [Sun, 27 Sep 2020 18:39:12 +0000 (18:39 +0000)]
Remove Linux and IRIX specific files.

MFC after: 1 week

3 years agoContinuing the effort started in r343701, #ifdef cleanup, remove
Cy Schubert [Sun, 27 Sep 2020 18:39:09 +0000 (18:39 +0000)]
Continuing the effort started in r343701, #ifdef cleanup, remove
never to be used again checks.

MFC after: 1 week

3 years agoShrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably
Edward Tomasz Napierala [Sun, 27 Sep 2020 18:14:01 +0000 (18:14 +0000)]
Shrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably
from 32 to 28) by shrinking some entries and reordering them.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26508

3 years agoCheck the result of the function, not the pointer to it.
Michal Meloun [Sun, 27 Sep 2020 16:15:03 +0000 (16:15 +0000)]
Check the result of the function, not the pointer to it.

3 years agoCleanup, no functional change intended.
Michael Tuexen [Sun, 27 Sep 2020 13:32:02 +0000 (13:32 +0000)]
Cleanup, no functional change intended.

MFC after: 3 days

3 years agoImprove the handling of receiving unordered and unreliable user
Michael Tuexen [Sun, 27 Sep 2020 13:24:01 +0000 (13:24 +0000)]
Improve the handling of receiving unordered and unreliable user
messages using DATA chunks. Don't use fsn_included when not being
sure that it is set to an appropriate value. If the default is
used, which is -1, this can result in SCTP associaitons not
making any user visible progress.

Thanks to Yutaka Takeda for reporting this issue for the the
userland stack in https://github.com/pion/sctp/issues/138.

MFC after: 3 days

3 years agoDon't send a signal with uninitialized 'sig' and 'code' fields.
Michal Meloun [Sun, 27 Sep 2020 11:37:17 +0000 (11:37 +0000)]
Don't send a signal with uninitialized 'sig' and 'code' fields.
We have a few shortcuts in the arm trap code to speed up obvious "must fail"
cases. In these situations, make sure that we fill in the "sig" and "code"
fields of the generated signal.

MFC after: 3 weeks

3 years agoAdd LINUX_BOOT_ABI back to arm64 GENERIC kernel.
Michal Meloun [Sun, 27 Sep 2020 10:15:03 +0000 (10:15 +0000)]
Add LINUX_BOOT_ABI back to arm64 GENERIC kernel.

It was removed in r355289 but forgot to return it back when new u-boot booti
support was committed.  Although booti is not the preferred method of
booting the kernel, it is very useful for the initial phase of porting
FreeBSD to a new platform or booting the kernel on various embedded boards
in an industrial environment.

3 years agoReapply r366193 with proper commit log.
Michal Meloun [Sun, 27 Sep 2020 09:27:39 +0000 (09:27 +0000)]
Reapply r366193 with proper commit log.

Don't map same physical memory multiple times with different cache attributes.
This is explicitly stated as architectural undefined behavior, leading to
coherency issues sooner or later.

3 years agoRevert r366193, it was committed with unsaved commit log.
Michal Meloun [Sun, 27 Sep 2020 09:24:31 +0000 (09:24 +0000)]
Revert r366193, it was committed with unsaved commit log.

3 years agoDon't map same physical memory multiple times with different cache attributes.
Michal Meloun [Sun, 27 Sep 2020 09:14:16 +0000 (09:14 +0000)]
Don't map same physical memory  multiple times with different cache attributes.
This is explicitly stated as architectural undefined behavior, leadint to
coherencz issues sonner or later.

3 years agoDon't try to print EFI memeory map if it doesn't exist.
Michal Meloun [Sun, 27 Sep 2020 09:12:36 +0000 (09:12 +0000)]
Don't try to print EFI memeory map if it doesn't exist.

MFC after: 1 week

3 years agoBjorn reported a problem where the Linux NFSv4.1 client is
Rick Macklem [Sat, 26 Sep 2020 23:05:38 +0000 (23:05 +0000)]
Bjorn reported a problem where the Linux NFSv4.1 client is
using an open_to_lock_owner4 when that lock_owner4 has already
been created by a previous open_to_lock_owner4. This caused the NFS server
to reply NFSERR_INVAL.

For NFSv4.0, this is an error, although the updated NFSv4.0 RFC7530 notes
that the correct error reply is NFSERR_BADSEQID (RFC3530 did not specify
what error to return).

For NFSv4.1, it is not obvious whether or not this is allowed by RFC5661,
but the NFSv4.1 server can handle this case without error.
This patch changes the NFSv4.1 (and NFSv4.2) server to handle multiple
uses of the same lock_owner in open_to_lock_owner so that it now correctly
interoperates with the Linux NFS client.
It also changes the error returned for NFSv4.0 to be NFSERR_BADSEQID.

Thanks go to Bjorn for diagnosing this and testing the patch.
He also provided a program that I could use to reproduce the problem.

Tested by: bj@cebitec.uni-bielefeld.de (Bjorn Fischer)
PR: 249567
Reported by: bj@cebitec.uni-bielefeld.de (Bjorn Fischer)
MFC after: 3 days

3 years agoCheck for the only 32-bit MIPS ABIs we support, rather than !n64
Justin Hibbits [Sat, 26 Sep 2020 21:47:11 +0000 (21:47 +0000)]
Check for the only 32-bit MIPS ABIs we support, rather than !n64

There may be additional 64-bit ABIs supported, so use a positive check rather
than a negative check.
Suggested by: imp
MFC after: 1 week
Sponsored by: Juniper Networks, Inc

3 years agobsdconfig, bsdinstall: Prune dead mirrors
Niclas Zeising [Sat, 26 Sep 2020 16:27:09 +0000 (16:27 +0000)]
bsdconfig, bsdinstall: Prune dead mirrors

Prune dead mirrors from the list of mirrors in bsdconfig and bsdinstall.
All these return NXDOMAIN when trying to resolve them.

Reviewed by: emaste
Approved by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26535

3 years agofix typo imorted -> imported.
Warner Losh [Sat, 26 Sep 2020 04:06:16 +0000 (04:06 +0000)]
fix typo imorted -> imported.

Noticed by: Maigurs Stalidzans

3 years agoRevert most of r360179.
John Baldwin [Fri, 25 Sep 2020 21:19:56 +0000 (21:19 +0000)]
Revert most of r360179.

I had failed to notice that sgsendccb() was using cam_periph_mapmem()
and thus was not passing down user pointers directly to drivers.  In
practice this broke requests submitted from userland.

PR: 249395
Reported by: Trenton Schulz <trueos@norwegianrockcat.com>
Reviewed by: scottl
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26550

3 years agoAdjustments to includes for openzfs in _STANDALONE
Warner Losh [Fri, 25 Sep 2020 20:51:07 +0000 (20:51 +0000)]
Adjustments to includes for openzfs in _STANDALONE

Allow the necessary parts of systm.h to be visible in the _STANDALONE
environnment. Limit the reset to only being visible for _KERNEL
builds.  Map KASSERT, etc to printf on failure in the bootloader until
we have more confidence things won't break and leave systems
unbootable. Eventually, this should map to a full panic in the
bootloader, but that also needs some enhancement to be more useful.

Reviewed by: tsoome, jhb
Differential Revision:  https://reviews.freebsd.org/D26543

3 years agoFix mips64 build
Justin Hibbits [Fri, 25 Sep 2020 20:27:36 +0000 (20:27 +0000)]
Fix mips64 build

Original patch was against FreeBSD 12, and a test compile wasn't run against
head.  md_tls_tcb_offset field was moved from mdthread to mdproc in the
meantime.

MFC after: 1 week
Sponsored by: Juniper Networks, Inc.

3 years agomips: Fix compat32 library builds from r366162
Justin Hibbits [Fri, 25 Sep 2020 19:04:03 +0000 (19:04 +0000)]
mips: Fix compat32 library builds from r366162

Re-add the a_ptr and a_fcn fields to Elf32_Auxinfo.

MFC after: 1 week
Sponsored by: Juniper Networks, Inc.

3 years agoDont let kernel and standalone both be defined at the same time
Warner Losh [Fri, 25 Sep 2020 19:02:49 +0000 (19:02 +0000)]
Dont let kernel and standalone both be defined at the same time

_KERNEL and _STANDALONE are different things. They cannot both be true
at the same time. If things that are normally visible only to _KERNEL
are needed for the _STANDALONE environment, you need to also make them
visible to _STANDALONE. Often times, this will be just a subset of the
required things for _KERNEL (eg global variables are but one example).

sys/cdefs.h is included by pretty much everything in both the loader
and the kernel, so is the ideal choke point.

3 years agong_l2tp: Fix callout synchronization in the rexmit timeout handler
Mark Johnston [Fri, 25 Sep 2020 18:55:50 +0000 (18:55 +0000)]
ng_l2tp: Fix callout synchronization in the rexmit timeout handler

A received control packet may cause the transmit queue to be flushed, in
which case ng_l2tp_seq_recv_nr() cancels the transmit timeout handler.
The handler checks to see if it was cancelled before doing anything, but
did so before acquiring the node lock, so a small race window could
cause ng_l2tp_seq_rack_timeout() to attempt to flush an empty queue,
ultimately causing a null pointer dereference.

PR: 241133
Reviewed by: bz, glebius, Lutz Donnerhacke
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D26548

3 years agoComment out bogus command line entry
Warner Losh [Fri, 25 Sep 2020 18:20:45 +0000 (18:20 +0000)]
Comment out bogus command line entry

Linux implements -d to mean --print-decimal. We don't implement that
and use -d for --device-path. Note that.

3 years agoTweak output of the loader variable
Warner Losh [Fri, 25 Sep 2020 18:20:41 +0000 (18:20 +0000)]
Tweak output of the loader variable

When the DEVICE_PATH is <= 4 that means it's effectively empty. I have
a laptop that has a BIOS that likes to generate these:

8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
0000: 01 00 00 00 04 00 45 00 46 00 49 00 20 00 55 00
0010: 53 00 42 00 20 00 44 00 65 00 76 00 69 00 63 00
0020: 65 00 00 00 7f ff 04 00 52 43

which now decodes as
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
* EFI USB Device
Empty path
Option:
0000: 52 43

which matches my hand-decode.

Add an extra newline after Option: to make it look nice.

I suspect that these entries really should be VenHw entries instead,
but my ability to change that is NIL, so cope with them as best we can.

efibootmgr(8)'s output is fine and doesn't need adjusting.

3 years agoFix compat32 on mips64
Justin Hibbits [Fri, 25 Sep 2020 17:13:45 +0000 (17:13 +0000)]
Fix compat32 on mips64

Summary:
Two bugs:
* Elf32_Auxinfo is broken, using pointers in the union, which are 64-bits not
  32.
* freebsd32_sysarch() doesn't update the 'user local' register when handling
  MIPS_SET_TLS, leading to a NULL pointer dereference in the 32-bit
  application.

Reviewed by: #mips, brooks
MFC after: 1 week
Sponsored by: Juniper Networks, Inc
Differential Revision: https://reviews.freebsd.org/D26556

3 years agoRefine locking inside of syscon driver.
Michal Meloun [Fri, 25 Sep 2020 16:44:01 +0000 (16:44 +0000)]
Refine locking inside of syscon driver.
In some cases, the syscon driver may be used by consumer requiring better
control about locking (ie. it may be used as registe file provider for clock
driver which needs locked access to multiple registers).
Add fine locking protocol methods together with bunch of helper functions
in syscon driver and implement this functionality in syscon_generic driver.

MFC after: 4 weeks

3 years agoEnable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
Olivier Cochard [Fri, 25 Sep 2020 16:02:13 +0000 (16:02 +0000)]
Enable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
many sockets in TIME_WAIT state at the end of the test.

PR: 249885
Reviewed by: markj
Approved by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26549

3 years agoCorrectly handle nodes compatible with "syscon", "simple-bus".
Michal Meloun [Fri, 25 Sep 2020 13:52:31 +0000 (13:52 +0000)]
Correctly handle nodes compatible with "syscon", "simple-bus".
Syscon can also have child nodes that share a registration file with it.
To do this correctly, follow these steps:
- subclass syscon from simplebus and expose it if the node is also
  "simple-bus" compatible.
- block simplebus probe for this compatible string, so it's priority
 (bus pass) doesn't colide with syscon driver.

While I'm in, also block "syscon", "simple-mfd" for the same reason.

MFC after: 4 weeks