freebsd.git
7 years agoBring back r313037, with fixes for mips:
jah [Sun, 19 Feb 2017 02:03:09 +0000 (02:03 +0000)]
Bring back r313037, with fixes for mips:

Implement get_pcpu() for amd64/sparc64/mips/powerpc, and use it to
replace pcpu_find(curcpu) in MI code.

Reviewed by: andreast, kan, lidl
Tested by: lidl(mips, sparc64), andreast(powerpc)
Differential Revision: https://reviews.freebsd.org/D9587

7 years agolocks: clean up trylock primitives
mjg [Sat, 18 Feb 2017 22:06:03 +0000 (22:06 +0000)]
locks: clean up trylock primitives

In particular thius reduces accesses of the lock itself.

7 years agoInclude ${LOCALBASE}/bin in $PATH when running "make checkworld"
ngie [Sat, 18 Feb 2017 21:47:32 +0000 (21:47 +0000)]
Include ${LOCALBASE}/bin in $PATH when running "make checkworld"

Some of the tests in devel/atf // devel/kyua rely on the tools being in $PATH,
which means that the tests fail when run via "make checkworld" because $PATH
is restricted to exclude directory elements like "${LOCALBASE}/bin".

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoQuote path to doxygen/kyua in test(1) -x check
ngie [Sat, 18 Feb 2017 21:41:50 +0000 (21:41 +0000)]
Quote path to doxygen/kyua in test(1) -x check

This is a basic stopgap against ${LOCALBASE} containing spaces in it

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoAdd new catrigl.c (r313761) APIs to include/complex.h
mmokhi [Sat, 18 Feb 2017 21:08:09 +0000 (21:08 +0000)]
Add new catrigl.c (r313761) APIs to include/complex.h

Reviewed by: bde, emaste
Approved by: bde, emaste (src committers)
Differential Revision: https://reviews.freebsd.org/D9615

7 years agoFor translated packets do not adjust UDP checksum if it is zero.
ae [Sat, 18 Feb 2017 19:53:37 +0000 (19:53 +0000)]
For translated packets do not adjust UDP checksum if it is zero.

In case when decrypted and decapsulated packet is an UDP datagram,
check that its checksum is not zero before doing incremental checksum
adjustment.

Reported by: Eugene Grosbein
Tested by: Eugene Grosbein

7 years agoFix the last case when kldload(8) wasn't printing the name of the module
glebius [Sat, 18 Feb 2017 18:57:29 +0000 (18:57 +0000)]
Fix the last case when kldload(8) wasn't printing the name of the module
that failed to load.

7 years agoAdd dtb files for Boundary Devices Nitrogen 6 family boards. FreeBSD runs
ian [Sat, 18 Feb 2017 18:31:42 +0000 (18:31 +0000)]
Add dtb files for Boundary Devices Nitrogen 6 family boards.  FreeBSD runs
on a nitrogen6x quad 2gb, and is expected to run on all the imx6 boards in
the nitrogen6 family.

7 years agoAdd definitions for the IEEE-1588 registers.
ian [Sat, 18 Feb 2017 18:27:28 +0000 (18:27 +0000)]
Add definitions for the IEEE-1588 registers.

7 years agoChange the naming of imx{5,6} gpio pins to exactly match the names used in
ian [Sat, 18 Feb 2017 18:24:03 +0000 (18:24 +0000)]
Change the naming of imx{5,6} gpio pins to exactly match the names used in
the chip reference manuals: GPIOn_IOnn.

7 years agoMake fsck(8) default to "ufs", like eg mount(8) does.
trasz [Sat, 18 Feb 2017 11:43:13 +0000 (11:43 +0000)]
Make fsck(8) default to "ufs", like eg mount(8) does.

Approved by: imp
Discussed with: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9621

7 years agoStyle(9), some XXX comments fix. No functional changes.
dchagin [Sat, 18 Feb 2017 10:01:17 +0000 (10:01 +0000)]
Style(9), some XXX comments fix. No functional changes.

MFC after: 1 week

7 years agoInitialize cap_rights before use.
dchagin [Sat, 18 Feb 2017 09:39:20 +0000 (09:39 +0000)]
Initialize cap_rights before use.

MFC after: 1 week

7 years agoFinich r313684.
dchagin [Sat, 18 Feb 2017 07:21:50 +0000 (07:21 +0000)]
Finich r313684.

Convert linux_recv(), linux_send() and linux_accept() system call arguments
to the register_t type too.

PR: 217161
MFC after: 3 days
xMFC with: r313284,r313285,r313684

7 years agoSpell VMXNET3_LEGACY_TX correctly.
loos [Sat, 18 Feb 2017 06:18:14 +0000 (06:18 +0000)]
Spell VMXNET3_LEGACY_TX correctly.

Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoChange XCOPY memory allocations.
mav [Sat, 18 Feb 2017 06:03:16 +0000 (06:03 +0000)]
Change XCOPY memory allocations.

Before this change XCOPY code could allocate memory in chunks up to 16-32MB
(VMware does XCOPY in 4MB chunks by default), that could be difficult for
VM subsystem to do due to KVA fragmentation, that sometimes created huge
allocation delays, blocking any I/O for respective LU for that time.

This change limits allocations down to TPC_MAX_IO_SIZE, which is 1MB now.
1MB is also not a cookie, but ZFS also can do that for large blocks, so
it should be less dramatic.  As drawback this increases CPU overhead, but
it still look acceptable comparing to time consumed by ZFS read/write.

MFC after: 1 week

7 years agoFix panic with unlocked vnode to vrecycle().
bdrewery [Sat, 18 Feb 2017 05:07:53 +0000 (05:07 +0000)]
Fix panic with unlocked vnode to vrecycle().

MFC after: 2 weeks

7 years agomtx: plug the 'opts' argument when not used
mjg [Sat, 18 Feb 2017 01:52:10 +0000 (01:52 +0000)]
mtx: plug the 'opts' argument when not used

7 years agoxdev: Fix after libc++ update in r300873.
bdrewery [Sat, 18 Feb 2017 00:08:13 +0000 (00:08 +0000)]
xdev: Fix after libc++ update in r300873.

The xdev build needed the same fixes as libcompat and external toolchain
support needed for handling of --sysroot, -L, -B, etc.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoiwi, ral, zyd: fix possible use-after-free.
avos [Fri, 17 Feb 2017 23:20:22 +0000 (23:20 +0000)]
iwi, ral, zyd: fix possible use-after-free.

MFC after: 5 days

7 years agoxdev: Build yacc which is needed for recent libpcap updates.
bdrewery [Fri, 17 Feb 2017 22:51:34 +0000 (22:51 +0000)]
xdev: Build yacc which is needed for recent libpcap updates.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoMETA_MODE+xdev: Don't rebuild build-tools during normal build.
bdrewery [Fri, 17 Feb 2017 22:51:21 +0000 (22:51 +0000)]
META_MODE+xdev: Don't rebuild build-tools during normal build.

See r297997 for more information.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoRely on CPUID feature only to enable attaching. MTRR are architectural
kib [Fri, 17 Feb 2017 22:50:41 +0000 (22:50 +0000)]
Rely on CPUID feature only to enable attaching. MTRR are architectural
and there is no reason to check cpu family or vendor.

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

7 years agosmp_rendezvous() works for UP case as well, reduce duplicated
kib [Fri, 17 Feb 2017 22:49:52 +0000 (22:49 +0000)]
smp_rendezvous() works for UP case as well, reduce duplicated
code.  Also fix cast and remove unneeded XXX in comment.

Noted and reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D9657

7 years agosx: fix mips builld after r313855
mjg [Fri, 17 Feb 2017 22:09:55 +0000 (22:09 +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

7 years agoPush max_frame_len back into iflib so that jumbo frame sizes work.
sbruno [Fri, 17 Feb 2017 21:30:16 +0000 (21:30 +0000)]
Push max_frame_len back into iflib so that jumbo frame sizes work.

Reported by: pho

7 years agoEnable capsicum on MALTA kernels.
brooks [Fri, 17 Feb 2017 21:25:24 +0000 (21:25 +0000)]
Enable capsicum on MALTA kernels.

This adds less that 10K to the kernel and should probably be done in the
other std.* configs.

7 years agoMerge i386 and amd64 mtrr drivers.
kib [Fri, 17 Feb 2017 21:08:32 +0000 (21:08 +0000)]
Merge i386 and amd64 mtrr drivers.

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

7 years agoext2fs: Remove unused assignment.
pfg [Fri, 17 Feb 2017 20:56:43 +0000 (20:56 +0000)]
ext2fs: Remove unused assignment.

Value is re-assigned a few lines later without being read.

Found by: Clang static analyzer
MFC after: 1 week

7 years agoMake ctl(4) build with CTL_IO_DELAY defined.
ken [Fri, 17 Feb 2017 20:15:27 +0000 (20:15 +0000)]
Make ctl(4) build with CTL_IO_DELAY defined.

sys/cam/ctl/ctl.c:
In ctl_datamove(), inside CTL_IO_DELAY, add a lun variable and fill
it in before trying to dereference it.

MFC after: 3 days
Sponsored by: Spectra Logic

7 years agoAdd task attribute support to camcontrol(8).
ken [Fri, 17 Feb 2017 20:04:22 +0000 (20:04 +0000)]
Add task attribute support to camcontrol(8).

Users can use the new generic argument, -Q task_attr, to specify a task
attribute (simple, ordered, head of queue, aca) for the commands issued.
The the default is simple, which works with all SCSI devices that support
tagged queueing.

This will mostly be useful for debugging target behavior in certain
situations.

You can try it out by compiling CTL with CTL_IO_DELAY turned on (in
sys/cam/ctl/ctl_io.h) and then do something like this with one of the CTL
LUNs:

ctladm delay 0:0 -l done -t 10
camcontrol tur da34 -v

And at then before the 10 second timer is up, in another terminal:

camcontrol inquiry da34 -Q ordered -v

The Inquiry should complete just after the TUR completes.  Ordinarily
it would complete first because of the delay injection, but because the
task attribute is set to ordered in this case, CTL holds it up until the
previous command has completed.

sbin/camcontrol/camcontrol.c:
Add the new generic argument, -Q, which allows the user to specify
a SCSI task attribute.  The user can specify task attributes by
name or numerically.

Add a new task_attr arguments to SCSI sub-functions.

sbin/camcontrol/attrib.c,
sbin/camcontrol/camcontrol.h,
sbin/camcontrol/fwdownload.c,
sbin/camcontrol/modeedit.c,
sbin/camcontrol/persist.c,
sbin/camcontrol/timestamp.c,
sbin/camcontrol/zone.c:
Add the new task_attr argument to SCSI sub-functions.

sbin/camcontrol/camcontrol.8:
Document the new -Q option, and add an example.

Sponsored by: Spectra Logic
MFC after: 1 week

7 years agoUpdate OLD_DIRS for various targets so that some of the branches of
sbruno [Fri, 17 Feb 2017 20:02:40 +0000 (20:02 +0000)]
Update OLD_DIRS for various targets so that some of the branches of
directories are pruned when the appropriate knobs are turned.

Specifically, turning off bsdconfig, locales, examples, i18n, man,
ntp, syscons.  It may not seem like a lot, but it helps when trying
to keep an x86 image under 96MB for MFSRoot netbooting.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D9558

7 years agosort(1): Remove unneeded initializations.
pfg [Fri, 17 Feb 2017 19:53:20 +0000 (19:53 +0000)]
sort(1): Remove unneeded initializations.

Found by: Clang static analyzer

7 years ago[asmc] Add support for MacBook Pro 11,2
adrian [Fri, 17 Feb 2017 18:49:18 +0000 (18:49 +0000)]
[asmc] Add support for MacBook Pro 11,2

This patch will add support for MacBookPro 11.2.
For the macros, the MBP11_* macros (for the existing MacBookPro11.3) did not
match so they have been renamed to MBP113_* and a new MBP112_* has been
added (modified copy of MBP11_*).

Some trailing whitespaces may have been removed automatically.

PR: kern/214836
Obtained from: Johannes Lundberg <johannes@brilliantservice.co.jp

7 years agoMVF: 313876
jpaetzel [Fri, 17 Feb 2017 17:52:12 +0000 (17:52 +0000)]
MVF: 313876

7504 kmem_reap hangs spa_sync and administrative tasks

illumos/illumos-gate@405a5a0f5c3ab36cb76559467d1a62ba648bd809
https://github.com/illumos/illumos-gate/commit/405a5a0f5c3ab36cb76559467d1a62ba648bd80

https://www.illumos.org/issues/7504

  We see long spa_sync(). We are waiting to hold dp_config_rwlock for writer. Some
  other thread holds dp_config_rwlock for reader, then calls arc_get_data_buf(),
  which finds that arc_is_overflowing()==B_TRUE. So it waits (while holding
  dp_config_rwlock for reader) for arc_reclaim_thread to signal arc_reclaim_waiters_cv.
  Before signaling, arc_reclaim_thread does arc_kmem_reap_now(), which takes ~seconds.

Author: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>

7 years agomtx: get rid of file/line args from slow paths if they are unused
mjg [Fri, 17 Feb 2017 15:40:24 +0000 (15:40 +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.

7 years agomtx: restrict r313875 to kernels without LOCK_PROFILING
mjg [Fri, 17 Feb 2017 15:34:40 +0000 (15:34 +0000)]
mtx: restrict r313875 to kernels without LOCK_PROFILING

7 years agomtx: microoptimize lockstat handling in __mtx_lock_sleep
mjg [Fri, 17 Feb 2017 14:55:59 +0000 (14:55 +0000)]
mtx: microoptimize lockstat handling in __mtx_lock_sleep

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

7 years agoMake inline lockstat checks just inspect lockstat_enabled
mjg [Fri, 17 Feb 2017 14:05:57 +0000 (14:05 +0000)]
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 agoPublish fp[get][set]sticky() for ARMv6.
mmel [Fri, 17 Feb 2017 13:49:46 +0000 (13:49 +0000)]
Publish fp[get][set]sticky() for ARMv6.

Although fp[get][set]sticky() functions are obsolete, they are still
required for GNU fortran49 library.

MFC after: 2 months
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D9634

7 years agoImplement GFP_DMA32 flag in the LinuxKPI.
hselasky [Fri, 17 Feb 2017 13:31:11 +0000 (13:31 +0000)]
Implement GFP_DMA32 flag in the LinuxKPI.
Define all FreeBSD native GFP bits as GFP_NATIVE_MASK.

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

7 years agox86: fix MTRR initialization if EARLY_AP_STARTUP is used
royger [Fri, 17 Feb 2017 12:47:51 +0000 (12:47 +0000)]
x86: fix MTRR initialization if EARLY_AP_STARTUP is used

MTRR handlers are set in {amd64/i686}_mem_drvinit, which is called at
SI_SUB_DRIVERS, and that's too late when EARLY_AP_STARTUP is set because APs
have already started at this point. {amd64/i686}_mrinit is also called too late
for the BSP, since that happens when the memory device is attached, also after
APs have already started.

Move the position to SI_SUB_CPU, and also initialize the state for the BSP, so
that the APs can correctly get to the same state as the BSP.

Sponsored by: Citrix Systems R&D
MFC after: 1 week
Reviewed by: jhb, kib
Differential Revision: https://reviews.freebsd.org/D9630

7 years agoUse full name for the month
bapt [Fri, 17 Feb 2017 11:31:27 +0000 (11:31 +0000)]
Use full name for the month

Reported by: brueffer

7 years agoAlso add vsevolod@ in the authors
bapt [Fri, 17 Feb 2017 11:26:03 +0000 (11:26 +0000)]
Also add vsevolod@ in the authors

7 years agoAdd history and Authors section in the manpage
bapt [Fri, 17 Feb 2017 11:17:56 +0000 (11:17 +0000)]
Add history and Authors section in the manpage

Submitted by: dteske
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D9419

7 years agoPublish __aeabi_uidiv and __aeabi_idiv as compatible symbols from libc.
mmel [Fri, 17 Feb 2017 11:16:19 +0000 (11:16 +0000)]
Publish __aeabi_uidiv and __aeabi_idiv as compatible symbols from libc.

Due to bug[1] in libcompiler_rt, all symbols declared by
DEFINE_AEABI_FUNCTION_ALIAS() are not hidden. All these but two
are explicitly exported from libc and don't causes problems.

Remaining two, __aeabi_uidiv and __aeabi_idiv, infecting all
non-versioned shared libraries. And these symbols are consumed
by many (if not all) packages[2].

As workaround, export these from libc as compatible symbols,
in global namespace. With this, these are still visible for
rtld, but static linker doesn't use then.

[1]
DEFINE_AEABI_FUNCTION_ALIAS() macro uses '.set' directive for
declaration of aliased symbol. Unfortunately, '.set' doesn't
inherit visibility of base symbol, and macro don't explicitly
sets visibility for aliased one.

[2]
Given symbols are exported from non-versioned libraries only if
library itself uses them. So, if world is built for CPU with
HW divide, these function are not used and given symbols are
not exported. By this, contents of these libraries is not stable,
and all packages fails to run.

Note: Due to r313823 I'm forced to commit this too early, without
leave enough time for proper review.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9632

7 years agosx: fix compilation on UP kernels after r313855
mjg [Fri, 17 Feb 2017 10:58:12 +0000 (10:58 +0000)]
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.

Reported by: kib

7 years agoAdd documentations related to new APIs of r313761
mmokhi [Fri, 17 Feb 2017 08:25:48 +0000 (08:25 +0000)]
Add documentations related to new APIs of r313761

PR: 216850 216851 216852 216856 216857 216858
Submitted by: sgk@troutmask.apl.washington.edu
Reported by: sgk@troutmask.apl.washington.edu
Reviewed by: bde emaste hselasky
Approved by: bde emaste hselasky
Differential Revision: https://reviews.freebsd.org/D9491

7 years agoFix building of r313761 on platforms that
mmokhi [Fri, 17 Feb 2017 08:22:32 +0000 (08:22 +0000)]
Fix building of r313761 on platforms that
`long double` is alias of `double` (MIPS, etc)

PR: 216850 216851 216852 216856 216857 216858
Reported by: emsate
Reviewed by: bde emaste hselasky
Approved by: bde emaste hselasky
Differential Revision: https://reviews.freebsd.org/D9491

7 years agoRemove ahb references as well as 1640 info in aha.4
imp [Fri, 17 Feb 2017 06:49:54 +0000 (06:49 +0000)]
Remove ahb references as well as 1640 info in aha.4

7 years agoRemove residuals of mca support
imp [Fri, 17 Feb 2017 06:49:46 +0000 (06:49 +0000)]
Remove residuals of mca support

7 years agoIntroduce SCHEDULER_STOPPED_TD for use when the thread pointer was already read
mjg [Fri, 17 Feb 2017 06:45:04 +0000 (06:45 +0000)]
Introduce SCHEDULER_STOPPED_TD for use when the thread pointer was already read

Sprinkle in few places.

7 years agoBump FreeBSD_version to 1200021 for removal of EISA and MCA.
imp [Fri, 17 Feb 2017 06:22:05 +0000 (06:22 +0000)]
Bump FreeBSD_version to 1200021 for removal of EISA and MCA.

7 years agoNote EISA and MCA bus removal
imp [Fri, 17 Feb 2017 06:22:00 +0000 (06:22 +0000)]
Note EISA and MCA bus removal

7 years agoRemove EISA build option
imp [Fri, 17 Feb 2017 06:13:49 +0000 (06:13 +0000)]
Remove EISA build option

7 years agolocks: let primitives for modules unlock without always goging to the slsow path
mjg [Fri, 17 Feb 2017 05:39:40 +0000 (05:39 +0000)]
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..

7 years agoChange the way MaxCmdSN is used.
mav [Fri, 17 Feb 2017 05:22:58 +0000 (05:22 +0000)]
Change the way MaxCmdSN is used.

Before this change MaxCmdSN was reported as CmdSN + delta, that made it
limit number of requests in transmission from the initiator to target,
that was pretty useless.  After this change MaxCmdSN limits number of
requests queued to CTL, i.e. maximal queue depth for the initiator.
The default limit is 256 outstanding requests per initiator at a time.

This code uses existing cs_outstanding_ctl_pdus counter to track queue
depth.  It's semantics doen't perfectly match, but close enough to not
add another counter.  Just don't set the maxtags below 2.

MFC after: 2 weeks

7 years agolocks: remove SCHEDULER_STOPPED checks from primitives for modules
mjg [Fri, 17 Feb 2017 05:09:51 +0000 (05:09 +0000)]
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.

7 years agoFreeze CAM SIM when request is postponed due to MaxCmdSN.
mav [Fri, 17 Feb 2017 04:34:17 +0000 (04:34 +0000)]
Freeze CAM SIM when request is postponed due to MaxCmdSN.

This allows to avoid resource allocation (especially offload) for requests
that can not be executed at this time any way.

MFC after: 2 weeks

7 years agoFix tight loop spinning on postponed requests.
mav [Fri, 17 Feb 2017 04:29:23 +0000 (04:29 +0000)]
Fix tight loop spinning on postponed requests.

MFC after: 2 weeks

7 years agoDirectly include needed headers rather than relying on pollution.
markj [Fri, 17 Feb 2017 03:27:20 +0000 (03:27 +0000)]
Directly include needed headers rather than relying on pollution.

We get machine/cpu.h via kmem.h -> proc.h -> _vm_domain.h -> seq.h.

Reported by: Ryan Libby
Sponsored by: Dell EMC Isilon
X-MFC with: r313841

7 years agoRemove EISA reference here
imp [Thu, 16 Feb 2017 23:38:30 +0000 (23:38 +0000)]
Remove EISA reference here

7 years agoPrevent CPU migration when checking the DTrace nofault flag on x86.
markj [Thu, 16 Feb 2017 23:05:20 +0000 (23:05 +0000)]
Prevent CPU migration when checking the DTrace nofault flag on x86.

dtrace_trap() consumes page and protection faults triggered by code running
in DTrace probe context. Such faults occur with interrupts disabled and are
detected using a per-CPU flag. Regular faults cause dtrace_trap() to be
called with interrupts enabled, and nothing was ensuring that the flag was
read from the correct CPU. This may result in dtrace_trap() consuming
unrelated page and protection faults when DTrace is enabled, causing the
fault handler to return without actually having handled the fault.

Diagnosed by: Ryan Libby <rlibby@gmail.com>
MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoFix the hardware.html build.
gjb [Thu, 16 Feb 2017 22:29:37 +0000 (22:29 +0000)]
Fix the hardware.html build.

Sponsored by: The FreeBSD Foundation

7 years agoRemove EISA bus support for add-in cards. Remove related kernel and
imp [Thu, 16 Feb 2017 21:57:35 +0000 (21:57 +0000)]
Remove EISA bus support for add-in cards. Remove related kernel and
compile options. Remove doxygen pointers to now deleted files. Remove
EISA and VME as examples in bus_space.9.

Retained EISA mode code for IO PIC and MPTABLES because that's not
EISA bus, per se, and some people have abused EISA to mean "EISA-like
behavior as opposed to ISA" rather than using it for EISA add-in
cards.

Relnotes: yes

7 years agoRemove PCI/EISA bridge support. But keep knowing that a chip is this
imp [Thu, 16 Feb 2017 21:57:30 +0000 (21:57 +0000)]
Remove PCI/EISA bridge support. But keep knowing that a chip is this
kind of bridge since we know for other types of unsupported bridges as
well.

7 years agoRemove EISA support from Buslogic (bt) cards. Remove known models form
imp [Thu, 16 Feb 2017 21:57:25 +0000 (21:57 +0000)]
Remove EISA support from Buslogic (bt) cards. Remove known models form
man page. Tweak comments to not refer to EISA scenarios now that it is
no longer supported. Remove unused enum.

7 years agoRemove EISA support from ahc driver. The AIC-7770 chip can be on ISA,
imp [Thu, 16 Feb 2017 21:57:19 +0000 (21:57 +0000)]
Remove EISA support from ahc driver. The AIC-7770 chip can be on ISA,
VesaLocalBus or EISA. Internally, EISA and ISA are handled the same,
with VL being handled slightly differently. To avoid too much code
churn, retain the EISA name, despite it being used only for ISA
bus. When it is on the ISA bus, weird gymnastics are required with
EISA-space address accesses as well. Remove known models from the ahc
man page. Remove ahc_eisa module.

7 years agoRemove EISA support from dpt. Remove known EISA models from
imp [Thu, 16 Feb 2017 21:57:13 +0000 (21:57 +0000)]
Remove EISA support from dpt. Remove known EISA models from
dpt.4. Remove EISA-only bits from dpt_scsi.c.

7 years agoRemove EISA attachment (fea) from pdq driver. Remove vestiges of
imp [Thu, 16 Feb 2017 21:57:08 +0000 (21:57 +0000)]
Remove EISA attachment (fea) from pdq driver. Remove vestiges of
TurboChannel and Q-Bus support while I'm here. Remove obsolete
diagnostics from man page.

7 years agoRemove EISA support from adv driver. Remove references to it from man
imp [Thu, 16 Feb 2017 21:57:02 +0000 (21:57 +0000)]
Remove EISA support from adv driver. Remove references to it from man
page. Remove comment about EISA dual channel card. Remove trivial
references in advlib to avoid false positives with grep. Remove stray
MCA reference not worth a seperate commit.

7 years agoRemove support for EISA in the ida driver. Remove references to
imp [Thu, 16 Feb 2017 21:56:57 +0000 (21:56 +0000)]
Remove support for EISA in the ida driver. Remove references to
EISA-only registers. Remove known EISA cards from man page.

7 years agoRemove EISA support for ep driver. Left in place EISA strings that are
imp [Thu, 16 Feb 2017 21:56:51 +0000 (21:56 +0000)]
Remove EISA support for ep driver. Left in place EISA strings that are
still relevant (ISA cards can still be in EISA mode, and we're still
ignoring those in the identify routine). Notes about cards in EISA
mode have been left in the manual since they aren't relevant to EISA
support, but instruct how to properly configure an ISA card in a mode
when it is in a ISA bus slot.

7 years agoRemove references to EISA support from the vx driver, along with EISA
imp [Thu, 16 Feb 2017 21:56:46 +0000 (21:56 +0000)]
Remove references to EISA support from the vx driver, along with EISA
support. Fix a comment block that's shared with both vx and ep. Remove
obsolete refernce to statically compiling a kernel with a fixed number
of vx devices. Have not removed EISA from the title of the document
the register definitions were originally derived from (though no doubt
more recent docments were also consulted).

7 years agoRemove references to C-Bus support in the le(4) driver. Support for
imp [Thu, 16 Feb 2017 21:56:41 +0000 (21:56 +0000)]
Remove references to C-Bus support in the le(4) driver. Support for
these devices were removed when pc98 was removed.

7 years agoRemove stray reference to EISA bus support that was never in FreeBSD.
imp [Thu, 16 Feb 2017 21:56:36 +0000 (21:56 +0000)]
Remove stray reference to EISA bus support that was never in FreeBSD.

7 years agoRemove references to EISA support in mlx. The driver never supported
imp [Thu, 16 Feb 2017 21:56:32 +0000 (21:56 +0000)]
Remove references to EISA support in mlx. The driver never supported
the EISA cards and EISA bus support is being removed.

7 years agoRemove the ahb driver for the EISA Adaptec 174x.
imp [Thu, 16 Feb 2017 21:56:27 +0000 (21:56 +0000)]
Remove the ahb driver for the EISA Adaptec 174x.

7 years agoRemove stale MCA comment now that the MCA bus support is gone.
imp [Thu, 16 Feb 2017 21:56:21 +0000 (21:56 +0000)]
Remove stale MCA comment now that the MCA bus support is gone.

Relnotes: yes

7 years agoRevert r313814 and r313816
rstone [Thu, 16 Feb 2017 21:18:31 +0000 (21:18 +0000)]
Revert r313814 and r313816

Something evidently got mangled in my git tree in between testing and
review, as an old and broken version of the patch was apparently submitted
to svn.  Revert this while I work out what went wrong.

Reported by: tuexen
Pointy hat to: rstone

7 years agoPull in r285478 from upstream compiler-rt trunk (by Saleem Abdulrasool):
dim [Thu, 16 Feb 2017 21:03:43 +0000 (21:03 +0000)]
Pull in r285478 from upstream compiler-rt trunk (by Saleem Abdulrasool):

  build: give aliases the same visibility

  ARM EABI also uses function aliases.  Ensure that those aliased
  functions are given proper visibility annotations.

Reported by: mmel
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D9633

7 years agoRemove inet_ntoa() from the kernel
vangyzen [Thu, 16 Feb 2017 20:50:01 +0000 (20:50 +0000)]
Remove inet_ntoa() from the kernel

inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer.  Remove it from the kernel.

Suggested by: glebius, emaste
Reviewed by: gnn
MFC after: never
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625

7 years agoUse inet_ntoa_r() instead of inet_ntoa() throughout the kernel
vangyzen [Thu, 16 Feb 2017 20:47:41 +0000 (20:47 +0000)]
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.

Suggested by: glebius, emaste
Reviewed by: gnn
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625

7 years agopf: use inet_ntoa_r() instead of inet_ntoa(); maybe fix IPv6 OS fingerprinting
vangyzen [Thu, 16 Feb 2017 20:44:44 +0000 (20:44 +0000)]
pf: use inet_ntoa_r() instead of inet_ntoa(); maybe fix IPv6 OS fingerprinting

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.

This code had an INET6 conditional before this commit, but opt_inet6.h
was not included, so INET6 was never defined.  Apparently, pf's OS
fingerprinting hasn't worked with IPv6 for quite some time.
This commit might fix it, but I didn't test that.

Reviewed by: gnn, kp
MFC after: 2 weeks
Relnotes: yes (if I/someone can test pf OS fingerprinting with IPv6)
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625

7 years agoRemove outdated claim.
pfg [Thu, 16 Feb 2017 20:30:55 +0000 (20:30 +0000)]
Remove outdated claim.

Despite wishful thinking the removal of these old function hasn't
happened yet.

MFC after: 3 days

7 years agoSmall inclusion guard comment fix.
pfg [Thu, 16 Feb 2017 20:28:30 +0000 (20:28 +0000)]
Small inclusion guard comment fix.

7 years agoacpica: remove a superfluous NULL check
vangyzen [Thu, 16 Feb 2017 20:27:22 +0000 (20:27 +0000)]
acpica: remove a superfluous NULL check

The address-of operator can't produce NULL (in practice).
Remove an unnecessary NULL check.

MFC after: 3 days
Sponsored by: Dell EMC

7 years agoFix a typo in my previous commit
rstone [Thu, 16 Feb 2017 20:06:21 +0000 (20:06 +0000)]
Fix a typo in my previous commit

Somehow in the late stages of testing my sched_ule patch, a character was
accidentally deleted from the file.  Correct this.

While I'm committing anyway, the previous commit message requires some
clarification: in the normal case of unlending priority after releasing
a mutex, the thread that was doing the lending will be woken up and
immediately become the highest-priority thread, and in that case no
priority inversion would take place.  However, if that thread is pinned
to a different CPU, then the currently running thread that just had its
priority lowered will not be preempted and then priority inversion can
occur.

Reported by: O. Hartmann (typo), jhb (scheduler clarification)
MFC after: 1 month
Pointy hat to: rstone

7 years agoAdd 0-8 as shortcuts for jumping to menu items in the hardening menu.
robak [Thu, 16 Feb 2017 19:58:02 +0000 (19:58 +0000)]
Add 0-8 as shortcuts for jumping to menu items in the hardening menu.

Submitted by: skreuzer
Reviewed by: allanjude, robak
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D6826

7 years agoCheck for preemption after lowering a thread's priority
rstone [Thu, 16 Feb 2017 19:41:13 +0000 (19:41 +0000)]
Check for preemption after lowering a thread's priority

When a high-priority thread is waiting for a mutex held by a
low-priority thread, it temporarily lends its priority to the
low-priority thread to prevent priority inversion.  When the mutex
is released, the lent priority is revoked and the low-priority
thread goes back to its original priority.

When the priority of that thread is lowered (through a call to
sched_priority()), the schedule was not checking whether
there is now a high-priority thread in the run queue.  This can
cause threads with real-time priority to be starved in the run
queue while the low-priority thread finishes its quantum.

Fix this by explicitly checking whether preemption is necessary
when a thread's priority is lowered.

Sponsored by: Dell EMC Isilon
Obtained from: Sandvine Inc
Differential Revision: https://reviews.freebsd.org/D9518
Reviewed by: Jeff Roberson (ule)
MFC after: 1 month

7 years agoMFV 313786
jpaetzel [Thu, 16 Feb 2017 19:00:09 +0000 (19:00 +0000)]
MFV 313786

7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid

illumos/illumos-gate@653af1b809998570c7e89fe7a0d3f90992bf0216
https://github.com/illumos/illumos-gate/commit/653af1b809998570c7e89fe7a0d3f90992bf0216

https://www.illumos.org/issues/7500
  With the integration of:

    commit 0f6d88aded0d165f5954688a9b13bac76c38da84
    Author: Alex Reece <alex@delphix.com>
    Date:   Sat Jul 26 13:40:04 2014 -0800
    4873 zvol unmap calls can take a very long time for larger datasets

  the dnode's dn_bufs field was changed from a list to a tree. As a result,
  the dn_unlisted_l0_blkid field is no longer necessary.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>

7 years agoAllow container_of() to be used with constant data pointers.
hselasky [Thu, 16 Feb 2017 14:13:36 +0000 (14:13 +0000)]
Allow container_of() to be used with constant data pointers.

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

7 years agoImplement linux version of ptrace(2). It's nowhere near complete,
trasz [Thu, 16 Feb 2017 13:32:15 +0000 (13:32 +0000)]
Implement linux version of ptrace(2).  It's nowhere near complete,
but it allows to use 64 bit linux strace(1) on 64 bit linux binaries.

Reviewed by: dchagin (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9406

7 years agoImplement more LinuxKPI atomic functions and macros.
hselasky [Thu, 16 Feb 2017 12:56:10 +0000 (12:56 +0000)]
Implement more LinuxKPI atomic functions and macros.

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

7 years agoAllow passing a constant atomic_t to atomic_read().
hselasky [Thu, 16 Feb 2017 12:20:57 +0000 (12:20 +0000)]
Allow passing a constant atomic_t to atomic_read().

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

7 years agoWhitespace fix.
hselasky [Thu, 16 Feb 2017 12:08:52 +0000 (12:08 +0000)]
Whitespace fix.

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

7 years agoFix LINT build for powerpc.
ae [Thu, 16 Feb 2017 11:38:50 +0000 (11:38 +0000)]
Fix LINT build for powerpc.

Build kernel modules support only when both IPSEC and TCP_SIGNATURE
are not defined.

Reported by: emaste

7 years agoImprove debugging output.
trasz [Thu, 16 Feb 2017 10:36:00 +0000 (10:36 +0000)]
Improve debugging output.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoRemove unnecessary #includes from the kqueue(2) man page.
ed [Thu, 16 Feb 2017 06:52:53 +0000 (06:52 +0000)]
Remove unnecessary #includes from the kqueue(2) man page.

Now that <sys/event.h> can be included on its own, adjust the manual
page accordingly. Remove both unnecessary #include statements from the
synopsis and the example code.

While there, also add a note to the BUGS section to mention that
previous versions of this header file still depend on <sys/types.h>.

Reviewed by: ngie, vangyzen
Differential Revision: https://reviews.freebsd.org/D9605

7 years agoDo not access memory past the buffer end.
kib [Thu, 16 Feb 2017 06:36:16 +0000 (06:36 +0000)]
Do not access memory past the buffer end.
Do not accept and silently truncate too long hostname.

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