]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agotail: style nits
oshogbo [Sun, 9 Jun 2019 11:21:29 +0000 (11:21 +0000)]
tail: style nits

5 years agoCorrect a new KASSERT() in r348828.
alc [Sun, 9 Jun 2019 05:55:58 +0000 (05:55 +0000)]
Correct a new KASSERT() in r348828.

X-MFC with: r348828

5 years agoImplement an alternative solution to the amd64 and i386 pmap problem that we
alc [Sun, 9 Jun 2019 03:36:10 +0000 (03:36 +0000)]
Implement an alternative solution to the amd64 and i386 pmap problem that we
previously addressed in r348246.

This pmap problem also exists on arm64 and riscv.  However, the original
solution developed for amd64 and i386 cannot be used on arm64 and riscv.  In
particular, arm64 and riscv do not define a PG_PROMOTED flag in their level
2 PTEs.  (A PG_PROMOTED flag makes no sense on arm64, where unlike x86 or
riscv we are required to break the old 4KB mappings before making the 2MB
mapping; and on riscv there are no unused bits in the PTE to define a
PG_PROMOTED flag.)

This commit implements an alternative solution that can be used on all four
architectures.  Moreover, this solution has two other advantages.  First, on
older AMD processors that required the Erratum 383 workaround, it is less
costly.  Specifically, it avoids unnecessary calls to pmap_fill_ptp() on a
superpage demotion.  Second, it enables the elimination of some calls to
pagezero() in pmap_kernel_remove_{l2,pde}().

In addition, remove a related stale comment from pmap_enter_{l2,pde}().

Reviewed by: kib, markj (an earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20538

5 years agoFix uninitialized variable in camdd
chuck [Sun, 9 Jun 2019 02:06:31 +0000 (02:06 +0000)]
Fix uninitialized variable in camdd

gcc  builds were failing because of this uninitialized warning.

Reported by: bz, imp
Approved by: imp (mentor)
Discussed with: ken
Pointy hat: chuck

5 years agopsm(4): Add extra sanity checks to Elantech trackpoint packet parser.
wulf [Sat, 8 Jun 2019 21:36:22 +0000 (21:36 +0000)]
psm(4): Add extra sanity checks to Elantech trackpoint packet parser.

Add strict checks for unused bit states in Elantech trackpoint packet
parser to filter out spurious events produces by some hardware which
are detected as trackpoint packets. See comment on r328191 for example.

Tested by: Andrey Kosachenko <andrey.kosachenko@gmail.com>

5 years agopsm(4): Fix Elantech trackpoint support.
wulf [Sat, 8 Jun 2019 21:33:34 +0000 (21:33 +0000)]
psm(4): Fix Elantech trackpoint support.

Sign bits for X and Y motion data were taken from wrong places.

PR: 238291
Reported by: Andrey Kosachenko <andrey.kosachenko@gmail.com>
Tested by: Andrey Kosachenko <andrey.kosachenko@gmail.com>
MFC after: 2 weeks

5 years agoStyle MAP_ENTRY_ and MAP_ definitions.
kib [Sat, 8 Jun 2019 20:28:04 +0000 (20:28 +0000)]
Style MAP_ENTRY_ and MAP_ definitions.

Spell all bits in the hex constants.
Since all lines are modified, consistently use <tab> after #define.

Reviewed by: alc (previous version), dougm
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D20560

5 years agoCorrect definition for PGEX_SGX.
kib [Sat, 8 Jun 2019 20:26:04 +0000 (20:26 +0000)]
Correct definition for PGEX_SGX.

At the moment it is only used for page fault error code textual
representation.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoAdd stuff to disable warning for %S
imp [Sat, 8 Jun 2019 19:58:58 +0000 (19:58 +0000)]
Add stuff to disable warning for %S

Add the customary warnings to disable format checking on armv7. Code
move to new files, and the unconditional setting of WARNS to 6
provoked it on tinerbox...

5 years agoMake trap_msg array constant as well.
kib [Sat, 8 Jun 2019 19:50:57 +0000 (19:50 +0000)]
Make trap_msg array constant as well.

Suggested by: tijl
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoCreate gptboot.efi
imp [Sat, 8 Jun 2019 19:02:17 +0000 (19:02 +0000)]
Create gptboot.efi

This is a primary boot loader that is intended to implement the
gptboot partition selection algorithm just like we did for BIOS
booting. While the preferred method for UEFI is to use the UEFI Boot
Manager protocol, there are situations where that can't be done: some
BIOS makers interfere with the protocol in unhelpful ways, there's a
new standard for a zero variable write from the client OS, and finally
for USB drives that might be mobile between systems with multiple
partitions there needs to be a media stable way to select.

Reviewed by: tsoome, bcran
Differential Revision: https://reviews.freebsd.org/D20547

5 years agoBreak out the disk selection protocol from the rest of boot1.
imp [Sat, 8 Jun 2019 18:59:50 +0000 (18:59 +0000)]
Break out the disk selection protocol from the rest of boot1.

Segregate the disk probing and selection protocol from the rest of the
boot loader.

Reviewed by: tsoome, bcran
Differential Revision: https://reviews.freebsd.org/D20547

5 years agoCurrently, MCA entries remain on an every-growing linked list. This means
jtl [Sat, 8 Jun 2019 18:26:48 +0000 (18:26 +0000)]
Currently, MCA entries remain on an every-growing linked list. This means
that it becomes increasingly expensive to process a steady stream of
correctable errors. Additionally, the memory used by the MCA entries can
grow without bound.

Change the code to maintain two separate lists: a list of entries which
still need to be logged, and a list of entries which have already been
logged. Additionally, allow a user-configurable limit on the number of
entries which will be saved after they are logged. (The limit defaults
to -1 [unlimited], which is the current behavior.)

Reviewed by: imp, jhb
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20482

5 years agoSimple code refactoring originally in D13484.
dougm [Sat, 8 Jun 2019 17:49:17 +0000 (17:49 +0000)]
Simple code refactoring originally in D13484.

Extract swp_pager_force_dirty() and swp_pager_force_launder() out of
swp_pager_force_pagein().

Extract swap_pager_swapoff_object() out of swap_pager_swapoff().

Submitted by: ota_j.email.ne.jp
Reviewed by: alc, dougm
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20545

5 years agoFix dpcpu and vnet panics with complex types at the end of the section.
bz [Sat, 8 Jun 2019 17:44:42 +0000 (17:44 +0000)]
Fix dpcpu and vnet panics with complex types at the end of the section.

Apply a linker script when linking i386 kernel modules to apply padding
to a set_pcpu or set_vnet section.  The padding value is kind-of random
and is used to catch modules not compiled with the linker-script, so
possibly still having problems leading to kernel panics.

This is needed as the code generated on certain architectures for
non-simple-types, e.g., an array can generate an absolute relocation
on the edge (just outside) the section and thus will not be properly
relocated. Adding the padding to the end of the section will ensure
that even absolute relocations of complex types will be inside the
section, if they are the last object in there and hence relocation will
work properly and avoid panics such as observed with carp.ko or ipsec.ko.

There is a rather lengthy discussion of various options to apply in
the mentioned PRs and their depends/blocks, and the review.
There seems no best solution working across multiple toolchains and
multiple version of them, so I took the liberty of taking one,
as currently our users (and our CI system) are hitting this on
just i386 and we need some solution.  I wish we would have a proper
fix rather than another "hack".

Also backout r340009 which manually, temporarily fixed CARP before 12.0-R
"by chance" after a lead-up of various other link-elf.c and related fixes.

PR: 230857,238012
With suggestions from: arichardson (originally last year)
Tested by: lwhsu
Event: Waterloo Hackathon 2019
Reported by: lwhsu, olivier
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D17512

5 years agoRemove extra stray + from a diff from the beginning of the lines after
bz [Sat, 8 Jun 2019 17:38:27 +0000 (17:38 +0000)]
Remove extra stray + from a diff from the beginning of the lines after
r348805 to fix the build.  Please do not ask how 3 more local builds
succeeded without barfing.

Pointyhat to: bz
MFC after: 6 weeks
X-MFC with: r348805

5 years agoAdd NVMe support to camdd(8)
chuck [Sat, 8 Jun 2019 17:17:17 +0000 (17:17 +0000)]
Add NVMe support to camdd(8)

Reviewed by: ken
Approved by: ken (mentor)
MFC after: 1 week
Differential Review: https://reviews.freebsd.org/D12141

5 years agoAdd SDIO support.
bz [Sat, 8 Jun 2019 16:26:56 +0000 (16:26 +0000)]
Add SDIO support.

Add a CAM-Newbus SDIO support module.  This works provides a newbus
infrastructure for device drivers wanting to use SDIO.  On the lower end
while it is connected by newbus to SDHCI, it talks CAM using the MMCCAM
framework to get to it.

This also duplicates the usbdevs framework to equally create sdiodev
header files with #defines for "vendors" and "products".

Submitted by: kibab (initial work, see https://reviews.freebsd.org/D12467)
Reviewed by: kibab, imp (comments on earlier version)
MFC after: 6 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19749

5 years agobcm2835_sdhci.c: exit DMA if not enough data left to avoid timeout errors
bz [Sat, 8 Jun 2019 16:15:00 +0000 (16:15 +0000)]
bcm2835_sdhci.c: exit DMA if not enough data left to avoid timeout errors

In the DMA case, given we disable the data interrupts, we never seem
to get DATA_END.  Given we are relying on DMA interrupts we are not
using the SDHCI state machine and hence only call into
sdhci_platform_will_handle() for the first check of data.
We do not call "will handle" for any following round trips of the same
transaction if block size * count > BCM_DMA_BLOCK_SIZE.
Manually check "left" in the DMA interrupt handler to see if we have at
least another full BCM_DMA_BLOCK_SIZE to handle.
Without this change we would DMA that and then even start a DMA with
left == 0 which would lead to a timeout and error.
Now we re-enable data interrupts and return and let the SDHCI generic
interrupt handler and state machine pick the SPACE_AVAIL up and then
find that it should punt to the pio_handler for the remaining bytes
or finish the data transaction.

With this change block mode seems to work beyond 7 * 64byte blocks,
which worked as it was below BCM_DMA_BLOCK_SIZE.

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

5 years agobcm2835_sdhci.c: save block registers to avoid controller bug
bz [Sat, 8 Jun 2019 16:05:43 +0000 (16:05 +0000)]
bcm2835_sdhci.c: save block registers to avoid controller bug

Extending what the initial revision, r273264, r276985, r277346 have
started for the transfer mode and command registers, another pair of
16bit registers written in sequence are block size and block count,
which fall together onto the same 32bit line and hence the same
register(s) would be written twice in sequence for those as well.

Use a similar approach to transfer mode and command and save the writes
to either of the block regiters and then only execute a write once.
We can do this as with transfer mode their values are meaningless until
a command is issued so we can use that write to command as a trigger
to also write out the block registers.
Compared to transfer mode and command the value of block count can
change, so we need to keep state and actually read the block registers
back the first time after a write.

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

5 years agoRemove lazy FPU switch support from amd64.
kib [Sat, 8 Jun 2019 16:03:34 +0000 (16:03 +0000)]
Remove lazy FPU switch support from amd64.

It is incompatible with some future features.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoImprove sdhci slot_printf() debug printing.
bz [Sat, 8 Jun 2019 15:24:03 +0000 (15:24 +0000)]
Improve sdhci slot_printf() debug printing.

Currently slot_printf() uses two printf() calls to print the
device-slot name, and actual message. When other printf()s are
ongoing in parallel this can lead to interleaved message on the console,
which is especially unhelpful for debugging or error messages.

Take a hit on the stack and vsnprintf() the message to the buffer.
This way it can be printed along with the device-slot name in one go
avoiding console gibberish.

Reviewed by: marius
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19747

5 years agoIntroduce sim_dev and cam_sim_alloc_dev().
bz [Sat, 8 Jun 2019 15:19:50 +0000 (15:19 +0000)]
Introduce sim_dev and cam_sim_alloc_dev().

Add cam_sim_alloc_dev() as a wrapper to cam_sim_alloc() which takes
a device_t instead of the unit_number (which we can derive from the
dev again).

Add device_t sim_dev to struct cam_sim. It will be used to pass through
the bus for cases when both sides of CAM speak newbus already and we want
to link them (yet make the calls through CAM for now).

SDIO will be the first consumer of this. For that make use of
cam_sim_alloc_dev() in sdhci under MMCCAM.

This will also allow people to start iterating more on the idea
to newbus-ify CAM without changing 50+ device drivers from the start.
Also to be clear there are callers to cam_sim_alloc() which do not
have a device_t (e.g., XPT) or provide their own unit number so we cannot
simply switch the KPI entirely.

Submitted by: kibab (original idea, see https://reviews.freebsd.org/D12467)
Reviewed by: imp, chuck
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19746

5 years agoi386 trap.c: Remove unused MAX_TRAP_MSG define.
kib [Sat, 8 Jun 2019 13:41:39 +0000 (13:41 +0000)]
i386 trap.c: Remove unused MAX_TRAP_MSG define.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoamd64 trap.c: Modernize syntax around trap_msg[].
kib [Sat, 8 Jun 2019 13:40:57 +0000 (13:40 +0000)]
amd64 trap.c: Modernize syntax around trap_msg[].

Convert the array to use C99 initializers.
Make it constant.
Replace MAX_TRAP_MSG with nitems().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoFix for reading the configuration descriptor in libusb. Catch invalid
hselasky [Sat, 8 Jun 2019 09:34:02 +0000 (09:34 +0000)]
Fix for reading the configuration descriptor in libusb. Catch invalid
configuration descriptor reads early on to avoid issues with devices
that don't check for a valid USB configuration read request.

Submitted by: takahiro.kurosawa@gmail.com
PR: 238412
MFC after: 3 days

5 years agovtfontcvt: allow out-of-order glyphs
emaste [Sat, 8 Jun 2019 08:25:43 +0000 (08:25 +0000)]
vtfontcvt: allow out-of-order glyphs

PR: 205707
Reported by: mi
MFC after: 2 weeks
Event: Vienna Hackathon 2019
Sponsored by: The FreeBSD Foundation

5 years agopowerpc/pmap: Move the SLB spill handlers to a better place
jhibbits [Sat, 8 Jun 2019 03:07:08 +0000 (03:07 +0000)]
powerpc/pmap: Move the SLB spill handlers to a better place

The SLB spill handlers are AIM-specific, and belong better with the rest of
the SLB code anyway.  No functional change.

5 years agopowerpc/aim: Use nitems() for calculating size of phys_avail in AIM pmaps
jhibbits [Sat, 8 Jun 2019 02:36:07 +0000 (02:36 +0000)]
powerpc/aim: Use nitems() for calculating size of phys_avail in AIM pmaps

Same thing was already done in r347164 for Book-E pmap.

5 years agoFix debug trace after removal of pdu_overhead.
jhb [Fri, 7 Jun 2019 21:30:11 +0000 (21:30 +0000)]
Fix debug trace after removal of pdu_overhead.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoFix comparison signedness in arc_is_overflowing().
mav [Fri, 7 Jun 2019 20:59:24 +0000 (20:59 +0000)]
Fix comparison signedness in arc_is_overflowing().

When ARC size is very small, aggsum_lower_bound(&arc_size) may return
negative values, that due to unsigned comparison caused delays, waiting
for arc_adjust() to "fix" it by calling aggsum_value(&arc_size).  Use
of signed comparison there fixes the problem.

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

5 years agoExplicitly start ARC adjustment on limits change.
mav [Fri, 7 Jun 2019 19:03:17 +0000 (19:03 +0000)]
Explicitly start ARC adjustment on limits change.

While formally it is not necessary, but the sooner it start, the sooner it
finish, and supposedly less disturbing for workload it will be.

MFC after: 2 weeks

5 years agoFix nda(4) PCIe link status output
chuck [Fri, 7 Jun 2019 18:34:48 +0000 (18:34 +0000)]
Fix nda(4) PCIe link status output

Differentiate between PCI Express Endpoint devices and Root Complex
Integrated Endpoints in the nda driver. The Link Status and Capability
registers are not valid for Integrated Endpoints and should not be
displayed. The bhyve emulated NVMe device will advertise as being an
Integrated Endpoint.

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

5 years agoReplace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m).
markj [Fri, 7 Jun 2019 18:23:29 +0000 (18:23 +0000)]
Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m).

These calls are not the same in general: the former will dequeue the
page if it is enqueued, while the latter will just leave it alone.  But,
all existing uses of the former apply to unmanaged pages, which are
never enqueued in the first place.  No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20470

5 years ago[PPC64] Support QEMU/KVM pseries without hugepages
luporl [Fri, 7 Jun 2019 17:58:59 +0000 (17:58 +0000)]
[PPC64] Support QEMU/KVM pseries without hugepages

This set of changes make it possible to run FreeBSD for PowerPC64/pseries,
under QEMU/KVM, without requiring the host to make hugepages available to the
guest.

While there was already this possibility, by means of setting hw_direct_map to
0, on PowerPC64 there were a couple of issues/wrong assumptions that prevented
this from working, before this changelist.

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

5 years agovmrun: Add a missing close-paren to the usage message.
markj [Fri, 7 Jun 2019 17:54:26 +0000 (17:54 +0000)]
vmrun: Add a missing close-paren to the usage message.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agobhyve: Add PCIe Integrated Endpoint capability
chuck [Fri, 7 Jun 2019 17:09:49 +0000 (17:09 +0000)]
bhyve: Add PCIe Integrated Endpoint capability

The NVMe CAM driver reports the PCIe Link Capability and Status for
devices. For emulated bhyve NVMe devices, this looks like:

nda0: nvme version 1.3 x63 (max x63) lanes PCIe Gen15 (max Gen15) link

The driver outputs this because the emulated device doesn't include the
PCIe Capability structure. The NVMe specification requires these
registers, so the fix is to add this set of capability registers to the
emulated device.

Note that PCI Express devices that are integrated into the Root Complex
(i.e. Bus 0x0) do not have to support the Link Capability or Status
registers. Windows will fail to start (i.e. Code 10) devices that appear
to be part of the Root Complex but report being a PCI Express Endpoint.
So also add a check to pci_emul_add_pciecap() to check if the device is
integrated and change the device type.

Reviewed by: imp, ken, araujo, jhb, rgrimes
Approved by: imp (mentor), ken (mentor), jhb (maintainer)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19904

5 years agoKeep the shadow PCIR_COMMAND synced with the real one for pass through.
jhb [Fri, 7 Jun 2019 15:53:27 +0000 (15:53 +0000)]
Keep the shadow PCIR_COMMAND synced with the real one for pass through.

This ensures that bhyve properly recognizes when decoding is disabled
for BARs on passthru devices.  To properly handle writes to the
register, export a pci_emul_cmd_changed function from pci_emul.c that
the pass through device model invokes for config writes that change
PCIR_COMMAND.

Reviewed by: rgrimes
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20531

5 years agoEnable memory and I/O decoding in PCI devices on demand.
jhb [Fri, 7 Jun 2019 15:48:12 +0000 (15:48 +0000)]
Enable memory and I/O decoding in PCI devices on demand.

Rather than uncoditionally setting the MEMEN and PORTEN bits in
PCIR_COMMAND for PCI devices, set the respective bit when the first
BAR of a given type is added to the device.  This more closely matches
what firmware does on bare metal.

BUSMASTEREN is still set unconditionally.  Eventually this bit should
move into the device models as not all device models need this set.

Reviewed by: rgrimes
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20530

5 years agoAdd a basic clang-format configuration file
arichardson [Fri, 7 Jun 2019 15:23:52 +0000 (15:23 +0000)]
Add a basic clang-format configuration file

This gets reasonably close to the existing format in sys/kern but will
probably require some changes to upstream clang-format before it can be
used as the default formatting tool.

I tried formatting a few files in sys/kern and the result is pretty close to
the existing code. However, this configuration file is not ready to be used
without manually checking the output.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D20533

5 years agoTeach readelf about some OpenBSD ELF program headers
csjp [Fri, 7 Jun 2019 14:51:55 +0000 (14:51 +0000)]
Teach readelf about some OpenBSD ELF program headers

- Add constants for OpenBSD wxneeded, bootdata and randomize to the
  FreeBSD elf_common.h file. This is the file that gets used by the
  elftoolchain library.
- Update readelf and elfdump utilities to decode these program headers
  if they are encountered.

Note: FreeBSD has it's own version of elfdump(1), which will be updated
in a subsequent commit. I am adding it here anyway because this diff is
going to be submitted upstream.

Discussed with: emaste
Reviewed by: imp
MFC afer: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20548

M    contrib/elftoolchain/elfdump/elfdump.c
M    contrib/elftoolchain/readelf/readelf.c
M    sys/sys/elf_common.h

5 years agoUse underscores for internal variable name to avoid conflicts.
ae [Fri, 7 Jun 2019 08:30:35 +0000 (08:30 +0000)]
Use underscores for internal variable name to avoid conflicts.

MFC after: 1 week

5 years agoRestore ARC MFU/MRU pressure
avg [Fri, 7 Jun 2019 06:35:42 +0000 (06:35 +0000)]
Restore ARC MFU/MRU pressure

Before r305323 (MFV r302991: 6950 ARC should cache compressed data)
arc_read() code did this for access to a ghost buffer:
 arc_adapt() (from arc_get_data_buf())
 arc_access(hdr, hash_lock)
I.e., we first checked access to the MFU ghost/MRU ghost buffer and
adapt MFU/MRU sizes (in arc_adapt()) and next move buffer from the ghost
state to regular.

After r305323 the sequence is different:
 arc_access(hdr, hash_lock);
 arc_hdr_alloc_pabd(hdr);
I.e., we first move the buffer from the ghost state in arc_access() and
then we check access to buffer in ghost state (in arc_hdr_alloc_pabd()
-> arc_get_data_abd() -> arc_get_data_impl() -> arc_adapt()).  This is
incorrect: arc_adapt() never see access to the ghost buffer because
arc_access() already migrated the buffer from the ghost state to
regular.

So, the fix is to restore a call to arc_adapt() before arc_access() and
to suppress the call to arc_adapt() after arc_access().

Submitted by: Slawa Olhovchenkov <slw@zxy.spb.ru>
MFC after: 2 weeks
Sponsored by: Integros [integros.com]
Differential Revision: https://reviews.freebsd.org/D19094

5 years agocxgbe(4): Rename the DDP sysctl to rx_zcopy to match the tx_zcopy sysctl
np [Fri, 7 Jun 2019 05:03:03 +0000 (05:03 +0000)]
cxgbe(4): Rename the DDP sysctl to rx_zcopy to match the tx_zcopy sysctl
and update its description.  The old name continues to work for now.

Sponsored by: Chelsio Communications

5 years agoAllow fail points to have separate declarations, definitions, and evals
rlibby [Fri, 7 Jun 2019 04:09:12 +0000 (04:09 +0000)]
Allow fail points to have separate declarations, definitions, and evals

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20546

5 years agoRework the reporting of the priority.
imp [Fri, 7 Jun 2019 02:05:22 +0000 (02:05 +0000)]
Rework the reporting of the priority.

Simplify the code a bit and rework how we report the results
of the probing.

Reviewed by: tsoome@
Differential Revision: https://reviews.freebsd.org/D20537

5 years agopreen should work independently with alwaysyes and alwaysno.
delphij [Fri, 7 Jun 2019 01:38:51 +0000 (01:38 +0000)]
preen should work independently with alwaysyes and alwaysno.

PR: 238375
MFC after: 2 weeks

5 years agoRemove left-over status variables
imp [Fri, 7 Jun 2019 00:02:02 +0000 (00:02 +0000)]
Remove left-over status variables

5 years agoAllow UMA hash tables to expand faster then 2x in 20 seconds.
mav [Thu, 6 Jun 2019 23:57:28 +0000 (23:57 +0000)]
Allow UMA hash tables to expand faster then 2x in 20 seconds.

ZFS ABD allocates tons of 4KB chunks via UMA, requiring huge hash tables.
With initial hash table size of only 32 elements it takes ~20 expansions
or ~400 seconds to adapt to handling 220GB ZFS ARC.  During that time not
only the hash table is highly inefficient, but also each of those expan-
sions takes significant time with the lock held, blocking operation.

On my test system with 256GB of RAM and ZFS pool of 28 HDDs this change
reduces time needed to first time read 240GB from ~300-400s, during which
system is quite busy and unresponsive, to only ~150s with light CPU load
and just 5 sub-second CPU spikes to expand the hash table.

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

5 years agoFix when NOFAT is defined
imp [Thu, 6 Jun 2019 22:56:55 +0000 (22:56 +0000)]
Fix when NOFAT is defined

We need to add the *efi file to the list of things that get built,
even if we're not creating the efifat stuff.

5 years agoDo not overwrite the RGMII bits in the CPU port register of Switch.
loos [Thu, 6 Jun 2019 21:25:46 +0000 (21:25 +0000)]
Do not overwrite the RGMII bits in the CPU port register of Switch.

Fixes the network on Espressobin.

The GENERIC kernel now boots over NFS.

Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoMove llvm-ranlib to appropriate location in OptionalObsoleteFiles.inc.
jkim [Thu, 6 Jun 2019 21:24:40 +0000 (21:24 +0000)]
Move llvm-ranlib to appropriate location in OptionalObsoleteFiles.inc.

Note llvm-ar is linked to llvm-ranlib since r311565.  r348677 fixed
"make delete-old" issue with llvm-ar but missed it somehow.

Discussed with: emaste, jhb

5 years agoUse simple malloc/free instead of dropping down to the UEFI
imp [Thu, 6 Jun 2019 21:04:37 +0000 (21:04 +0000)]
Use simple malloc/free instead of dropping down to the UEFI
BootServices AllocatePool/FreePool calls. They are simpler to use and
result in the same thing happening.

Reviewed by: tsoome@
Differential Revision: https://reviews.freebsd.org/D20540

5 years agoZero the GPIO regulator pins memory.
loos [Thu, 6 Jun 2019 20:54:09 +0000 (20:54 +0000)]
Zero the GPIO regulator pins memory.

This fixes a panic in Espressobin when gpioregulator fails to allocate the
GPIO pin (the GPIO controller is not there).

Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agonvdimm: Provide nvdimm location information
scottph [Thu, 6 Jun 2019 20:12:04 +0000 (20:12 +0000)]
nvdimm: Provide nvdimm location information

Provide the acpi handle path as the location string for the nvdimm
children of the nvdimm_root device.

Reviewed by: kib
Approved by: jhb (mentor)
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20528

5 years agoRestore the comment removed in r348745.
markj [Thu, 6 Jun 2019 17:20:35 +0000 (17:20 +0000)]
Restore the comment removed in r348745.

LAGG_RLOCK() enters an epoch section, so the comment wasn't stale.

Reported by: jhb
MFC with: r348745

5 years agoThe means of finding ranges of free pages was changed for
dougm [Thu, 6 Jun 2019 16:28:34 +0000 (16:28 +0000)]
The means of finding ranges of free pages was changed for
vm_reserv_break in r348484, and there was found to improve performance
minutely and reduce code size. This change applies a similar change to
vm_reserv_reclaim_config, expecting similar benefits. This change also
allows quick rejection of page ranges that are unsuitable on account
of alignment or boundary issues, where those issues are processed a
page at a time in the current implementation.  For contrived test
cases, this can make finding a reservation satisfying a major
alignment requirement around 30 times faster.

Tested by: pho
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20274

5 years agoloader: disk_open() should honor D_PARTNONE
tsoome [Thu, 6 Jun 2019 16:27:05 +0000 (16:27 +0000)]
loader: disk_open() should honor D_PARTNONE

The D_PARTNONE is documented to make it possible to open raw MBR
partition, but the current disk_open() does not really implement this
statement.

The current code is checking partition against -1 (D_PARTNONE) but does
attempt to open partition table in case we do have FreeBSD MBR partition type.
Instead, we should check -2 (D_PARTWILD).

In case we do have MBR + BSD label, this code is only working because
by default, the first BSD partiton is created starting with relative sector
0, and we can still access the BSD table from that MBR slice.

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

5 years agoAdd sysctls for uma_kmem_{limit,total}.
markj [Thu, 6 Jun 2019 16:26:58 +0000 (16:26 +0000)]
Add sysctls for uma_kmem_{limit,total}.

Reviewed by: alc, dougm, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20514

5 years agoRemove the volatile qualifer from uma_kmem_total.
markj [Thu, 6 Jun 2019 16:23:44 +0000 (16:23 +0000)]
Remove the volatile qualifer from uma_kmem_total.

No functional change intended.

Reviewed by: alc, dougm, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20514

5 years agoConditionalize an in_epoch() call on INVARIANTS.
markj [Thu, 6 Jun 2019 16:22:29 +0000 (16:22 +0000)]
Conditionalize an in_epoch() call on INVARIANTS.

Its result is only used to determine whether to perform further
INVARIANTS-only checks.  Remove a stale comment while here.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

5 years agoMake the linuxkpi's alloc_pages() consistently return wired pages.
markj [Thu, 6 Jun 2019 16:09:19 +0000 (16:09 +0000)]
Make the linuxkpi's alloc_pages() consistently return wired pages.

Previously it did this only on platforms without a direct map.  This
also more closely matches Linux's semantics.

Since some DRM v5.0 code assumes the old behaviour, use a
LINUXKPI_VERSION guard to preserve that until the out-of-tree module
is updated.

Reviewed by: hselasky, kib (earlier versions), johalun
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20502

5 years agoFix a race between fasttrap and the user breakpoint handler.
markj [Thu, 6 Jun 2019 16:03:25 +0000 (16:03 +0000)]
Fix a race between fasttrap and the user breakpoint handler.

When disabling the last enabled userspace probe, fasttrap clears the
function pointers which hook in to the breakpoint handler.  If a traced
thread hit a fasttrap breakpoint before it was removed, we must ensure
that it is able to call the hook; otherwise fasttrap will not consume
the trap and SIGTRAP will be delievered to the thread.  Synchronize
with such threads by ensuring that they load the hook pointer with
interrupts disabled, and by completing an SMP rendezvous after removing
breakpoints and before clearing the pointers.

Reported by: Alexander Alexeev <Alexander.Alexeev@dell.com>
Tested by: Alexander Alexeev (earlier version)
Reviewed by: cem, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20526

5 years agoFor armv6 and armv7, build hwpmc_armv7.c as well as the base hwpmc_arm.c.
ian [Thu, 6 Jun 2019 15:21:36 +0000 (15:21 +0000)]
For armv6 and armv7, build hwpmc_armv7.c as well as the base hwpmc_arm.c.

Submitted by: Arnaud YSMAL <arnaud.ysmal@stormshield.eu>

5 years agoDon't refer to the cpu variable in a KASSERT before initializing it.
ian [Thu, 6 Jun 2019 15:18:23 +0000 (15:18 +0000)]
Don't refer to the cpu variable in a KASSERT before initializing it.

5 years agoAdd a testing facility to manually reclaim a vnode
asomers [Thu, 6 Jun 2019 15:04:50 +0000 (15:04 +0000)]
Add a testing facility to manually reclaim a vnode

Add the debug.try_reclaim_vnode sysctl. When a pathname is written to it, it
will be reclaimed, as long as it isn't already or doomed. The purpose is to
gain test coverage for vnode reclamation, which is otherwise hard to
achieve.

Add the debug.ftry_reclaim_vnode sysctl.  It does the same thing, except
that its argument is a file descriptor instead of a pathname.

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

5 years agoAdd myself (arrowd) to calendar.freebsd.
arrowd [Thu, 6 Jun 2019 08:43:23 +0000 (08:43 +0000)]
Add myself (arrowd) to calendar.freebsd.

Approved by: bapt

5 years agoAdd my birthday to calendar
0mp [Thu, 6 Jun 2019 08:12:49 +0000 (08:12 +0000)]
Add my birthday to calendar

Requested by: mckusick

5 years agor347382 added receiver side DSACK support for the TCP base stack.
tuexen [Thu, 6 Jun 2019 07:49:03 +0000 (07:49 +0000)]
r347382 added receiver side DSACK support for the TCP base stack.
The corresponding changes for the RACK stack where missed and are added
by this commit.

Reviewed by: Richard Scheffenegger, rrs@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D20372

5 years agoDon't make the efifat thing if NOFAT is defined.
imp [Thu, 6 Jun 2019 03:07:10 +0000 (03:07 +0000)]
Don't make the efifat thing if NOFAT is defined.

5 years agoWhitespace adjustment.
cy [Thu, 6 Jun 2019 03:02:25 +0000 (03:02 +0000)]
Whitespace adjustment.

MFC after: 3 days

5 years agozpool.8: the comment property is not read-only
allanjude [Thu, 6 Jun 2019 01:32:00 +0000 (01:32 +0000)]
zpool.8: the comment property is not read-only

The comment property was listed in the man page twice, once under the list
of read-only properties, and again (correctly), under the list of user
editable properties.

PR: 238355
Reported by: Michael Zuo <muh.muhten@gmail.com>
Sponsored by: Klara Systems

5 years agoUse parse_integer to avoid sign extension.
jhb [Wed, 5 Jun 2019 23:37:50 +0000 (23:37 +0000)]
Use parse_integer to avoid sign extension.

Coverity warned about gdb_write_mem sign extending the result of
parse_byte shifted left by 24 bits when generating a 32-bit memory
write value for MMIO.  Simplify the code by using parse_integer
instead of unrolled parse_byte calls.

CID: 1401600
Reviewed by: cem
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D20508

5 years agotail: disable capsicum in rescue mode
oshogbo [Wed, 5 Jun 2019 22:55:00 +0000 (22:55 +0000)]
tail: disable capsicum in rescue mode

All rescue application are not capsicumized.

Reported by: jenkins

5 years agotail: fix style nit introduced in the r348708
oshogbo [Wed, 5 Jun 2019 22:47:37 +0000 (22:47 +0000)]
tail: fix style nit introduced in the r348708

5 years agogeli: build warning fixes
oshogbo [Wed, 5 Jun 2019 22:46:18 +0000 (22:46 +0000)]
geli: build warning fixes

Submitted by: Aaron Prieger <aprieger@llnw.com>
Reviewed by: sbruno
Differential Revision: https://reviews.freebsd.org/D11068

5 years agotail: capsicumize
oshogbo [Wed, 5 Jun 2019 22:40:49 +0000 (22:40 +0000)]
tail: capsicumize

Submitted by: Nik Sultana <sultana@seas.upenn.edu>
Differential Revision: https://reviews.freebsd.org/D20393

5 years agounlink: add missing function to unlink.2 man page
oshogbo [Wed, 5 Jun 2019 22:36:19 +0000 (22:36 +0000)]
unlink: add missing function to unlink.2 man page

5 years agoDTrace: create an amd64 test suit
oshogbo [Wed, 5 Jun 2019 22:32:26 +0000 (22:32 +0000)]
DTrace: create an amd64 test suit

Create two tests checking if we can read urgs registers and if the
rax register returns a correct number.

Reviewed by: markj
Discussed with: lwhsu
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20364

5 years agodtrace: 64-bits registers support
oshogbo [Wed, 5 Jun 2019 22:29:05 +0000 (22:29 +0000)]
dtrace: 64-bits registers support

The registers in ilumos and FreeBSD have a different number.
In the illumos, last 32-bits register defined is SS an in FreeBSD is GS.
This off-by-one caused the uregs array to returns the wrong 64-bits register
on amd64.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20363

5 years agoIn vm_map_entry_set_vnode_text(), tolerate tmpfs mappings for which
kib [Wed, 5 Jun 2019 20:21:17 +0000 (20:21 +0000)]
In vm_map_entry_set_vnode_text(), tolerate tmpfs mappings for which
vnode is no longer resident.

Mapping of tmpfs file does not bump use count on the vnode, because
backing object has swap type.  As result, even during normal
operations, and of course on forced unmount, we might end up with text
mapping from tmpfs node which has no vnode in memory.  In this case,
there is no v_writecount to clear (this was done during reclaim), and
no reason to assert that the vnode is present.

Restructure the code to silently ignore OBJ_SWAP objects with
OBJ_TMPFS_NODE flag set, but OBJ_TMPFS flag clear.

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

5 years agosha.3: clarify admonition against use in NEW signature schemes
allanjude [Wed, 5 Jun 2019 20:18:08 +0000 (20:18 +0000)]
sha.3: clarify admonition against use in NEW signature schemes

Reported by: cem, cperciva (grammar)

5 years agoManually clear text references on reclaim for nullfs and tmpfs.
kib [Wed, 5 Jun 2019 20:16:25 +0000 (20:16 +0000)]
Manually clear text references on reclaim for nullfs and tmpfs.

Both filesystems do no use vnode_pager_dealloc() which would handle
this case otherwise.  Nullfs because vnode vm_object handle never
points to nullfs vnode.  Tmpfs because its vm_object is never vnode
object at all.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years ago[ath] [fix] athani compilation was broken by recent ath change
mizhka [Wed, 5 Jun 2019 19:55:30 +0000 (19:55 +0000)]
[ath] [fix] athani compilation was broken by recent ath change

 * This commit is going to fix build of AR724x on 13-CURRENT with additional
tools like athani. See r344841

5 years agoSupport MSI-X for passthrough devices with a separate PBA BAR.
jhb [Wed, 5 Jun 2019 19:30:32 +0000 (19:30 +0000)]
Support MSI-X for passthrough devices with a separate PBA BAR.

pci_alloc_msix() requires both the table and PBA BARs to be allocated
by the driver.  ppt was only allocating the table BAR so would fail
for devices with the PBA in a separate BAR.  Fix this by allocating
the PBA BAR before pci_alloc_msix() if it is stored in a separate BAR.

While here, release BARs after calling pci_release_msi() instead of
before.  Also, don't call bus_teardown_intr() in error handling code
if bus_setup_intr() has just failed.

Reported by: gallatin
Tested by: gallatin
Reviewed by: rgrimes, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20525

5 years agoDon't simulate PBA access if the PBA is in a separate BAR.
jhb [Wed, 5 Jun 2019 19:29:02 +0000 (19:29 +0000)]
Don't simulate PBA access if the PBA is in a separate BAR.

bhyve has to virtualize the MSI-X table to trap reads and writes to
that table and map those to virtual interrupts that it maps real host
interrupts on to.  For the pending-bit-array (PBA), bhyve passes
accesses from the guest directly to the hardware.

bhyve's virtualization of the MSI-X table is done by intercepting all
reads and writes to the BAR holding the MSI-X table.  However, if the
PBA is stored in the same BAR as the MSI-X table, accesses to the PBA
portion of this BAR have to be forwarded to the real BAR.

However, in the case that the PBA was stored in a separate BAR and
it's offset in that separate BAR overlapped with the portion of the
MSI-X table BAR that the table used, the handlers for the table BAR
would incorrectly think that some accesses were PBA reads and writes.
This caused a crash in bhyve when it indirected a NULL pointer.  Fix
this case by never trying to handle PBA access if the PBA lives in a
separate BAR.

Reported by: gallatin
Tested by: gallatin
Reviewed by: markj, Patrick Mooney
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20523

5 years agoAdd my birthday entry.
pkubaj [Wed, 5 Jun 2019 16:01:05 +0000 (16:01 +0000)]
Add my birthday entry.

5 years agovtfontcvt: exit on error if the input font has too many glyphs
emaste [Wed, 5 Jun 2019 15:23:48 +0000 (15:23 +0000)]
vtfontcvt: exit on error if the input font has too many glyphs

The kernel has a limit of 131072 glyphs in a font; add the same check to
vtfontcvt so that we won't create a font file that the kernel will not
load.

PR: 205707
Submitted by: Dmitry Wagin
MFC after: 2 weeks

5 years agoUse CLANG knob to remove llvm-symbolizer man page
emaste [Wed, 5 Jun 2019 14:08:39 +0000 (14:08 +0000)]
Use CLANG knob to remove llvm-symbolizer man page

r348504 moved llvm-symbolizer from the CLANG_EXTRAS knob to CLANG, but
the man page was still in the CLANG_EXTRAS section in
OptionalObsoleteFiles.inc.

Reported by: jhb
MFC after: 3 days
MFC with: r348504

5 years agofirst step towards enforcing must-succeed semantics for bus accessors
avg [Wed, 5 Jun 2019 13:18:00 +0000 (13:18 +0000)]
first step towards enforcing must-succeed semantics for bus accessors

Unlike BUS_READ_IVAR / BUS_WRITE_IVAR, bus accessors do not have a
return code.  It is assumed that there is a tight coupling between a bus
driver and a driver for a device on the bus with respect to instance
variables that the bus defines for its children.  So, the driver is
supposed to have only valid accesses to the variables and, thus, the
accessors must always succeed.

Of course, programming errors sometimes happen.  At present, such errors
go completely unnoticed.  The idea of this change is to start catching
them.  As a first step, there will be a warning about a failed accessor
call.  This is to give developers a heads-up.  I plan to replace the
printf with a KASSERT a week later, so that the warning is harder to
ignore.

Reviewed by: cem, imp, ian
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20458

5 years agoanother occurrence where a very large dma mapping can cause integer overflow
tychon [Wed, 5 Jun 2019 13:08:21 +0000 (13:08 +0000)]
another occurrence where a very large dma mapping can cause integer overflow

Submitted by: rlibby
Sponsored by: Dell EMC Isilon

5 years agoInitialize V_nat64out methods explicitly.
ae [Wed, 5 Jun 2019 09:25:40 +0000 (09:25 +0000)]
Initialize V_nat64out methods explicitly.

It looks like initialization of static variable doesn't work for
VIMAGE and this leads to panic.

Reported by: olivier
MFC after: 1 week

5 years agoOnly respond to the PCIe Attention Button if a device is already plugged in.
cperciva [Wed, 5 Jun 2019 04:58:42 +0000 (04:58 +0000)]
Only respond to the PCIe Attention Button if a device is already plugged in.

Prior to this commit, if PCIEM_SLOT_STA_ABP and PCIEM_SLOT_STA_PDC are
asserted simultaneously, FreeBSD sets a 5 second "hardware going away" timer
and then processes the "presence detect" change. In the (physically
challenging) case that someone presses the "attention button" and inserts
a new PCIe device at exactly the same moment, this results in FreeBSD
recognizing that the device is present, attaching it, and then detaching it
5 seconds later.

On EC2 "bare metal" hardware this is the precise sequence of events which
takes place when a new EBS volume is attached; virtual machines have no
difficulty effecting physically implausible simultaneity.

This patch changes the handling of PCIEM_SLOT_STA_ABP to only detach a
device if the presence of a device was detected *before* the interrupt
which reports the Attention Button push.

Reported by: Matt Wilson
Reviewed by: jhb
MFC after: 1 week
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D20499

5 years agoAdd myself to committers-src.dot and calendar.freebsd
scottph [Wed, 5 Jun 2019 04:01:31 +0000 (04:01 +0000)]
Add myself to committers-src.dot and calendar.freebsd

Approved by: jhb (mentor)

5 years agoAdd self to calendar, per mckusick's request
meta [Wed, 5 Jun 2019 03:40:34 +0000 (03:40 +0000)]
Add self to calendar, per mckusick's request

5 years agoEliminate unused uuid parameters from gptread and gptread_table. We
imp [Wed, 5 Jun 2019 02:34:58 +0000 (02:34 +0000)]
Eliminate unused uuid parameters from gptread and gptread_table.  We
only need it for the gptfind() function, where it's used.

5 years agomove llvm-ar and llvm-nm to appropriate location in OptionalObsoleteFiles.inc
emaste [Wed, 5 Jun 2019 00:55:22 +0000 (00:55 +0000)]
move llvm-ar and llvm-nm to appropriate location in OptionalObsoleteFiles.inc

After r348610 `make delete-old` was still removing llvm-ar and llvm-nm
(and associated man pages).

Reported by: jhb
Sponsored by: The FreeBSD Foundation

5 years agoufs_module.c can't currently be compiled with -Wcast-align, but the
imp [Wed, 5 Jun 2019 00:08:30 +0000 (00:08 +0000)]
ufs_module.c can't currently be compiled with -Wcast-align, but the
code is safe enough. Turn off the warning for now until I can find the
right construct to silence it in the code.

5 years agoDon't shadow a global zfsmount variable.
imp [Wed, 5 Jun 2019 00:04:21 +0000 (00:04 +0000)]
Don't shadow a global zfsmount variable.

5 years agoAdd self to calendar, per Kirk's request
adridg [Tue, 4 Jun 2019 21:54:34 +0000 (21:54 +0000)]
Add self to calendar, per Kirk's request