]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFC r306161:
trasz [Sat, 18 Mar 2017 18:05:39 +0000 (18:05 +0000)]
MFC r306161:

Small tweaks to the diskinfo(8) manual page, to make it more consistent
with others.

7 years agoMFC r306160:
trasz [Sat, 18 Mar 2017 18:01:30 +0000 (18:01 +0000)]
MFC r306160:

Add "diskinfo -i", a simple aio-based IOPS benchmark.

7 years agoMFC r306129:
trasz [Sat, 18 Mar 2017 17:59:43 +0000 (17:59 +0000)]
MFC r306129:

Reduce code duplication by factoring out the delta_t() function.
No functional changes.

7 years agoMFC r306096:
trasz [Sat, 18 Mar 2017 17:58:41 +0000 (17:58 +0000)]
MFC r306096:

Cosmetics - add missing newline.

7 years agoMFC r306094:
trasz [Sat, 18 Mar 2017 17:57:47 +0000 (17:57 +0000)]
MFC r306094:

Make it possible for diskinfo(8) to operate on files.  This is useful
with -t and upcoming -i.

7 years agoMFC r315005: sh: Fix executing wrong command with ${x#$(y)}$(z).
jilles [Sat, 18 Mar 2017 16:07:28 +0000 (16:07 +0000)]
MFC r315005: sh: Fix executing wrong command with ${x#$(y)}$(z).

The parsed internal representation of words consists of a byte string with a
list of nodes (commands in command substitution). Each unescaped CTLBACKQ or
CTLBACKQ | CTLQUOTE byte corresponds to an entry in the list.

If param in ${param#%##%%word} is not set, the word is not expanded (in a
deviation of POSIX shared with other ash variants and ksh93). Erroneously,
the pointer in the list of commands (argbackq) was not advanced. This caused
the wrong command to be executed later if the outer word contained another
command substitution.

Example:
  echo "${unsetvar#$(echo a)}$(echo b)"
wrote "a" but should write "b".

7 years agoMFC r315294:
kevlo [Sat, 18 Mar 2017 13:58:25 +0000 (13:58 +0000)]
MFC r315294:
Fix unreachable code in wi_pci_resume().

PR: 217784
Submitted by: Svyatoslav <razmyslov at viva64.com>
Found by: PVS-Studio

7 years agoMFC r315050:
ae [Sat, 18 Mar 2017 10:48:37 +0000 (10:48 +0000)]
MFC r315050:
  Fix the L2 address printed in the "arp: %s moved from %*D" message.

  In the r292978 struct llentry was changed and the ll_addr field become
  the pointer.

  PR: 217667

7 years agoMFC r314717,315085
alc [Sat, 18 Mar 2017 06:05:54 +0000 (06:05 +0000)]
MFC r314717,315085
  Style and punctuation fixes.

  Simplify the control flow and tidy up a comment in map_insert.

7 years agoMFC r315318
alc [Sat, 18 Mar 2017 05:53:09 +0000 (05:53 +0000)]
MFC r315318
  Relax the locking requirements for vm_object_page_noreuse().  While
  reviewing all uses of OFF_TO_IDX(), I observed that
  vm_object_page_noreuse() is requiring an exclusive lock on the object
  when, in fact, a shared lock suffices.

7 years agoMFC r313186
alc [Sat, 18 Mar 2017 05:48:26 +0000 (05:48 +0000)]
MFC r313186
  Over the years, the code and comments in vm_page_startup() have diverged
  in one respect.  When determining how many page structures to allocate,
  contrary to what the comments say, the code does not account for the
  overhead of a page structure per page of physical memory.  This revision
  changes the code to match the comments.

7 years agoMFC r310083
alc [Sat, 18 Mar 2017 05:38:10 +0000 (05:38 +0000)]
MFC r310083
  Tidy up.  Mostly, remove or replace stale comments.  Most of the comments
  in this file actually described the operation of the swap pager, not the
  default pager.  Given that this is the wrong place to discuss the
  implementation of the swap pager, it shouldn't come as a surprise that as
  the swap pager evolved these comments became increasingly stale.  In
  addition, apply some style fixes, like modernizing a few remaining old-
  style function definitions.

7 years agoMFC r309416
alc [Sat, 18 Mar 2017 05:25:23 +0000 (05:25 +0000)]
MFC r309416
  Eliminate a stale comment; vm_radix_prealloc() was replaced in r254141.

7 years agoMFC r315238:
kib [Sat, 18 Mar 2017 03:55:29 +0000 (03:55 +0000)]
MFC r315238:
Use designated initializers for kevent_copyops.

7 years agoMFC r315155:
kib [Sat, 18 Mar 2017 03:49:50 +0000 (03:49 +0000)]
MFC r315155:
Ktracing kevent(2) calls with unusual arguments might leads to an
overly large allocation requests.

PR: 217435

MFC r315237:
Hide kev_iovlen() definition under #ifdef KTRACE.

7 years agoMFC r314996
mmokhi [Fri, 17 Mar 2017 21:03:54 +0000 (21:03 +0000)]
MFC r314996
Fix NULL pointer dereference and panic with shm file pread/pwrite.

Approved by: dchagin

7 years agoMFC r313821 r315277 r315286
vangyzen [Fri, 17 Mar 2017 14:54:10 +0000 (14:54 +0000)]
MFC r313821 r315277 r315286

Use inet_ntoa_r() instead of inet_ntoa() throughout the kernel.

inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer.  Instead, use inet_ntoa_r()
with a buffer on the caller's stack, except for KTR messages.
KTR can correctly log the immediate integral values passed to it,
as well as constant strings, but not non-constant strings,
since they might change by the time ktrdump retrieves them.
Therefore, use hex notation in KTR messages.

Sponsored by: Dell EMC

7 years agoMFC r309856: Postpone ZVOL media/block size caching till first open.
mav [Fri, 17 Mar 2017 11:45:16 +0000 (11:45 +0000)]
MFC r309856: Postpone ZVOL media/block size caching till first open.

At least on FreeBSD there are no legal way to access media or get its
size without opening device/provider first.  Postponing this caching
allows to skip several disk seeks per ZVOL/snapshot during import.

For HDD pool with 1 ZVOL in dev mode with 1000 snapshots this reduces
pool import time from 40 to 10 seconds.

7 years agoMFC r309833: Add missed vfs.zfs.zfetch.max_idistance sysctl.
mav [Fri, 17 Mar 2017 11:44:16 +0000 (11:44 +0000)]
MFC r309833: Add missed vfs.zfs.zfetch.max_idistance sysctl.

7 years agoMFC r308099:
mav [Fri, 17 Mar 2017 11:43:14 +0000 (11:43 +0000)]
MFC r308099:
Add sysctls for zfs_immediate_write_sz and zvol_immediate_write_sz.

7 years agoMFC r308782:
mav [Fri, 17 Mar 2017 07:56:20 +0000 (07:56 +0000)]
MFC r308782:
After some ZIL changes 6 years ago zil_slog_limit got partially broken
due to zl_itx_list_sz not updated when async itx'es upgraded to sync.
Actually because of other changes about that time zl_itx_list_sz is not
really required to implement the functionality, so this patch removes
some unneeded broken code and variables.

Original idea of zil_slog_limit was to reduce chance of SLOG abuse by
single heavy logger, that increased latency for other (more latency critical)
loggers, by pushing heavy log out into the main pool instead of SLOG. Beside
huge latency increase for heavy writers, this implementation caused double
write of all data, since the log records were explicitly prepared for SLOG.
Since we now have I/O scheduler, I've found it can be much more efficient
to reduce priority of heavy logger SLOG writes from ZIO_PRIORITY_SYNC_WRITE
to ZIO_PRIORITY_ASYNC_WRITE, while still leave them on SLOG.

Existing ZIL implementation had problem with space efficiency when it
has to write large chunks of data into log blocks of limited size. In some
cases efficiency stopped to almost as low as 50%. In case of ZIL stored on
spinning rust, that also reduced log write speed in half, since head had to
uselessly fly over allocated but not written areas. This change improves
the situation by offloading problematic operations from z*_log_write() to
zil_lwb_commit(), which knows real situation of log blocks allocation and
can split large requests into pieces much more efficiently. Also as side
effect it removes one of two data copy operations done by ZIL code WR_COPIED
case.

While there, untangle and unify code of z*_log_write() functions.
Also zfs_log_write() alike to zvol_log_write() can now handle writes crossing
block boundary, that may also improve efficiency if ZPL is made to do that.

Sponsored by: iXsystems, Inc.

7 years agoMFC r307397: Add vfs.zfs.zil_log_limit sysctl.
mav [Fri, 17 Mar 2017 07:52:56 +0000 (07:52 +0000)]
MFC r307397: Add vfs.zfs.zil_log_limit sysctl.

It is at least partially broken now, but that is another question.

7 years agoMFC: 314382-314485
sephe [Fri, 17 Mar 2017 02:48:29 +0000 (02:48 +0000)]
MFC: 314382-314485

314382
    hyperv/hn: Simplify RNDIS packet data offset calculation.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9699

314483
    hyperv/hn: Simplify RNDIS packet total length calculation.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9712

314484
    hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned.

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9713

314485
    hyperv/hn: Misaligned chimney sending buffers should not be used

    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D9714

7 years agoMFC r314571:
mm [Thu, 16 Mar 2017 23:07:35 +0000 (23:07 +0000)]
MFC r314571:
Update libarchive to version 3.3.1 (and sync with latest vendor dist)

Notable vendor changes:
  PR #501: improvements in ACL path handling
  PR #724: fix hang when reading malformed cpio files
  PR #864: fix out of bounds read with malformed GNU tar archives
  Documentation, style, test suite improvements and typo fixes.

New options to bsdtar that enable or disable reading and/or writing of:
  Access Control Lists (--acls, --no-acls)
  Extended file flags (--fflags, --no-fflags)
  Extended attributes (--xattrs, --no-xattrs)
  Mac OS X metadata (Mac OS X only) (--mac-metadata, --no-mac-metadata)

7 years agoMFC r314973:
kib [Thu, 16 Mar 2017 15:13:28 +0000 (15:13 +0000)]
MFC r314973:
Avoid bind lock recursion.

7 years agoMFC r308126:
royger [Thu, 16 Mar 2017 09:40:54 +0000 (09:40 +0000)]
MFC r308126:

xen/netfront: fix statistics

PR: 213439

7 years agoMFC r312600,r312601,r312602,r312606,r312646:
mjg [Thu, 16 Mar 2017 09:17:14 +0000 (09:17 +0000)]
MFC r312600,r312601,r312602,r312606,r312646:

vfs: refactor _vn_lock

Stop testing for LK_RETRY and error multiple times. Also postpone the
VI_DOOMED until after LK_RETRY was seen as it reads from the vnode.

No functional changes.

==

vfs: fix whitespace damage in r312600

While here wrap the previously overly long line so that it fits 80 chars.

==

vfs: __predict_false the need to handle F_HASLOCK

Also reorder the check with DTYPE_VNODE. Passed files are vnodes vast
majority of the time, so it is typically true.

==

vfs: fix LK_RETRY logic braino in r312600

==

More style cleanup.  Use ANSI C definition for vn_closefile().  Switch
to VNASSERT in _vn_lock(), simplify messages.

7 years agoMFC r309425,r312645,r312598,r312621:
mjg [Thu, 16 Mar 2017 08:51:30 +0000 (08:51 +0000)]
MFC r309425,r312645,r312598,r312621:

vfs: provide fake locking primitives for the crossmp vnode

Since the vnode is only expected to be shared locked, we can save a
little overhead by only pretending we are locking in the first place.

==

Provide fallback VOP methods for crossmp vnode.

In particular, crossmp vnode might leak into rename code.

==

vfs: hide the getvnode NULL mp message behind DIAGNOSTIC

Since crossmp vnode changes the message was being printed on each boot.

==

Improve debugging printf.

7 years agoMFC r312723:
mjg [Thu, 16 Mar 2017 08:40:47 +0000 (08:40 +0000)]
MFC r312723:

proc: perform a lockless check in sys_issetugid

7 years agoMFC r312889:
mjg [Thu, 16 Mar 2017 08:39:36 +0000 (08:39 +0000)]
MFC r312889:

cache: annotate with __read_mostly and __exclusive_cache_line

7 years agoMFC r312981:
mjg [Thu, 16 Mar 2017 08:38:00 +0000 (08:38 +0000)]
MFC r312981:

cache: use vrefact for '.' lookups and refing the rdir in fullpath

7 years agoMFC r312980:
mjg [Thu, 16 Mar 2017 08:37:05 +0000 (08:37 +0000)]
MFC r312980:

fd: sprinkle __read_mostly and __exclusive_cache_line

7 years agoMFC r309784,r309783:
mjg [Thu, 16 Mar 2017 08:35:27 +0000 (08:35 +0000)]
MFC r309784,r309783:
Use a consistent snapshot of the lock state in owner_mtx().

==

Return a non-NULL owner only if the lock is exclusively held in owner_sx().

Fix some whitespace bugs while here.

============

While here the correct commit message for the previous commit:

MFC r313855 r313865 r313875 r313877 r313878 r313901 r313908 r313928 r313944 r314185 r314476 r314187

    locks: let primitives for modules unlock without always goging to the slsow path

    It is only needed if the LOCK_PROFILING is enabled. It has to always check if
    the lock is about to be released which requires an avoidable read if the option
    is not specified..

==

    sx: fix compilation on UP kernels after r313855

    sx primitives use inlines as opposed to macros. Change the tested condition
    to LOCK_DEBUG which covers the case, but is slightly overzelaous.

==

    mtx: microoptimize lockstat handling in __mtx_lock_sleep

    This saves a function call and multiple branches after the lock is acquired.

==

    mtx: restrict r313875 to kernels without LOCK_PROFILING

==

    mtx: get rid of file/line args from slow paths if they are unused

    This denotes changes which went in by accident in r313877.

    On most production kernels both said parameters are zeroed and have nothing
    reading them in either __mtx_lock_sleep or __mtx_unlock_sleep. Thus this change
    stops passing them by internal consumers which this is the case.

    Kernel modules use _flags variants which are not affected kbi-wise.

==

    sx: fix mips builld after r313855

    The namespace in this file really needs cleaning up. In the meantime
    let inline primitives be defined as long as LOCK_DEBUG is not enabled.

==

    mtx: plug the 'opts' argument when not used

    git-svn-id: svn+ssh://svn.freebsd.org/base/head@313908 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

==

    locks: clean up trylock primitives

    In particular thius reduces accesses of the lock itself.

==

    locks: make trylock routines check for 'unowned' value

    Since fcmpset can fail without lock contention e.g. on arm, it was possible
    to get spurious failures when the caller was expecting the primitive to succeed.

==

    mtx: microoptimize lockstat handling in spin mutexes and thread lock

    While here make the code compilablle on kernels with LOCK_PROFILING but without
    KDTRACE_HOOKS.

==

    KDTRACE_HOOKS isn't guaranteed to be defined. Change to check to see
    if it is defined or not rather than if it is non-zero.

==

    locks: fix compilation with KTR wihout KTR_LOCKS

    While here wrap the overly long line.

7 years agoMFC,r313855,r313865,r313875,r313877,r313878,r313901,r313908,r313928,r313944,r314185...
mjg [Thu, 16 Mar 2017 08:29:09 +0000 (08:29 +0000)]
MFC,r313855,r313865,r313875,r313877,r313878,r313901,r313908,r313928,r313944,r314185,r314476,r314187

    locks: let primitives for modules unlock without always goging to the slsow path

    It is only needed if the LOCK_PROFILING is enabled. It has to always check if
    the lock is about to be released which requires an avoidable read if the option
    is not specified..

==

    sx: fix compilation on UP kernels after r313855

    sx primitives use inlines as opposed to macros. Change the tested condition
    to LOCK_DEBUG which covers the case, but is slightly overzelaous.

commit a39b839d16cd72b1df284ccfe6706fcdf362706e
Author: mjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Date:   Sat Feb 18 22:06:03 2017 +0000

    locks: clean up trylock primitives

    In particular thius reduces accesses of the lock itself.

    git-svn-id: svn+ssh://svn.freebsd.org/base/head@313928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

commit 013560e742a5a276b0deef039bc18078d51d6eb0
Author: mjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Date:   Sat Feb 18 01:52:10 2017 +0000

    mtx: plug the 'opts' argument when not used

    git-svn-id: svn+ssh://svn.freebsd.org/base/head@313908 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

commit 9a507901162fb476b9809da2919905735cd605af
Author: mjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Date:   Fri Feb 17 22:09:55 2017 +0000

    sx: fix mips builld after r313855

    The namespace in this file really needs cleaning up. In the meantime
    let inline primitives be defined as long as LOCK_DEBUG is not enabled.

    Reported by:        kib

    git-svn-id: svn+ssh://svn.freebsd.org/base/head@313901 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

commit aa6243a5124b9ceb3b1683ea4dbb0a133ce70095
Author: mjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Date:   Fri Feb 17 15:40:24 2017 +0000

    mtx: get rid of file/line args from slow paths if they are unused

    This denotes changes which went in by accident in r313877.

    On most production kernels both said parameters are zeroed and have nothing
    reading them in either __mtx_lock_sleep or __mtx_unlock_sleep. Thus this change
    stops passing them by internal consumers which this is the case.

    Kernel modules use _flags variants which are not affected kbi-wise.

    git-svn-id: svn+ssh://svn.freebsd.org/base/head@313878 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

commit 688545a6af7ed0972653d6e2c6ca406ac511f39d
Author: mjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Date:   Fri Feb 17 15:34:40 2017 +0000

    mtx: restrict r313875 to kernels without LOCK_PROFILING

    git-svn-id: svn+ssh://svn.freebsd.org/base/head@313877 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

commit bbe6477138713da2d503f93cb5dd602e14152a08
Author: mjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Date:   Fri Feb 17 14:55:59 2017 +0000

    mtx: microoptimize lockstat handling in __mtx_lock_sleep

    This saves a function call and multiple branches after the lock is acquired.

    overzelaous

7 years agoMFC r313472:
mjg [Thu, 16 Mar 2017 08:00:02 +0000 (08:00 +0000)]
MFC r313472:

The runlock slow path would update wrong variable before restarting the
loop, in effect corrupting the state.

Something was botched in the previous mfc attempt in r315380.

7 years agoMFC r311168,r311171:
mjg [Thu, 16 Mar 2017 07:51:34 +0000 (07:51 +0000)]
MFC r311168,r311171:

Add the upcoming atomic_fcmpset family to the atomic(9) man page.

These primitives give the caller the read value if the exchange attempt
failed which saves an explicit reload for cmpset loops.

The man page was partially submitted by kib.

==

Fix typo

7 years agoMFC r313874:
mjg [Thu, 16 Mar 2017 07:46:24 +0000 (07:46 +0000)]
MFC r313874:

Make inline lockstat checks just inspect lockstat_enabled

There is no correctness issue and this lets the kernel just test one typically
false variable.

7 years agoMFC r313453:
mjg [Thu, 16 Mar 2017 07:20:32 +0000 (07:20 +0000)]
MFC r313453:

Implement LOCKSTAT_OOL_PROFILE_ENABLED

For use in uninlined locking primitives to decide whether lockstat
or profiling needs to be taken care of.

7 years agoMFC r314549: Execute last ZIO of log commit synchronously.
mav [Thu, 16 Mar 2017 07:11:05 +0000 (07:11 +0000)]
MFC r314549: Execute last ZIO of log commit synchronously.

For short transactions overhead of context switch can be too large.
Skipping it gives significant latency reduction.  For large ones,
including multiple ZIOs, latency is less critical, while throughput
there may become limited by checksumming speed of single CPU core.
To get best of both cases, execute last ZIO directly from calling
thread context to save latency, while all others (if there are any)
enqueue to taskqueues in traditional way.

7 years agoMFC r313853,r313859:
mjg [Thu, 16 Mar 2017 07:10:08 +0000 (07:10 +0000)]
MFC r313853,r313859:

locks: remove SCHEDULER_STOPPED checks from primitives for modules

They all fallback to the slow path if necessary and the check is there.

This means a panicked kernel executing code from modules will be able to
succeed doing actual lock/unlock, but this was already the case for core code
which has said primitives inlined.

==

Introduce SCHEDULER_STOPPED_TD for use when the thread pointer was already read

Sprinkle in few places.

7 years agoMFC r314548: Completely skip cache flushing for not supporting log devices.
mav [Thu, 16 Mar 2017 07:09:19 +0000 (07:09 +0000)]
MFC r314548: Completely skip cache flushing for not supporting log devices.

7 years agoMFC r314555: Inline some trivial wrapper functions.
mav [Thu, 16 Mar 2017 07:07:56 +0000 (07:07 +0000)]
MFC r314555: Inline some trivial wrapper functions.

7 years agoMFC r313467:
mjg [Thu, 16 Mar 2017 07:06:06 +0000 (07:06 +0000)]
MFC r313467:

locks: tidy up unlock fallback paths

Update comments to note these functions are reachable if lockstat is
enabled.

Check if the lock has any bits set before attempting unlock, which saves
an unnecessary atomic operation.

7 years agoMFC r313455:
mjg [Thu, 16 Mar 2017 06:56:23 +0000 (06:56 +0000)]
MFC r313455:

sx: implement slock/sunlock fast path

See r313454.

7 years agoMFC r313454,r313472:
mjg [Thu, 16 Mar 2017 06:53:55 +0000 (06:53 +0000)]
MFC r313454,r313472:

rwlock: implemenet rlock/runlock fast path

This improves singlethreaded throughput on my test machine from ~247 mln
ops/s to ~328 mln.

It is mostly about avoiding the setup cost of lockstat.

==

rwlock: fix r313454

The runlock slow path would update wrong variable before restarting the
loop, in effect corrupting the state.

7 years agoMFC r313392,r313784:
mjg [Thu, 16 Mar 2017 06:51:00 +0000 (06:51 +0000)]
MFC r313392,r313784:

rwlock: implement RW_LOCK_WRITER_RECURSED bit

This moves recursion handling out of the inlined wunlock path and in
particular saves a read and a branch.

==

rwlock: tidy up r313392

While a new bit was added and thread alignment got shifted to accomodate it,
RW_READERS_SHIFT was not modified accordingly and clashed with the new flag.

This was surprisingly harmless. If the lock was taken for writing, other flags
were tested. If the lock was taken for reading, it would correctly work for
readers > 1 and this was the only relevant test performed.

7 years agoMFC r313275,r313280,r313282,r313335:
mjg [Thu, 16 Mar 2017 06:45:36 +0000 (06:45 +0000)]
MFC r313275,r313280,r313282,r313335:

mtx: move lockstat handling out of inline primitives

Lockstat requires checking if it is enabled and if so, calling a 6 argument
function. Further, determining whether to call it on unlock requires
pre-reading the lock value.

This is problematic in at least 3 ways:
- more branches in the hot path than necessary
- additional cacheline ping pong under contention
- bigger code

Instead, check first if lockstat handling is necessary and if so, just fall
back to regular locking routines. For this purpose a new macro is introduced
(LOCKSTAT_PROFILE_ENABLED).

LOCK_PROFILING uninlines all primitives. Fold in the current inline lock
variant into the _mtx_lock_flags to retain the support. With this change
the inline variants are not used when LOCK_PROFILING is defined and thus
can ignore its existence.

This results in:
text        data     bss     dec     hex filename
22259667    1303208 4994976 28557851        1b3c21b kernel.orig
21797315    1303208 4994976 28095499        1acb40b kernel.patched

i.e. about 3% reduction in text size.

A remaining action is to remove spurious arguments for internal kernel
consumers.

==

sx: move lockstat handling out of inline primitives

See r313275 for details.

==

rwlock: move lockstat handling out of inline primitives

See r313275 for details.

One difference here is that recursion handling was removed from the fallback
routine. As it is it was never supposed to see a recursed lock in the first
place. Future changes will move it out of inline variants, but right now
there is no easy to way to test if the lock is recursed without reading
additional words.

==

locks: fix recursion support after recent changes

When a relevant lockstat probe is enabled the fallback primitive is called with
a constant signifying a free lock. This works fine for typical cases but breaks
with recursion, since it checks if the passed value is that of the executing
thread.

Read the value if necessary.

7 years agoMFC r313269,r313270,r313271,r313272,r313274,r313278,r313279,r313996,r314474
mjg [Thu, 16 Mar 2017 06:35:53 +0000 (06:35 +0000)]
MFC r313269,r313270,r313271,r313272,r313274,r313278,r313279,r313996,r314474

mtx: switch to fcmpset

The found value is passed to locking routines in order to reduce cacheline
accesses.

mtx_unlock grows an explicit check for regular unlock. On ll/sc architectures
the routine can fail even if the lock could have been handled by the inline
primitive.

==

rwlock: switch to fcmpset

==

sx: switch to fcmpset

==

sx: uninline slock/sunlock

Shared locking routines explicitly read the value and test it. If the
change attempt fails, they fall back to a regular function which would
retry in a loop.

The problem is that with many concurrent readers the risk of failure is pretty
high and even the value returned by fcmpset is very likely going to be stale
by the time the loop in the fallback routine is reached.

Uninline said primitives. It gives a throughput increase when doing concurrent
slocks/sunlocks with 80 hardware threads from ~50 mln/s to ~56 mln/s.

Interestingly, rwlock primitives are already not inlined.

==

sx: add witness support missed in r313272

==

mtx: fix up _mtx_obtain_lock_fetch usage in thread lock

Since _mtx_obtain_lock_fetch no longer sets the argument to MTX_UNOWNED,
callers have to do it on their own.

==

mtx: fixup r313278, the assignemnt was supposed to go inside the loop

==

mtx: fix spin mutexes interaction with failed fcmpset

While doing so move recursion support down to the fallback routine.

==

locks: ensure proper barriers are used with atomic ops when necessary

Unclear how, but the locking routine for mutexes was using the *release*
barrier instead of acquire. This must have been either a copy-pasto or bad
completion.

Going through other uses of atomics shows no barriers in:
- upgrade routines (addressed in this patch)
- sections protected with turnstile locks - this should be fine as necessary
barriers are in the worst case provided by turnstile unlock

I would like to thank Mark Millard and andreast@ for reporting the problem and
testing previous patches before the issue got identified.

7 years agoMFC r313740:
dchagin [Thu, 16 Mar 2017 06:32:58 +0000 (06:32 +0000)]
MFC r313740:

Replace Linuxulator implementation of readdir(), getdents() and
getdents64() with wrapper over kern_getdirentries().

The patch was originally written by emaste@ and then adapted by trasz@
and me.

Note:
1. I divided linux_getdents() and linux_readdir() as in case when the
getdents() called with count = 1 (readdir() case) it can overwrite
user stack (by writing to user buffer pointer more than 1 byte).

2. Linux returns EINVAL in case when user supplied buffer is not enough
to contain fetched dirent.

3. Linux returns ENOTDIR in case when fd points to not a directory.

7 years agoMFC r313683:
mjg [Thu, 16 Mar 2017 06:14:33 +0000 (06:14 +0000)]
MFC r313683:

lockmgr: implement fast path

The main lockmgr routine takes 8 arguments which makes it impossible to
tail-call it by the intermediate vop_stdlock/unlock routines.

The routine itself starts with an if-forest and reads from the lock itself
several times.

This slows things down both single- and multi-threaded. With the patch
single-threaded fstats go 4% up and multithreaded up to ~27%.

Note that there is still a lot of room for improvement.

7 years agoMFC r313391:
mjg [Thu, 16 Mar 2017 06:12:00 +0000 (06:12 +0000)]
MFC r313391:

Bump struct thread alignment to 32.

This gives additional bits to use in locking primitives which store
the lock thread pointer in the lock value.

7 years agoMFC r313268:
mjg [Thu, 16 Mar 2017 06:04:26 +0000 (06:04 +0000)]
MFC r313268:

vfs: use atomic_fcmpset in vfs_refcount_*

7 years agoMFC r313260:
mjg [Thu, 16 Mar 2017 06:03:27 +0000 (06:03 +0000)]
MFC r313260:

fd: switch fget_unlocked to atomic_fcmpse

7 years agoMFC r311169,r311898,r312925,r312973,r312975,r313007,r313040,r313080,
mjg [Thu, 16 Mar 2017 06:00:27 +0000 (06:00 +0000)]
MFC r311169,r311898,r312925,r312973,r312975,r313007,r313040,r313080,
    r313254,r313341

amd64: add atomic_fcmpset

==

sparc64: add atomic_fcmpset

==

Implement atomic_fcmpset_* for arm and arm64.

==

Add atomic_fcmpset_*() inlines for powerpc

Summary:
atomic_fcmpset_*() is analogous to atomic_cmpset(), but saves off the read value
from the target memory location into the 'old' pointer in the case of failure.

==

i386: add atomic_fcmpset

==

Don't retry a lost reservation in atomic_fcmpset()

The desired behavior of atomic_fcmpset_() is to always exit on error.  Instead
of retrying on lost reservation, leave the retry to the caller, and return

==

Add atomic_fcmpset_*() inlines for MIPS

atomic_fcmpset_*() is analogous to atomic_cmpset(), but saves off the
read value from the target memory location into the 'old' pointer.

==

i386: fixup fcmpset

An incorrect output specifier was used which worked with clang by accident,
but breaks with the in-tree gcc version.

While here plug a whitespace nit.

==

Implement atomic_fcmpset_*() for RISC-V.

==

Use 64bit store instruction in atomic_fcmpset_64.

7 years agoMFC r310345:
ngie [Thu, 16 Mar 2017 04:58:12 +0000 (04:58 +0000)]
MFC r310345:
r310345 (by sephe):

build: Unbreak LINT

7 years agoMFC r314918, r314919:
ian [Thu, 16 Mar 2017 03:49:06 +0000 (03:49 +0000)]
MFC r314918, r314919:

  Add the pnp id for a Wacom 'WACF00e' tablet.

  Update the comment for the Wacom WACF00e to make it clear it's not an
  accidental duplicate of WACF004.

PR: 217306

7 years agoMFC r310189:
ian [Thu, 16 Mar 2017 03:41:31 +0000 (03:41 +0000)]
MFC r310189:

Fix sscanf() format string to match an argument. This also fixes kernel
build after r310171.

7 years agoMFC r314951:
ngie [Thu, 16 Mar 2017 02:09:51 +0000 (02:09 +0000)]
MFC r314951:

Expect :test_zero_input to fail on amd64

The clang 4.x+ upgrade now causes this testcase to fail, but
only on amd64.

More investigation will be done to determine the cause.

PR: 217528

7 years agoMFC r315113:
ngie [Thu, 16 Mar 2017 02:04:13 +0000 (02:04 +0000)]
MFC r315113:

Conditionally compile [additional] programs into rescue(8) if requested

Trivial oversight missed in r314240 cleanup because I enable these knobs on
my test machines.

MK_INET6_SUPPORT - rtsol
MK_NETCAT - nc

7 years agoMFC r314924:
ngie [Thu, 16 Mar 2017 01:59:41 +0000 (01:59 +0000)]
MFC r314924:

sbin/devfs: clarify usage

- Note existence of -m option.
- Note that -s applies to rule keyword, only, by adding usage text
  specifically for the `rule` and `ruleset` keywords.

Don't go into any further detail in usage(..) -- it's best that one
reads the manpage to get a better idea of how things work as there are
a number of different option-specific keywords and arguments, as well
as some rule grammar.

7 years agoMFC r315111:
ngie [Thu, 16 Mar 2017 01:58:06 +0000 (01:58 +0000)]
MFC r315111:

Remove /rescue/iscsictl and /rescue/iscsid if MK_ISCSI == no

7 years agoMFC r315114:
ngie [Thu, 16 Mar 2017 01:54:56 +0000 (01:54 +0000)]
MFC r315114:

Remove /rescue/zdb if MK_ZFS == no

Missed in r202452.

7 years agoMFC r314831:
ngie [Thu, 16 Mar 2017 01:53:21 +0000 (01:53 +0000)]
MFC r314831:

Don't rely on dependency in Makefile.inc1 for strfile; make datfiles depend on strfile

In most cases strfile is built as part of build-tools, but in the event that someone
cd'ed to the directory, tried to build from scratch, and had MK_GAMES=no previously,
the build would fail in .../datfiles , trying to find strfile .

Mark this directory tree "SUBDIR_PARALLEL" safe to help facilitate this, instead of
shuffling around the SUBDIR entries (all of the other Makefiles will build standalone).

7 years agoMFC r314895:
ngie [Thu, 16 Mar 2017 01:48:08 +0000 (01:48 +0000)]
MFC r314895:

Only install 900.tcpwrap if MK_INETD != "no" and MK_TCP_WRAPPERS != "no"

It relies on output from inetd that is triggered by MK_TCP_WRAPPERS=yes.

We need to check for both knobs being set -- otherwise the script doesn't
have much value.

PR: 217577

7 years agoMFC r314830:
ngie [Thu, 16 Mar 2017 01:38:07 +0000 (01:38 +0000)]
MFC r314830:

mergemaster: fix description of -p

-p only handles updating /etc/master.passwd and /etc/group . No more,
no less.

Also, mergemaster (and no other portions of the vanilla FreeBSD build
process) should be messing with __MAKECONF or SRCCONF as part of the
installworld or distribution process. Don't insinuate that mergemaster
does that as it's a false claim.

7 years agoMFC r314869,r314871,r314872:
ngie [Thu, 16 Mar 2017 01:36:09 +0000 (01:36 +0000)]
MFC r314869,r314871,r314872:

r314869:

Alphabetically sort variables

The only content change is minor rewording around CLEANDIRS/CLEANFILES to
accomodate sorting order.

r314871:

Fix LINKS example in bsd.prog.mk

LINKS appends DESTDIR -- don't suggest double-append in example.

r314872:

Add bsd.man.mk references for MAN under bsd.lib.mk and bsd.prog.mk

The latter set of manpages directly consume bsd.man.mk, so the bsd.man.mk
behavior should be the source of truth for underlying behavior, whereas
the other manpage fragment descriptions should document how they tweak
the variable behavior, if at all (bsd.prog.mk does tweak the default
value, as noted in its description)

7 years agoMFC r311172,r311194,r311226,r312389,r312390:
mjg [Thu, 16 Mar 2017 01:32:56 +0000 (01:32 +0000)]
MFC r311172,r311194,r311226,r312389,r312390:

mtx: reduce lock accesses

Instead of spuriously re-reading the lock value, read it once.

This change also has a side effect of fixing a performance bug:
on failed _mtx_obtain_lock, it was possible that re-read would find
the lock is unowned, but in this case the primitive would make a trip
through turnstile code.

This is diff reduction to a variant which uses atomic_fcmpset.

==

Reduce lock accesses in thread lock similarly to r311172

==

mtx: plug open-coded mtx_lock access missed in r311172

==

rwlock: reduce lock accesses similarly to r311172

==

sx: reduce lock accesses similarly to r311172

7 years agoMFC r305671:
mjg [Thu, 16 Mar 2017 01:04:30 +0000 (01:04 +0000)]
MFC r305671:

locks: add backoff for spin mutexes and thread lock

7 years agoMFC r312890,r313386,r313390:
mjg [Thu, 16 Mar 2017 00:51:24 +0000 (00:51 +0000)]
MFC r312890,r313386,r313390:

Sprinkle __read_mostly on backoff and lock profiling code.

==

locks: change backoff to exponential

Previous implementation would use a random factor to spread readers and
reduce chances of starvation. This visibly reduces effectiveness of the
mechanism.

Switch to the more traditional exponential variant. Try to limit starvation
by imposing an upper limit of spins after which spinning is half of what
other threads get. Note the mechanism is turned off by default.

==

locks: follow up r313386

Unfinished diff was committed by accident. The loop in lock_delay
was changed to decrement, but the loop iterator was still incrementing.

7 years agoMFC r308700:
mizhka [Wed, 15 Mar 2017 21:03:51 +0000 (21:03 +0000)]
MFC r308700:

[etherswitch] add RTL8366SR support

Add RTL8366SR support at etherswitch driver. Tested on RTL8366RB and
RTL8366SR.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: adrian, mizhka
Approved by: adrian(mentor)
Differential Revision: https://reviews.freebsd.org/D6796

7 years agoMFC r310017-r310018
mizhka [Wed, 15 Mar 2017 21:01:03 +0000 (21:01 +0000)]
MFC r310017-r310018

r310017:
[spi] reformat message and ar5315_spi minor fix

This commit corrects print of nomatch (newline was too early) and fix
unit number for new child in ar5315_spi (was 0, now is -1 to calculate it
according to actual system state)

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: ray, loos, mizhka
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8749

r310018:
[gpiospi] add clock delay to avoid smashing of bits

Submitted by: Hiroki Mori <yamori83@yahoo.co.jp>
Reviewed by: loos, ray, mizhka
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8749

7 years agoMFC r310232:
dim [Wed, 15 Mar 2017 19:50:58 +0000 (19:50 +0000)]
MFC r310232:

After r310171, the kernel version of sscanf() has format string checking
enabled.  This results in a -Werror warning in mlx4ib:

    sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c:90:22: error: format specifies type 'unsigned long long *' but the argument has type 'u64 *' (aka 'unsigned long *') [-Werror,-Wformat]
            sscanf(buf, "%llx", &sysadmin_ag_val);
                         ~~~~   ^~~~~~~~~~~~~~~~

Change sysadmin_ag_val to unsigned long long to avoid the warning.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D8831

7 years agoMFC r314643:
dchagin [Wed, 15 Mar 2017 17:16:43 +0000 (17:16 +0000)]
MFC r314643:

Hide Linux socketcall constants under corresponding #ifdef since
they are used only in i386 Linuxulator.

7 years agoMFC r314132:
dchagin [Wed, 15 Mar 2017 17:14:05 +0000 (17:14 +0000)]
MFC r314132:

Right clock defines specified in linux_timer.h.
Get rid of spirious clock defines from linux_misc.h.

7 years agoMFC r313940:
dchagin [Wed, 15 Mar 2017 17:11:01 +0000 (17:11 +0000)]
MFC r313940:

Implement rt_tgsigqueueinfo system call used by glibc for pthread_sigqueue(3).

7 years agoMFC r313913:
dchagin [Wed, 15 Mar 2017 17:06:04 +0000 (17:06 +0000)]
MFC r313913:

Initialize cap_rights before use.

MFC r313914:

Style(9), some XXX comments fix. No functional changes.

7 years agoMFC r305093 (by mjg@):
dchagin [Wed, 15 Mar 2017 16:38:39 +0000 (16:38 +0000)]
MFC r305093 (by mjg@):

fd: add fdeget_locked and use in kern_descrip

MFC r305756 (by oshogbo@):

fd: add fget_cap and fget_cap_locked primitives.
They can be used to obtain capabilities along with a referenced fp.

MFC r306174 (by oshogbo@):

capsicum: propagate rights on accept(2)

Descriptor returned by accept(2) should inherits capabilities rights from
the listening socket.

PR:           201052

MFC r306184 (by oshogbo@):

fd: simplify fgetvp_rights by using fget_cap_locked.

MFC r306225 (by mjg@):

fd: fix up fgetvp_rights after r306184

fget_cap_locked returns a referenced file, but the fgetvp_rights does
not need it. Instead, due to the filedesc lock being held, it can
ref the vnode after the file was looked up.

Fix up fget_cap_locked to be consistent with other _locked helpers and not
ref the file.

This plugs a leak introduced in r306184.

MFC r306232 (by oshogbo@):

fd: fix up fget_cap

If the kernel is not compiled with the CAPABILITIES kernel options
fget_unlocked doesn't return the sequence number so fd_modify will
always report modification, in that case we got infinity loop.

MFC r311474 (by glebius@):

Use getsock_cap() instead of fgetsock().

MFC r312079 (by glebius@):

Use getsock_cap() instead of deprecated fgetsock().

MFC r312081 (by glebius@):

Use getsock_cap() instead of deprecated fgetsock().

MFC r312087 (by glebius@):

Remove deprecated fgetsock() and fputsock().

Bump __FreeBSD_version as getsock_cap changed and
fgetsock/fputsock pair removed.

7 years agoMFC r315095, r315096, r315097, r315187:
pfg [Wed, 15 Mar 2017 15:33:32 +0000 (15:33 +0000)]
MFC r315095, r315096, r315097, r315187:
libc: small cleanups.

Rename nitems to numitems: it shares the anme with an existing macro in
sys/params.h. Also initialize the value later which avoids asigning the
value if we exit early.

Unsign setlen: it is local and will never be negative. Having one more bit
for growth is beneficial and it avoids a cast when it's going to be used
for allocation.

Remove unused initialization: "num" is properly defined before use.

Let calloc(3) do the multiplication.

7 years agoMFC r314489:
kib [Wed, 15 Mar 2017 10:53:40 +0000 (10:53 +0000)]
MFC r314489:
With the removal of IA64, the only arch which uses ia32 compat is amd64.

7 years agoMFC r307688:
kib [Wed, 15 Mar 2017 10:51:00 +0000 (10:51 +0000)]
MFC r307688:
With the removal of IA64, the only arch which uses ia32 compat is amd64.

7 years agoMFC r312724,r312901,r312902:
mjg [Tue, 14 Mar 2017 20:43:04 +0000 (20:43 +0000)]
MFC r312724,r312901,r312902:

hwpmc: partially depessimize munmap handling if the module is not loaded

HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the
common (module not loaded) case.

In particular this avoids permission checks + lock downgrade
singlethreaded and in cases were an executable mapping is found the pmc
sx lock is no longer bounced.

Note this is a band aid.

==

hwpmc: partially depessimize mmap handling if the module is not loaded

In particular this means the pmc sx lock is no longer taken when an
executable mapping succeeds.

==

hwpmc: annotate pmc_hook and pmc_intr as __read_mostly

7 years agoMFC r312888:
mjg [Tue, 14 Mar 2017 20:39:06 +0000 (20:39 +0000)]
MFC r312888:

Introduce __read_mostly and __exclusive_cache_line macros.

The intended use is to annotate frequently used globals which either rarely
change (and thus can be grouped in the same cacheline) or are an atomic counter
(which means it may benefit from being the only variable in the cacheline).

Linker script support is provided only for amd64. Architectures without it risk
having other variables put in, i.e. as if they were not annotated. This is
harmless from correctness point of view.

7 years agoMFC r312934:
pfg [Tue, 14 Mar 2017 20:14:57 +0000 (20:14 +0000)]
MFC r312934:
Make use of clang nullability attributes in C headers.

Replace uses of the GCC __nonnull__ attribute with the clang nullability
qualifiers. These are starting to get use in clang's static analyzer.

Replacement should be transparent for developers using clang. GCC ports
from older FreeBSD versions may need updating if the compiler was built
before r312860 (Jan-27-2017).

Hinted by: Apple's Libc-1158.20.4, Bionic libc

Relnotes: yes

7 years agoDirect commit to stable/11, a followup to fix r314591 on pc98.
kib [Tue, 14 Mar 2017 17:56:36 +0000 (17:56 +0000)]
Direct commit to stable/11, a followup to fix r314591 on pc98.

Reported by: rpokala
Sponsored by: The FreeBSD Foundation

7 years agoMFC r314179 r314206 r314424
vangyzen [Tue, 14 Mar 2017 17:52:43 +0000 (17:52 +0000)]
MFC r314179 r314206 r314424

Add sem_clockwait_np()

This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Relnotes: yes
Sponsored by: Dell EMC

7 years agoMFC r314553:
hselasky [Tue, 14 Mar 2017 15:59:51 +0000 (15:59 +0000)]
MFC r314553:

Implement taskqueue_poll_is_busy() for use by the LinuxKPI.
Refer to comment above function for a detailed description.

Discussed with: kib @
Sponsored by: Mellanox Technologies

7 years agoMFC r314328:
hselasky [Tue, 14 Mar 2017 15:55:17 +0000 (15:55 +0000)]
MFC r314328:

Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by: avg @

7 years agoMFC r313941:
hselasky [Tue, 14 Mar 2017 15:49:28 +0000 (15:49 +0000)]
MFC r313941:

Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.

This patch adds a thread construction and destruction call for the
first thread in a procedure.

Tested: dtrace, linux emulation
Reviewed by: kib @
Sponsored by: Mellanox Technologies

7 years agoMFC r313778:
hselasky [Tue, 14 Mar 2017 15:42:27 +0000 (15:42 +0000)]
MFC r313778:

Improve code readability and fix compilation error when using clang 4.x.

Found by: emaste @
Sponsored by: Mellanox Technologies

7 years agoMFC r312551:
hselasky [Tue, 14 Mar 2017 15:35:40 +0000 (15:35 +0000)]
MFC r312551:

Fix for race leading to endless timer interrupts related to
configtimer().

During normal operation "state->nextcallopt" will always be less than
or equal to "state->nextcall" and checking only "state->nextcallopt"
before calling "callout_process()" is sufficient. However when
"configtimer()" is called a race might happen requiring both of these
binary times to be checked.

Short description of race:

1) A configtimer() call will reset both "state->nextcall" and
"state->nextcallopt" to the same binary time.

2) If a "callout_reset()" call happens between "configtimer()" and the
next "callout_process()" call, "state->nextcallopt" will get updated
and "state->nextcall" will remain at the current time. Refer to logic
inside cpu_new_callout().

3) getnextcpuevent() only respects "state->nextcall" and returns this
value over and over again, even if it is in the past, until "now >=
state->nextcallopt" becomes true. Then these two time variables are
corrected by a "callout_process()" call and the situation goes back to
normal.

The problem manifests itself in different ways. The common factor is
the timer process(es) consume all CPU on one or more CPU cores for a
long time, blocking other kernel processes from getting execution
time. This can be seen by very high interrupt counts as displayed by
"vmstat -i | grep timer" right after boot.

When EARLY_AP_STARTUP was enabled in r310177 the likelyhood of hitting
this bug apparently increased.

Example output from "vmstat -i" before patch:
cpu0:timer                          7591         69
cpu9:timer                      39031773     358089
cpu4:timer                          9359         85
cpu3:timer                          9100         83
cpu2:timer                          9620         88

Example output from "vmstat -i" after patch:
cpu0:timer                          4242         34
cpu6:timer                          5531         44
cpu3:timer                          6450         52
cpu1:timer                          4545         36
cpu9:timer                          7153         58

Before the patch cpu9 in the example above, was spinning in a loop in
order to reach 39 million interrupts just a few seconds after
bootup. After the patch the timer interrupt counts are more or less
consistent.

Discussed with: mav @
Reported by: several people
Sponsored by: Mellanox Technologies

7 years agoMFC r312424:
hselasky [Tue, 14 Mar 2017 15:27:38 +0000 (15:27 +0000)]
MFC r312424:

Fix problem with suspend and resume when using Skylake chipsets. Make
sure the XHCI controller is reset after halting it. The problem is
clearly a BIOS bug as the suspend and resume is failing without
loading the XHCI driver. The same happens when using Linux and the
XHCI driver is not loaded.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
PR: 216261

7 years agoMFC r312338:
hselasky [Tue, 14 Mar 2017 15:19:14 +0000 (15:19 +0000)]
MFC r312338:

Add USB audio support for S/PDIF output with C-Media CM6206 devices.

Submitted by: Julien Nadeau <vedge@hypertriton.com>
PR: 216131

7 years agoMFC r310806:
hselasky [Tue, 14 Mar 2017 15:12:58 +0000 (15:12 +0000)]
MFC r310806:

Add MSIX rewrite table quirk for use with VMs.

This patch solves IRQ generation problems using the mlx5en(4) driver
with xenserver v6.5.0 in SRIOV and PCI-passthrough modes.

Until further the hw.pci.msix_rewrite_table quirk must be set manually
in /boot/loader.conf .

Reviewed by: jhb @
Sponsored by:           Mellanox Technologies

7 years agoMFC r314851:
kib [Tue, 14 Mar 2017 10:09:50 +0000 (10:09 +0000)]
MFC r314851:
When selecting brand based on old Elf branding, prefer the brand which
interpreter exactly matches the one requested by the activated image.

7 years agoMFC r314850:
kib [Tue, 14 Mar 2017 10:08:12 +0000 (10:08 +0000)]
MFC r314850:
Require whole brand string matching for old Elf branding.

7 years agoMFC r314849:
kib [Tue, 14 Mar 2017 10:06:20 +0000 (10:06 +0000)]
MFC r314849:
Consistently use vm_ooffset_t type for the vm object offset in
elf_load_section.

7 years agoMFC r314375: Remove some locking not needed for modern CAM.
mav [Tue, 14 Mar 2017 07:06:05 +0000 (07:06 +0000)]
MFC r314375: Remove some locking not needed for modern CAM.

This driver is full of LORs.  This change allows to reduce deadlock chance
from 100% to level that allows some tests to be done.

7 years agoMFC r315225:
delphij [Tue, 14 Mar 2017 06:10:40 +0000 (06:10 +0000)]
MFC r315225:

Discard first 3072 bytes of RC4 keystream, this is a bandaid
that allows us to work on switching to a more modern PRNG.

Submitted by: Steven Chamberlain <steven pyro eu org>
Approved by: so

7 years agoMFC r314974, r315006:
pfg [Tue, 14 Mar 2017 02:13:59 +0000 (02:13 +0000)]
MFC r314974, r315006:
localedef(1): Fix small coverity issues.

- Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
- Buffer not null terminated (BUFFER_SIZE_WARNING)

CID: 13385571338565

Obtained from: illumos

7 years agoMFC r313982, r314068:
pfg [Tue, 14 Mar 2017 02:06:03 +0000 (02:06 +0000)]
MFC r313982, r314068:
sys: Replace zero with NULL for pointers.

Found with: devel/coccinelle