]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agozfs: tighten debug versions of ZTOV and VTOZ
avg [Tue, 12 Sep 2017 06:02:21 +0000 (06:02 +0000)]
zfs: tighten debug versions of ZTOV and VTOZ

MFC after: 2 weeks
Sponsored by: Panzura

6 years agoImprove the wording of a comment describing why EAGAIN is the error code.
cy [Tue, 12 Sep 2017 04:21:04 +0000 (04:21 +0000)]
Improve the wording of a comment describing why EAGAIN is the error code.

MFC after: 3 days

6 years agoAdd a default implementation that returns ENODEV for start, repeat_start,
ian [Mon, 11 Sep 2017 23:47:49 +0000 (23:47 +0000)]
Add a default implementation that returns ENODEV for start, repeat_start,
stop, read, and write methods.  Some controllers don't implement these
individual operations and have only a transfer method.  In that case, we
should return an indication that the device is present but doesn't support
the method, as opposed to the kobj default error ENXIO which makes it
look like the whole device is missing.  Userland tools such as i2c(8) can
use the differing return values to switch between the two different i2c
IO mechanisms.

6 years agoAdd CFI directives for _rtld_bind_start.
jhb [Mon, 11 Sep 2017 22:18:01 +0000 (22:18 +0000)]
Add CFI directives for _rtld_bind_start.

This allows debuggers to unwind back into the caller when stopped in the
runtime linker.

Sponsored by: DARPA / AFRL

6 years agoMake i2c -s (device scan) work on hardware that supports only full xfers.
ian [Mon, 11 Sep 2017 21:49:38 +0000 (21:49 +0000)]
Make i2c -s (device scan) work on hardware that supports only full xfers.

The existing scan code is based on sending an i2c START condition and if
there is no error it assumes there is a device at that i2c address.  Some
i2c controllers don't support sending individual start/stop signals on the
bus, they can only perform complete data transfers with start/stop handled
in the silicon.

This adds a fallback mechanism that attempts to read a single byte from each
i2c address.  It's less reliable than looking for an an ACK repsonse to a
start, because some devices will NAK an attempt to read that isn't preceeded
by a write of a register address.  Writing to devices to probe them is too
dangerous to even consider.  The user is told that a less-reliable scan is
being done, so even if the read-scan comes up empty too, it's still a vast
improvement over the old situation where it would just claim there were no
devices on the bus even though the devices were there and working fine.

If the i2c controller responds with a proper ENODEV (device doesn't support
operation) or an almost-proper EOPNOTSUPP, the START/STOP scan is switched
to a read-scan right away.  Most controllers respond with ENXIO or EIO if
they don't support START/STOP, so no quick-out is available.  For those,
if a scan of all 127 addresses and come up empty, the scan is re-done using
the read method.

Reported by: Maxim Filimonov <che@bein.link>

6 years agoMCA: Rename AMD MISC bits/masks
cem [Mon, 11 Sep 2017 20:42:07 +0000 (20:42 +0000)]
MCA: Rename AMD MISC bits/masks

They apply to all AMD MCAi_MISC0 registers, not just MCA4 (NB).

No functional change.

Sponsored by: Dell EMC Isilon

6 years agox86 MCA: Extract CMCI support predicate into function
cem [Mon, 11 Sep 2017 20:41:25 +0000 (20:41 +0000)]
x86 MCA: Extract CMCI support predicate into function

On AMD, the MCG_CAP feature bit is reserved -- not explicitly zero.  Do not
use it to determine CMCI support.

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

6 years agoRestore alphabetical order in UART Makefile
mw [Mon, 11 Sep 2017 19:07:53 +0000 (19:07 +0000)]
Restore alphabetical order in UART Makefile

Commit r323359 introduced new Marvell UART controller driver
and by mistake it broke correct order in the Makefile. Fix this.

Reported by: emaste

6 years agoAdd MMCCAM-enabled kernel config for arm64
kibab [Mon, 11 Sep 2017 19:07:42 +0000 (19:07 +0000)]
Add MMCCAM-enabled kernel config for arm64

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

6 years agoExpand Marvell NIC description in arm64 GENERIC config
mw [Mon, 11 Sep 2017 19:00:53 +0000 (19:00 +0000)]
Expand Marvell NIC description in arm64 GENERIC config

Suggested by: emaste

6 years agoFix ioapic acpi id matching on PCI attach and rid calculation.
kib [Mon, 11 Sep 2017 18:29:09 +0000 (18:29 +0000)]
Fix ioapic acpi id matching on PCI attach and rid calculation.

Sponsored by: The FreeBSD Foundation
MFC after: 11 days

6 years agoDecode new AMD SVM feature bits on family 17h
cem [Mon, 11 Sep 2017 18:11:53 +0000 (18:11 +0000)]
Decode new AMD SVM feature bits on family 17h

Sponsored by: Dell EMC Isilon

6 years agoIgnore error return from newaliases(1)
emaste [Mon, 11 Sep 2017 17:39:21 +0000 (17:39 +0000)]
Ignore error return from newaliases(1)

This was originally added as "exit $SUCCESS" but with nothing to set the
SUCCESS variable. Thus it became an exit with no argument, which just
exits with the status of the preceding command.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoProvide an error message if KTR symbols in a vmcore cannot be resolved.
markj [Mon, 11 Sep 2017 15:18:43 +0000 (15:18 +0000)]
Provide an error message if KTR symbols in a vmcore cannot be resolved.

libkvm does not set an error string in this case, so we were previously
failing silently.

MFC after: 1 week

6 years agomake-memstick.sh: use UFSv2
emaste [Mon, 11 Sep 2017 14:41:57 +0000 (14:41 +0000)]
make-memstick.sh: use UFSv2

There's not much practical difference as far as install media is
concerned but newfs creates UFSv2 by default and it is sensible to use
the contemporary UFS version.

I also intend to change makefs to create UFSv2 by default (to match
newfs) so we'll want make-memstick.sh to be explicit, rather than
relying on the host tool's default.

Reviewed by: andrew, gjb, jhibbits
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12231

6 years agorevert unintentional changes from r323436
emaste [Mon, 11 Sep 2017 14:35:43 +0000 (14:35 +0000)]
revert unintentional changes from r323436

6 years agoboot1: remove BOOT1_MAXSIZE default value
emaste [Mon, 11 Sep 2017 14:33:04 +0000 (14:33 +0000)]
boot1: remove BOOT1_MAXSIZE default value

This Makefile relies on Makefile.fat providing the correct value for
BOOT1_MAXSIZE and BOOT1_OFFSET. Since BOOT1_OFFSET had no default value
here the build would already fail if Makefile.fat did not provide
correct values.

Sponsored by: The FreeBSD Foundation

6 years agoMFV r323111: 8569 problem with inline functions in abd.h
avg [Mon, 11 Sep 2017 12:15:49 +0000 (12:15 +0000)]
MFV r323111: 8569 problem with inline functions in abd.h

illumos/illumos-gate@37e84ab74e939caf52150fc3352081786ecc0c29
https://github.com/illumos/illumos-gate/commit/37e84ab74e939caf52150fc3352081786ecc0c29

https://www.illumos.org/issues/8569
  C [C99] has peculiar rules for inline functions that are different from the
  C++ rules.  Unlike C++ where inline is "fire and forget", in C a programmer
  must pay attention to the function's storage class / visibility.  The main
  problem is with the case where a compiler decides to not inline a call to the
  function declared as inline.
  Some relevant links:
  - http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15831.html
  - http://www.drdobbs.com/the-new-c-inline-functions/184401540
  The summary is that either the inline functions should be declared 'static
  inline' or one of the compilation units (.c files) must provide a callable
  externally visible function definition.  In the former case, the compiler would
  automatically create a local non-inlined function instance in every compilation
  unit where it's needed.  In the latter case the single external definition is
  used to satisfy any non-inlined calls in all compilation units.  As things
  stand right now, we can get an undefined reference error under certain
  combinations of compilers and compiler options.  For example, this is what I
  get on FreeBSD when compiling with clang 4.0.0 and -O1:
    In function `abd_free': /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c:385:
    undefined reference to `abd_is_linear'

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Andriy Gapon <avg@FreeBSD.org>

MFC after: 1 week

6 years agoRevert r322601, Mark ZFS ABD inline functions static
avg [Mon, 11 Sep 2017 12:08:20 +0000 (12:08 +0000)]
Revert r322601, Mark ZFS ABD inline functions static

An alternative fix is to be merged from illumos shortly.

6 years agoMFV r323110: 8558 lwp_create() returns EAGAIN on system with more than 80K ZFS filesy...
avg [Mon, 11 Sep 2017 11:31:43 +0000 (11:31 +0000)]
MFV r323110: 8558 lwp_create() returns EAGAIN on system with more than 80K ZFS filesystems

illumos/illumos-gate@216d7723a1a58124cf95c4950d51d5f99d3f4128
https://github.com/illumos/illumos-gate/commit/216d7723a1a58124cf95c4950d51d5f99d3f4128

https://www.illumos.org/issues/8558
  On a system with more than 80K ZFS filesystems, we've seen cases where
  lwp_create() will start to fail by returning EAGAIN. The problem being,
  for each of those 80K ZFS filesystems, a taskq will be created for each
  dataset as part of the ZIL for each dataset.
  For each of these taskq's, a kernel thread will be created which results
  in 24KB being allocated for each thread. With enough of these 24KB
  allocations, we eventually exhaust the memory region set aside for these
  allocations. Currently, segkpsize is set to a value of 2GB, which means
  we can only support about 80K filesystems; 2GB / 24KB = ~80K.
  The lwp_create() failure comes into play due to the fact that LWP
  creation also allocates 24KB from this same region of memory. Thus, if
  we've exhausted this region of memory due to the number of ZIL taskq's,
  there won't be any memory avaible to allow the call to lwp_create() to
  succeed.

FreeBSD note: I haven't created sysctl-s for the new ZIL clean
parameters.  Let's add them if anyone requires to tune them.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>
MFC after: 3 weeks

6 years agoImprove HW type checking in mv_ehci driver
mw [Mon, 11 Sep 2017 10:41:42 +0000 (10:41 +0000)]
Improve HW type checking in mv_ehci driver

This patch adds hwtype parameter which keeps information about hardware
revision of Marvell EHCI controller. It allows to replace multiple
calls to ofw_bus_is_compatible with comparing hwtype value during driver
initialization.

Submitted by: Patryk Duda <pdk@semihalf.com>
Suggested by: ian
Obtained from: Semihalf
Sponsored by: Semihalf

6 years agor323389 breaks the kernel build when WITHOUT_ZFS is defined in src.conf
tsoome [Mon, 11 Sep 2017 07:38:53 +0000 (07:38 +0000)]
r323389 breaks the kernel build when WITHOUT_ZFS is defined in src.conf

Need to add #ifdef EFI_ZFS_BOOT guard into efi/loader/main.c

PR: 222215
Reported by: Sylvain Garrigues

6 years agoAdd infrastructure for allocating multiple MSI-X interrupts. Also
scottl [Mon, 11 Sep 2017 01:51:27 +0000 (01:51 +0000)]
Add infrastructure for allocating multiple MSI-X interrupts.  Also
add more fine-tuned controls for allocating requests and replies.

Sponsored by: Netflix

6 years agoboot1 generate-fat: generate all templates at once
emaste [Mon, 11 Sep 2017 00:37:00 +0000 (00:37 +0000)]
boot1 generate-fat: generate all templates at once

In advance of other changes to the fat template generation process, have
generate-fat.sh create all template files at the same time so that they
cannot get out of sync.

Also correct a longstanding but where BOOT1_OFFSET was overwritten on
each invocation. A previous version of this patch stored a per-arch
offset (e.g. BOOT1_arm64_OFFSET) but that was deemed unnecessary.
Instead just hardcode the known offset that applies to all archs (0x2d)
and fail if the offset happens to be different.

Ongiong work (using newfs_msdos in bsdinstall and adding msdosfs support
to makefs) will eventually allow us to do away with this fat template
hack altogether, but in the near term we have a few improvements that
will build on this.

Reviewed by: allanjude, imp, Eric McCorkle
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10931

6 years agonewvers.sh: speed up failing git-svn revision search
emaste [Mon, 11 Sep 2017 00:14:04 +0000 (00:14 +0000)]
newvers.sh: speed up failing git-svn revision search

In the case of running newvers.sh on a git tree w/o git-svn-id notes we
previously piped the entire 'git log' to grep. Add --grep to the log
invocation to avoid processing log entries of no interest.

This saves about 2-3 seconds of newvers.sh run time on my SSD laptop.
Later changes will bring further speedups.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoAdd information about new src committer (kibab)
kibab [Sun, 10 Sep 2017 20:33:23 +0000 (20:33 +0000)]
Add information about new src committer (kibab)

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

6 years agonewvers.sh: accept "git-svn-id:" at the start of a line only
emaste [Sun, 10 Sep 2017 19:12:01 +0000 (19:12 +0000)]
newvers.sh: accept "git-svn-id:" at the start of a line only

This prevents incorrect subversion revision detection when "git svn" is
not being used to get the sources but git is available. Previously old
subversion revisions included in commit messages were favoured over the
more recent and correct revisions in git notes.

For example cf1f35574722 represents r315395 but was treated as r313908
which is referenced in the commit message. Commits following
r315395/cf1f35574722 but before another commit with a git-svn-id
reference in the commit message would be treated as r313908 as well.

Patch from PR updated to accommodate the initial four space indent in
`git log` ouptut.

PR: 221848
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 2 weeks

6 years agoMove vmmeter atomic counters into dedicated cache lines
mjg [Sun, 10 Sep 2017 19:00:38 +0000 (19:00 +0000)]
Move vmmeter atomic counters into dedicated cache lines

Prior to the change they were subject to extreme false sharing.
In particular this change shaves about 3 seconds real time of -j 80 buildkernel.

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

6 years agoAdd gpio methods to read/write/configure up to 32 pins simultaneously.
ian [Sun, 10 Sep 2017 18:08:25 +0000 (18:08 +0000)]
Add gpio methods to read/write/configure up to 32 pins simultaneously.

Sometimes it is necessary to combine several gpio pins into an ad-hoc bus
and manipulate the pins as a group. In such cases manipulating the pins
individualy is not an option, because the value on the "bus" assumes
potentially-invalid intermediate values as each pin is changed in turn. Note
that the "bus" may be something as simple as a bi-color LED where changing
colors requires changing both gpio pins at once, or something as complex as
a bitbanged multiplexed address/data bus connected to a microcontroller.

In addition to the absolute requirement of simultaneously changing the
output values of driven pins, a desirable feature of these new methods is to
provide a higher-performance mechanism for reading and writing multiple
pins, especially from userland where pin-at-a-time access incurs a noticible
syscall time penalty.

These new interfaces are NOT intended to abstract away all the ugly details
of how gpio is implemented on any given platform. In fact, to use these
properly you absolutely must know something about how the gpio hardware is
organized. Typically there are "banks" of gpio pins controlled by registers
which group several pins together. A bank may be as small as 2 pins or as
big as "all the pins on the device, hundreds of them." In the latter case, a
driver might support this interface by allowing access to any 32 adjacent
pins within the overall collection. Or, more likely, any 32 adjacent pins
starting at any multiple of 32. Whatever the hardware restrictions may be,
you would need to understand them to use this interface.

In additional to defining the interfaces, two example implementations are
included here, for imx5/6, and allwinner. These represent the two primary
types of gpio hardware drivers. imx6 has multiple gpio devices, each
implementing a single bank of 32 pins. Allwinner implements a single large
gpio number space from 1-n pins, and the driver internally translates that
linear number space to a bank+pin scheme based on how the pins are grouped
into control registers. The allwinner implementation imposes the restriction
that the first_pin argument to the new functions must always be pin 0 of a
bank.

Differential Revision: https://reviews.freebsd.org/D11810

6 years agoTo analyze the allocation of swap blocks by blist functions, add a method
alc [Sun, 10 Sep 2017 17:46:03 +0000 (17:46 +0000)]
To analyze the allocation of swap blocks by blist functions, add a method
for analyzing the radix tree structures and reporting on the number, and
sizes, of maximal intervals of free blocks.  The report includes the number
of maximal intervals, and also the number of them in each of several size
ranges, from small (size 1, or 3 to 4) to large (28657 to 46367) with size
boundaries defined by Fibonacci numbers.  The report is written in the test
tool with the 's' command, or in a running kernel by sysctl.

The analysis of the radix tree frequently computes the position of the lone
bit set in a u_daddr_t, a computation that also appears in leaf allocation.
That computation has been moved into a function of its own, and optimized
for cases where an inlined machine instruction can replace the usual binary
search.

Submitted by: Doug Moore <dougm@rice.edu>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11906

6 years agoIf the user tries to set kern.randompid to 1 (which is meaningless), set
des [Sun, 10 Sep 2017 15:01:29 +0000 (15:01 +0000)]
If the user tries to set kern.randompid to 1 (which is meaningless), set
it to a random value between 100 and 1123, rather than 0 as before.

Submitted by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D5336

6 years agoloader.efi: chain loader should provide proper device handle
tsoome [Sun, 10 Sep 2017 13:53:42 +0000 (13:53 +0000)]
loader.efi: chain loader should provide proper device handle

Since the efipart rewrite, the chain command was looking for device
handle using interface applicable only for net devices. Disk
partitions and zfs pools need their own approach to find the proper handle.

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

6 years agoFix typo, TC0->TCO.
kib [Sun, 10 Sep 2017 13:21:54 +0000 (13:21 +0000)]
Fix typo, TC0->TCO.

Submitted by: jhb
MFC after: 1 week

6 years agoAdd definitions of (new) bits for TCO registers from the
kib [Sun, 10 Sep 2017 12:10:27 +0000 (12:10 +0000)]
Add definitions of (new) bits for TCO registers from the
Lewisburg/Sunrise Point documentation.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoStyle: tab after #define.
kib [Sun, 10 Sep 2017 11:57:02 +0000 (11:57 +0000)]
Style: tab after #define.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agonamecache: clean up struct namecache_ts handling
mjg [Sun, 10 Sep 2017 11:17:32 +0000 (11:17 +0000)]
namecache: clean up struct namecache_ts handling

namecache_ts differs from mere namecache by few fields placed mid struct.
The access to the last element (the name) is thus special-cased.

The standard solution is to put new fields at the very beginning anad
embedd the original struct. The pointer shuffled around points to the
embedded part. If needed, access to new fields can be gained through
__containerof.

MFC after: 1 week

6 years agoFix intrhook release in MPR and MPS for EARLY_AP_STARTUP.
scottl [Sun, 10 Sep 2017 07:10:40 +0000 (07:10 +0000)]
Fix intrhook release in MPR and MPS for EARLY_AP_STARTUP.

Reported by: Limelight
Sponsored by: Netflix

6 years agoMore code refactoring in preparation for enabling multiqueue.
scottl [Sun, 10 Sep 2017 04:09:18 +0000 (04:09 +0000)]
More code refactoring in preparation for enabling multiqueue.

Sponsored by: Netflix

6 years agoMFV: r323381
marius [Sun, 10 Sep 2017 01:25:15 +0000 (01:25 +0000)]
MFV: r323381

Permit a deflateParams() parameter change as soon as possible.

This change fixes compression errors seen when the embedded Tomcat
web server of a UniFi Controller zlib compresses responses. Given
that Tomcat just uses Java/OpenJDK which in turn employs zlib for
its compression/decompression support, this bug might very well
affect other applications, too.

PR: 222136

6 years agoConvert some in-line printing of diagnostic into tables.
scottl [Sat, 9 Sep 2017 22:02:36 +0000 (22:02 +0000)]
Convert some in-line printing of diagnostic into tables.

Sponsored by: Netflix

6 years agoIt's been pointed out that init_script at least is useful w/o
imp [Sat, 9 Sep 2017 21:33:43 +0000 (21:33 +0000)]
It's been pointed out that init_script at least is useful w/o
re-rooting. Remove deprecation notice for it. init_chroot likely is
still better served with reroot.

6 years agoFix MTU computation. Coverity scanning usrsctp pointed to this code...
tuexen [Sat, 9 Sep 2017 21:03:40 +0000 (21:03 +0000)]
Fix MTU computation. Coverity scanning usrsctp pointed to this code...

MFC after: 3 days

6 years agoFix a locking issue found by Coverity scanning the usrsctp library.
tuexen [Sat, 9 Sep 2017 20:51:54 +0000 (20:51 +0000)]
Fix a locking issue found by Coverity scanning the usrsctp library.

MFC after: 3 days

6 years agoFix locking issues found by Coverity scanning the usrsctp library.
tuexen [Sat, 9 Sep 2017 20:44:56 +0000 (20:44 +0000)]
Fix locking issues found by Coverity scanning the usrsctp library.

MFC after: 3 days

6 years agoDon't build uart_dev_mvebu unless we're on arm64.
imp [Sat, 9 Sep 2017 20:14:18 +0000 (20:14 +0000)]
Don't build uart_dev_mvebu unless we're on arm64.

This module is specific to a single Marvel board that we currently
only support in 64-bit mode. Remove it from the build otherwise. It
likely should be completely removed, but this unbreaks x86 building.

Noticed by: sbruno@

6 years agoSilence a Coverity warning from scanning the usrsctp library.
tuexen [Sat, 9 Sep 2017 20:08:26 +0000 (20:08 +0000)]
Silence a Coverity warning from scanning the usrsctp library.

MFC after: 3 days

6 years agorevert r323371 in prepartion for a proper fix
sbruno [Sat, 9 Sep 2017 20:07:04 +0000 (20:07 +0000)]
revert r323371 in prepartion for a proper fix

Submitted by: imp

6 years agoSavely remove a chunk from the control queue.
tuexen [Sat, 9 Sep 2017 19:49:50 +0000 (19:49 +0000)]
Savely remove a chunk from the control queue.
This bug was found by Coverity scanning the usrsctp library.

MFC after: 3 days

6 years agor323359 instroduced an ARMv8 only uart(4) device to the tree but placed
sbruno [Sat, 9 Sep 2017 19:19:13 +0000 (19:19 +0000)]
r323359 instroduced an ARMv8 only uart(4) device to the tree but placed
the driver in a place where it will be built for all targets.  x86 doesn't
have all the required build bits for this device.

Move the uart(4) device mvebu to arm64 only.

6 years agoRemove the unnecessary use of a temporary string buffer.
scottl [Sat, 9 Sep 2017 18:39:55 +0000 (18:39 +0000)]
Remove the unnecessary use of a temporary string buffer.

Sponsored by: Netflix

6 years agoStart separating the LSI drivers into per-queue structures. No
scottl [Sat, 9 Sep 2017 18:03:40 +0000 (18:03 +0000)]
Start separating the LSI drivers into per-queue structures.  No
functional change.

Sponsored by: Netflix

6 years agoAdd a vm_page_change_lock() helper, the common code to not relock page
kib [Sat, 9 Sep 2017 17:35:19 +0000 (17:35 +0000)]
Add a vm_page_change_lock() helper, the common code to not relock page
lock if both old and new pages use the same underlying lock.  Convert
existing places to use the helper instead of inlining it.  Use the
optimization in vm_object_page_remove().

Suggested and reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoMark init_chroot and init_script variables as deprecated.
imp [Sat, 9 Sep 2017 16:04:49 +0000 (16:04 +0000)]
Mark init_chroot and init_script variables as deprecated.

6 years agoRemove redundant source and object files.
jonathan [Sat, 9 Sep 2017 13:18:32 +0000 (13:18 +0000)]
Remove redundant source and object files.

Reviewed by: bdrewery, ngie
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12208

6 years agoOnly search the scope ID in ip6_find_dev() for IPv6 addresses which
hselasky [Sat, 9 Sep 2017 12:50:12 +0000 (12:50 +0000)]
Only search the scope ID in ip6_find_dev() for IPv6 addresses which
have a scope ID. Change size of the searched scope ID to the full
16-bits. There can typically be more than 255 interfaces.

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

6 years agoEnable compilation of Marvell NETA controller with arm64 GENERIC
mw [Sat, 9 Sep 2017 11:56:48 +0000 (11:56 +0000)]
Enable compilation of Marvell NETA controller with arm64 GENERIC

This patch enables network operation on Marvell Armada 3700 SoC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12259

6 years agoAdd support for Armada 3700 in the NETA driver
mw [Sat, 9 Sep 2017 11:54:04 +0000 (11:54 +0000)]
Add support for Armada 3700 in the NETA driver

This patch enables using NETA driver on Marvell Armada 3700 SoC
by introducing new compatible string, modifying clock source
obtaining and also excluding unnecessary parts.
The driver is added as a build option for arm64 platforms as well.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12258

6 years agoStore virtual address of buffer in mvneta_rx_ring
mw [Sat, 9 Sep 2017 11:49:36 +0000 (11:49 +0000)]
Store virtual address of buffer in mvneta_rx_ring

Now the virtual address of received buffer is taken from a software ring.
Thanks to this, we can use the NETA driver on 64 bits architecture and
avoid 32-bit buf_cookie descriptor field limitation.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12257

6 years agoAdd support for uart_mvebu driver arm64 GENERIC config
mw [Sat, 9 Sep 2017 11:46:34 +0000 (11:46 +0000)]
Add support for uart_mvebu driver arm64 GENERIC config

This patch enables console output on Armada 3700 SoCs
with kernel GENERIC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12251

6 years agoIntroduce UART driver module for Armada 3700
mw [Sat, 9 Sep 2017 11:42:32 +0000 (11:42 +0000)]
Introduce UART driver module for Armada 3700

This patch adds support for UART in Armada 3700 family.
It exposes both low-level UART interface, as well as
standard driver methods.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12250

6 years agoEnable compilation of Marvell EHCI driver in arm64 GENERIC
mw [Sat, 9 Sep 2017 11:16:10 +0000 (11:16 +0000)]
Enable compilation of Marvell EHCI driver in arm64 GENERIC

Enabled driver can be used on boards equipped with Marvell Armada 3700 SoC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12256

6 years agoAdd support for Armada 3700 EHCI
mw [Sat, 9 Sep 2017 11:06:58 +0000 (11:06 +0000)]
Add support for Armada 3700 EHCI

This patch reuses ehci_mv driver by adding a support for the new
compatible string and adding ehci_mv.c to list of available options
for arm64 platforms.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12255

6 years agoAdd support for AHCI in Armada 3700
mw [Sat, 9 Sep 2017 11:01:44 +0000 (11:01 +0000)]
Add support for AHCI in Armada 3700

This patch simply AHCI generic driver by extending compatible list.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12254

6 years agoMFV r323107: 8414 Implemented zpool scrub pause/resume
avg [Sat, 9 Sep 2017 11:00:07 +0000 (11:00 +0000)]
MFV r323107: 8414 Implemented zpool scrub pause/resume

illumos/illumos-gate@1702cce751c5cb7ead878d0205a6c90b027e3de8
https://github.com/illumos/illumos-gate/commit/1702cce751c5cb7ead878d0205a6c90b027e3de8

FreeBSD note:  rather than merging the zpool.8 update I copied the zpool
scrub section from the illumos zpool.1m to FreeBSD zpool.8 almost
verbatim.  Now that the illumos page uses the mdoc format, it was an
easier option.  Perhaps the change is not in perfect compliance with the
FreeBSD style, but I think that it is acceptible.

https://www.illumos.org/issues/8414
  This issue tracks the port of scrub pause from ZoL: https://github.com/zfsonlinux/zfs/pull/6167
  Currently, there is no way to pause a scrub. Pausing may be useful when
  the pool is busy with other I/O to preserve bandwidth.

  Description

  This patch adds the ability to pause and resume scrubbing.  This is achieved
  by maintaining a persistent on-disk scrub state.  While the state is 'paused'
  we do not scrub any more blocks.  We do however perform regular scan
  housekeeping such as freeing async destroyed and deadlist blocks while paused.

  Motivation and Context

  Scrub pausing can be an I/O intensive operation and people have been asking
  for the ability to pause a scrub for a while. This allows one to preserve scrub
  progress while freeing up bandwidth for other I/O.

Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Alek Pinchuk <apinchuk@datto.com>

MFC after: 2 weeks

6 years agoEnable compilation of Marvell XHCI driver in arm64 GENERIC
mw [Sat, 9 Sep 2017 10:58:45 +0000 (10:58 +0000)]
Enable compilation of Marvell XHCI driver in arm64 GENERIC

Enabled driver can be used on boards equipped with Marvell Armada
3700/7k/8k SoCs.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12253

6 years agoAdd support for xhci in Armada 3700 and 7k/8k
mw [Sat, 9 Sep 2017 10:54:13 +0000 (10:54 +0000)]
Add support for xhci in Armada 3700 and 7k/8k

This driver will be used by Marvell Armada 3700 and 7k/8k SoC families.
The same, generic xhci device also appears in Armada 380, so we are reusing
driver.

This patch also adds xhci_mv.c entry to the arm64 files list.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D12252

6 years agoThe combination of IPv6 and SCTP is also supported.
tuexen [Sat, 9 Sep 2017 07:48:58 +0000 (07:48 +0000)]
The combination of IPv6 and SCTP is also supported.

MFC after: 1 week

6 years agoResolve IPv6 scope ID issues when using ip6_find_dev() in the LinuxKPI.
hselasky [Sat, 9 Sep 2017 07:21:27 +0000 (07:21 +0000)]
Resolve IPv6 scope ID issues when using ip6_find_dev() in the LinuxKPI.

Workaround problem that ifa_ifwithaddr() also matches the scope ID of
the IPv6 address when searching for a maching IPv6 address. For now
simply try all valid scope IDs until a match is found.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRemove unsafe access to the LinuxKPI file structure from ibcore.
hselasky [Sat, 9 Sep 2017 06:34:20 +0000 (06:34 +0000)]
Remove unsafe access to the LinuxKPI file structure from ibcore.
selwakeup() is now done by the wake_up() family of functions.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoProperly implement poll_wait() in the LinuxKPI. This prevents direct
hselasky [Sat, 9 Sep 2017 06:29:29 +0000 (06:29 +0000)]
Properly implement poll_wait() in the LinuxKPI. This prevents direct
use of the linux_poll_wakeup() function from unsafe contexts, which
can lead to use-after-free issues.

Instead of calling linux_poll_wakeup() directly use the wake_up()
family of functions in the LinuxKPI to do this.

Bump the FreeBSD version to force recompilation of external kernel modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoUnbreak :broken_pipe
ngie [Sat, 9 Sep 2017 06:24:21 +0000 (06:24 +0000)]
Unbreak :broken_pipe

- Capture exit code in pipeline and test in output.
- Drop awk use in favor of `sleep 2`. This helps guarantee the EPIPE
  behavior without the potential race.

6 years agoAdd more sanity checks to linux_fget() in the LinuxKPI. This prevents
hselasky [Sat, 9 Sep 2017 06:04:05 +0000 (06:04 +0000)]
Add more sanity checks to linux_fget() in the LinuxKPI. This prevents
returning pointers to file descriptors which were not created by the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix riscv and powerpc compilation after r323329.
mjg [Sat, 9 Sep 2017 05:56:04 +0000 (05:56 +0000)]
Fix riscv and powerpc compilation after r323329.

On these archs bzero is a C function, which triggers a compilation error
as the compiler tries to expand the macro.

6 years agoCheck result of seq call and save output via atf_check -o
ngie [Sat, 9 Sep 2017 05:50:47 +0000 (05:50 +0000)]
Check result of seq call and save output via atf_check -o

This ensures that seq outputting to ints will not fail as silently if there's
an error.

6 years agocxgbe(4): Fix a couple of problems in the sge_wrq data path.
np [Sat, 9 Sep 2017 05:12:14 +0000 (05:12 +0000)]
cxgbe(4): Fix a couple of problems in the sge_wrq data path.

- start_wrq_wr must not drain the wr_list if there are incomplete_wrs
  pending.  This can happen when a t4_wrq_tx runs between two
  start_wrq_wr.

- commit_wrq_wr must examine the cookie's pidx and ndesc with the
  queue's lock held.  Otherwise there is a bad race when incomplete WRs
  are being completed and commit_wrq_wr for the WR that is ahead in the
  queue updates the next incomplete WR's cookie's pidx/ndesc but the
  commit_wrq_wr for the second one is using stale values that it read
  without the lock.

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoThe purge option hasn't been implemented since 1994 when we imported this
gordon [Sat, 9 Sep 2017 03:09:02 +0000 (03:09 +0000)]
The purge option hasn't been implemented since 1994 when we imported this
code. I think it is safe to say it's not going to be. I'm also working to
de-orbit catman, so remove the reference in the manpage.

Reviewed by: allanjude

6 years agoClarify that the size option is in bytes by default, but also accepts the
ian [Sat, 9 Sep 2017 02:28:21 +0000 (02:28 +0000)]
Clarify that the size option is in bytes by default, but also accepts the
usual SI suffixes.

6 years agoAdd P5021 and P5040 conditions for LAW count check.
jhibbits [Sat, 9 Sep 2017 02:19:44 +0000 (02:19 +0000)]
Add P5021 and P5040 conditions for LAW count check.

P5040/P5021 have the same number of LAWs as P5020.  There may be a better way of
getting the count from the FDT (fsl,num-laws property on soc/corenet-law or
soc/ecm-law), but that's not supported everywhere, so we still need this check
for those other cases.

6 years agoAdd some more PVR and SVR defines
jhibbits [Sat, 9 Sep 2017 02:08:22 +0000 (02:08 +0000)]
Add some more PVR and SVR defines

These processors may not be supported yet, but add them for completion.

POWER9 is planned for support.  e300 may work (based on 603e core).
P5040/P5021 are similar to P5020, so should work as well.  One addition is
needed for P5040, to support the number of LAWs, and will be a separate commit.

6 years agoFix information leak in geli(8) integrity mode
cem [Sat, 9 Sep 2017 01:41:01 +0000 (01:41 +0000)]
Fix information leak in geli(8) integrity mode

In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several
physical sectors (e.g., 512 bytes) on the backing device.  Due to hash
overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors.
This means that only 288 bytes (256 data + 32 hash) of the last 512 byte
sector are used.

The memory allocation used to store the encrypted data to be written to the
physical sectors comes from malloc(9) and does not use M_ZERO.

Previously, nothing initialized the final physical sector backing each
logical sector, aside from the hash + encrypted data portion.  So 224 bytes
of kernel heap memory was leaked to every block :-(.

This patch addresses the issue by initializing the trailing portion of the
physical sector in every logical sector to zeros before use.  A much simpler
but higher overhead fix would be to tag the entire allocation M_ZERO.

PR: 222077
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: emaste
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12272

6 years agoRefactor interrupt allocation and deallocation. Add some extra
scottl [Fri, 8 Sep 2017 20:20:35 +0000 (20:20 +0000)]
Refactor interrupt allocation and deallocation.  Add some extra
diagnostics.  No other functional changes.

Sponsored by: Netflix

6 years agoAllow __builtin_memset instead of bzero for small buffers of known size
mjg [Fri, 8 Sep 2017 20:09:14 +0000 (20:09 +0000)]
Allow __builtin_memset instead of bzero for small buffers of known size

In particular this eliminates function calls and related register save/restore
when only few writes would suffice.

Example speed up can be seen in a fstat microbenchmark on AMD Ryzen cpus, where
the throughput went up by ~4.5%.

Thanks to cem@ for benchmarking and reviewing the patch.

MFC after: 1 week

6 years agoEnhance qpi.c to make it usable on all Core-microarchitecture Xeons.
kib [Fri, 8 Sep 2017 19:51:03 +0000 (19:51 +0000)]
Enhance qpi.c to make it usable on all Core-microarchitecture Xeons.

Scan all buses for CSR bus, not stopping on the first failed
match. Scan all slots for function 0 on the found bus, for instance on
IvyBridge the slot 0 is not decoded at all. Since the scan is quite
unsafe, and access to the buses is mostly useful for developers,
enable the csr buses scan with the tunable.

Current qpi.c makes too many assumptions about the uncore
configuration buses location and about slots occupied.  Also it
restricts itself only to Nehalem CPUs.  It is needed on all Core-based
Xeons.  On the 2600 v2 (IvyBridge) machine I have access to, the CSR
buses have numbers 31 (BSP socket) and 63 (second socket), and there
is no functions pci0.31.0.0 or pci0.63.0.0.  According to the CPU
datasheet, all devices on the uncore bus occupy slots >= 8.

Practically, the attach to config buses is required for the intel-pcm
pcm-memory.x tool to work, for instance.

Reviewed by: jhb (previous version)
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D12268

6 years agoUse IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
kib [Fri, 8 Sep 2017 19:45:37 +0000 (19:45 +0000)]
Use IOAPIC PCI rid as the interrupt TLP source id for DMAR interrupt
remapping.

VT-d specification requires use of PCI rid as source id for IOAPICs
enumerated by PCI bus.  The values from the DMAR ACPI table should be
only used when IOAPIC is not on PCI.

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

6 years agoAdd an ioapic_get_rid() function to obtain PCIe TLP requester-id for
kib [Fri, 8 Sep 2017 19:39:20 +0000 (19:39 +0000)]
Add an ioapic_get_rid() function to obtain PCIe TLP requester-id for
the interrupt messages from given IOAPIC, if the IOAPIC can be
enumerated on PCI bus.

If IOAPIC has PCI binding, match the PCI device against MADT
enumerated IOAPIC.  Match is done first by registers window physical
address, then by IOAPIC ID as read from the APIC ID register.

PCI bsf address of the matched PCI device is the rid.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Hardware provided by: Intel
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12205

6 years agoAdd a constant specifying the min size of the IOAPIC registers window.
kib [Fri, 8 Sep 2017 19:25:11 +0000 (19:25 +0000)]
Add a constant specifying the min size of the IOAPIC registers window.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoTweak comment for install -S usage since it does not impact the build.
bdrewery [Fri, 8 Sep 2017 19:20:42 +0000 (19:20 +0000)]
Tweak comment for install -S usage since it does not impact the build.

The -S flag is currently ignored for builds since we filter through
tools/install.sh that is intended for both non-root and cross-builds.

Sponsored by: Dell EMC Isilon
X-MFC-With: r322565

6 years agoCorrect bintime32 declaration: uint32_t sec -> time32_t sec.
sobomax [Fri, 8 Sep 2017 18:32:13 +0000 (18:32 +0000)]
Correct bintime32 declaration: uint32_t sec -> time32_t sec.

Submitted by: jhb
MFC after: 1 month

6 years agoAdded support for displaying HW port stats using sysctl.
shurd [Fri, 8 Sep 2017 18:03:34 +0000 (18:03 +0000)]
Added support for displaying HW port stats using sysctl.

This provides port stats (updated once per second) in
dev.bnxt.X.port_stats for PFs.  VFs do not have access to the port stats.

Submitted by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Reviewed by: shurd, sbruno
Approved by: sbruno (mentor)
Sponsored by: Broadcom Limited
Differential Revision: https://reviews.freebsd.org/D11914

6 years agoFix intrhook release in MFI as well
scottl [Fri, 8 Sep 2017 17:51:19 +0000 (17:51 +0000)]
Fix intrhook release in MFI as well

6 years agoAs with r323317, hold off on releasing the intrhook during boot until
scottl [Fri, 8 Sep 2017 17:40:29 +0000 (17:40 +0000)]
As with r323317, hold off on releasing the intrhook during boot until
we're ready to accept probing from GEOM.  Untested, but the pattern is
the same as with aac.

6 years agoMove the intrhook release to later in the function so that GEOM knows to wait longer
scottl [Fri, 8 Sep 2017 16:52:59 +0000 (16:52 +0000)]
Move the intrhook release to later in the function so that GEOM knows to wait longer
for possible root devices to come online.  This fixes a race that seems to be
triggered by EARLY_AP_STARTUP.

Submitted by: cgull@glup.org

6 years agolibgeom: Remove redundant and duplicated code
cem [Fri, 8 Sep 2017 15:44:52 +0000 (15:44 +0000)]
libgeom: Remove redundant and duplicated code

In g_open(), g_device_path_open().

No functional change.

Sponsored by: Dell EMC Isilon

6 years agogeom_virstor: Remove wholly unnecessary g_metadata_store copy
cem [Fri, 8 Sep 2017 15:38:02 +0000 (15:38 +0000)]
geom_virstor: Remove wholly unnecessary g_metadata_store copy

Just code cleanup.  No functional change.

Sponsored by: Dell EMC Isilon

6 years agoAudit userspace geom code for leaking memory to disk
cem [Fri, 8 Sep 2017 15:08:17 +0000 (15:08 +0000)]
Audit userspace geom code for leaking memory to disk

Any geom class using g_metadata_store, as well as geom_virstor which
duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes
of userspace memory following the metadata block stored. This is most or all
geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath,
graid3, gshsec, gstripe, and geom_virstor).

PR: 222077 (comment #3)
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: des
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12269

6 years agoFix malloc() uses in em_get_regs().
kib [Fri, 8 Sep 2017 14:54:07 +0000 (14:54 +0000)]
Fix malloc() uses in em_get_regs().

Do not use malloc(M_NOWAIT), wait is possible there, and the malloc
failures where not checked.  Do not forget to free malloced memory.

Reported and tested by: pho
Approved by: sbruno
Sponsored by: The FreeBSD Foundation

6 years agoConsistently use tabs for indent.
kib [Fri, 8 Sep 2017 10:39:28 +0000 (10:39 +0000)]
Consistently use tabs for indent.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoNot all CPUs handle reading ID_AA64MMFR2_EL1 (e.g. qemu), disable it for now.
andrew [Fri, 8 Sep 2017 08:02:06 +0000 (08:02 +0000)]
Not all CPUs handle reading ID_AA64MMFR2_EL1 (e.g. qemu), disable it for now.

Sponsored by: DARPA, AFRL

6 years agonamecache: fold the unlock label into the only consumer
mjg [Fri, 8 Sep 2017 06:57:11 +0000 (06:57 +0000)]
namecache: fold the unlock label into the only consumer

No functional changes.

MFC after: 1 week

6 years agonamecache: factor out dot lookup into a dedicated function
mjg [Fri, 8 Sep 2017 06:51:33 +0000 (06:51 +0000)]
namecache: factor out dot lookup into a dedicated function

The intent is to move uncommon cases out of the way.

MFC after: 1 week