]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFV r355071: libbsdxml (expat) 2.2.9.
delphij [Mon, 25 Nov 2019 07:48:16 +0000 (07:48 +0000)]
MFV r355071: libbsdxml (expat) 2.2.9.

MFC after: 2 weeks
Relnotes: yes

4 years agovm_object_collapse_scan_wait: drop locks before reacquiring
rlibby [Mon, 25 Nov 2019 07:38:31 +0000 (07:38 +0000)]
vm_object_collapse_scan_wait: drop locks before reacquiring

Regression from r352174.  In the vm_page_rename() failure case we forgot
to unlock the vm object locks before sleeping and reacquiring them.

Reviewed by: jeff
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22542

4 years agosysctl sysctls: wire old buf before output with sysctl lock
rlibby [Mon, 25 Nov 2019 07:38:27 +0000 (07:38 +0000)]
sysctl sysctls: wire old buf before output with sysctl lock

Several sysctl sysctls output to a user buffer while holding a
non-sleepable lock that protects the sysctl topology.  They need to wire
the output buffer, or else they may try to sleep on a page fault.

Reviewed by: cem, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22528

4 years agoMove anonymous object copying for fork into its own routine and so that we
jeff [Mon, 25 Nov 2019 07:13:05 +0000 (07:13 +0000)]
Move anonymous object copying for fork into its own routine and so that we
can avoid locking non-anonymous objects.

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

4 years agoWhere 'current' is used to index over vm_map entries, use
dougm [Mon, 25 Nov 2019 02:19:47 +0000 (02:19 +0000)]
Where 'current' is used to index over vm_map entries, use
'entry'. Where 'entry' is used to identify the starting point for
iteration, use 'first_entry'. These are the naming conventions used in
most of the vm_map.c code.  Where VM_MAP_ENTRY_FOREACH can be used, do
so. Squeeze a few lines to fit in 80 columns.  Where lines are being
modified for these reasons, look to remove style(9) violations.

Reviewed by: alc, markj
Differential Revision: https://reviews.freebsd.org/D22458

4 years agoReport XLAT0 register for completeness.
mav [Mon, 25 Nov 2019 01:00:51 +0000 (01:00 +0000)]
Report XLAT0 register for completeness.

4 years agoVendor import of expat 2.2.9
delphij [Sun, 24 Nov 2019 23:46:29 +0000 (23:46 +0000)]
Vendor import of expat 2.2.9

4 years agoAllow kernel to compile without BPF.
bz [Sun, 24 Nov 2019 23:21:47 +0000 (23:21 +0000)]
Allow kernel to compile without BPF.

r297816 added some bpf magic for VIMAGE unconditionally which no longer
allows kernels to compile without bpf (but with other networking).
Add the missing ifdef checks and allow a kernel to compile without bpf
again.

PR: 242136
Reported by: dave mischler.com
MFC after: 2 weeks

4 years agoWhen doing ARM stack unwinding as part of stack_save(9), do not search
ian [Sun, 24 Nov 2019 21:08:56 +0000 (21:08 +0000)]
When doing ARM stack unwinding as part of stack_save(9), do not search
loaded modules (pass 0/false for the can_lock arg).  Searching the unwind
info in modules acquires an exclusive sxlock, and the stack(9) functions can
be called in a context where unbounded sleeps are forbidden (such as from
the witness checkorder code).

Just ignoring the existence of modules in stack_save() is not ideal, so I'm
looking for a better solution, but this commit will make it possible to boot
an ARM kernel with WITNESS enabled again, until I get something better.

PR: 242200

4 years agoLinux epoll: Allow passing of any negative timeout value to epoll_wait
wulf [Sun, 24 Nov 2019 20:51:09 +0000 (20:51 +0000)]
Linux epoll: Allow passing of any negative timeout value to epoll_wait

Linux epoll allow passing of any negative timeout value to epoll_wait()
to cause unbound blocking

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

4 years agoLinux epoll: Register events with zero event mask
wulf [Sun, 24 Nov 2019 20:47:40 +0000 (20:47 +0000)]
Linux epoll: Register events with zero event mask

Such an events are legal and should be interpreted as EPOLLERR | EPOLLHUP.
Register a disabled kqueue event in that case as we do not support EPOLLHUP yet.

Required by Linux Steam client.

PR: 240590
Reported by: Alex S <iwtcex@gmail.com>
Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22516

4 years agoLinux epoll: Check both read and write kqueue events existence in EPOLL_CTL_ADD
wulf [Sun, 24 Nov 2019 20:44:14 +0000 (20:44 +0000)]
Linux epoll: Check both read and write kqueue events existence in EPOLL_CTL_ADD

Linux epoll EPOLL_CTL_ADD op handler should always check registration
of both EVFILT_READ and EVFILT_WRITE kevents to deceide if supplied
file descriptor fd is already registered with epoll instance.

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

4 years agoLinux epoll: Don't deregister file descriptor after EPOLLONESHOT is fired
wulf [Sun, 24 Nov 2019 20:41:47 +0000 (20:41 +0000)]
Linux epoll: Don't deregister file descriptor after EPOLLONESHOT is fired

Linux epoll does not remove descriptor after one-shot event has been triggered.
Set EV_DISPATCH kqueue flag rather then EV_ONESHOT to get the same behavior.

Required by Linux Steam client.

PR: 240590
Reported by: Alex S <iwtcex@gmail.com>
Reviewed by: emaste, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22513

4 years agoIgnore object->handle for OBJ_ANON objects.
kib [Sun, 24 Nov 2019 19:18:12 +0000 (19:18 +0000)]
Ignore object->handle for OBJ_ANON objects.

Note that the change in vm_object_collapse() is arguably a correctness
fix.  We must not collapse into content-identity carrying objects.

Reviewed by: jeff
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D22467

4 years agobsd-family-tree: correct macOS release date
eadler [Sun, 24 Nov 2019 19:16:57 +0000 (19:16 +0000)]
bsd-family-tree: correct macOS release date

Reported by: Herbert J. Skuhra <herbert@gojira.at>
Reported by: Maxim Konovalov <maxim.konovalov@gmail.com>

4 years agoRecord part of the owner struct thread pointer into busy_lock.
kib [Sun, 24 Nov 2019 19:12:23 +0000 (19:12 +0000)]
Record part of the owner struct thread pointer into busy_lock.

Record as much bits from curthread into busy_lock as fits.  Low bits
for struct thread * representation are zero due to struct and zone
alignment, and they leave space for busy flags (perhaps except
statically allocated thread0).  Upper bits are not very interesting
for assert, and in most practical situations recorded value should
allow to manually identify the owner with certainity.

Assert that unbusy is performed by the owner, except few places where
unbusy is done in io completion handler.  For this case, add
_unchecked variants of asserts and unbusy primitives.

Reviewed by: markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D22298

4 years agotmpfs: resolve deadlock between rename and unmount.
kib [Sun, 24 Nov 2019 19:06:38 +0000 (19:06 +0000)]
tmpfs: resolve deadlock between rename and unmount.

Top-level kern_renameat() increases the writecount on the mount point,
which, together with tmpfs unmount suspending the mount, already
ensures that unmount cannot proceed while rename unlocks and relocks
all operated vnodes.

Remove vfs_busy() call from tmpfs_rename() which was done while
holding a vnode lock, creating the deadlock.  The only intent of the
busy operation seems to be the prevention of unmount, which is already
ensured.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoamd64: assert that EARLY_COUNTER does not corrupt memory.
kib [Sun, 24 Nov 2019 19:02:13 +0000 (19:02 +0000)]
amd64: assert that EARLY_COUNTER does not corrupt memory.

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

4 years agocxgbe(4): sysctl to reset the temperature/voltage sensor.
np [Sun, 24 Nov 2019 16:40:54 +0000 (16:40 +0000)]
cxgbe(4): sysctl to reset the temperature/voltage sensor.

# sysctl dev.<nexus>.<inst>.reset_sensor=1
# sysctl dev.t6nex.0.reset_sensor=1

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agoDon't need giant for these drivers dev nodes.
imp [Sun, 24 Nov 2019 15:37:19 +0000 (15:37 +0000)]
Don't need giant for these drivers dev nodes.

Also, Giant isn't required to busy / unbusy a device, so drop that too while I'm
here. It's not done elsewhere in the tree and in the future will likely be
handled by a node lock to ensure consistency. Leave Giant in place for attach
and removing childing, as that's actually still needed, even if imperfect.

Remove stale comment about contigmalloc taking Giant and calling w/o the lock
held. Neither of these is still true.

4 years agoHoist locking giant back up into the ioctl handler
imp [Sun, 24 Nov 2019 15:37:14 +0000 (15:37 +0000)]
Hoist locking giant back up into the ioctl handler

Move the locking back into the ioctl handler. This "fixes" the race where we hve
a hot plug event just after the dropping of Giant in pci_find_dbsf, assuming the
driver doesn't then call anything that drops and picks up Giant again... It's a
little safer since don't think it doesn't, but we lack the tools to know for
sure.

4 years agoFix leak in state machine for commands.
imp [Sun, 24 Nov 2019 15:24:05 +0000 (15:24 +0000)]
Fix leak in state machine for commands.

When we get a device departed message from the firmware, we send a TARGET_REST
to the device to let the firmware know we're done and as part of the recovery
process. This will abort all the commands. While the documentation says the IOC
is responsible for writing the completion message for all the commands pending
with an aborted status, we sometimes have queued commands for the target that
haven't been completed so are in the INQUEUE state. So, when we later complete
the pending CCB as aborted, these commands are freed and we hit the "state not
busy" panic.

Elsewhere where we dequeue commands, we move the state to BUSY from INQUEUE. Do
that here as well. In talking to Ken, Scott and Justin, they recommended a
series of tests to see if this is 100% safe. Those tests are ongoing, but
preliminary tests suggest this is safe as we see no duplicate completions when
we hit this case at work. We have a machine that has a dodgy powersupply which
usually doesn't apply power to a few drives, but sometimes does when the machine
is under heavy load so we get a rash of the connect / disconnect messages over
half an hour. Without this change, we'd see state not busy panic. With this
change, the drives just annoyingly come and go without affecting the rest of the
machine, but without a complete error injection test suite, it's hard to know if
all edge cases are now covered or not.

Discussed with: scottl, ken, gibbs

4 years agoFix gcc build
lwhsu [Sun, 24 Nov 2019 15:03:35 +0000 (15:03 +0000)]
Fix gcc build

We have -Werror=strict-overflow so gcc complains:

In file included from /tmp/obj/workspace/src/amd64.amd64/tmp/usr/include/bitstring.h:36:0,
                 from /workspace/src/tests/sys/sys/bitstring_test.c:34:
/workspace/src/tests/sys/sys/bitstring_test.c: In function 'bit_ffc_at_test':
/workspace/src/sys/sys/bitstring.h:239:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
  if (_start >= _nbits) {
     ^

Disable assuming overflow of signed integer will never happen by specifying
-fno-strict-overflow

Sponsored by: The FreeBSD Foundation

4 years agopf: Add endline to all DPFPRINTF()
kp [Sun, 24 Nov 2019 13:53:36 +0000 (13:53 +0000)]
pf: Add endline to all DPFPRINTF()

DPFPRINTF() doesn't automatically add an endline, so be consistent and
always add it.

4 years agobsd-family-tree: add several new entries
eadler [Sun, 24 Nov 2019 07:52:35 +0000 (07:52 +0000)]
bsd-family-tree: add several new entries

Reviewed by: imp, scottl
Differential Revision: https://reviews.freebsd.org/D22529

4 years ago[PowerPC] Fix stack padding issue on ppc32.
bdragon [Sun, 24 Nov 2019 06:43:03 +0000 (06:43 +0000)]
[PowerPC] Fix stack padding issue on ppc32.

Four bytes of padding are needed in the regular powerpc case to bring the
stack frame size up to a multiple of 16 bytes to meet ABI requirements.

Fixes odd hangs I was encountering during testing.

4 years agocxgbe(4): Update the firmware interface header.
np [Sun, 24 Nov 2019 05:37:28 +0000 (05:37 +0000)]
cxgbe(4): Update the firmware interface header.

This allows the driver to be updated for the next firmware without
waiting for it to be released.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

4 years agortld/powerpc: Fix _rtld_bind_start for powerpcspe
jhibbits [Sun, 24 Nov 2019 04:35:29 +0000 (04:35 +0000)]
rtld/powerpc: Fix _rtld_bind_start for powerpcspe

Summary:
We need to save off the full 64-bit register, not just the low 32 bits,
of all registers getting saved off in _rtld_bind_start.  Additionally,
we need to save off the other SPE registers (SPEFSCR and accumulator),
so that their program state is not affected by the PLT resolver.

Reviewed by: bdragon
Differential Revision: https://reviews.freebsd.org/D22520

4 years agoAdd a warning about Giant Locked devices
imp [Sat, 23 Nov 2019 23:57:26 +0000 (23:57 +0000)]
Add a warning about Giant Locked devices

Add a warning when a device registers with devfs and requests
D_NEEDGIANT. The warning says the device will go away before
13.0. This is needed to flush out the devices in the tree that are
still Giant locked. This warning, or some variant of it, should have
gone into the tree a long time ago...

The intention is to require all devices be converted to not use
automatic giant in this way, or remove any such devices that remain
that we don't have the hardware to test a conversion of.

kbd so far is the only device that can't leave the tree, yet needs
something sensible done to avoid the auto giant lock (even if it is
just doing the wrapping itself). There may be others added to this
list... Any discussions of this topic will take place on arch@.

4 years agoWe don't even need Giant here. It isn't protecting anything internal
imp [Sat, 23 Nov 2019 23:44:00 +0000 (23:44 +0000)]
We don't even need Giant here. It isn't protecting anything internal
to geom, and nothing we call requires it to be held. It's left over
from a time when the latter wasn't the case. Retire it.

Reviewed in concept: scottl@

4 years agoPush Giant down one layer
imp [Sat, 23 Nov 2019 23:43:52 +0000 (23:43 +0000)]
Push Giant down one layer

The /dev/pci device doesn't need GIANT, per se. However, one routine
that it calls, pci_find_dbsf implicitly does. It walks a list that can
change when PCI scans a new bus. With hotplug, this means we could
have a race with that scanning. To prevent that, take out Giant around
scanning the list.

However, given that we have places in the tree that drop giant, if
held when we call into them, the whole use of Giant to protect newbus
may be less effective that we desire, so add a comment about why we're
talking it out, and we'll address the issue when we lock newbus with
something other than Giant.

4 years ago[PowerPC] Fix typo in _ctx_start on ppc32
bdragon [Sat, 23 Nov 2019 23:41:21 +0000 (23:41 +0000)]
[PowerPC] Fix typo in _ctx_start on ppc32

Theoretically, this was breaking the size calculation for the symbol.

Noticed when doing a readthrough.

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

4 years ago[PowerPC] Use QEMU-compatible version of SPE accumulator save
bdragon [Sat, 23 Nov 2019 21:18:55 +0000 (21:18 +0000)]
[PowerPC] Use QEMU-compatible version of SPE accumulator save

Switch from "evaddumiaaw 0,0" to "evmwumiaa 0,0,0" when persisting the
accumulator. This has the benefit of actually being implemented in QEMU
as it is the form Linux uses for the same task.

Both instructions are functionally equivilent, as we are using them for
their side effect of copying the accumulator to GPRs rather than for the
actual math operation that they are performing.

Reviewed by: jhibbits

4 years agolibclang_rt: enable on powerpc*
dim [Sat, 23 Nov 2019 19:35:09 +0000 (19:35 +0000)]
libclang_rt: enable on powerpc*

Summary:
Enable on powerpc64 and in lib/libclang_rt/Makefile change
MACHINE_CPUARCH to MACHINE_ARCH because on powerpc64
MACHINE_ARCH==MACHINE_CPUARCH so the 32-bit library overwrites 64-bit
library during installworld.

This patch doesn't enable any other libclang_rt libraries because they
need to be separately ported.

I have verified that games/julius (which fails on powerpc64 elfv2
without this change because of no libclang_rt profiling library) builds.

Test Plan: Ship it, test on powerpc and powerpcspe

Submitted by: pkubaj
Reviewed by: dim, jhibbits
Differential Revision: https://reviews.freebsd.org/D22425
MFC after: 1 month
X-MFC-With: r353358

4 years agoThe error messages that indicate bugs in 'area' bitstring functions
dougm [Sat, 23 Nov 2019 17:22:36 +0000 (17:22 +0000)]
The error messages that indicate bugs in 'area' bitstring functions
should identify accurately which function exhibited the bug.

Reviewed by: asomers
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22519

4 years agobcm2835_sdhci: fix non-INVARIANTS build
kevans [Sat, 23 Nov 2019 13:39:47 +0000 (13:39 +0000)]
bcm2835_sdhci: fix non-INVARIANTS build

sc is now only used to make sure we're not re-entering the data handling
path erroneously.

Reported by: Mark Millard

4 years agoarm64/NOTES: add SOC_BRCM_BCM2838
kevans [Sat, 23 Nov 2019 03:38:26 +0000 (03:38 +0000)]
arm64/NOTES: add SOC_BRCM_BCM2838

This should have been done back when it was added, but it was not. It only
really adds an extra entry for memory mapping bits in bcm2835_vcbus.c, so
nothing too extensive yet.

4 years agobcm2835_dma: rip out the "use_dma" flag, make it non-optional
kevans [Sat, 23 Nov 2019 01:47:17 +0000 (01:47 +0000)]
bcm2835_dma: rip out the "use_dma" flag, make it non-optional

Now that it works for the Raspberry Pi 4, we can discontinue our workarounds
that were put in place to at least get a bootable kernel for other testing.

4 years agobcm2835_sdhci: "fix" DMA on the RPi 4
kevans [Sat, 23 Nov 2019 01:46:02 +0000 (01:46 +0000)]
bcm2835_sdhci: "fix" DMA on the RPi 4

According to the documentation I have, DREQ pacing should be required here.
The DREQ# hasn't changed since the BCM2835. As soon as we attempt to setup
DREQ, DMA stalls and there's no clear reason why as of yet. Setting this
back to NONE seems to work just as well, though it's yet to be determined if
this is a sustainable model in high-throughput scenarios.

4 years agoAdd explicit SI_SUB_EPOCH
cem [Fri, 22 Nov 2019 23:23:40 +0000 (23:23 +0000)]
Add explicit SI_SUB_EPOCH

Add explicit SI_SUB_EPOCH, after SI_SUB_TASKQ and before SI_SUB_SMP
(EARLY_AP_STARTUP).  Rename existing "SI_SUB_TASKQ + 1" to SI_SUB_EPOCH.

epoch(9) consumers cannot epoch_alloc() before SI_SUB_EPOCH:SI_ORDER_SECOND,
but likely should allocate before SI_SUB_SMP.  Prior to this change,
consumers (well, epoch itself, and net/if.c) just open-coded the
SI_SUB_TASKQ + 1 order to match epoch.c, but this was fragile.

Reviewed by: mmacy
Differential Revision: https://reviews.freebsd.org/D22503

4 years agoDo not retry long ready waits if previous gave nothing.
mav [Fri, 22 Nov 2019 21:31:59 +0000 (21:31 +0000)]
Do not retry long ready waits if previous gave nothing.

I have some disks reporting "Logical unit is in process of becoming ready"
for about half an hour before finally reporting failure.  During that time
CAM waits for the readiness during ~2 minutes for each request, that makes
system boot take very long time.

This change reduces wait times for the following requests to ~1 second if
previously long wait for that device has timed out.

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

4 years agorandom(4): De-export random_sources list
cem [Fri, 22 Nov 2019 20:24:15 +0000 (20:24 +0000)]
random(4): De-export random_sources list

The internal datastructures do not need to be visible outside of
random_harvestq, and this helps ensure they are not misused.

No functional change.

Approved by: csprng(delphij, markm)
Differential Revision: https://reviews.freebsd.org/D22485

4 years agoMark hpt27xx for removal in 13.0; all CAM drivers will be Giant-free by then.
scottl [Fri, 22 Nov 2019 20:23:22 +0000 (20:23 +0000)]
Mark hpt27xx for removal in 13.0; all CAM drivers will be Giant-free by then.

Relnotes: yes

4 years agorandom(4): Use ordinary sysctl definitions
cem [Fri, 22 Nov 2019 20:22:29 +0000 (20:22 +0000)]
random(4): Use ordinary sysctl definitions

There's no need to dynamically populate them; the SYSCTL_ macros take care
of load/unload appropriately already (and random_harvestq is 'standard' and
cannot be unloaded anyway).

Approved by: csprng(delphij, markm)
Differential Revision: https://reviews.freebsd.org/D22484

4 years agodhclient: support option 114, default-url ascii
dch [Fri, 22 Nov 2019 20:22:16 +0000 (20:22 +0000)]
dhclient: support option 114, default-url ascii

This will enable further automation of HTTP UEFI boot loader support by
providing a specific option for providing the boot URL to FreeBSD.

Documented in:

https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml
https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options
https://tools.ietf.org/html/rfc3679

Approved by: emaste
MFC after: 2 weeks
Sponsored by: SkunkWerks, GmbH
Differential Revision: https://reviews.freebsd.org/D22475

4 years agorandom(4): Abstract loader entropy injection
cem [Fri, 22 Nov 2019 20:20:37 +0000 (20:20 +0000)]
random(4): Abstract loader entropy injection

Break random_harvestq_prime up into some logical subroutines.  The goal
is that it becomes easier to add other early entropy sources.

While here, drop pre-12.0 compatibility logic.  loader default configuration
should preload the file as expeced since 12.0.

Approved by: csprng(delphij, markm)
Differential Revision: https://reviews.freebsd.org/D22482

4 years agorandom(4): Remove unused definitions
cem [Fri, 22 Nov 2019 20:18:07 +0000 (20:18 +0000)]
random(4): Remove unused definitions

Approved by: csprng(gordon, markm)
Differential Revision: https://reviews.freebsd.org/D22481

4 years agobcm2835_vcbus: add the *other* rpi4 compat string
kevans [Fri, 22 Nov 2019 19:56:52 +0000 (19:56 +0000)]
bcm2835_vcbus: add the *other* rpi4 compat string

The DTS I used initially had brcm,bcm2838; the new one uses brcm,bcm2711.
Add that one as well.

4 years agoMMCCAM: defer release of ccb until we're done with it
kevans [Fri, 22 Nov 2019 19:54:14 +0000 (19:54 +0000)]
MMCCAM: defer release of ccb until we're done with it

If we've found a device, we attempt to call xpt_action() on a ccb that's
already been released. Simply defer release until after we're done with it.

Reviewed by: imp, scottl
MFC after: 1 week

4 years agorandom/ivy: Provide mechanism to read independent seed values from rdrand
cem [Fri, 22 Nov 2019 19:30:31 +0000 (19:30 +0000)]
random/ivy: Provide mechanism to read independent seed values from rdrand

On x86 platforms with the intrinsic, rdrand is a deterministic bit generator
(AES-CTR) seeded from an entropic source.  On x86 platforms with rdseed, it
is something closer to the upstream entropic source.  (There is more nuance;
a block diagram is provided in [1].)

On devices with rdrand and without rdseed, there is no good intrinsic for
acecssing the good entropic soure directly.  However, the DRBG is guaranteed
to reseed every 8 kB on these platforms.  As a conservative option, on such
hardware we can read an extra 7.99kB samples every time we want a sample
from an independent seed.

As one can imagine, this drastically slows the effective read rate of
RDRAND (a factor of 1024 on amd64 and 2048 on ia32).  Microbenchmarks on AMD
Zen (has RDSEED) show an RDRAND rate of 25 MB/s and Intel Haswell (no
RDSEED) show RDRAND of 170 MB/s.  This would reduce the read rate on Haswell
to ~170 kB/s (at 100% CPU).  random(4)'s harvestq thread periodically
"feeds" from pure sources in amounts of 128-1024 bytes.  On Haswell,
enabling this feature increases the CPU time of RDRAND in each "feed" from
approximately 0.7-6 Âµs to 0.7-6 ms.

Because there is some performance penalty to this more conservative option,
a knob is provided to enable the change.  The change does not affect
platforms with RDSEED.

[1]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide#inpage-nav-4-2

Approved by: csprng(delphij, markm)
Differential Revision: https://reviews.freebsd.org/D22455

4 years agoRemove xpt_lock mutex.
mav [Fri, 22 Nov 2019 18:55:27 +0000 (18:55 +0000)]
Remove xpt_lock mutex.

CAM does not require SIM locks for years, and obviously does not require
it for completely virtual XPT SIM.

MFC after: 2 weeks

4 years agoSchedule the trm(4) driver for removal. It relies on Giant and thus has
scottl [Fri, 22 Nov 2019 18:50:53 +0000 (18:50 +0000)]
Schedule the trm(4) driver for removal.  It relies on Giant and thus has
required compat shims in CAM for 12 years.

Relnotes: yes

4 years agoRevert r354909: Make the warning for deprecated NO_ variables an error.
brooks [Fri, 22 Nov 2019 18:41:09 +0000 (18:41 +0000)]
Revert r354909: Make the warning for deprecated NO_ variables an error.

An unexpectidly large number of ports define NO_MAN (and sometimes the
long-dead NOMAN).  I'll fix ports and then re-commit.

4 years agoMake CAM use root_mount_hold_token() to delay boot.
mav [Fri, 22 Nov 2019 18:39:51 +0000 (18:39 +0000)]
Make CAM use root_mount_hold_token() to delay boot.

Before this change CAM used config_intrhook_establish() for this purpose,
but that approach does not allow to delay it again after releasing once.

USB stack uses root_mount_hold() to delay boot until bus scan is complete.
But once it is, CAM had no time to scan SCSI bus, registered by umass(4),
if it already done other scans and called config_intrhook_disestablish().
The new approach makes it work smooth, assuming the USB device is found
during the initial bus scan.  Devices appearing on USB bus later may still
require setting kern.cam.boot_delay, but hopefully those are minority.

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

4 years agoRemove NEEDGIANT from the scsi_sg /dev node. It likely has not been
scottl [Fri, 22 Nov 2019 18:18:36 +0000 (18:18 +0000)]
Remove NEEDGIANT from the scsi_sg /dev node.  It likely has not been
needed for many years.

Reported by: imp

4 years agoAdd and document options to allow rpc.lockd and rpc.statd to run in the
rpokala [Fri, 22 Nov 2019 16:53:30 +0000 (16:53 +0000)]
Add and document options to allow rpc.lockd and rpc.statd to run in the
foreground.

This allows a separate process to monitor when and how those programs exit.
That process can then restart them if needed.

Submitted by: Alex Burlyga
Reviewed by: bcr, imp
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D22474

4 years agoSimplify vm_pageout_init_domain() and add a "big picture" comment.
markj [Fri, 22 Nov 2019 16:31:43 +0000 (16:31 +0000)]
Simplify vm_pageout_init_domain() and add a "big picture" comment.

Stop subtracting 1024/200 from vmd_page_count/200.  I cannot see how
such precise accounting can make a difference on modern systems.

Add some explanation of what the page daemon does and how it handles
memory shortages.

Reviewed by: dougm
Discussed with: jeff, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22396

4 years agoReclaim memory from UMA if the page daemon is struggling.
markj [Fri, 22 Nov 2019 16:31:30 +0000 (16:31 +0000)]
Reclaim memory from UMA if the page daemon is struggling.

Use the UMA reclaim thread to asynchronously drain all caches if
there is a severe shortage in a domain.  Otherwise we only trigger UMA
reclamation every 10s even when the system has completely run out of
memory.

Stop entirely draining the caches when one domain falls below its min
threshold.  In some workloads it is normal for one NUMA domain to end
up being nearly depleted by kernel memory allocations, for example for
the ZFS ARC.  The domainset iterators skip domains below the
vmd_min_free theshold on the first iteration, so we should allow that
mechanism to limit further depletion of the domain's free pages before
taking the extreme step of calling uma_reclaim(UMA_RECLAIM_DRAIN_CPU).

Discussed with: jeff
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22395

4 years agoUpdate the checks in vm_page_zone_import().
markj [Fri, 22 Nov 2019 16:31:10 +0000 (16:31 +0000)]
Update the checks in vm_page_zone_import().

- Remove the cnt == 1 check.  UMA passes cnt == 1 when it has disabled
  per-CPU caching.  In this case we might as well just allocate a single
  page and return it to the caller, since the caller is going to do
  exactly that anyway if the UMA cache allocation attempt fails.
- Don't replenish caches if the domain is severely short on free pages.
  With large buckets we may otherwise quickly exacerbate a situation
  where the page daemon is failing to keep up.
- Don't replenish caches if the calling thread belongs to the page
  daemon, which should avoid creating extra memory pressure when it is
  trying to free memory.  Virtually all such allocations while occur in
  the context of laundering, where the laundry thread must allocate
  slabs for various swap and I/O-related UMA zones.

Reviewed by: kib
Discussed with: alc, jeff
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22394

4 years agoRevise the page cache size policy.
markj [Fri, 22 Nov 2019 16:30:47 +0000 (16:30 +0000)]
Revise the page cache size policy.

In r353734 the use of the page caches was limited to systems with a
relatively large amount of RAM per CPU.  This was to mitigate some
issues reported with the system not able to keep up with memory pressure
in cases where it had been able to do so prior to the addition of the
direct free pool cache.  This change re-enables those caches.

The change modifies uma_zone_set_maxcache(), which was introduced
specifically for the page cache zones.  Rather than using it to limit
only the full bucket cache, have it also set uz_count_max to provide an
upper bound on the per-CPU cache size that is consistent with the number
of items requested.  Remove its return value since it has no use.

Enable the page cache zones unconditionally, and limit them to 0.1% of
the domain's pages.  The limit can be overridden by the
vm.pgcache_zone_max tunable as before.

Change the item size parameter passed to uma_zcache_create() to the
correct size, and stop setting UMA_ZONE_MAXBUCKET.  This allows the page
cache buckets to be adaptively sized, like the rest of UMA's caches.
This also causes the initial bucket size to be small, so only systems
which benefit from large caches will get them.

Reviewed by: gallatin, jeff
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22393

4 years agoFix locking in vm_reserv_reclaim_contig().
markj [Fri, 22 Nov 2019 16:28:52 +0000 (16:28 +0000)]
Fix locking in vm_reserv_reclaim_contig().

We were not properly handling the case where the trylock of the
reservaton fails, in which case we could leak reservation lock.

Introduce a marker reservation to implement precise scanning in
vm_reserv_reclaim_contig().  Before, a race could result in early
termination of the scan in rare situations.  Use the marker's lock to
serialize scans of the partpop queue so that a global marker structure
can be used.  Modify vm_reserv_reclaim_inactive() to handle the presence
of a marker while minimizing the hold time of domain-global locks.

Reviewed by: alc, jeff, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22392

4 years agoFix typos in the cpuset_{get,set}domain() man page.
markj [Fri, 22 Nov 2019 16:25:00 +0000 (16:25 +0000)]
Fix typos in the cpuset_{get,set}domain() man page.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoFix off-by-one error in HPA/AMA maximum reporting.
mav [Fri, 22 Nov 2019 15:41:47 +0000 (15:41 +0000)]
Fix off-by-one error in HPA/AMA maximum reporting.

Before my refactoring the code reported value as maximum number of sectors,
adding one to the maximum sector number returned by respective command.
While this difference is somewhat confusing, restore previous behavior.

MFC after: 3 days

4 years agoamd: add deprecation warning on program startup
emaste [Fri, 22 Nov 2019 15:06:07 +0000 (15:06 +0000)]
amd: add deprecation warning on program startup

Reviewed by: rgrimes, trasz, kevans, brooks
Discussed with: cy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22466

4 years agoadd deprecation notice to amd man page
emaste [Fri, 22 Nov 2019 15:04:03 +0000 (15:04 +0000)]
add deprecation notice to amd man page

Clarify the deprecation notice in amd.8.  amd will be removed from the
FreeBSD base system before FreeBSD 13.0.

Reviewed by: rgrimes, trasz, kevans, brooks (all earlier, in D22466)
Discussed with: cy
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoInitialize variable bitstr
lwhsu [Fri, 22 Nov 2019 10:15:15 +0000 (10:15 +0000)]
Initialize variable bitstr

r354991 removed variable-sized object initializing on defining.  For the safe
reason, manually initialize the members to 0.

Sponsored by: The FreeBSD Foundation

4 years agoFix GCC build.
lwhsu [Fri, 22 Nov 2019 10:03:16 +0000 (10:03 +0000)]
Fix GCC build.

Sponsored by: The FreeBSD Foundation

4 years agopowerpc/ptrace: Give ptrace(2) access to SPE registers when available
jhibbits [Fri, 22 Nov 2019 04:34:46 +0000 (04:34 +0000)]
powerpc/ptrace: Give ptrace(2) access to SPE registers when available

SPE registers are already exported in core dumps with the VMX note, so use
the same interface for live access.

Instead of simply guarding out in #ifndef __SPE__ the cpu_feature check, I
chose to keep the check and check against PPC_FEATURE_SPE, on the off-chance
someone decides to run a SPE kernel on a non-SPE device (which is possible,
though highly unlikely, and would be no different from running a MPC85XX
kernel in that instance).

4 years agoFix the pNFS server's reporting of SpaceUsed (va_bytes).
rmacklem [Fri, 22 Nov 2019 00:22:55 +0000 (00:22 +0000)]
Fix the pNFS server's reporting of SpaceUsed (va_bytes).

The pNFS server currently reports SpaceUsed (va_bytes) for the metadata
file. This in not correct, since the metadata file is always empty and,
as such, va_bytes is just the allocation for the empty file.
This patch adds va_bytes to the list of attributes acquired from the
DS for a file, so that it includes the allocated data size and is updated
when the file is written.
For files created on a pNFS server before this patch is applied, the
va_bytes value is estimated by rounding va_size up to a multiple of
BLKDEV_IOSIZE. Once the file is written after this patch has been
applied to the metadata server, the va_bytes returned for the file
will be correct.

This patch only affects a pNFS metadata server.

Found during testing of the NFSv4.2 pNFS server for the Allocate operation.
(Not yet in head/current.)

MFC after: 2 weeks

4 years agocc_ktr_event_name is used only with KTR
glebius [Thu, 21 Nov 2019 23:55:43 +0000 (23:55 +0000)]
cc_ktr_event_name is used only with KTR

4 years agoDelete ih_thread. Should have gone in r334170.
glebius [Thu, 21 Nov 2019 23:55:19 +0000 (23:55 +0000)]
Delete ih_thread.  Should have gone in r334170.

4 years agoAdd variant of root_mount_hold() without allocation.
mav [Thu, 21 Nov 2019 21:59:35 +0000 (21:59 +0000)]
Add variant of root_mount_hold() without allocation.

It allows to use this KPI in non-sleepable contexts.

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

4 years agoMerge commit a751f557d from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:36:46 +0000 (20:36 +0000)]
Merge commit a751f557d from llvm git (by Simon Atanasyan):

  [mips] Set macros for Octeon+ CPU

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoMerge commit 0d14656b9 from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:35:53 +0000 (20:35 +0000)]
Merge commit 0d14656b9 from llvm git (by Simon Atanasyan):

  [mips] Set __OCTEON__ macros

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoMerge commit e578d0fd2 from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:32:34 +0000 (20:32 +0000)]
Merge commit e578d0fd2 from llvm git (by Simon Atanasyan):

  [mips] Fix `__mips_isa_rev` macros value for Octeon CPU

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoMerge commit 3552d3e0f from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:26:34 +0000 (20:26 +0000)]
Merge commit 3552d3e0f from llvm git (by Simon Atanasyan):

  [mips] Add `octeon+` to the list of CPUs accepted by the driver

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoMerge commit bf996f761 from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:25:12 +0000 (20:25 +0000)]
Merge commit bf996f761 from llvm git (by Simon Atanasyan):

  [mips] Write `AFL_EXT_OCTEONP` flag to the `.MIPS.abiflags` section

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

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoMerge commit 3718102d4 from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:23:35 +0000 (20:23 +0000)]
Merge commit 3718102d4 from llvm git (by Simon Atanasyan):

  [mips] Support `octeon+` CPU in the `.set arch=` directive

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

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoMerge commit 7bed381ea from llvm git (by Simon Atanasyan):
dim [Thu, 21 Nov 2019 20:22:07 +0000 (20:22 +0000)]
Merge commit 7bed381ea from llvm git (by Simon Atanasyan):

  [mips] Implement Octeon+ `saa` and `saad` instructions

  `saa` and `saad` are 32-bit and 64-bit store atomic add instructions.

     memory[base] = memory[base] + rt

  These instructions are available for "Octeon+" CPU. The patch adds
  support for both instructions to MIPS assembler and diassembler and
  introduces new CPU type - "octeon+".

  Next patches will implement `.set arch=octeon+` directive and
  `AFL_EXT_OCTEONP` ISA extension flag support.

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

This is one of the upstream changes needed for adding support for the
OCTEON+ CPU type, so that we can test Clang builds using the most
commonly available FreeBSD/mips64 reference platform, the Edge Router
Lite.

Requested by: kevans
MFC after: 1 month
X-MFC-With: r353358

4 years agoChase r344883. ntp is 4.2.8p13.
cy [Thu, 21 Nov 2019 20:15:22 +0000 (20:15 +0000)]
Chase r344883. ntp is 4.2.8p13.

MFC after: 3 days

4 years agobitstring: add functions to find contiguous set/unset bit sequences
erj [Thu, 21 Nov 2019 19:57:56 +0000 (19:57 +0000)]
bitstring: add functions to find contiguous set/unset bit sequences

Add bit_ffs_area_at and bit_ffc_area_at functions for searching a bit
string for a sequence of contiguous set or unset bits of at least the
specified size.

The bit_ffc_area function will be used by the Intel ice driver for
implementing resource assignment logic using a bitstring to represent
whether or not a given index has been assigned or is currently free.

The bit_ffs_area, bit_ffc_area_at and bit_ffs_area_at functions are
implemented for completeness.

I'd like to add further test cases for the new functions, but I'm not
really sure how to add them easily. The new functions depend on specific
sequences of bits being set, while the bitstring tests appear to run for
varying bit sizes.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: asomers@, erj@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D22400

4 years agoInstall bsd.sysdir.mk.
imp [Thu, 21 Nov 2019 19:54:10 +0000 (19:54 +0000)]
Install bsd.sysdir.mk.

Submitted by: Jung-uk Kim

4 years agobitstring: exit early if _start is past size of the bitstring
erj [Thu, 21 Nov 2019 19:36:11 +0000 (19:36 +0000)]
bitstring: exit early if _start is past size of the bitstring

bit_ffs_at and bit_ffc_at both take _start parameters which indicate to
start searching from _start onwards.

If the given _start index is past the size of the bit string, these
functions will calculate an address of the current bitstring which is
after the expected size. The function will also dereference the memory,
resulting in a read buffer overflow.

The output of the function remains correct, because the tests ensure to
stop the loop if the current bitstring chunk passes the stop bitstring
chunk, and because of a check to ensure the reported _value is never
past _nbits.

However, if <sys/bitstring.h> is ever used in code which is checked by
-fsanitize=undefined, or similar static analysis, it can produce
warnings about reading past the buffer size.

Because of the above mentioned checks, these buffer overflows do not
occur as long as _start is less than _nbits. Additionally, by definition
bit_ffs_at and bif_ffc_at should set _result to -1 in any case where the
_start is after the _nbits.

Check for this case at the start of the function and exit early if so,
preventing the buffer read overflow, and reducing the amount of
computation that occurs.

Note that it may seem odd to ever have code that could call bit_ffc_at
or bit_ffs_at with a _start value greater than _nbits. However, consider
a for-loop that used bit_ffs and bit_ffs_at to loop over a bit string
and perform some operation on each bit that was set. If the last bit of
the bit string was set, the simplest loop implementation would call
bit_ffs_at with a start of _nbits, and expect that to return -1. While
it does infact perform correctly, this is what ultimately triggers the
unexpected buffer read overflow.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: asomers@, erj@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D22398

4 years agoNIC KTLS for Chelsio T6 adapters.
jhb [Thu, 21 Nov 2019 19:30:31 +0000 (19:30 +0000)]
NIC KTLS for Chelsio T6 adapters.

This adds support for ifnet (NIC) KTLS using Chelsio T6 adapters.
Unlike the TOE-based KTLS in r353328, NIC TLS works with non-TOE
connections.

NIC KTLS on T6 is not able to use the normal TSO (LSO) path to segment
the encrypted TLS frames output by the crypto engine.  Instead, the
TOE is placed into a special setup to permit "dummy" connections to be
associated with regular sockets using KTLS.  This permits using the
TOE to segment the encrypted TLS records.  However, this approach does
have some limitations:

1) Regular TOE sockets cannot be used when the TOE is in this special
   mode.  One can use either TOE and TOE-based KTLS or NIC KTLS, but
   not both at the same time.

2) In NIC KTLS mode, the TOE is only able to accept a per-connection
   timestamp offset that varies in the upper 4 bits.  Put another way,
   only connections whose timestamp offset has the 28 lower bits
   cleared can use NIC KTLS and generate correct timestamps.  The
   driver will refuse to enable NIC KTLS on connections with a
   timestamp offset with any of the lower 28 bits set.  To use NIC
   KTLS, users can either disable TCP timestamps by setting the
   net.inet.tcp.rfc1323 sysctl to 0, or apply a local patch to the
   tcp_new_ts_offset() function to clear the lower 28 bits of the
   generated offset.

3) Because the TCP segmentation relies on fields mirrored in a TCB in
   the TOE, not all fields in a TCP packet can be sent in the TCP
   segments generated from a TLS record.  Specifically, for packets
   containing TCP options other than timestamps, the driver will
   inject an "empty" TCP packet holding the requested options (e.g. a
   SACK scoreboard) along with the segments from the TLS record.
   These empty TCP packets are counted by the
   dev.cc.N.txq.M.kern_tls_options sysctls.

Unlike TOE TLS which is able to buffer encrypted TLS records in
on-card memory to handle retransmits, NIC KTLS must re-encrypt TLS
records for retransmit requests as well as non-retransmit requests
that do not include the start of a TLS record but do include the
trailer.  The T6 NIC KTLS code tries to optimize some of the cases for
requests to transmit partial TLS records.  In particular it attempts
to minimize sending "waste" bytes that have to be given as input to
the crypto engine but are not needed on the wire to satisfy mbufs sent
from the TCP stack down to the driver.

TCP packets for TLS requests are broken down into the following
classes (with associated counters):

- Mbufs that send an entire TLS record in full do not have any waste
  bytes (dev.cc.N.txq.M.kern_tls_full).

- Mbufs that send a short TLS record that ends before the end of the
  trailer (dev.cc.N.txq.M.kern_tls_short).  For sockets using AES-CBC,
  the encryption must always start at the beginning, so if the mbuf
  starts at an offset into the TLS record, the offset bytes will be
  "waste" bytes.  For sockets using AES-GCM, the encryption can start
  at the 16 byte block before the starting offset capping the waste at
  15 bytes.

- Mbufs that send a partial TLS record that has a non-zero starting
  offset but ends at the end of the trailer
  (dev.cc.N.txq.M.kern_tls_partial).  In order to compute the
  authentication hash stored in the trailer, the entire TLS record
  must be sent as input to the crypto engine, so the bytes before the
  offset are always "waste" bytes.

In addition, other per-txq sysctls are provided:

- dev.cc.N.txq.M.kern_tls_cbc: Count of sockets sent via this txq
  using AES-CBC.

- dev.cc.N.txq.M.kern_tls_gcm: Count of sockets sent via this txq
  using AES-GCM.

- dev.cc.N.txq.M.kern_tls_fin: Count of empty FIN-only packets sent to
  compensate for the TOE engine not being able to set FIN on the last
  segment of a TLS record if the TLS record mbuf had FIN set.

- dev.cc.N.txq.M.kern_tls_records: Count of TLS records sent via this
  txq including full, short, and partial records.

- dev.cc.N.txq.M.kern_tls_octets: Count of non-waste bytes (TLS header
  and payload) sent for TLS record requests.

- dev.cc.N.txq.M.kern_tls_waste: Count of waste bytes sent for TLS
  record requests.

To enable NIC KTLS with T6, set the following tunables prior to
loading the cxgbe(4) driver:

hw.cxgbe.config_file=kern_tls
hw.cxgbe.kern_tls=1

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

4 years agoRewrite iicdev_writeto() to use a single buffer and a single iic_msg, rather
ian [Thu, 21 Nov 2019 19:13:05 +0000 (19:13 +0000)]
Rewrite iicdev_writeto() to use a single buffer and a single iic_msg, rather
than effectively doing scatter/gather IO with a pair of iic_msgs that direct
the controller to do a single transfer with no bus STOP/START between the
two buffers.  It turns out we have multiple i2c hardware drivers that don't
honor the NOSTOP and NOSTART flags; sometimes they just try to do the
transfers anyway, creating confusing failures or leading to corrupted data.

4 years agoRemove two obsolete comments that reference splhigh/splx.
imp [Thu, 21 Nov 2019 18:49:54 +0000 (18:49 +0000)]
Remove two obsolete comments that reference splhigh/splx.

4 years agoUse kmod.opts.mk to fix standalone build.
jhb [Thu, 21 Nov 2019 18:21:30 +0000 (18:21 +0000)]
Use kmod.opts.mk to fix standalone build.

4 years agoAdd a kmod.opts.mk.
jhb [Thu, 21 Nov 2019 18:14:26 +0000 (18:14 +0000)]
Add a kmod.opts.mk.

This Makefile sets KERN_OPTS.  This permits kernel module Makefiles to
use KERN_OPTS to control the value of variables such as SRCS that are
used by bsd.kmod.mk for KERN_OPTS values that honor WITH/WITHOUT
options for standalone builds.

4 years agoAdd USB ID for Diamond Multimedia BVU195 Display Link device.
hselasky [Thu, 21 Nov 2019 16:42:25 +0000 (16:42 +0000)]
Add USB ID for Diamond Multimedia BVU195 Display Link device.

Submitted by: darius@dons.net.au
PR: 242128
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoIntroduce bsd.sysdir.mk to consolidate looking for the kernel.
imp [Thu, 21 Nov 2019 15:59:33 +0000 (15:59 +0000)]
Introduce bsd.sysdir.mk to consolidate looking for the kernel.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D22144

4 years agobsdinstall.8: Fix description of DISTRIBUTIONS environment variable
0mp [Thu, 21 Nov 2019 15:54:56 +0000 (15:54 +0000)]
bsdinstall.8: Fix description of DISTRIBUTIONS environment variable

Reviewed by: bcr
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22478

4 years agoObsoleteFiles.inc: add sio(4) leftovers
zeising [Thu, 21 Nov 2019 15:38:27 +0000 (15:38 +0000)]
ObsoleteFiles.inc: add sio(4) leftovers

Add the manual page for sio(4) to ObsoleteFiles.inc, so that make delete-all
will remove it.  The manual page was removed together with sio(4) in
r354929.

Approved by: emaste
Differential Revision: https://reviews.freebsd.org/D22477

4 years agoarch.7: document only FreeBSD 11.0 and later
emaste [Thu, 21 Nov 2019 14:23:16 +0000 (14:23 +0000)]
arch.7: document only FreeBSD 11.0 and later

FreeBSD 11 is the earliest supported version and there is no longer a
need to include information about differences present in earlier
releases.

4 years agobcm2835_sdhci: only inspect interrupts we handle
kevans [Thu, 21 Nov 2019 14:01:44 +0000 (14:01 +0000)]
bcm2835_sdhci: only inspect interrupts we handle

We'll write the value we read back to ack pending interrupts, but we should
at least make it clear to ourselves that we only want to ack pending
transfer interrupts.

4 years agoDisable KCSAN within a panic.
andrew [Thu, 21 Nov 2019 13:59:01 +0000 (13:59 +0000)]
Disable KCSAN within a panic.

The kernel is single threaded at this point and the panic is more
important.

Sponsored by: DARPA, AFRL

4 years agorevert contrib/amd changes accidentally committed with r354950
emaste [Thu, 21 Nov 2019 13:57:30 +0000 (13:57 +0000)]
revert contrib/amd changes accidentally committed with r354950

4 years agorevert r354935 and apply fix for cleandir failure
emaste [Thu, 21 Nov 2019 13:56:16 +0000 (13:56 +0000)]
revert r354935 and apply fix for cleandir failure

This reapplies the RISC-V GNU ld workaround from r354896, r354899, and
354900, along with a fix for the build failure during cleandir.

LINKER_TYPE was not being set during cleandir, resulting in
Malformed conditional (${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv")
from Cirrus-CI.

PR: 242109
Sponsored by: The FreeBSD Foundation

4 years agoMFV r354383: 10592 misc. metaslab and vdev related ZoL bug fixes
avg [Thu, 21 Nov 2019 13:35:43 +0000 (13:35 +0000)]
MFV r354383: 10592 misc. metaslab and vdev related ZoL bug fixes

illumos/illumos-gate@555d674d5d4b8191dc83723188349d28278b2431
https://github.com/illumos/illumos-gate/commit/555d674d5d4b8191dc83723188349d28278b2431

https://www.illumos.org/issues/10592
  This is a collection of recent fixes from ZoL:
  8eef997679b Error path in metaslab_load_impl() forgets to drop ms_sync_lock
  928e8ad47d3 Introduce auxiliary metaslab histograms
  425d3237ee8 Get rid of space_map_update() for ms_synced_length
  6c926f426a2 Simplify log vdev removal code
  21e7cf5da89 zdb -L should skip leak detection altogether
  df72b8bebe0 Rename range_tree_verify to range_tree_verify_not_present
  75058f33034 Remove unused vdev_t fields

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>
MFC after: 4 weeks

4 years agoAdd kcsan_md_unsupported from NetBSD.
andrew [Thu, 21 Nov 2019 13:22:23 +0000 (13:22 +0000)]
Add kcsan_md_unsupported from NetBSD.

It's used to ignore virtual addresses that may have a different physical
address depending on the CPU.

Sponsored by: DARPA, AFRL

4 years agoFix the bus_space functions with KCSAN on arm64.
andrew [Thu, 21 Nov 2019 13:12:58 +0000 (13:12 +0000)]
Fix the bus_space functions with KCSAN on arm64.

Arm64 doesn't define the bus_space_set_multi_stream and
bus_space_set_region_stream functions. Don't try to define them there.

Sponsored by: DARPA, AFRL