]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agosshd: allow UseBlocklist alias for UseBlacklist
Ed Maste [Wed, 29 Jul 2020 00:34:24 +0000 (00:34 +0000)]
sshd: allow UseBlocklist alias for UseBlacklist

blacklistd has been renamed to blocklistd upstream, and a future
import into FreeBSD will follow that change.  Support the new name
as an alias in config files.

Reviewed by: bz, delphij
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25865

3 years agoWhen modifying LUN pass "special" options too.
Alexander Motin [Tue, 28 Jul 2020 22:32:50 +0000 (22:32 +0000)]
When modifying LUN pass "special" options too.

Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value.  Now CTL completely
replaces them, so we must pass everything still relevant.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agoFixup some incorrect information and some comments. These changes
Christian S.J. Peron [Tue, 28 Jul 2020 20:06:16 +0000 (20:06 +0000)]
Fixup some incorrect information and some comments. These changes
were cherry picked up the upstream OpenBSD repository. At some point we
will look at doing another import, but the diffs are substantial and will
require some careful testing.

Differential Revision: https://reviews.freebsd.org/D25021
MFC after: 2 weeks
Submitted by: gbe
Reviewed by: myself, bcr

3 years agovm_page_xbusy_claim(): Use atomics to update busy lock state.
Mark Johnston [Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)]
vm_page_xbusy_claim(): Use atomics to update busy lock state.

vm_page_xbusy_claim() could clobber the waiter bit.  For its original
use, kernel memory pages, this was not a problem since nothing would
ever block on the busy lock for such pages.  r363607 introduced a new
use where this could in principle be a problem.

Fix the problem by using atomic_cmpset to update the lock owner.  Since
this macro is defined only for INVARIANTS kernels the extra overhead
doesn't seem prohibitive.

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

3 years agoAdd further clarification on si_addr and si_trapno.
John Baldwin [Tue, 28 Jul 2020 17:09:15 +0000 (17:09 +0000)]
Add further clarification on si_addr and si_trapno.

- In the initial description of si_addr, do not claim that it is
  always the faulting instruction.

- For si_addr, document that it is generally set to the PC for
  synchronous signals, but that it can be set to the the address of
  the faulting memory reference for some signals including SIGSEGV and
  SIGBUS.  In particular, while SIGSEGV generally sets si_addr to the
  faulting memory reference, SIGBUS can vary.  On some platforms, some
  SIGBUS signals set si_addr to the PC and other SIGBUS signals set
  si_addr to the faulting address depending on the specific hardware
  exception.

- For si_trapno, synchronous signals should set this to some value.

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

3 years agoo Move the buswide_ctxs bitmap to iommu_unit and rename related functions.
Ruslan Bukin [Tue, 28 Jul 2020 16:08:14 +0000 (16:08 +0000)]
o Move the buswide_ctxs bitmap to iommu_unit and rename related functions.
o Rename bus_dma_dmar_load_ident() as well.

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

3 years agops(1): Fix formatting of the "command" field for kernel threads.
Mark Johnston [Tue, 28 Jul 2020 15:26:19 +0000 (15:26 +0000)]
ps(1): Fix formatting of the "command" field for kernel threads.

When -H is specified, for kernel threads the command is formatted as
"<proc name>/<td name>" and truncated to MAXCOMLEN.  But each of the
proc name and td name may be up to MAXCOMLEN bytes in length.

Also handle the ki_moretdname field to ensure that the full thread name
gets printed.  This is already handled correctly when formatting for
"-o tdname".

Reported by: freqlabs
Reviewed by: freqlabs
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25840

3 years agoAdd a workaround for a bug when setting the Raspberry GIO config and state
Andrew Turner [Tue, 28 Jul 2020 11:32:45 +0000 (11:32 +0000)]
Add a workaround for a bug when setting the Raspberry GIO config and state

The Raspberry Pi GPIO config and state messages incorrectly return with
the tag length set to 0. We then check this value to have the response
flag set. Work around this by setting the response flag when setting the
GPIO config or state and this value is zero.

Sponsored by: Innovate UK

3 years agovirtio: fix mips regression introduced by r357596
Alfredo Dal'Ava Junior [Tue, 28 Jul 2020 11:23:37 +0000 (11:23 +0000)]
virtio: fix mips regression introduced by r357596

PowerPC support was fixed in r357596 by changing PCI bustag to BE as
part of the solution, but this caused regression on mips. This change
implements byte swapping of virtio PCI config area in the driver,
leaving lower layer untouched.

Submittnd by: Fernando Valle <fernando.valle@eldorado.org.br>
Reported by: arichardson
Reviewed by: alfredo, arichardson
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D25416

3 years agoAadd Raspberry Pi firmware messages to manage GPIOs
Andrew Turner [Tue, 28 Jul 2020 11:13:37 +0000 (11:13 +0000)]
Aadd Raspberry Pi firmware messages to manage GPIOs

Some GPIOs are managed by an external IO expaandder through the firmware.
Add the message details for these.

Sponsored by: Innovate UK

3 years ago- Cleanups related to sparc64 removal.
Yoshihiro Takahashi [Tue, 28 Jul 2020 10:58:37 +0000 (10:58 +0000)]
- Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D25831

3 years agoSwitch the bcm2835 cpufreq driver to use the firmware interface
Andrew Turner [Tue, 28 Jul 2020 10:45:29 +0000 (10:45 +0000)]
Switch the bcm2835 cpufreq driver to use the firmware interface

Use the new Raspberry Pi firmware driver in the cpufreq driver. It is
intended all drivers that need to interact with the firmware will move to
use the firmware driver, this is the first.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25609

3 years agoMove the bcm2835 firmware driver earlier in the boot.
Andrew Turner [Tue, 28 Jul 2020 10:43:52 +0000 (10:43 +0000)]
Move the bcm2835 firmware driver earlier in the boot.

It will be needed by other eaarly drivers.

While here make the dependency of the mailbox formal with MODULE_DEPEND.

Reviewed by: manu
Sponsored by: Innovate UK

3 years agoRevert r363639 so I can use a more correct commit message
Andrew Turner [Tue, 28 Jul 2020 10:41:43 +0000 (10:41 +0000)]
Revert r363639 so I can use a more correct commit message

3 years agoMove the bcm2835 mailbox driver earlier in the boot
Andrew Turner [Tue, 28 Jul 2020 10:40:00 +0000 (10:40 +0000)]
Move the bcm2835 mailbox driver earlier in the boot

This will be needed before the firmware driver is loaded

3 years agoHave the bcm2835 firmware driver depend on the mailbox driver
Andrew Turner [Tue, 28 Jul 2020 10:37:58 +0000 (10:37 +0000)]
Have the bcm2835 firmware driver depend on the mailbox driver

The firmware driver uses the mailbox driver to communicate with the
firmware. Make this a more formal dependency.

Reviewed by: manu
Sponsored by: Innovate UK

3 years agoFix ENA build when integrated into kernel
Marcin Wojtas [Tue, 28 Jul 2020 10:08:07 +0000 (10:08 +0000)]
Fix ENA build when integrated into kernel

Provide missing rules for ena_datapath.c and ena_netmap.c,
which prevented the ENA driver from building.
This issue was showing up only when building the driver statically
into the kernel.

PR: 248116
Submitted by: Artur Rojek <ar@semihalf.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25796
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

3 years agoEnable use of the regulator in the Broadcom SDHCI controller
Andrew Turner [Tue, 28 Jul 2020 09:46:58 +0000 (09:46 +0000)]
Enable use of the regulator in the Broadcom SDHCI controller

This will be needed before a future GPIO controller driver is added
as the later enables regulators that leave the SDHCI controller disabled.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25834

3 years agoAdd an ACPI attachment for if_smc
Andrew Turner [Tue, 28 Jul 2020 09:29:56 +0000 (09:29 +0000)]
Add an ACPI attachment for if_smc

This is needed by some of the Arm simulators as they implement a smc based
network interface, but use ACPI rather than FDT.

Sponsored by: Innovate UK

3 years agolibpmc: Use known pmc_cpuid buffer size
Ryan Moeller [Tue, 28 Jul 2020 02:56:26 +0000 (02:56 +0000)]
libpmc: Use known pmc_cpuid buffer size

Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various
buffers for reading it in libpmc.  This avoids some extra syscalls and
malloc/frees.

While in here, use strlcpy to copy a user-provided cpuid string instead of
memcpy, to make sure we terminate the buffer.

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

3 years agomakesyscalls.sh: improve the 'this is going away' message
Kyle Evans [Tue, 28 Jul 2020 01:05:40 +0000 (01:05 +0000)]
makesyscalls.sh: improve the 'this is going away' message

Reported by: Ronald Klop, rgrimes

3 years agossh: Remove AES-CBC ciphers from default server and client lists
Ed Maste [Tue, 28 Jul 2020 00:24:12 +0000 (00:24 +0000)]
ssh: Remove AES-CBC ciphers from default server and client lists

A base system OpenSSH update in 2016 or so removed a number of ciphers
from the default lists offered by the server/client, due to known
weaknesses.  This caused POLA issues for some users and prompted
PR207679; the ciphers were restored to the default lists in r296634.

When upstream removed these ciphers from the default server list, they
moved them to the client-only default list.  They were subsequently
removed from the client default, in OpenSSH 7.9p1.

The change has persisted long enough.  Remove these extra ciphers from
both the server and client default lists, in advance of FreeBSD 13.

Reviewed by: markm, rgrimes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25833

3 years agoAdd initial driver for ACPI Platform Error Interfaces.
Alexander Motin [Mon, 27 Jul 2020 21:19:41 +0000 (21:19 +0000)]
Add initial driver for ACPI Platform Error Interfaces.

APEI allows platform to report different kinds of errors to OS in several
ways.  We've found that Supermicro X10/X11 motherboards report PCIe errors
appearing on hot-unplug via this interface using NMI.  Without respective
driver it ended up in kernel panic without any additional information.

This driver introduces support for the APEI Generic Hardware Error Source
reporting via NMI, SCI or polling.  It decodes the reported errors and
either pass them to pci(4) for processing or just logs otherwise.  Errors
marked as fatal still end up in kernel panic, but some more informative.

When somebody get to native PCIe AER support implementation both of the
reporting mechanisms should get common error recovery code.  Since in our
case errors happen when the device is already gone, there is nothing to
recover, so the code just clears the error statuses, practically ignoring
the otherwise destructive NMIs in nicer way.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.

3 years agocxgbe(4): Stop checking for failures from malloc(M_WAITOK).
Mark Johnston [Mon, 27 Jul 2020 19:05:53 +0000 (19:05 +0000)]
cxgbe(4): Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: np
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25767

3 years agoRestrict definition of CTL_P1003_1B_MAXID to the kernel
Alan Somers [Mon, 27 Jul 2020 18:57:28 +0000 (18:57 +0000)]
Restrict definition of CTL_P1003_1B_MAXID to the kernel

This constant is only used to size an array within the kernel. There are
probably no legitimate uses in userland. Worse, since the kernel's array
could theoretically change size over time, any use of that symbol in
userland wouldn't be forwards compatible to new kernel versions.

Reviewed by: jhb
MFC after: Never
Differential Revision: https://reviews.freebsd.org/D25816

3 years agosh(1): print a newline when ^D quits sh
Piotr Pawel Stefaniak [Mon, 27 Jul 2020 18:46:20 +0000 (18:46 +0000)]
sh(1): print a newline when ^D quits sh

I've always found this a little bit confusing:
> sh
$ ^D> sh
$ ^D>

Reviewed by: 0mp, jilles
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25813

3 years agocomm(1): Add EXAMPLES section
Fernando Apesteguía [Mon, 27 Jul 2020 16:51:23 +0000 (16:51 +0000)]
comm(1): Add EXAMPLES section

Add two very simple examples.

Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D25344

3 years agoTrim some extraneous parentheses.
John Baldwin [Mon, 27 Jul 2020 16:37:18 +0000 (16:37 +0000)]
Trim some extraneous parentheses.

Reported by: kib (do_trap_user)
Sponsored by: DARPA

3 years agoSet si_addr to dar for MMU and alignment faults.
John Baldwin [Mon, 27 Jul 2020 16:34:31 +0000 (16:34 +0000)]
Set si_addr to dar for MMU and alignment faults.

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

3 years agoFix si_addr value for breakpoints in a delay slot.
John Baldwin [Mon, 27 Jul 2020 16:32:21 +0000 (16:32 +0000)]
Fix si_addr value for breakpoints in a delay slot.

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

3 years agoFix indentation.
John Baldwin [Mon, 27 Jul 2020 16:31:21 +0000 (16:31 +0000)]
Fix indentation.

3 years agoSet si_trapno to the fault index from fsr.
John Baldwin [Mon, 27 Jul 2020 16:29:21 +0000 (16:29 +0000)]
Set si_trapno to the fault index from fsr.

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

3 years agoSet si_trapno to the exception code from scause.
John Baldwin [Mon, 27 Jul 2020 16:28:44 +0000 (16:28 +0000)]
Set si_trapno to the exception code from scause.

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

3 years agoDon't include T_USER in si_trapno reported to userland.
John Baldwin [Mon, 27 Jul 2020 16:25:18 +0000 (16:25 +0000)]
Don't include T_USER in si_trapno reported to userland.

Signals are only reported for user traps, so T_USER is redundant.  It
is also a software convention and not included in the value reported
by the hardware.

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

3 years agotruncate(1): Add EXAMPLES section
Fernando Apesteguía [Mon, 27 Jul 2020 15:25:04 +0000 (15:25 +0000)]
truncate(1): Add EXAMPLES section

Add four simple examples showing the use of -c, -r and -s

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D25774

3 years agompr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).
Mark Johnston [Mon, 27 Jul 2020 14:28:55 +0000 (14:28 +0000)]
mpr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25766

3 years agovm_page_free_invalid(): Relax the xbusy assertion.
Mark Johnston [Mon, 27 Jul 2020 14:25:10 +0000 (14:25 +0000)]
vm_page_free_invalid(): Relax the xbusy assertion.

vm_page_assert_xbusied() asserts that the busying thread is the current
thread.  For some uses of vm_page_free_invalid() (e.g., error handling
in vnode_pager_generic_getpages_done()), this condition might not hold.

Reported by: Jenkins via trasz
Reviewed by: chs, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25828

3 years agotree.3: Bump date after 363450 (WAVL)
Mateusz Piotrowski [Mon, 27 Jul 2020 11:42:22 +0000 (11:42 +0000)]
tree.3: Bump date after 363450 (WAVL)

While here:
- Address whitespace warnings.
- Start sentences on a new line.

3 years agonologin.8: Improve wording
Mateusz Piotrowski [Mon, 27 Jul 2020 10:45:47 +0000 (10:45 +0000)]
nologin.8: Improve wording

Reported by: yuripv
Reviewed by: bcr, yuripv
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25814

3 years agoactually enable gate control for allwinner's r-ccu ir clock
Andriy Gapon [Mon, 27 Jul 2020 09:10:02 +0000 (09:10 +0000)]
actually enable gate control for allwinner's r-ccu ir clock

The gate control bit offset was correctly specified, but AW_CLK_HAS_GATE
flag was not set.
Tested with (C)IR receiver on Orange Pi PC Plus.

Reviewed by: manu
MFC after: 1 week

3 years agoSupport the setting of additional AHCI controller parameters.
Peter Grehan [Mon, 27 Jul 2020 07:56:55 +0000 (07:56 +0000)]
Support the setting of additional AHCI controller parameters.

Allow the serial number, firmware revision, model number and nominal media
rotation rate (nmrr) parameters to be set from the command line.

Note that setting the nmrr value can be used to indicate the AHCI
device is an SSD.

Submitted by: Wanpeng Qian
Reviewed by: jhb, grehan (#bhyve)
Approved by: jhb, grehan
MFC after: 3 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D24174

3 years agomakesyscalls.sh: spit out a deprecation notice to stderr
Kyle Evans [Mon, 27 Jul 2020 03:13:23 +0000 (03:13 +0000)]
makesyscalls.sh: spit out a deprecation notice to stderr

This has for a while been replaced by makesyscalls.lua in the stock FreeBSD
build.  Ensure downstreams get some notice that it'a going away if they're
reliant on it, maybe.

3 years agoiflib: fix LOR with bpf detach
Matt Macy [Mon, 27 Jul 2020 01:17:59 +0000 (01:17 +0000)]
iflib: fix LOR with bpf detach

Reported by: grehan@
Approved by: grehan@
MFC after: 1 week
Sponsored by: Netgate
Differential Revision: https://reviews.freebsd.org/D25530

3 years agoFix the NFSv4 client so that it checks for support of TimeCreate before
Rick Macklem [Sun, 26 Jul 2020 23:13:10 +0000 (23:13 +0000)]
Fix the NFSv4 client so that it checks for support of TimeCreate before
trying to set it.

r362490 added support for setting of the TimeCreate (va_birthtime) attribute,
but it does so without checking to see if the server supports the attribute.
This could result in NFSERR_ATTRNOTSUPP error replies to the Setattr operation.
This patch adds code to check that the server supports TimeCreate before
attempting to do a Setattr of it to avoid these error returns.

3 years agoFix the NFS server so that it sets va_birthtime.
Rick Macklem [Sun, 26 Jul 2020 23:03:41 +0000 (23:03 +0000)]
Fix the NFS server so that it sets va_birthtime.

r362490 marked that the NFSv4 attribute TimeCreate (va_birthtime) is supported,
but it did not change the NFS server code to actually do it.
As such, errors could occur when unrolling a tarball onto an NFSv4 mounted
volume, since setting TimeCreate would fail with a NFSERR_ATTRNOTSUPP reply.

This patch fixes the server so that it does TimeCreate and also makes
sure that TimeCreate will not be set for a DS file for a pNFS server.

A separate commit will add a check to the NFSv4 client for support of
the TimeCreate attribute before attempting to set it, to avoid a problem
when mounting a server that does not support the attribute.
The failures will still occur for r362490 or later kernels that do not
have this patch, since they indicate support for the attribute, but do not
actually support the attribute.

3 years agogctl_get_geom: Skip validation of g_class.
Xin LI [Sun, 26 Jul 2020 22:30:55 +0000 (22:30 +0000)]
gctl_get_geom: Skip validation of g_class.

The caller from kernel is expected to provide an valid g_class
pointer, instead of traversing the global g_class list, just
use that pointer directly instead.

Reviewed by: mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25811

3 years agogeom_map and geom_redboot: Remove unused ctlreq handler.
Xin LI [Sun, 26 Jul 2020 22:30:01 +0000 (22:30 +0000)]
geom_map and geom_redboot: Remove unused ctlreq handler.

The two classes do not take any verbs and always gctl_error for
all requests, so don't bother to provide a ctlreq handler.

Reviewed by: mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25810

3 years agoDescribe the value in the 're' column of vmstat(8) in terms of freebsd's vm
Ian Lepore [Sun, 26 Jul 2020 18:33:29 +0000 (18:33 +0000)]
Describe the value in the 're' column of vmstat(8) in terms of freebsd's vm
implementation.  The old description was left over from the 4.4 BSD Lite
import in 1994, and was a bit misleading (not all arches use simulated
reference bits, some implement reference tracking in hardware).

3 years agoFix r363565
Emmanuel Vadot [Sun, 26 Jul 2020 18:33:29 +0000 (18:33 +0000)]
Fix r363565

lockdep.h needs sys/lock.h for LOCK_CLASS

3 years agoriscv: Include syscon_power device driver in GENERIC kernel config
Jessica Clarke [Sun, 26 Jul 2020 18:21:02 +0000 (18:21 +0000)]
riscv: Include syscon_power device driver in GENERIC kernel config

QEMU's RISC-V virt machine provides syscon-power and syscon-reset
devices as the means by which to shutdown and reboot. We also need to
ensure that we have attached the syscon_generic device before attaching
any syscon_power devices, and so we introduce a new riscv_syscon device
akin to aw_syscon added in r327936. Currently the SiFive test finisher
is used as the specific implementation of such a syscon device.

Reviewed by: br, brooks (mentor), jhb (mentor)
Approved by: br, brooks (mentor), jhb (mentor)
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D25725

3 years agoAdd syscon power and reset control device driver
Jessica Clarke [Sun, 26 Jul 2020 18:19:50 +0000 (18:19 +0000)]
Add syscon power and reset control device driver

This device driver supports both syscon-power and syscon-reset devices,
as specified in [1] and [2]. These provide a very simple interface for
power and reset control, and among other things are used by QEMU's virt
machine on RISC-V. A separate commit will enable this on RISC-V, as that
requires adding a RISC-V-specific riscv_syscon akin to r327936's
aw_syscon.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt
[2] https://www.kernel.org/doc/Documentation/devicetree/bindings/power/reset/syscon-reboot.txt

Reviewed by: brooks (mentor), jhb (mentor)
Approved by: brooks (mentor), jhb (mentor)
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D25724

3 years agoloader: Avoid -Wpointer-to-int cast warnings for Arm and RISC-V
Jessica Clarke [Sun, 26 Jul 2020 18:17:36 +0000 (18:17 +0000)]
loader: Avoid -Wpointer-to-int cast warnings for Arm and RISC-V

On RISC-V, Clang warns with:

    cast to smaller integer type 'unsigned int' from 'void (*)(void *)'

Instead, use %p as the standard format specifier for printing pointers.
Whilst Arm's pointer size is the same as unsigned, it's still cleaner to
use the right thing there too.

Reviewed by: brooks (mentor), emaste
Approved by: brooks (mentor), emaste
Differential Revision: https://reviews.freebsd.org/D25718

3 years agoAdd Goldfish RTC device driver for RISC-V
Jessica Clarke [Sun, 26 Jul 2020 18:15:16 +0000 (18:15 +0000)]
Add Goldfish RTC device driver for RISC-V

This device was originally used as part of the goldfish virtual hardware
platform used for emulating Android on QEMU, but is now also used as the
RTC for the RISC-V virt machine in QEMU. It provides a simple 64-bit
nanosecond timer exposed via a pair of memory-mapped 32-bit registers,
although only with 1s granularity.

Reviewed by: brooks (mentor), jhb (mentor), kp
Approved by: brooks (mentor), jhb (mentor), kp
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D25717

3 years agoRemove commented-out lines describing the old never-implemented -t option.
Ian Lepore [Sun, 26 Jul 2020 17:50:39 +0000 (17:50 +0000)]
Remove commented-out lines describing the old never-implemented -t option.

In 2018, r338094 removed the commented-out code for supporting the -t
command line option which had been present since the BSD 4.4 Lite import,
but was never implemented for freebsd.

This does the same for the man page.

3 years agoRevert r363564
Emmanuel Vadot [Sun, 26 Jul 2020 17:21:24 +0000 (17:21 +0000)]
Revert r363564

linux/sizes.h doesn't exists in base ... sorry.

3 years agolinuxkpi: Add taint* defines
Emmanuel Vadot [Sun, 26 Jul 2020 16:31:49 +0000 (16:31 +0000)]
linuxkpi: Add taint* defines

This isn't used for us but allow us to port drivers more easily.

Reviewed by: hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25703

3 years agolinuxkpi: Include hardirq.h in preempt.h and lockdep.h in hardirq.h
Emmanuel Vadot [Sun, 26 Jul 2020 16:30:59 +0000 (16:30 +0000)]
linuxkpi: Include hardirq.h in preempt.h and lockdep.h in hardirq.h

Linux does the same, this avoids ifdef or extra includes in ported drivers.

Reviewed by: emaste, hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25702

3 years agolinuxkpi: Include linux/sizes.h in dma-mapping.h
Emmanuel Vadot [Sun, 26 Jul 2020 16:30:01 +0000 (16:30 +0000)]
linuxkpi: Include linux/sizes.h in dma-mapping.h

Linux does the same, this avoids ifdef or extra includes in ported drivers.

Reviewed by: emaste, hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25701

3 years agochio: avoid out of bounds read
Ed Maste [Sun, 26 Jul 2020 15:10:33 +0000 (15:10 +0000)]
chio: avoid out of bounds read

ch_ces is alloacated with space for total_elem entries.

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

3 years agoBump __FreeBSD_version after introduction of lockless lookup to the VFS layer
Mateusz Guzik [Sun, 26 Jul 2020 13:30:33 +0000 (13:30 +0000)]
Bump __FreeBSD_version after introduction of lockless lookup to the VFS layer

3 years agoRename DMAR flags:
Ruslan Bukin [Sun, 26 Jul 2020 12:29:22 +0000 (12:29 +0000)]
Rename DMAR flags:
o DMAR_DOMAIN_* -> IOMMU_DOMAIN_*
o DMAR_PGF_* -> IOMMU_PGF_*

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

3 years agoarm64: Only compile imx8 files if soc_freescale_imx8 is selected
Emmanuel Vadot [Sun, 26 Jul 2020 10:07:05 +0000 (10:07 +0000)]
arm64: Only compile imx8 files if soc_freescale_imx8 is selected

No Objection from:  gonzo

3 years agosed: treat '[' as ordinary character in 'y' command
Yuri Pankov [Sun, 26 Jul 2020 09:15:05 +0000 (09:15 +0000)]
sed: treat '[' as ordinary character in 'y' command

'y' does not handle bracket expressions, treat '[' as ordinary character
and do not apply bracket expression checks (GNU sed agrees).

PR: 247931
Reviewed by: pfg, kevans
Tested by: antoine (exp-run), Quentin L'Hours <lhoursquentin@gmail.com>
Differential Revision: https://reviews.freebsd.org/D25640

3 years agoAdd support for ext_pgs mbufs to nfsrv_adj().
Rick Macklem [Sun, 26 Jul 2020 02:42:09 +0000 (02:42 +0000)]
Add support for ext_pgs mbufs to nfsrv_adj().

This patch uses a slightly different algorithm for nfsrv_adj()
since ext_pgs mbuf lists are not permitted to have m_len == 0 mbufs.
As such, the code now frees mbufs after the adjustment in the list instead
of setting their m_len field to 0.
Since mbuf(s) may be trimmed off the tail of the list, the function now
returns a pointer to the last mbuf in the list.  This saves the caller
from needing to use m_last() to find the last mbuf.
It also implies that it might return a nul list, which required a check for
that in nfsrvd_readlink().

This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.

Use of ext_pgs mbufs will not be enabled until the kernel RPC is updated
to handle TLS.

3 years agoUse snprintf instead of sprintf.
Xin LI [Sun, 26 Jul 2020 01:45:26 +0000 (01:45 +0000)]
Use snprintf instead of sprintf.

MFC after: 2 weeks

3 years agogeom_label: Make glabel labels more trivial by separating the tasting
Xin LI [Sun, 26 Jul 2020 00:44:59 +0000 (00:44 +0000)]
geom_label: Make glabel labels more trivial by separating the tasting
routines out.

While there, also simplify the creation of label paths a little bit
by requiring the / suffix for label directory prefixes (ld_dir renamed
to ld_dirprefix to indicate the change) and stop defining macros for
these when they are only used once.

Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25597

3 years agoo Make the _hw_iommu sysctl node non-static;
Ruslan Bukin [Sat, 25 Jul 2020 21:37:07 +0000 (21:37 +0000)]
o Make the _hw_iommu sysctl node non-static;
o Move the dmar sysctl knobs to _hw_iommu_dmar.

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

3 years agoo Move iommu gas prototypes, DMAR flags to iommu.h;
Ruslan Bukin [Sat, 25 Jul 2020 19:07:12 +0000 (19:07 +0000)]
o Move iommu gas prototypes, DMAR flags to iommu.h;
o Move hw.dmar sysctl node to iommu_gas.c.

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

3 years agoFix an overflow bug in the blist allocator that needlessly capped max
Doug Moore [Sat, 25 Jul 2020 18:29:10 +0000 (18:29 +0000)]
Fix an overflow bug in the blist allocator that needlessly capped max
swap size by dividing a value, which was always a multiple of 64, by
64.  Remove the code that reduced max swap size down to that cap.

Eliminate the distinction between BLIST_BMAP_RADIX and
BLIST_META_RADIX.  Call them both BLIST_RADIX.

Make improvments to the blist self-test code to silence compiler
warnings and to test larger blists.

Reported by: jmallett
Reviewed by: alc
Discussed with: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25736

3 years agoclean up whitespace...
John-Mark Gurney [Sat, 25 Jul 2020 18:09:04 +0000 (18:09 +0000)]
clean up whitespace...

3 years agofd: put back FILEDESC_SUNLOCK to pwd_hold lost during rebase
Mateusz Guzik [Sat, 25 Jul 2020 15:34:29 +0000 (15:34 +0000)]
fd: put back FILEDESC_SUNLOCK to pwd_hold lost during rebase

Reported by: pho

3 years agoAllow swi_sched() to be called from NMI context.
Alexander Motin [Sat, 25 Jul 2020 15:19:38 +0000 (15:19 +0000)]
Allow swi_sched() to be called from NMI context.

For purposes of handling hardware error reported via NMIs I need a way to
escape NMI context, being too restrictive to do something significant.

To do it this change introduces new swi_sched() flag SWI_FROMNMI, making
it careful about used KPIs.  On platforms allowing IPI sending from NMI
context (x86 for now) it immediately wakes clk_intr_event via new IPI_SWI,
otherwise it works just like SWI_DELAY.  To handle the delayed SWIs this
patch calls clk_intr_event on every hardclock() tick.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25754

3 years agoMove Intel GAS to dev/iommu/ as now a part of generic iommu framework.
Ruslan Bukin [Sat, 25 Jul 2020 11:34:50 +0000 (11:34 +0000)]
Move Intel GAS to dev/iommu/ as now a part of generic iommu framework.

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

3 years agovfs: add support for !LOCKLEAF to lockless lookup
Mateusz Guzik [Sat, 25 Jul 2020 10:40:38 +0000 (10:40 +0000)]
vfs: add support for !LOCKLEAF to lockless lookup

Tested by:      pho (in a patchset)
Differential Revision: https://reviews.freebsd.org/D23916

3 years agozfs: add support for lockless lookup
Mateusz Guzik [Sat, 25 Jul 2020 10:39:41 +0000 (10:39 +0000)]
zfs: add support for lockless lookup

Tested by: pho (in a patchset, previous version)
Differential Revision: https://reviews.freebsd.org/D25581

3 years agotmpfs: add support for lockless lookup
Mateusz Guzik [Sat, 25 Jul 2020 10:38:44 +0000 (10:38 +0000)]
tmpfs: add support for lockless lookup

Reviewed by:    kib
Tested by:      pho (in a patchset)
Differential Revision: https://reviews.freebsd.org/D25580

3 years agoufs: add support for lockless lookup
Mateusz Guzik [Sat, 25 Jul 2020 10:38:05 +0000 (10:38 +0000)]
ufs: add support for lockless lookup

ACLs are not supported, meaning their presence will force the use of the old lookup.

Reviewed by:    kib
Tested by:      pho (in a patchset)
Differential Revision: https://reviews.freebsd.org/D25579

3 years agovfs: lockless lookup
Mateusz Guzik [Sat, 25 Jul 2020 10:37:15 +0000 (10:37 +0000)]
vfs: lockless lookup

Provides full scalability as long as all visited filesystems support the
lookup and terminal vnodes are different.

Inner workings are explained in the comment above cache_fplookup.

Capabilities and fd-relative lookups are not supported and will result in
immediate fallback to regular code.

Symlinks, ".." in the path, mount points without support for lockless lookup
and mismatched counters will result in an attempt to get a reference to the
directory vnode and continue in regular lookup. If this fails, the entire
operation is aborted and regular lookup starts from scratch. However, care is
taken that data is not copied again from userspace.

Sample benchmark:
incremental -j 104 bzImage on tmpfs:
before: 142.96s user 1025.63s system 4924% cpu 23.731 total
after: 147.36s user 313.40s system 3216% cpu 14.326 total

Sample microbenchmark: access calls to separate files in /tmpfs, 104 workers, ops/s:
before:   2165816
after:  151216530

Reviewed by:    kib
Tested by:      pho (in a patchset)
Differential Revision: https://reviews.freebsd.org/D25578

3 years agovfs: add the infrastructure for lockless lookup
Mateusz Guzik [Sat, 25 Jul 2020 10:32:45 +0000 (10:32 +0000)]
vfs: add the infrastructure for lockless lookup

Reviewed by:    kib
Tested by:      pho (in a patchset)
Differential Revision: https://reviews.freebsd.org/D25577

3 years agovfs: introduce vnode sequence counters
Mateusz Guzik [Sat, 25 Jul 2020 10:31:52 +0000 (10:31 +0000)]
vfs: introduce vnode sequence counters

Modified on each permission change and link/unlink.

Reviewed by: kib
Tested by: pho (in a patchset)
Differential Revision: https://reviews.freebsd.org/D25573

3 years agoseqc: add a sleepable variant and convert some routines to macros
Mateusz Guzik [Sat, 25 Jul 2020 10:29:48 +0000 (10:29 +0000)]
seqc: add a sleepable variant and convert some routines to macros

This temporarily duplicates some code.

Macro conversion convinces clang to carry predicts into consumers.

3 years agoSplit-out the Intel GAS (Guest Address Space) management component
Ruslan Bukin [Sat, 25 Jul 2020 09:28:38 +0000 (09:28 +0000)]
Split-out the Intel GAS (Guest Address Space) management component
from Intel DMAR support, so it can be used on other IOMMU systems.

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

3 years agoRemove duplicated content from _eventhandler.h
Mateusz Guzik [Sat, 25 Jul 2020 07:48:20 +0000 (07:48 +0000)]
Remove duplicated content from _eventhandler.h

3 years agoRemove leftover macros for long gone vmsize mtx
Mateusz Guzik [Sat, 25 Jul 2020 07:45:44 +0000 (07:45 +0000)]
Remove leftover macros for long gone vmsize mtx

3 years agoGuard sbcompress_ktls_rx with KERN_TLS
Mateusz Guzik [Sat, 25 Jul 2020 07:15:23 +0000 (07:15 +0000)]
Guard sbcompress_ktls_rx with KERN_TLS

Fixes a compilation warning after r363464

3 years agoDo a lockless check in kthread_suspend_check
Mateusz Guzik [Sat, 25 Jul 2020 07:14:33 +0000 (07:14 +0000)]
Do a lockless check in kthread_suspend_check

Otherwise an idle system running lockstat sleep 10 reports contention on
process lock comming from bufdaemon.

While here fix a style nit.

3 years agoRevert r363123.
Michal Meloun [Sat, 25 Jul 2020 06:32:23 +0000 (06:32 +0000)]
Revert r363123.
As Emanuel poited me the Linux processes these clock assignments in forward
order, not in reversed. I misread the original code.
Tha problem with wrong order for assigned clocks found in tegra (and some imx)
DT should be reanalyzed and solved by different way.

MFC with: r363123
Reported by; manu

3 years agoAdd support for ext_pgs mbufs to nfsm_uiombuflist() and nfsm_split().
Rick Macklem [Fri, 24 Jul 2020 23:17:09 +0000 (23:17 +0000)]
Add support for ext_pgs mbufs to nfsm_uiombuflist() and nfsm_split().

This patch uses a slightly different algorithm for nfsm_uiombuflist() for
the non-ext_pgs case, where a variable called "mcp" is maintained, pointing to
the current location that mbuf data can be filled into. This avoids use of
mtod(mp, char *) + mp->m_len to calculate the location, since this does
not work for ext_pgs mbufs and I think it makes the algorithm more readable.
This change should not result in semantic changes for the non-ext_pgs case.
The patch also deletes come unneeded code.

It also adds support for anonymous page ext_pgs mbufs to nfsm_split().

This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.
At this time for this case, use of ext_pgs mbufs cannot be enabled, since
ktls_encrypt() replaces the unencrypted data with encrypted data in place.

Until such time as this can be enabled, there should be no semantic change.
Also, note that this code is only used by the NFS client for a mirrored pNFS
server.

3 years agocxgbe(4): Some updates to the common code.
Navdeep Parhar [Fri, 24 Jul 2020 23:15:42 +0000 (23:15 +0000)]
cxgbe(4): Some updates to the common code.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoMake it possible to get/set MMC frequency from camcontrol
Ilya Bakulin [Fri, 24 Jul 2020 21:14:59 +0000 (21:14 +0000)]
Make it possible to get/set MMC frequency from camcontrol

Enhance camcontrol(8) so that it's possible to manually set frequency for SD/MMC cards.
While here, display more information about the current controller, such as
supported operating modes and VCCQ voltages, as well as current VCCQ voltage.

Reviewed by: manu
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D25795

3 years agoIntroduce ipi_self_from_nmi().
Alexander Motin [Fri, 24 Jul 2020 20:52:09 +0000 (20:52 +0000)]
Introduce ipi_self_from_nmi().

It allows safe IPI sending to current CPU from NMI context.

Unlike other ipi_*() functions this waits for delivery to leave LAPIC in
a state safe for interrupted code.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

3 years agoUse APIC_IPI_DEST_OTHERS for bitmapped IPIs too.
Alexander Motin [Fri, 24 Jul 2020 20:44:50 +0000 (20:44 +0000)]
Use APIC_IPI_DEST_OTHERS for bitmapped IPIs too.

It should save bunch of LAPIC register accesses.

MFC after: 2 weeks

3 years agoMake lapic_ipi_vectored(APIC_IPI_DEST_SELF) NMI safe.
Alexander Motin [Fri, 24 Jul 2020 19:54:15 +0000 (19:54 +0000)]
Make lapic_ipi_vectored(APIC_IPI_DEST_SELF) NMI safe.

Sending IPI to self or all CPUs does not require write into upper part of
the ICR, prone to races.  Previously the code disabled interrupts, but it
was not enough for NMIs.  Instead of that when possible write only lower
part of the register, or use special SELF IPI register in x2APIC mode.

This also removes ICR reads used to preserve reserved bits on write.
It was there from the beginning, but I failed to find explanation why,
neither I see Linux doing it.  Specification even tells that ICR content
may be lost in deep C-states, so if hardware does not bother to preserve
it, why should we?

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

3 years agodwmmc: Add MMCCAM part
Emmanuel Vadot [Fri, 24 Jul 2020 19:52:52 +0000 (19:52 +0000)]
dwmmc: Add MMCCAM part

Add support for MMCCAM for dwmmc

Submitted by: kibab
Tested On: Rock64, RockPro64

3 years agommccam: aw_mmc: Only print the new ios value under bootverbose
Emmanuel Vadot [Fri, 24 Jul 2020 18:44:50 +0000 (18:44 +0000)]
mmccam: aw_mmc: Only print the new ios value under bootverbose

3 years agommccam: Make non bootverbose more readable
Emmanuel Vadot [Fri, 24 Jul 2020 18:43:46 +0000 (18:43 +0000)]
mmccam: Make non bootverbose more readable

Remove some debug printfs.
Convert some to CAM_DEBUG
Only print some when bootverbose is set.

3 years agoUse gbincore_unlocked for unprotected incore()
Conrad Meyer [Fri, 24 Jul 2020 17:34:44 +0000 (17:34 +0000)]
Use gbincore_unlocked for unprotected incore()

Reviewed by: markj
Sponsored by: Isilon
Differential Revision: https://reviews.freebsd.org/D25790

3 years agoAdd unlocked/SMR fast path to getblk()
Conrad Meyer [Fri, 24 Jul 2020 17:34:04 +0000 (17:34 +0000)]
Add unlocked/SMR fast path to getblk()

Convert the bufobj tries to an SMR zone/PCTRIE and add a gbincore_unlocked()
API wrapping this functionality.  Use it for a fast path in getblkx(),
falling back to locked lookup if we raced a thread changing the buf's
identity.

Reported by: Attilio
Reviewed by: kib, markj
Testing: pho (in progress)
Sponsored by: Isilon
Differential Revision: https://reviews.freebsd.org/D25782

3 years agoUse SMR to provide safe unlocked lookup for pctries from SMR zones
Conrad Meyer [Fri, 24 Jul 2020 17:32:10 +0000 (17:32 +0000)]
Use SMR to provide safe unlocked lookup for pctries from SMR zones

Adapt r358130, for the almost identical vm_radix, to the pctrie subsystem.
Like that change, the tree is kept correct for readers with store barriers
and careful ordering.  Existing locks serialize writers.

Add a PCTRIE_DEFINE_SMR() wrapper that takes an additional smr_t parameter
and instantiates a FOO_PCTRIE_LOOKUP_UNLOCKED() function, in addition to the
usual definitions created by PCTRIE_DEFINE().

Interface consumers will be introduced in later commits.

As future work, it might be nice to add vm_radix algorithms missing from
generic pctrie to the pctrie interface, and then adapt vm_radix to use
pctrie.

Reported by: Attilio
Reviewed by: markj
Sponsored by: Isilon
Differential Revision: https://reviews.freebsd.org/D25781

3 years agolockmgr: add missing 'continue' to account for spuriously failed fcmpset
Mateusz Guzik [Fri, 24 Jul 2020 17:28:24 +0000 (17:28 +0000)]
lockmgr: add missing 'continue' to account for spuriously failed fcmpset

PR: 248245
Reported by: gbe
Noted by: markj
Fixes by: r363415 ("lockmgr: add adaptive spinning")