freebsd.git
6 years agoadd vfs_zfs.abd_chunk_size tunable
avg [Wed, 20 Sep 2017 08:36:31 +0000 (08:36 +0000)]
add vfs_zfs.abd_chunk_size tunable

It is reported that the default value of 4KB results in a substantial
memory use overhead (at least, on some configurations).  Using 1KB seems
to reduce the overhead significantly.

PR: 222377
Reported by: Sean Chittenden <sean@chittenden.org>
MFC after: 1 week

6 years agofix memory leak in g_bio zone introduced in r320452, another ABD fallout
avg [Wed, 20 Sep 2017 08:27:21 +0000 (08:27 +0000)]
fix memory leak in g_bio zone introduced in r320452, another ABD fallout

I overlooked the fact that that ZIO_IOCTL_PIPELINE does not include
ZIO_STAGE_VDEV_IO_DONE stage.  We do allocate a struct bio for an ioctl
zio (a disk cache flush), but we never freed it.

This change splits bio handling into two groups, one for normal
read/write i/o that passes data around and, thus, needs the abd data
tranform; the other group is for "data-less" i/o such as trim and cache
flush.

PR: 222288
Reported by: Dan Nelson <dnelson@allantgroup.com>
Tested by: Borja Marcos <borjam@sarenet.es>
MFC after: 10 days

6 years agoMFV r323792: 8602 remove unused "dp_early_sync_tasks" field from "dsl_pool" structure
avg [Wed, 20 Sep 2017 07:26:52 +0000 (07:26 +0000)]
MFV r323792: 8602 remove unused "dp_early_sync_tasks" field from "dsl_pool" structure

illumos/illumos-gate@2bcb5458541cc6e8bf7dc541303da29297b82e8b
https://github.com/illumos/illumos-gate/commit/2bcb5458541cc6e8bf7dc541303da29297b82e8b

https://www.illumos.org/issues/8602
  When I landed the fix for 8558, I incorrectly added the "dp_early_sync_tasks"
  field to the "dsl_pool" structure. This field is used in DelphixOS, but not in
  illumos. It was incorrectly pulled into illumos, so this bug is to remove it
  from the structure.

Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>

MFC after: 1 week

6 years agoMFV r323790: 8567 Inconsistent return value in zpool_read_label
avg [Wed, 20 Sep 2017 07:23:50 +0000 (07:23 +0000)]
MFV r323790: 8567 Inconsistent return value in zpool_read_label

illumos/illumos-gate@c861bfbd77c4ae780a0341e9cb6926d8b74341cf
https://github.com/illumos/illumos-gate/commit/c861bfbd77c4ae780a0341e9cb6926d8b74341cf

https://www.illumos.org/issues/8567
  If fstat64 fails, pread64 fails, or the label is unintelligible,
  zpool_read_label will return 0. But if malloc fails, it will return -1. For
  consistency, it should always return -1 on failure or 0 on success.

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Alan Somers <asomers@gmail.com>

MFC after: 2 weeks

6 years agoIn r288122, we changed vm_page_unwire() so that it returns a Boolean
alc [Wed, 20 Sep 2017 04:59:52 +0000 (04:59 +0000)]
In r288122, we changed vm_page_unwire() so that it returns a Boolean
indicating whether the page's wire count transitioned to zero.  Use that
return value in zbuf_page_free() rather than checking the wire count.

MFC after: 1 week

6 years agoSync with amd64/arm/arm64/i386/mips pmap change r288256:
alc [Wed, 20 Sep 2017 04:19:49 +0000 (04:19 +0000)]
Sync with amd64/arm/arm64/i386/mips pmap change r288256:

Exploit r288122 to address a cosmetic issue.  Since PV chunk pages don't
belong to a vm object, they can't be paged out.  Since they can't be paged
out, they are never enqueued in a paging queue.  Nonetheless, passing
PQ_INACTIVE to vm_page_unwire() creates the appearance that these pages
are being enqueued in the inactive queue.  As of r288122, we can avoid
this false impression by passing PQ_NONE.

MFC after: 1 week

6 years agoDefine CPU_XSCALE_CORE3 when relevant.
cognet [Tue, 19 Sep 2017 23:41:55 +0000 (23:41 +0000)]
Define CPU_XSCALE_CORE3 when relevant.
It was lost when cpuconf.h was deobirted.

6 years agoMake the nfsrpc_layoutget() function a static.
rmacklem [Tue, 19 Sep 2017 23:28:22 +0000 (23:28 +0000)]
Make the nfsrpc_layoutget() function a static.

Make the NFSv4 pNFS client function nfsrpc_layoutget() a static, since it
is only used in sys/fs/nfsclient/nfs_clrpcops.c.
This prepares the code for future patches that add Flex File layout
support.

6 years agoAdd sysctl "enable_minidump" to turn on/off automatic minidump retrieval
davidcs [Tue, 19 Sep 2017 23:26:27 +0000 (23:26 +0000)]
Add sysctl "enable_minidump" to turn on/off automatic minidump retrieval

MFC after:5 days

6 years agoUpdate minidump template for version 5.4.66
davidcs [Tue, 19 Sep 2017 22:17:30 +0000 (22:17 +0000)]
Update minidump template for version 5.4.66

MFC after:5 days

6 years agoAdd a new function called nfsm_uiombuflist(), similar to nfsm_uiombuf().
rmacklem [Tue, 19 Sep 2017 21:31:36 +0000 (21:31 +0000)]
Add a new function called nfsm_uiombuflist(), similar to nfsm_uiombuf().

This patch adds a new function called nfsm_uiombuflist(), which is
similar to nfsm_uiombuf(), but doesn't not use the fields in
struct nfsrv_descript. This new function will be used by the pNFS client
for writing to mirrors using Flex Files layout.
The function is not yet called anywhere.
Also, get rid of #ifndef APPLE, which is ancient cruft left over from
the Mac OSX port of the NFSv4 client.

6 years agoSimplify nfsrpc_layoutreturn() args.
rmacklem [Tue, 19 Sep 2017 20:45:25 +0000 (20:45 +0000)]
Simplify nfsrpc_layoutreturn() args.

Simplify nfsrpc_layoutreturn() args. in preparation for the addition
of Flex File layout support, since File layout uses a 0 length field.
Flex Files does use a longer field, but that will be added in a
subsequent commit.

6 years agoFix indentation for r323068
jpaetzel [Tue, 19 Sep 2017 20:40:05 +0000 (20:40 +0000)]
Fix indentation for r323068

PR: 220170
Reported by: lidl
MFC after: 3 days
Pointyhat to: jpaetzel

6 years agoi81342 is little endian, not big endian.
cognet [Tue, 19 Sep 2017 20:33:22 +0000 (20:33 +0000)]
i81342 is little endian, not big endian.

6 years agoFix a warning.
tuexen [Tue, 19 Sep 2017 20:24:13 +0000 (20:24 +0000)]
Fix a warning.

MFC after: 1 week

6 years agoSimplify nfsrpc_layoutcommit() args.
rmacklem [Tue, 19 Sep 2017 20:18:41 +0000 (20:18 +0000)]
Simplify nfsrpc_layoutcommit() args.

Simplify nfsrpc_layoutcommit() args. in preparation for the addition
of Flex File layout support, since it also uses a 0 length field.

6 years agoAvoid an overflow when computing the staleness.
tuexen [Tue, 19 Sep 2017 20:09:58 +0000 (20:09 +0000)]
Avoid an overflow when computing the staleness.
This issue was found by running libfuzz on the userland stack.

MFC after: 1 week

6 years agoDo not do torn writes to active LDTs.
kib [Tue, 19 Sep 2017 17:57:04 +0000 (17:57 +0000)]
Do not do torn writes to active LDTs.

Care must be taken when updating the active LDT, since parallel
threads might try to load a segment descriptor which is currently
updated. Since the results are undefined, this cannot be ignored by
claiming to be an application race.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12413

6 years agoDo not vrele() covered vnode under the mp mutex.
kib [Tue, 19 Sep 2017 16:49:45 +0000 (16:49 +0000)]
Do not vrele() covered vnode under the mp mutex.

If vrele() changes the hold count to zero, it needs to acquire the
vnode lock.

Sponsored by: The FreeBSD Foundation
Discussed with: avg
X-MFC with: r323578

6 years agoFor unlinked files, do not msync(2) or sync on the vnode deactivation.
kib [Tue, 19 Sep 2017 16:46:37 +0000 (16:46 +0000)]
For unlinked files, do not msync(2) or sync on the vnode deactivation.

One consequence of the patch is that msyncing unlinked file mappings
no longer reduces the amount of the dirty memory in the system, but I
do not think that there are users of msync(2) that utilize it for such
side-effect.

Reported and tested by: tjil
PR: 222356
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12411

6 years agoAdd myself and mentorship status to committers files.
eugen [Tue, 19 Sep 2017 16:38:54 +0000 (16:38 +0000)]
Add myself and mentorship status to committers files.
This was not done right when I got my ports bit, so do them both in one commit:

my ports mentors were az@ and vsevolod@ and my src mentors are avg@ and mav@

Approved by: avg (mentor)

6 years agoProvide an articulate example of how to properly delete partitions and
danfe [Tue, 19 Sep 2017 15:08:31 +0000 (15:08 +0000)]
Provide an articulate example of how to properly delete partitions and
partitioning scheme.

Users often get confused and frustrated when trying to delete partition
table and getting ``Device busy'' error because they forgot (or did not
ever know that they have) to delete all its partitions first, and while
the manual page mentions this briefly, it does not stress it out enough.

Approved by: ae, manpages (bjk)
PR (as inspiration): 196102
Differential Revision: https://reviews.freebsd.org/D12336

6 years agoRemove a no longer used variable.
tuexen [Tue, 19 Sep 2017 15:00:19 +0000 (15:00 +0000)]
Remove a no longer used variable.

Reported by: Felix Weinrank
MFC after: 1 week

6 years agohyperv/hn: Incease max supported MTU
sephe [Tue, 19 Sep 2017 06:46:00 +0000 (06:46 +0000)]
hyperv/hn: Incease max supported MTU

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12365

6 years agohyperv/hn: Fix MTU setting
sephe [Tue, 19 Sep 2017 06:38:57 +0000 (06:38 +0000)]
hyperv/hn: Fix MTU setting

- Add size of an ethernet header to the value configured to NVS.  This
  does not seem to have any effects if MTU is 1500, but fix hypervisor
  side's setting if MTU > 1500.
- Override the MTU setting according to the view from the hypervisor
  side.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12352

6 years agohyperv/hn: Apply VF's RSS setting
sephe [Tue, 19 Sep 2017 06:29:38 +0000 (06:29 +0000)]
hyperv/hn: Apply VF's RSS setting

Since in Azure SYN and SYN|ACK go through the synthetic parts while the
rest of the same TCP flow goes through the VF, apply VF's RSS settings
to synthetic parts to have a consistent hash value/type for the same TCP
flow.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12333

6 years agoEnable support for lookaside crypto operations by default.
jhb [Mon, 18 Sep 2017 23:50:34 +0000 (23:50 +0000)]
Enable support for lookaside crypto operations by default.

This permits ccr(4) to be used with the default firmware configuration
file.

Discussed with: np
Sponsored by: Chelsio Communications

6 years agoAdd UFS_LINK_MAX for the UFS-specific limit on link counts.
jhb [Mon, 18 Sep 2017 23:30:39 +0000 (23:30 +0000)]
Add UFS_LINK_MAX for the UFS-specific limit on link counts.

ino64 expanded nlink_t to 64 bits, but the on-disk format for UFS is still
limited to 16 bits.  This is a nop currently but will matter if LINK_MAX is
increased in the future.

Reviewed by: kib
Sponsored by: Chelsio Communications

6 years agoFix handling of the segment registers on i386.
kib [Mon, 18 Sep 2017 20:22:42 +0000 (20:22 +0000)]
Fix handling of the segment registers on i386.

Suppose that userspace is executing with the non-standard segment
descriptors.  Then, until exception or interrupt handler executed
SET_KERNEL_SEGS, kernel is still executing with user %ds, %es and %fs.
If an interrupt occurs in this window, the interrupt handler is
executed unsafely, relying on usability of the usermode registers.  If
the interrupt results in the context switch on return, the
contamination of the kernel state spreads to the thread we switched
to.  As result, kernel data accesses might fault or, if only the base
is changed, completely messed up.

More, if the user segment was allocated in LDT, another thread might
mark the descriptor as invalid before doreti code tried to reload
them.  In this case kernel panics.

The issue exists for all exception entry points which use trap gate,
and thus do not automatically disable interrupts on entry, and for
lcall_handler.

Fix is two-fold: first, we need to disable interrupts for all kernel
entries, changing the IDT descriptor types from trap gate to interrupt
gate.  Interrupts are re-enabled not earlier than the kernel segments
are loaded into the segment registers.  Second, we only load the
segment registers from the trap frame when returning to usermode.  For
the later, all interrupt return paths must happen through the doreti
common code.

There is no way to disable interrupts on call gate, which is the
supposed mode of servicing for lcall $7,$0 syscalls.  Change the LDT
descriptor 0 into a code segment type and point it to the userspace
trampoline which redirects the syscall to int $0x80.

All the measures make the segment register handling similar to that of
amd64.  We do not apply amd64 optimizations of not reloading segment
registers on return from the syscall.

Reported by: Maxime Villard <max@m00nbsd.net>
Tested by: pho (the non-lcall part)
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12402

6 years agoAdd kern.features flag for MMCCAM
kibab [Mon, 18 Sep 2017 20:17:08 +0000 (20:17 +0000)]
Add kern.features flag for MMCCAM

kern.features.mmcam will be present and equal to 1 if the kernel has been
compiled with option MMCCAM.
This will help sdio-related userland tools to fail-fast if running on the kernel
without MMCCAM enabled.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D12386

6 years agoMake basic Broadcom I/O space reading functions work
kibab [Mon, 18 Sep 2017 20:01:01 +0000 (20:01 +0000)]
Make basic Broadcom I/O space reading functions work

It's now possible to use Broadcom functions to read the I/O registers of
SDIO card. The functions were copied from the BSD-licensed Broadcom Linux driver
as-is. To make it possible, a small Linux compatibility layer was introduced.

Currently the card responds with the correct version number ("magic")
when reading the corresponding address.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D12111

6 years agoDon't use an apostrophe in a possesive pronoun.
cy [Mon, 18 Sep 2017 19:16:41 +0000 (19:16 +0000)]
Don't use an apostrophe in a possesive pronoun.

MFC after: 3 days

6 years agolinsysfs: quiet gcc -Wformat after r323692
rlibby [Mon, 18 Sep 2017 19:09:40 +0000 (19:09 +0000)]
linsysfs: quiet gcc -Wformat after r323692

Reviewed by: cem
Sponsored by: Dell EMC Isilon

6 years agoHide a normal probe warning message under bootverbose, similar to atkbdc
scottl [Mon, 18 Sep 2017 18:42:28 +0000 (18:42 +0000)]
Hide a normal probe warning message under bootverbose, similar to atkbdc

Sponsored by: Netflix

6 years agolinsysfs(5): Fix two unrelated issues
cem [Mon, 18 Sep 2017 17:14:13 +0000 (17:14 +0000)]
linsysfs(5): Fix two unrelated issues

1. Swap the order of device_get_ivars with device_get_devclass and devclass
   name validation.  This bug was introduced in r323692.

2. Error check device_get_children and free the returned list.  This bug was
   introduced in the original linsysfs commit.

Reported by: Oleg V. Nauman <oleg AT theweb.org.ua>, hselasky (1); hselasky (2)
Reviewed by: hselasky
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12407

6 years agoRevert tcpdump to using the source manpage instead of having a copy here.
gordon [Mon, 18 Sep 2017 16:42:13 +0000 (16:42 +0000)]
Revert tcpdump to using the source manpage instead of having a copy here.

This helps future maintainability of tcpdump so we don't forget to update
the manpage (like we have previously).

Stolen from: usr.bin/file/Makefile
Reviewed by: jilles
Approved by: delphij (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12403

6 years agoloader: biosmem allocate heap just below 4GB
tsoome [Mon, 18 Sep 2017 15:17:01 +0000 (15:17 +0000)]
loader: biosmem allocate heap just below 4GB

The current biosmem code is walking bios smap entries and looking for smap
entry just below 4GB line, if there is such entry, its base and size is set
for heap base and size. Instead of entry base, we should use last HEAP_MIN
(currently 64MB) bytes just below 4GB, to make maximum space for kernel and
modules.

The problem was revealed on ASUS B350M-A system board, an AMD Ryzen 3 1200 CPU

memory map:

SMAP type=01 base=0000000000000000 len=000000000009d400 attr=01
SMAP type=02 base=000000000009d400 len=0000000000002c00 attr=01
SMAP type=02 base=00000000000e0000 len=0000000000020000 attr=01
SMAP type=01 base=0000000000100000 len=0000000009c00000 attr=01
SMAP type=02 base=0000000009d00000 len=0000000000300000 attr=01
SMAP type=01 base=000000000a000000 len=00000000be69b000 attr=01
SMAP type=03 base=00000000c869b000 len=0000000000016000 attr=01
SMAP type=01 base=00000000c86b1000 len=00000000124e7000 attr=01
SMAP type=02 base=00000000dab98000 len=0000000000138000 attr=01
SMAP type=03 base=00000000dacd0000 len=0000000000008000 attr=01
SMAP type=01 base=00000000dacd8000 len=0000000000100000 attr=01
SMAP type=04 base=00000000dadd8000 len=00000000003b3000 attr=01
SMAP type=02 base=00000000db18b000 len=0000000000d42000 attr=01
SMAP type=01 base=00000000dbecd000 len=0000000002133000 attr=01
SMAP type=01 base=0000000100000000 len=000000011f380000 attr=01
SMAP type=02 base=00000000de000000 len=0000000002000000 attr=01
SMAP type=02 base=00000000f8000000 len=0000000004000000 attr=01
SMAP type=02 base=00000000fdf00000 len=0000000000100000 attr=01
SMAP type=02 base=00000000fea00000 len=0000000000010000 attr=01
SMAP type=02 base=00000000feb80000 len=0000000000082000 attr=01
SMAP type=02 base=00000000fec10000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fec30000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fed00000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fed40000 len=0000000000005000 attr=01
SMAP type=02 base=00000000fed80000 len=0000000000010000 attr=01
SMAP type=02 base=00000000fedc2000 len=000000000000e000 attr=01
SMAP type=02 base=00000000fedd4000 len=0000000000002000 attr=01
SMAP type=02 base=00000000fee00000 len=0000000000100000 attr=01
SMAP type=02 base=00000000ff000000 len=0000000001000000 attr=01

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

6 years agoBump the __FreeBSD_version after recent LinuxKPI changes.
hselasky [Mon, 18 Sep 2017 13:39:51 +0000 (13:39 +0000)]
Bump the __FreeBSD_version after recent LinuxKPI changes.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoThe LinuxKPI atomics do not have acquire nor release semantics unless
hselasky [Mon, 18 Sep 2017 13:37:14 +0000 (13:37 +0000)]
The LinuxKPI atomics do not have acquire nor release semantics unless
specified. Fix code to use READ_ONCE() and WRITE_ONCE() where appropriate.

Suggested by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoOnly wire pages in the LinuxKPI instead of holding and wiring them.
hselasky [Mon, 18 Sep 2017 13:23:59 +0000 (13:23 +0000)]
Only wire pages in the LinuxKPI instead of holding and wiring them.
This prevents the page daemon from regularly scanning the held pages.

Suggested by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd support for shared memory functions to the LinuxKPI.
hselasky [Mon, 18 Sep 2017 13:17:23 +0000 (13:17 +0000)]
Add support for shared memory functions to the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agolinsysfs(5): Add support for recent libdrm
cem [Sun, 17 Sep 2017 23:40:16 +0000 (23:40 +0000)]
linsysfs(5): Add support for recent libdrm

Expose more information about PCI devices (and GPUs in particular) via
linsysfs to libdrm.

This allows unmodified modern 64-bit Linux libdrm to work, which allows
modern Linux Mesa to work.  The submitter reports that he tested the change
with an Ubuntu 16.04 chroot + amdgpu from graphics/drm-next-kmod.

PR: 222375
Submitted by: Greg V <greg AT unrelenting.technology>

6 years agoGive icee(4) a detach() method so it can be used as a module. Add a
ian [Sun, 17 Sep 2017 22:58:13 +0000 (22:58 +0000)]
Give icee(4) a detach() method so it can be used as a module.  Add a
module makefile for it.

6 years agoMCA: Expand AMD Thresholding support to cover all banks
cem [Sun, 17 Sep 2017 22:58:13 +0000 (22:58 +0000)]
MCA: Expand AMD Thresholding support to cover all banks

When it was added in r314636, AMD Thresholding was hardcoded to only
bank 4 (Northbridge) for some reason.  However, even on family 10h the
MCAx_MISC register Valid/Present bits determine whether thresholding is
supported on that bank.

Expand thresholding support to monitor all monitorable banks.  This
simplifies some of the logic and makes it more consistent with our Intel
CMCI support.

Reviewed by: markj (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12321

6 years agoFix bogus FREAD with NFSV4OPEN_ACCESSREAD. No functional change.
rmacklem [Sun, 17 Sep 2017 22:18:01 +0000 (22:18 +0000)]
Fix bogus FREAD with NFSV4OPEN_ACCESSREAD. No functional change.

The code in nfscl_doflayoutio() bogusly used FREAD instead of
NFSV4OPEN_ACCESSREAD. Since both happen to be defined as "1", this
worked and the patch doesn't result in a functional change.
Found by inspection during development of Flex File Layout support.

MFC after: 2 weeks

6 years agoDon't use a non-zero argument for __builtin_frame_address
jhibbits [Sun, 17 Sep 2017 20:07:20 +0000 (20:07 +0000)]
Don't use a non-zero argument for __builtin_frame_address

__builtin_frame_address with a non-zero argument is unsafe and rejected by
newer gcc.  Since it doesn't seem to impact the stacktrace, don't bother
with gymnastics to unwind to a different frame for starting.

PR: kern/220118
MFC after: 2 weeks

6 years agoPrint the correct bitmask for the running Book-E CPU
jhibbits [Sun, 17 Sep 2017 19:40:17 +0000 (19:40 +0000)]
Print the correct bitmask for the running Book-E CPU

All the Book-E world is no longer e500v{1,2}.  e500mc the 64-bit derivatives do
not use the DOZE/NAP bits with MSR[WE], instead using the `wait' instruction to
wait for interrupts, and SoC plane controls (via CCSR) for power management.

MFC after: 1 week

6 years agoMFV r323678: file 5.32
gordon [Sun, 17 Sep 2017 19:14:38 +0000 (19:14 +0000)]
MFV r323678: file 5.32

Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12400

6 years agoVendor import of file 5.32.
gordon [Sun, 17 Sep 2017 15:57:06 +0000 (15:57 +0000)]
Vendor import of file 5.32.

6 years agoImplement mmu_page_init for AIM platforms.
markj [Sun, 17 Sep 2017 15:40:12 +0000 (15:40 +0000)]
Implement mmu_page_init for AIM platforms.

As of r323290 we cannot rely on the vm_page array being
zero-initialized.

Reported and tested by: andreast
MFC after: 1 week

6 years agolibsysdecode: report invalid cap_rights_t
emaste [Sun, 17 Sep 2017 14:03:54 +0000 (14:03 +0000)]
libsysdecode: report invalid cap_rights_t

Previously we'd have an assertion failure in cap_rights_is_set if
sysdecode_cap_rights is called with an invalid cap_rights_t, so test for
validity first.

PR: 222258
Reviewed by: cem
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12391

6 years agoFix language used in the r322923.
oshogbo [Sun, 17 Sep 2017 10:28:45 +0000 (10:28 +0000)]
Fix language used in the r322923.

Pointed out by: wblock@
MFC after:      1 week
X-MFC-with:     r322923

6 years agoFix an accounting bug and use sctp_timer_start to start a timer.
tuexen [Sun, 17 Sep 2017 09:27:27 +0000 (09:27 +0000)]
Fix an accounting bug and use sctp_timer_start to start a timer.

MFC after: 1 week

6 years agoRemove code not used on any platform currently supported.
tuexen [Sat, 16 Sep 2017 21:26:06 +0000 (21:26 +0000)]
Remove code not used on any platform currently supported.

MFC after: 1 week

6 years agoModify blst_leaf_alloc to take only the cursor argument.
alc [Sat, 16 Sep 2017 18:12:15 +0000 (18:12 +0000)]
Modify blst_leaf_alloc to take only the cursor argument.

Modify blst_leaf_alloc to find allocations that cross the boundary between
one leaf node and the next when those two leaves descend from the same
meta node.

Update the hint field for leaves so that it represents a bound on how
large an allocation can begin in that leaf, where it currently represents
a bound on how large an allocation can be found within the boundaries of
the leaf.

The first phase of blst_leaf_alloc currently shrinks sequences of
consecutive 1-bits in mask until each has been shrunken by count-1 bits,
so that any bits remaining show where an allocation can begin, or until
all the bits have disappeared, in which case the allocation fails. This
change amends that so that the high-order bit is copied, as if, when the
last block was free, it was followed by an endless stream of free
blocks. It also amends the early stopping condition, so that the shrinking
of 1-sequences stops early when there are none, or there is only one
unbounded one remaining.

The search for the first set bit is unchanged, and the code path
thereafter is mostly unchanged unless the first set bit is in a position
that makes some of those copied sign bits matter. In that case, we look
for a next leaf, and at what blocks it can provide, to see if a
cross-boundary allocation is possible.

The hint is updated on a successful allocation that clears the last bit,
but it not updated on a failed allocation that leaves the last bit
set. So, as long as the last block is free, the hint value for the leaf is
large. As long as the last block is free, and there's a next leaf, a large
allocation can begin here, perhaps. A stricter rule than this would mean
that allocations and frees in one leaf could require hint updates to the
preceding leaf, and this change seeks to leave the freeing code
unmodified.

Define BLIST_BMAP_MASK, and use it for bit masking in blst_leaf_free and
blist_leaf_fill, as well as in blst_leaf_alloc.

Correct a panic message in blst_leaf_free.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: markj (an earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11819

6 years agoAdd missing links to the nv man page.
oshogbo [Sat, 16 Sep 2017 17:52:25 +0000 (17:52 +0000)]
Add missing links to the nv man page.

MFC after: 1 week

6 years agoFix names of the array functions in the nv man page.
oshogbo [Sat, 16 Sep 2017 17:50:24 +0000 (17:50 +0000)]
Fix names of the array functions in the nv man page.

Submitted by: def@
MFC after: 1 week

6 years agokern.osreldate is an integer, not a string
allanjude [Sat, 16 Sep 2017 16:23:00 +0000 (16:23 +0000)]
kern.osreldate is an integer, not a string

PR: 217501
Submitted by: Yavuz Tanriverdi <stemix@gmail.com>
MFC after: 1 week

6 years agoAdd a missing header file to SRCS to fix out-of-kernel builds.
ian [Sat, 16 Sep 2017 16:09:05 +0000 (16:09 +0000)]
Add a missing header file to SRCS to fix out-of-kernel builds.

PR: 222354
Submitted by: eugen@
Pointy hat: ian@

6 years agoAllwinner usb phy: Rework resource allocation
manu [Sat, 16 Sep 2017 15:58:20 +0000 (15:58 +0000)]
Allwinner usb phy: Rework resource allocation

The usbphy node for allwinner have two kind of resources, one for the
phy_ctrl and one per phy. Instead of blindy allocating resources, alloc
the phy_ctrl and pmu ones separately.
Also add a configuration struct for all different phy that hold the difference
between them (number of phys, unknow needed register write etc ...).

While here remove A83T code as upstream and FreeBSD dts don't have
nodes for USB.

This (plus 323640) re-enable OHCI on Pine64 on the bottom USB port.
The top USB port is routed to the OHCI0/EHCI0 which is by default in OTG mode.
While the phy code can handle the re-route to standard OHCI/EHCI we still need
a driver for musb to probe and configure it in host mode.

EHCI is still buggy on Pine64 (hang the board) so do not enable it for now.

Tested On: Bananapi (A20), BananapiM2 (A31S), OrangePi One (H3) Pine64 (A64)

6 years agoA64 CCUNG: Correct gate and reset for OHCI0/1
manu [Sat, 16 Sep 2017 15:50:31 +0000 (15:50 +0000)]
A64 CCUNG: Correct gate and reset for OHCI0/1

Reported by: jmcneill
Pointy Hat: manu

6 years agoAllwinner: a10_gpio Fix panic on multiple lock
manu [Sat, 16 Sep 2017 14:08:20 +0000 (14:08 +0000)]
Allwinner: a10_gpio Fix panic on multiple lock

r323392 introduce gpio_pin_get/gpio_pin_set for a10_gpio driver.
When called via gpio method they must aquire the device lock while
when they are called via gpio_pin_configure the lock is already aquire.

Introduce a10_gpio_pin_{s,g}et_locked and call them in pin_gpio_configure
instead.

Tested On: BananaPi (A20)

Reported by: Richard Puga richard@puga.net

6 years agoUse OBJS_SRCS_FILTER to control setting OBJS from SRCS
sjg [Sat, 16 Sep 2017 05:42:27 +0000 (05:42 +0000)]
Use OBJS_SRCS_FILTER to control setting OBJS from SRCS

Some makefiles do reachover builds.
In some cases it is convenient to list subdirs of the distribution
in SRCS.

It is not very convenient, or always even desirable to have corresponding
subdirs in .OBJDIR, so OBJS_SRCS_FILTER allows the makefile to choose.
The default value 'R' matches existing practice.

But a makefile can set OBJS_SRCS_FILTER= T (the R gets added by
bsd.init.mk) to avoid the need for subdirs in .OBJDIR

Differential Revision: https://reviews.freebsd.org/D12218
Reviewed by: bdrewery

6 years agoRevert r323516 (iflib rollup)
shurd [Sat, 16 Sep 2017 02:41:38 +0000 (02:41 +0000)]
Revert r323516 (iflib rollup)

This was really too big of a commit even if everything worked, but there
are multiple new issues introduced in the one huge commit, so it's not
worth keeping this until it's fixed.

I'll work on splitting this up into logical chunks and introduce them one
at a time over the next week or two.

Approved by: sbruno (mentor)
Sponsored by: Limelight Networks

6 years agoAdd missing newline after unknown MIPS-specific dynamic entries.
jhb [Fri, 15 Sep 2017 22:56:39 +0000 (22:56 +0000)]
Add missing newline after unknown MIPS-specific dynamic entries.

Reviewed by: emaste
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D12384

6 years agoAdd an -a flag to getconf.
jhb [Fri, 15 Sep 2017 22:55:15 +0000 (22:55 +0000)]
Add an -a flag to getconf.

When -a is specified, the name and value of all system or path
configuration values is reported to standard output.

Reviewed by: kib (earlier version)
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D12373

6 years agoAvoid reusing the wrong buffer for a DDP AIO request.
jhb [Fri, 15 Sep 2017 22:40:57 +0000 (22:40 +0000)]
Avoid reusing the wrong buffer for a DDP AIO request.

To optimize the case of ping-ponging between two buffers, the DDP code
caches the last two buffers used keeping the pages wired and page pods
stored in the NIC's RAM.  If a new aio_read() request uses one of the
same buffers, then the work of holding pages, etc. can be avoided.
However, the starting virtual address of an aio buffer was not saved,
only the page count, length, and initial page offset.  Thus, an
aio_read() request could match a different buffer in the address
space.  (Earlier during development vm_fault_hold_quick_pages() was
always called and the vm_page_t values were compared, but that was
eventually removed without being adequately replaced.)  Fix by storing
the starting virtual address and comparing that (along with other
fields) to determine if a buffer can be reused.

MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoFix line wrap issues.
scottl [Fri, 15 Sep 2017 20:58:52 +0000 (20:58 +0000)]
Fix line wrap issues.

Sponsored by: Netflix

6 years agoRemove tailing whitespace.
tuexen [Fri, 15 Sep 2017 20:46:51 +0000 (20:46 +0000)]
Remove tailing whitespace.

6 years agoRemove empty line accidently introduced in r323626.
tuexen [Fri, 15 Sep 2017 20:41:12 +0000 (20:41 +0000)]
Remove empty line accidently introduced in r323626.

6 years agoAdd references. Suggested by Maxim Konovalov.
tuexen [Fri, 15 Sep 2017 20:34:52 +0000 (20:34 +0000)]
Add references. Suggested by Maxim Konovalov.

Sponsored by: Netflix, Inc.

6 years agoAllow multiple TRIMs to be done for nda
imp [Fri, 15 Sep 2017 20:16:06 +0000 (20:16 +0000)]
Allow multiple TRIMs to be done for nda

Don't call cam_iosched_trim_done or cam_iosched_submit_trim for nda
since its hardware can handle almost an arbitrary number of TRIMs and
we don't have to be careful to only ever do one.

Sponsored by: Netflix

6 years agoUpdate comments on what the CAM_IOSCHED_FLAG_TRIM_ACTIVE means.
imp [Fri, 15 Sep 2017 20:15:55 +0000 (20:15 +0000)]
Update comments on what the CAM_IOSCHED_FLAG_TRIM_ACTIVE means.

It's intended only for those situations where the periph driver
ones to limit the number of trims active to one and only one.
Also update comments on associated functions.

Sponsored by: Netflix

6 years agorename(2): document capability mode errors
emaste [Fri, 15 Sep 2017 20:12:38 +0000 (20:12 +0000)]
rename(2): document capability mode errors

Reviewed by: allanjude
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12339

6 years agoopen(2): update ENOTCAPABLE description for .. lookups
emaste [Fri, 15 Sep 2017 20:05:55 +0000 (20:05 +0000)]
open(2): update ENOTCAPABLE description for .. lookups

After r308212 Capsicum permits .. lookups in capability mode, as long as
path component traversal does not escape the directory corresponding to
the provided file descriptor.

We should add a description of the vfs.lookup_cap_dotdot and
vfs.lookup_cap_dotdot_nonlocal sysctls, perhaps as a cross-reference to
capsicum(4). I intend to look at that soon.

Reviewed by: bjk, cem, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12343

6 years agoAdd MIPS32/64 Rev2 CP0 intctl register definitions.
landonf [Fri, 15 Sep 2017 19:56:21 +0000 (19:56 +0000)]
Add MIPS32/64 Rev2 CP0 intctl register definitions.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D12300

6 years agoFix the raise tests.
bdrewery [Fri, 15 Sep 2017 19:48:48 +0000 (19:48 +0000)]
Fix the raise tests.

- The exit probe was not appropriately filtered to only the known pid so it
  was firing on any random process that would exit rather the only the one
  we cared about.
- The dtest script executes the tst.raise*.exe in the background from
  POSIX sh without jobs control.  POSIX mandates that SIGINT be set to
  SIG_IGN in this case.  The test executable never actually tested that
  SIGINT could be caught despite trying to block and delay the signal.
  So the SIGINT sent from raise() is never actually received since it
  is ignored.  This could be fixed by calling 'trap - INT' from dtest
  before running the executable but I've opted to just use SIGUSR1
  instead in these specific tests rather than adding more logic to
  test that SIGINT is not ignored at startup.

These 2 issues meant that the tests would randomly work but only if a process
coincidentally exited during the test.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoMiscellaneous fixes and improvements to MMCCAM stack
kibab [Fri, 15 Sep 2017 19:47:44 +0000 (19:47 +0000)]
Miscellaneous fixes and improvements to MMCCAM stack

 * Demote the level of several debug messages to CAM_DEBUG_TRACE
 * Add detection for SDHC cards that can do 1.8V. No voltage switch sequence
   is issued yet;
 * Don't create a separate LUN for each SDIO function. We need just one to make
   pass(4) attach;
 * Remove obsolete mmc_sdio* files. SDIO functionality will be moved into the
   separate device that will manage a new sdio(4) bus;
 * Terminate probing if got no reply to CMD0;
 * Make bcm2835 SDHCI host controller driver compile with 'option MMCCAM'.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D12109

6 years agoBatch freeing of the pages in vm_object_page_remove() under the same
kib [Fri, 15 Sep 2017 16:07:09 +0000 (16:07 +0000)]
Batch freeing of the pages in vm_object_page_remove() under the same
free queue mutex lock owning session, same as it was done for the
object termination in r323561.

Reported and tested by: mjg
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agobsdgrep: disable TRE implementation by default
kevans [Fri, 15 Sep 2017 15:57:15 +0000 (15:57 +0000)]
bsdgrep: disable TRE implementation by default

Start the phasing out of TRE by disabling it by default. r317254 introduced
a BSD_GREP_FASTMATCH knob (defaulting to on) for testing of bsdgrep with and
without TRE enabled. More bugs have cropped up since then, and
WITHOUT_BSD_GREP_FASTMATCH has shown in testing to be more stable than its
counterpart.

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D12381

6 years agoAdd support for parsing the Watchdog Descriptor Table (WDDT)
scottl [Fri, 15 Sep 2017 15:41:07 +0000 (15:41 +0000)]
Add support for parsing the Watchdog Descriptor Table (WDDT)

Sponsored by: Netflix

6 years agoInclude _bitset.h to get BITSET_DEFINE, used to define struct slabbits.
markj [Fri, 15 Sep 2017 14:59:35 +0000 (14:59 +0000)]
Include _bitset.h to get BITSET_DEFINE, used to define struct slabbits.

MFC after: 1 week

6 years agogmirror: treat ENXIO as disk disconnect, not media error
avg [Fri, 15 Sep 2017 13:57:08 +0000 (13:57 +0000)]
gmirror: treat ENXIO as disk disconnect, not media error

In theory, all data access errors mean that a member is out of sync
at most.  But they were treated as more serious errors to avoid the
situation where a flaky disk gets repeatedly disconnected, re-synchronized,
reconnected and then disconnected again.

ENXIO is a special error that means that the member disk disappeared,
so it should get the same handling as the GEOM orphaning event.
There is a better chance that when the disk is reconnected, it will be
a good member again.

When ENXIO happens on a read we use the exisiting G_MIRROR_BUMP_SYNCID
mechanism which means that the mirror's syncid is increased as soon
as there is a write to the mirror.  That's because no data has got out
of sync yet, but the problematic memeber is disconnected, so the future
write will make it stale.

When ENXIO happens on a write we use a new G_MIRROR_BUMP_SYNCID_NOW
mechanism which means that we update the mirror metadata as soon as
possible because the problematic memeber is already behind.

Reviewed by: markj, imp
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D9463

6 years agofastmatch.h: remove duplicate #defines
emaste [Fri, 15 Sep 2017 13:34:00 +0000 (13:34 +0000)]
fastmatch.h: remove duplicate #defines

Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12375

6 years agoAdd the ARMv8.3 ID register fields. These were found in the A-Profile
andrew [Fri, 15 Sep 2017 12:57:34 +0000 (12:57 +0000)]
Add the ARMv8.3 ID register fields. These were found in the A-Profile
exploration tools documentation:
https://developer.arm.com/products/architecture/a-profile/exploration-tools

Sponsored by: DARPA, AFRL

6 years agoUpdate OptionalObsoleteFiles.inc with NTP docs
emaste [Fri, 15 Sep 2017 00:54:37 +0000 (00:54 +0000)]
Update OptionalObsoleteFiles.inc with NTP docs

The list of files for MK_NTP was incomplete.

PR: 218193
Submitted by: brnrd
MFC after: 1 week

6 years agoAdd myself (leres) as a ports committer with ler and matthew as mentors.
leres [Fri, 15 Sep 2017 00:08:36 +0000 (00:08 +0000)]
Add myself (leres) as a ports committer with ler and matthew as mentors.

Reviewed by: matthew (mentor)
Approved by: matthew (mentor)
Differential Revision: https://reviews.freebsd.org/D12372

6 years agoFix some incorrect sysctl pointers for some error stats.
jhb [Thu, 14 Sep 2017 21:06:08 +0000 (21:06 +0000)]
Fix some incorrect sysctl pointers for some error stats.

The bad_session, sglist_error, and process_error sysctl nodes were
returning the value of the pad_error node instead of the appropriate
error counters.

Sponsored by: Chelsio Communications

6 years agoBump date missed in r323596. Trim trailing whitespace.
tuexen [Thu, 14 Sep 2017 20:42:19 +0000 (20:42 +0000)]
Bump date missed in r323596. Trim trailing whitespace.

Sponsored by: Netflix, Inc.

6 years agolibedit: raise the warning level to 3.
pfg [Thu, 14 Sep 2017 19:50:07 +0000 (19:50 +0000)]
libedit: raise the warning level to 3.

NetBSD has the warning level to 5 but that actually triggers -Wcast-qual.

6 years agoSilently handle freeaddrinfo(NULL) for compatibility with code which
kib [Thu, 14 Sep 2017 19:18:24 +0000 (19:18 +0000)]
Silently handle freeaddrinfo(NULL) for compatibility with code which
works on other OSes.  Also avoid unnecessary NULL check, free(NULL) is
valid.

Reviewed by: bjk (man page), hrs, hselasky, ume
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D12354

6 years agoAdd a description how tcpdrop handles the case of specifying the
tuexen [Thu, 14 Sep 2017 18:50:40 +0000 (18:50 +0000)]
Add a description how tcpdrop handles the case of specifying the
-s and the -S option.

Sponsored by: Netflix, Inc.

6 years agoFix locking in soisconnected().
glebius [Thu, 14 Sep 2017 18:05:54 +0000 (18:05 +0000)]
Fix locking in soisconnected().

When a newborn socket moves from incomplete queue to complete
one, we need to obtain the listening socket lock after the child,
which is a wrong order.  The old code did that in potentially
endless loop of mtx_trylock().  The new one does only one attempt
of mtx_trylock(), and in case of failure references listening
socket, unlocks child and locks everything in right order.  In
case if listening socket shuts down during that, just bail out.

Reported & tested by: Jason Eggleston <jeggleston llnw.com>
Reported & tested by: Jason Wolfe <jason llnw.com>

6 years agoAdd support for handling undefined instructions in userspace and the
andrew [Thu, 14 Sep 2017 17:29:51 +0000 (17:29 +0000)]
Add support for handling undefined instructions in userspace and the
kernel. We can register callbacks to perform the required operation on the
saved registers before returning.

This is initially used to work around a bug in old versions of QEMU that
trigger such an exception when reading from an ID register when it should
load z zero value.

I expect this could be used with other exception types, e.g. to emulate
special register access from userland.

Sponsored by: DARPA, AFRL

6 years agoloader: biosmem.c cstyle cleanup
tsoome [Thu, 14 Sep 2017 16:42:29 +0000 (16:42 +0000)]
loader: biosmem.c cstyle cleanup

No functional changes, just cleanup.

Reviewed by: allanjude, imp
Differential Revision: https://reviews.freebsd.org/D12370

6 years agoRecognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.
jhb [Thu, 14 Sep 2017 16:41:24 +0000 (16:41 +0000)]
Recognize NT_PTLWPINFO and NT_ARM_VFP in FreeBSD ELF cores.

Reviewed by: emaste
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12371

6 years agoocteon sdk: initialize variable to quiet Clang warning
emaste [Thu, 14 Sep 2017 16:41:22 +0000 (16:41 +0000)]
octeon sdk: initialize variable to quiet Clang warning

Clang complains "variable 'dummy' is uninitialized when used here".

Reported by: Clang
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoAdd PNP metadata to a few drivers
cem [Thu, 14 Sep 2017 15:34:45 +0000 (15:34 +0000)]
Add PNP metadata to a few drivers

An eventual devd(8) or other component should be able to scan buses and
automatically load drivers that match device ids described in this metadata.

Reviewed by: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12364

6 years agoAdd AT_EHDRFLAGS and AT_HWCAP on amd64.
jhb [Thu, 14 Sep 2017 15:34:29 +0000 (15:34 +0000)]
Add AT_EHDRFLAGS and AT_HWCAP on amd64.

x86 has two separate (but identical) list of AT_* constants and the
earlier commit to add AT_HWCAP only updated the i386 list.

6 years agoAdd a NT_ARM_VFP ELF core note to hold VFP registers for each thread.
jhb [Thu, 14 Sep 2017 15:07:48 +0000 (15:07 +0000)]
Add a NT_ARM_VFP ELF core note to hold VFP registers for each thread.

The core note matches the format and layout of NT_ARM_VFP on Linux.
Debuggers use the AT_HWCAP flags to determine how many VFP registers
are actually used and their format.

Reviewed by: mmel (earlier version w/o gcore)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12293