freebsd.git
6 years agogcc builds: reenable -Wstrict-overflow for kern.mk
rlibby [Thu, 14 Sep 2017 03:42:41 +0000 (03:42 +0000)]
gcc builds: reenable -Wstrict-overflow for kern.mk

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12284

6 years agogcc builds: reenable -Wstrict-overflow for bsd.sys.mk
rlibby [Thu, 14 Sep 2017 03:41:49 +0000 (03:41 +0000)]
gcc builds: reenable -Wstrict-overflow for bsd.sys.mk

This effectively reverts r304877, after having relegated the warning
suppression to the zic(8) makefile in r323572.

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
X-Differential Revision: https://reviews.freebsd.org/D12284

6 years agozic: -Wno-error=strict-overflow
rlibby [Thu, 14 Sep 2017 03:39:42 +0000 (03:39 +0000)]
zic: -Wno-error=strict-overflow

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
X-Differential Revision: https://reviews.freebsd.org/D12284

6 years agoUse soref() in sendfile(2) instead fhold() to reference a socket.
glebius [Wed, 13 Sep 2017 22:11:05 +0000 (22:11 +0000)]
Use soref() in sendfile(2) instead fhold() to reference a socket.

The problem is that fdrop() requires syscall context, as it may
enter sleep in some cases.  The reason to use it in the original
non-blocking sendfile implementation, was to avoid use of global
ACCEPT_LOCK() on every I/O completion. Now in head sorele() no
longer requires this lock.

6 years agoWiden uk_pgoff, the slab header offset field.
markj [Wed, 13 Sep 2017 21:54:37 +0000 (21:54 +0000)]
Widen uk_pgoff, the slab header offset field.

16 bits is only wide enough for kegs with an item size of up to 64KB.
At that size or larger, slab headers are typically offpage because the
item size is a multiple of the page size, but there is no requirement
that this be the case.

We can widen the field without affecting the layout of struct uma_keg
since the removal of uk_slabsize in r315077 left an adjacent hole.

PR: 218911
MFC after: 2 weeks

6 years agoRemove inline specifier from vm_page_free_wakeup(), do not
kib [Wed, 13 Sep 2017 19:30:09 +0000 (19:30 +0000)]
Remove inline specifier from vm_page_free_wakeup(), do not
micro-manage compiler.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoDo not relock free queue mutex for each page, free whole terminating
kib [Wed, 13 Sep 2017 19:22:07 +0000 (19:22 +0000)]
Do not relock free queue mutex for each page, free whole terminating
object' page queue under the single mutex lock.

First, all pages on the queue are prepared for free by calls to
vm_page_free_prep(), and pages which should not be returned to the
physical allocator (e.g. wired or fictitious) are simply removed from
the queue.  On the second pass, vm_page_free_phys_pglist() inserts all
pages from the queue without relocking the mutex.

The change improves the object termination, e.g. on the process exit
where large anonymous memory objects otherwise cause relocks the free
queue mutex for each page.  More, if several such processes are
exiting or execing in parallel, the mutex was highly contended on
the address space demolition.

Diagnosed and tested by: mjg (previous version)
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoSplit vm_page_free_toq() into two parts, preparation vm_page_free_prep()
kib [Wed, 13 Sep 2017 19:11:52 +0000 (19:11 +0000)]
Split vm_page_free_toq() into two parts, preparation vm_page_free_prep()
and insertion into the phys allocator free queues vm_page_free_phys().
Also provide a wrapper vm_page_free_phys_pglist() for batched free.

Reviewed by: alc, markj
Tested by: mjg (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoUse existing tag name for the vm_object' memq.
kib [Wed, 13 Sep 2017 19:03:59 +0000 (19:03 +0000)]
Use existing tag name for the vm_object' memq.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoRemove an unneeded sentence stop.
gjb [Wed, 13 Sep 2017 18:32:43 +0000 (18:32 +0000)]
Remove an unneeded sentence stop.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoRetire the T3 iWARP and TOE drivers. This saves catch-up work when OFED or
np [Wed, 13 Sep 2017 17:49:23 +0000 (17:49 +0000)]
Retire the T3 iWARP and TOE drivers.  This saves catch-up work when OFED or
other kernel infrastructure changes.

Note that this doesn't affect the base cxgb(4) NIC driver for T3 at all.

MFC after: No MFC.
Sponsored by: Chelsio Communications

6 years agointpm(4): Decrease requested i/o port range width
cem [Wed, 13 Sep 2017 17:43:18 +0000 (17:43 +0000)]
intpm(4): Decrease requested i/o port range width

On some AMD FCH devices driven by intpm(4) (read: mine), the SMBus I/O port
range is split in two and the low range is only 0x10 wide.  intpm(4) does
not access any registers above 0x0f, so there is no need for the wider
range.

Discussed with: avg
Sponsored by: Dell EMC Isilon

6 years agoIncrease EFI boot file size frok 128k to 384k
allanjude [Wed, 13 Sep 2017 17:00:02 +0000 (17:00 +0000)]
Increase EFI boot file size frok 128k to 384k

generate_fat.sh does the following:
- create an 800kb zero-filled file
- create an md device backed by this file
- format the device fat12
- mount the filesystem
- create the EFI ESP directory structure
- create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, etc)
- Adds a marker to the beginning of the file, and pad it to 384kb
- 384kb was chosen as it is less than half of 800kb, thus allowing
  users to keep a backup of their older boot file in the small partition
- Unmount the filesystem
- Scan the image and find the offset where the marker was inserted
- The process requires root, to make image generation easier, images for
  each architecture are pregenerated, compressed with xz, and checked
  into svn.

The Makefile that generates boot1.efifat does the following:
- Ensure the compiled boot1.efi file is no larger than the generated image
- Decompress the template created by generate-fat.sh
- dd the contents of boot1.efi into boot1.efifat starting at the offset
  where the marker is found. This allows any file less than the maximum
  size to be written into the fat filesystem without having to mount it,
  so no root privileges are required.

Later work by imp and myself makes bsdinstall create a 200mb fat16 instead
of using this process, but it is retained to make image generation easier.

Submitted by: Eric McCorkle (original version)
Reviewed by: emaste, tsoome, Eric McCorkle
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9680

6 years agoDefer attaching and probing iicbus and its children until interrupts are
ian [Wed, 13 Sep 2017 16:54:27 +0000 (16:54 +0000)]
Defer attaching and probing iicbus and its children until interrupts are
available, in i2c controller drivers that require interrupts for transfers.

This is the result of auditing all 22 existing drivers that attach iicbus.
These drivers were the only ones remaining that require interrupts and were
not using config_intrhook to defer attachment.  That has led, over the
years, to various i2c slave device drivers needing to use config_intrhook
themselves rather than performing bus transactions in their probe() and
attach() methods, just in case they were attached too early.

6 years agoFix two issues with not ready data in sockets (read: sendfile)
glebius [Wed, 13 Sep 2017 16:47:23 +0000 (16:47 +0000)]
Fix two issues with not ready data in sockets (read: sendfile)
in UNIX sockets.

o Check that socket is still connected in uipc_ready(). If not
  we are responsible to free mbufs.
o In uipc_send() if socket appears to be disconnected, but we
  are sending data with pending I/Os, don't free mbufs.

Reported by: Kevin Bowling <kbowling llnw.com>
Tested by: Kevin Bowling <kbowling llnw.com>
PR: 222259
Reported by: Mark Martinec <Mark.Martinec ijs.si>
MFC after: 3 days

6 years agointpm(4): While here, remove redundant 'res' check
cem [Wed, 13 Sep 2017 16:43:31 +0000 (16:43 +0000)]
intpm(4): While here, remove redundant 'res' check

Reported by: avg
Sponsored by: Dell EMC Isilon

6 years agoDeorbit catman. The tradeoff of disk for performance has long since tipped
gordon [Wed, 13 Sep 2017 16:35:16 +0000 (16:35 +0000)]
Deorbit catman. The tradeoff of disk for performance has long since tipped
in favor of just rendering the manpage instead of relying on pre-formatted
catpages. Note, this does not impede the ability to use existing catpages,
it just removes the utility to generate them.

Reviewed by: imp, allanjude
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D12317

6 years agointpm(4): Do not attach if io_res can not be allocated
cem [Wed, 13 Sep 2017 16:23:59 +0000 (16:23 +0000)]
intpm(4): Do not attach if io_res can not be allocated

Attempts to use the driver without an io_res result in immediate panic.

Sponsored by: Dell EMC Isilon

6 years agolibedit: add missing bracket.
pfg [Wed, 13 Sep 2017 16:13:14 +0000 (16:13 +0000)]
libedit: add missing bracket.

We never hit this because we always build with widechar support.

Reported by: cognet
MFC after: 3 days

6 years agoFix a logic error in the item size calculation for internal UMA zones.
markj [Wed, 13 Sep 2017 15:44:54 +0000 (15:44 +0000)]
Fix a logic error in the item size calculation for internal UMA zones.

Kegs for internal zones always keep the slab header in the slab itself.
Therefore, when determining the allocation size, we need to take the
slab header size into account.

Reported and tested by: ae, rakuco
Reviewed by: avg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12342

6 years agoDon't (try to) build lio(4) if the SOURCELESS_UCODE is set.
sbruno [Wed, 13 Sep 2017 15:17:35 +0000 (15:17 +0000)]
Don't (try to) build lio(4) if the SOURCELESS_UCODE is set.

Submitted by: Fabien Keil <fk@fabiankeil.de>

6 years agoIncrease arm{,64} SoC image sizes to prevent "filesystem full" build
gjb [Wed, 13 Sep 2017 14:30:30 +0000 (14:30 +0000)]
Increase arm{,64} SoC image sizes to prevent "filesystem full" build
failures.

Sponsored by: The FreeBSD Foundation

6 years agolibefi: efipart_realstrategy rsize pointer may be NULL
tsoome [Wed, 13 Sep 2017 14:27:13 +0000 (14:27 +0000)]
libefi: efipart_realstrategy rsize pointer may be NULL

Need to check rsize before dereferencing it.

6 years agojedec_ts: add many more devices from various vendors
avg [Wed, 13 Sep 2017 13:03:29 +0000 (13:03 +0000)]
jedec_ts: add many more devices from various vendors

The new IDs are taken from the hardware to which I have access
and from open datasheets.

Also, the hardware probing is moved to the device probe method.

Reviewed by: rpokala
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11730

6 years agoqlnx: exclude if WITHOUT_SOURCELESS_UCODE set
emaste [Wed, 13 Sep 2017 12:16:27 +0000 (12:16 +0000)]
qlnx: exclude if WITHOUT_SOURCELESS_UCODE set

PR: 222277
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agoAdd MMCCAM-enabled kernel config for IMX6, reduce debug noice in MMCCAM kernels
kibab [Wed, 13 Sep 2017 10:56:02 +0000 (10:56 +0000)]
Add MMCCAM-enabled kernel config for IMX6, reduce debug noice in MMCCAM kernels

CAM_DEBUG_TRACE results in way too much debug output than needed now.
When debugging, it's always possible to turn on trace level using camcontrol.

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

6 years agoMFV r323527: 5815 libzpool's panic function doesn't set global panicstr, ::status...
avg [Wed, 13 Sep 2017 10:34:31 +0000 (10:34 +0000)]
MFV r323527: 5815 libzpool's panic function doesn't set global panicstr, ::status not as useful

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

https://www.illumos.org/issues/5815
  When panic() is called from within ztest, the mdb ::status command isn't as
  useful as it could be since the global panicstr variable isn't updated. We
  should modify the function to make sure panicstr is set, so ::status can
  present the error message just like it does on a failed assertion.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>
MFC after: 4 weeks

6 years agoMFV r323523: 8331 zfs_unshare returns wrong error code for smb unshare failure
avg [Wed, 13 Sep 2017 10:23:55 +0000 (10:23 +0000)]
MFV r323523: 8331 zfs_unshare returns wrong error code for smb unshare failure

illumos/illumos-gate@4f4378cc54b7deec3a35c529dc397dbdc325b4bb
https://github.com/illumos/illumos-gate/commit/4f4378cc54b7deec3a35c529dc397dbdc325b4bb

https://www.illumos.org/issues/8331
  zfs_unshare returns EZFS_UNSHARENFSFAILED on error for all share types.

Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Andrew Stormont <astormont@racktopsystems.com>

MFC after: 4 weeks

6 years agoMFV r316932: 6280 libzfs: unshare_one() could fail with EZFS_SHARENFSFAILED
avg [Wed, 13 Sep 2017 10:22:09 +0000 (10:22 +0000)]
MFV r316932: 6280 libzfs: unshare_one() could fail with EZFS_SHARENFSFAILED

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

https://www.illumos.org/issues/6280
  The unshare_one() in libzfs could fail with EZFS_SHARENFSFAILED at line 834
  here:
  831    /* make sure libshare initialized */
  832    if ((err = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
  833        free(mntpt);    /* don't need the copy anymore */
  834        return (zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
  835            dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"),
  836            name, _sa_errorstr(err)));
  837    }
  The correct error should be EZFS_UNSHARENFSFAILED instead.

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Marcel Telka <marcel.telka@nexenta.com>

MFC after: 4 weeks

6 years agoslightly simplify zfs_vptocnp
avg [Wed, 13 Sep 2017 07:09:58 +0000 (07:09 +0000)]
slightly simplify zfs_vptocnp

It's not necessary to look up the parent's ID to check if the node is
the root node of the filesystem.

MFC after: 2 weeks

6 years agoAdd a command line option for using a wider field for displaying
tuexen [Wed, 13 Sep 2017 06:57:52 +0000 (06:57 +0000)]
Add a command line option for using a wider field for displaying
addresses. This allows the table to be consistent when IPv6
addresses have to be printed.
While there, document the -v option in the man page.

Sponsored by: Netflix, Inc.

6 years agocxgbe(4): Ignore capabilities that depend on TOE when the firmware
np [Wed, 13 Sep 2017 06:07:02 +0000 (06:07 +0000)]
cxgbe(4): Ignore capabilities that depend on TOE when the firmware
reports TOE is not available.

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoMinor fixes to edge cases in efi_get_next_variable_name
imp [Wed, 13 Sep 2017 04:32:23 +0000 (04:32 +0000)]
Minor fixes to edge cases in efi_get_next_variable_name

Fix allocating more memory for the names (unlikely to be needed, but
still best to get right) to ask for the length the kernel told use we
needed, not the old length of the variable. Mind the proper NUL that
we add in the space we allocate. Free the old name string before we
allcoate a new one to limit what we leak to the last one (free passed
in name for the last one in the list), and detect the last one by rv
!= 0 and errno == ENOENT, rather then just the former to avoid false
positives if errno happens to be ENOENT on entry.

Sponsored by: Netflix

6 years agoJenkins i386 LINT build uses NOTES to generate its LINT kernel config.
sbruno [Wed, 13 Sep 2017 03:56:03 +0000 (03:56 +0000)]
Jenkins i386 LINT build uses NOTES to generate its LINT kernel config.

ixl(4) isn't in here either, so I'll remove lio(4) too.

6 years agoFix GCC build failure caused by r323516
shurd [Wed, 13 Sep 2017 02:44:50 +0000 (02:44 +0000)]
Fix GCC build failure caused by r323516

No need to declare cold when we #include <sys/systm.h>

Reported by: Jenkins
Reviewed by: sbruno
Approved by: sbruno (mentor)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D12347

6 years agoRoll up iflib commits from github. This pulls in most of the work done
shurd [Wed, 13 Sep 2017 01:18:42 +0000 (01:18 +0000)]
Roll up iflib commits from github.  This pulls in most of the work done
by Matt Macy as well as other changes which he has accepted via pull
request to his github repo at https://github.com/mattmacy/networking/

This should bring -CURRENT and the github repo into close enough sync to
allow small feature branches rather than a large chain of interdependant
patches being developed out of tree.  The reset of the synchronization
should be able to be completed on github by splitting the remaining
changes that are not yet ready into short feature branches for later
review as smaller commits.

Here is a summary of changes included in this patch:

1)  More checks when INVARIANTS are enabled for eariler problem
    detection
2)  Group Task Queue cleanups
    - Fix use of duplicate shortdesc for gtaskqueue malloc type.
      Some interfaces such as memguard(9) use the short description to
      identify malloc types, so duplicates should be avoided.
3)  Allow gtaskqueues to use ithreads in addition to taskqueues
    - In some cases, this can improve performance
4)  Better logging when taskqgroup_attach*() fails to set interrupt
    affinity.
5)  Do not start gtaskqueues until they're needed
6)  Have mp_ring enqueue function enter the ABDICATED rather than BUSY
    state.  This moves the TX to the gtaskq and allows processing to
    continue faster as well as make TX batching more likely.
7)  Add an ift_txd_errata function to struct if_txrx.  This allows
    drivers to inspect/modify mbufs before transmission.
8)  Add a new IFLIB_NEED_ZERO_CSUM for drivers to indicate they need
    checksums zeroed for checksum offload to work.  This avoids modifying
    packet data in the TX path when possible.
9)  Use ithreads for iflib I/O instead of taskqueues
10) Clean up ioctl and support async ioctl functions
11) Prefetch two cachlines from each mbuf instead of one up to 128B.  We
    often need to parse packet header info beyond 64B.
12) Fix potential memory corruption due to fence post error in
    bit_nclear() usage.
13) Improved hang detection and handling
14) If the packet is smaller than MTU, disable the TSO flags.
    This avoids extra packet parsing when not needed.
15) Move TCP header parsing inside the IS_TSO?() test.
    This avoids extra packet parsing when not needed.
16) Pass chains of mbufs that are not consumed by lro to if_input()
    rather call if_input() for each mbuf.
17) Re-arrange packet header loads to get as much work as possible done
    before a cache stall.
18) Lock the context when calling IFDI_ATTACH_PRE()/IFDI_ATTACH_POST()/
    IFDI_DETACH();
19) Attempt to distribute RX/TX tasks across cores more sensibly,
    especially when RX and TX share an interrupt.  RX will attempt to
    take the first threads on a core, and TX will attempt to take
    successive threads.
20) Allow iflib_softirq_alloc_generic() to request affinity to the same
    cpus an interrupt has affinity with.  This allows TX queues to
    ensure they are serviced by the socket the device is on.
21) Add new iflib sysctls to net.iflib:
    - timer_int - interval at which to run per-queue timers in ticks
    - force_busdma
22) Add new per-device iflib sysctls to dev.X.Y.iflib
    - rx_budget allows tuning the batch size on the RX path
    - watchdog_events Count of watchdog events seen since load
23) Fix error where netmap_rxq_init() could get called before
    IFDI_INIT()
24) e1000: Fixed version of r323008: post-cold sleep instead of DELAY
    when waiting for firmware
    - After interrupts are enabled, convert all waits to sleeps
    - Eliminates e1000 software/firmware synchronization busy waits after
      startup
25) e1000: Remove special case for budget=1 in em_txrx.c
    - Premature optimization which may actually be incorrect with
      multi-segment packets
26) e1000: Split out TX interrupt rather than share an interrupt for
    RX and TX.
    - Allows better performance by keeping RX and TX paths separate
27) e1000: Separate igb from em code where suitable
    Much easier to understand separate functions and "if (is_igb)" than
    previous tests like "if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))"

#blamebruno

Reviewed by: sbruno
Approved by: sbruno (mentor)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D12235

6 years agocxgbetool(8): mode must be specified when creating the dump file.
np [Wed, 13 Sep 2017 00:37:42 +0000 (00:37 +0000)]
cxgbetool(8): mode must be specified when creating the dump file.

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoAllow vlan interfaces to rx through netmap(4).
mjoras [Wed, 13 Sep 2017 00:25:09 +0000 (00:25 +0000)]
Allow vlan interfaces to rx through netmap(4).

Normally after receiving a packet, a vlan(4) interface sends the packet
back through its parent interface's rx routine so that it can be
processed as an untagged frame. It does this by using the parent's
ifp->if_input. This is incompatible with netmap(4), which replaces the
vlan(4) interface's if_input with a netmap(4) hook. Fix this by using
the vlan(4) interface's ifp instead of the parent's directly.

Reported by: Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by: rstone
Approved by: rstone (mentor)
MFC after: 3 days
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12191

6 years agoLeave the Cavium Liquid IO driver exist in files, not files.amd64
sbruno [Tue, 12 Sep 2017 23:58:38 +0000 (23:58 +0000)]
Leave the Cavium Liquid IO driver exist in files, not files.amd64

Submitted by: imp

6 years agocam iosched: Limit the quanta default to hz if it's below 200
imp [Tue, 12 Sep 2017 23:46:33 +0000 (23:46 +0000)]
cam iosched: Limit the quanta default to hz if it's below 200

The cam_iosched_ticker() can't be scheduled more than once per tick.
Some limiters depend on quanta matching the number of calls per second
to enforce the proper limits. Limit the quanta to no faster than 1 per
clock tick. This fixes some features when running in VMs where the
default HZ is 100.

PR: 221953
Obtained from: ElectroBSD
Differential Revision: https://reviews.freebsd.org/D12337
Submitted by: Fabian Keil

6 years agoDo not try to build the Cavium Liquidio driver on all architechtures.
sbruno [Tue, 12 Sep 2017 23:42:52 +0000 (23:42 +0000)]
Do not try to build the Cavium Liquidio driver on all architechtures.

For now, limit to amd64 only.

6 years agoThe diff is the initial submission of Cavium Liquidio 2350/2360 10/25G
sbruno [Tue, 12 Sep 2017 23:36:58 +0000 (23:36 +0000)]
The diff is the initial submission of Cavium Liquidio 2350/2360 10/25G
Intelligent NIC driver.

The submission conconsists of firmware binary file and driver sources.

Submitted by: pkanneganti@cavium.com (Prasad V Kanneganti)
Relnotes: Yes
Sponsored by: Cavium Networks
Differential Revision: https://reviews.freebsd.org/D11927

6 years agoWhen doing a non-interactive installation, don't display an interactive
rpokala [Tue, 12 Sep 2017 22:19:21 +0000 (22:19 +0000)]
When doing a non-interactive installation, don't display an interactive
warning about a filesystem which doesn't have a mountpoint. Presumably, the
person who wrote the install script knew what they were doing.

Submitted by: Brian Mueller <bmueller@panasas.com>
MFC after: 1 month
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D12346

6 years agoAdd support for printing the path state for SCTP association.
tuexen [Tue, 12 Sep 2017 21:36:13 +0000 (21:36 +0000)]
Add support for printing the path state for SCTP association.

6 years agoFix incorrect error message in iovctl
rstone [Tue, 12 Sep 2017 21:12:04 +0000 (21:12 +0000)]
Fix incorrect error message in iovctl

If the iovctl command was invoked with only the -C flag, the user would
receive a message claiming that they needed to also supply either the
-d flag or the -f flag.  However, in the case of the -C mode, only the
-f flag is acceptable.  Correct this error message in this case.

PR: 222050
Submitted by: Heinz N. Gies
Reported by: Heinz N. Gies
MFC after: 1 week

6 years agoExport the UDP encapsualation port and the path state.
tuexen [Tue, 12 Sep 2017 21:08:50 +0000 (21:08 +0000)]
Export the UDP encapsualation port and the path state.

6 years agoAdd printing of the remote encapsulation port for SCTP associations.
tuexen [Tue, 12 Sep 2017 21:07:48 +0000 (21:07 +0000)]
Add printing of the remote encapsulation port for SCTP associations.

Sponsored by: Netflix, Inc.

6 years agoRemove spaces from CTL devices' default serial numbers
asomers [Tue, 12 Sep 2017 19:36:24 +0000 (19:36 +0000)]
Remove spaces from CTL devices' default serial numbers

It's awkward to have spaces in CAM device serial numbers. That leads to
such things as device nodes named "/dev/diskid/MYSERIAL%20%20%201". Better
to replace the spaces with "0"s. This change only affects the default
serial numbers for users who don't provide their own.

Reviewed by: ken, mav
MFC after: Never
Relnotes: Yes
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12263

6 years agoAdd self to mentor-mentee data, procedure 1.5.
adridg [Tue, 12 Sep 2017 19:20:24 +0000 (19:20 +0000)]
Add self to mentor-mentee data, procedure 1.5.

Approved by: tcberner (mentor)

6 years agoHandle relocations for newer non-PIC MIPS ABI.
jhb [Tue, 12 Sep 2017 17:46:30 +0000 (17:46 +0000)]
Handle relocations for newer non-PIC MIPS ABI.

Newer binutils supports extensions to the MIPS ABI for non-PIC code
that is used when compiling O32 binaries with clang 5 (but not used
for N64 oddly enough).  These extensions require support for
R_MIPS_COPY relocations as well as a second PLT GOT using
R_MIPS_JUMP_SLOT relocations.

For R_MIPS_COPY, use the same approach as on other architectures where
fixups are deferred to the MD do_copy_relocations.

The additional PLT GOT for jump slots is located in a .got.plt section
which is identified by a DT_MIPS_PLTGOT dynamic entry.  This GOT also
requires fixups for the first two GOT entries just as the normal GOT.
However, the entry point for this second GOT uses a different calling
convention. Rather than passing an offset into the GOT, it passes an
offset into the .rel.plt section.  This requires a second entry point
(_rtld_pltbind_start) which calls the normal _rtld_bind() rather than
_mips_rtld_bind().  This also means providing a real version of
reloc_jmpslot() which is used by _rtld_bind().

In addition, add real implementions of reloc_plt() and
reloc_jmpslots() which walk .rel.plt handling R_MIPS_JUMP_SLOT
relocations.

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

6 years agoEnd softfp->hardfp transition period for arm
imp [Tue, 12 Sep 2017 17:06:35 +0000 (17:06 +0000)]
End softfp->hardfp transition period for arm

On hard-float 32-bit arm platforms, always search for the soft float
binaries in the alternative locations.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D12274
MFC After: 1 week

6 years agoFix DTrace test tst_inet_ntop_d: remove definitions are already in libdtrace
lwhsu [Tue, 12 Sep 2017 16:00:51 +0000 (16:00 +0000)]
Fix DTrace test tst_inet_ntop_d: remove definitions are already in libdtrace

We have D definitions for the named values in socket.h after r323253.  Remove
them in test script to prevent compiling failure.

Reviewed by: markj, gnn
Differential Revision: https://reviews.freebsd.org/D12334

6 years agoAdd a O_CLOEXEC use missed in r323166.
markj [Tue, 12 Sep 2017 14:38:10 +0000 (14:38 +0000)]
Add a O_CLOEXEC use missed in r323166.

PR: 199810
Reported by: Jukka A. Ukkonen <jau789@gmail.com>
MFC after: 3 days

6 years agolibefi: efipart_open should check the status from disk_open
tsoome [Tue, 12 Sep 2017 14:18:45 +0000 (14:18 +0000)]
libefi: efipart_open should check the status from disk_open

In case of error from disk_open(), we should clean up properly.

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

6 years agolibstand: tftp_open() can leak pkt on error
tsoome [Tue, 12 Sep 2017 13:51:18 +0000 (13:51 +0000)]
libstand: tftp_open() can leak pkt on error

The memory can be leaked if we will have pkt set and will get an error
during tftp_open() processing.

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

6 years agoloader should support large_dnode
tsoome [Tue, 12 Sep 2017 13:45:04 +0000 (13:45 +0000)]
loader should support large_dnode

The zfsonlinux feature large_dnode is not yet supported by the loader.

Reviewed by: avg, allanjude
Differential Revision: https://reviews.freebsd.org/D12288

6 years agoAllow TCP connections to be filtered by stack and state.
tuexen [Tue, 12 Sep 2017 13:39:44 +0000 (13:39 +0000)]
Allow TCP connections to be filtered by stack and state.

Choose the command line options to be consistent with the ones of
sockstat.

Sponsored by: Netflix, Inc.

6 years agoAdd support to print the TCP stack being used.
tuexen [Tue, 12 Sep 2017 13:34:43 +0000 (13:34 +0000)]
Add support to print the TCP stack being used.

Sponsored by: Netflix, Inc.

6 years agofix a fallout from the ZTOV tightening, r323479
avg [Tue, 12 Sep 2017 13:21:14 +0000 (13:21 +0000)]
fix a fallout from the ZTOV tightening, r323479

MFC after: 13 days
X-MFC with: r323479

6 years agoSome devices come with the same name as TI devices, so we can't rely on the
cognet [Tue, 12 Sep 2017 10:43:02 +0000 (10:43 +0000)]
Some devices come with the same name as TI devices, so we can't rely on the
"probe" method of those drivers to mean we're on e TI SoC. Introduce a new
function, ti_soc_is_supported(), and use it to be sure we're really a TI
system.

PR: 222250

6 years agozfsctl_snapdir_lookup should be able to handle an uncovered vnode
avg [Tue, 12 Sep 2017 06:06:58 +0000 (06:06 +0000)]
zfsctl_snapdir_lookup should be able to handle an uncovered vnode

The uncovered vnode is possible because there is no guarantee that
its hold count would go to zero (and it would be inactivated and reclaimed)
immediately after a covering filesystem is unmounted.
So, such a vnode should be expected and it is possible to re-use it
without any trouble.

MFC after: 3 weeks
Sponsored by: Panzura

6 years agozfs_ctldir: remove obsolete / bogus ARGSUSED lint directives
avg [Tue, 12 Sep 2017 06:05:30 +0000 (06:05 +0000)]
zfs_ctldir: remove obsolete / bogus ARGSUSED lint directives

None of the tagged functions had unused parameters.

MFC after: 1 week

6 years agozfsvfs_hold: assert that the busied filesystem can not be unmounted
avg [Tue, 12 Sep 2017 06:04:50 +0000 (06:04 +0000)]
zfsvfs_hold: assert that the busied filesystem can not be unmounted

This is a FreeBSD specific feature.

MFC after: 3 weeks
Sponsored by: Panzura

6 years agozfs_get_vfs: reference a requested filesystem instead of vfs_busy-ing it
avg [Tue, 12 Sep 2017 06:04:01 +0000 (06:04 +0000)]
zfs_get_vfs: reference a requested filesystem instead of vfs_busy-ing it

The only consumer of zfs_get_vfs, zfs_unmount_snap, does not need
the filesystem to be busy, it just need a reference that it can pass
to dounmount.

Also, previously the code was racy as it unbusied the filesystem
before taking a reference on it.

Now the code should be simpler and safer.

MFC after: 2 weeks
Sponsored by: Panzura

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