]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMerge ^/head r313644 through r313895.
Dimitry Andric [Fri, 17 Feb 2017 20:19:38 +0000 (20:19 +0000)]
Merge ^/head r313644 through r313895.

7 years agoMake ctl(4) build with CTL_IO_DELAY defined.
Kenneth D. Merry [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 agoMerge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
Dimitry Andric [Fri, 17 Feb 2017 20:07:35 +0000 (20:07 +0000)]
Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r295380, and update build glue.

7 years agoAdd task attribute support to camcontrol(8).
Kenneth D. Merry [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
Sean Bruno [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.
Pedro F. Giffuni [Fri, 17 Feb 2017 19:53:20 +0000 (19:53 +0000)]
sort(1): Remove unneeded initializations.

Found by: Clang static analyzer

7 years agoVendor import of libc++ release_40 branch r295380:
Dimitry Andric [Fri, 17 Feb 2017 19:38:36 +0000 (19:38 +0000)]
Vendor import of libc++ release_40 branch r295380:
https://llvm.org/svn/llvm-project/libcxx/branches/release_40@295380

7 years agoVendor import of compiler-rt release_40 branch r295380:
Dimitry Andric [Fri, 17 Feb 2017 19:37:28 +0000 (19:37 +0000)]
Vendor import of compiler-rt release_40 branch r295380:
https://llvm.org/svn/llvm-project/compiler-rt/branches/release_40@295380

7 years agoVendor import of clang release_40 branch r295380:
Dimitry Andric [Fri, 17 Feb 2017 19:36:19 +0000 (19:36 +0000)]
Vendor import of clang release_40 branch r295380:
https://llvm.org/svn/llvm-project/cfe/branches/release_40@295380

7 years agoVendor import of llvm release_40 branch r295380:
Dimitry Andric [Fri, 17 Feb 2017 19:35:08 +0000 (19:35 +0000)]
Vendor import of llvm release_40 branch r295380:
https://llvm.org/svn/llvm-project/llvm/branches/release_40@295380

7 years ago[asmc] Add support for MacBook Pro 11,2
Adrian Chadd [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
Josh Paetzel [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
Mateusz Guzik [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
Mateusz Guzik [Fri, 17 Feb 2017 15:34:40 +0000 (15:34 +0000)]
mtx: restrict r313875 to kernels without LOCK_PROFILING

7 years ago7504 kmem_reap hangs spa_sync and administrative tasks
Josh Paetzel [Fri, 17 Feb 2017 15:00:13 +0000 (15:00 +0000)]
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: microoptimize lockstat handling in __mtx_lock_sleep
Mateusz Guzik [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
Mateusz Guzik [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.
Michal Meloun [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.
Hans Petter Selasky [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
Roger Pau Monné [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
Baptiste Daroussin [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
Baptiste Daroussin [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
Baptiste Daroussin [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.
Michal Meloun [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
Mateusz Guzik [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
Mahdi Mokhtari [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
Mahdi Mokhtari [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
Warner Losh [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
Warner Losh [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
Mateusz Guzik [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.
Warner Losh [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
Warner Losh [Fri, 17 Feb 2017 06:22:00 +0000 (06:22 +0000)]
Note EISA and MCA bus removal

7 years agoRemove EISA build option
Warner Losh [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
Mateusz Guzik [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.
Alexander Motin [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
Mateusz Guzik [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.
Alexander Motin [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.
Alexander Motin [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.
Mark Johnston [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
Warner Losh [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.
Mark Johnston [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.
Glen Barber [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
Warner Losh [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
Warner Losh [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
Warner Losh [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,
Warner Losh [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
Warner Losh [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
Warner Losh [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
Warner Losh [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
Warner Losh [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
Warner Losh [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
Warner Losh [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
Warner Losh [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.
Warner Losh [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
Warner Losh [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.
Warner Losh [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.
Warner Losh [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
Ryan Stone [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):
Dimitry Andric [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
Eric van Gyzen [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
Eric van Gyzen [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
Eric van Gyzen [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.
Pedro F. Giffuni [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.
Pedro F. Giffuni [Thu, 16 Feb 2017 20:28:30 +0000 (20:28 +0000)]
Small inclusion guard comment fix.

7 years agoacpica: remove a superfluous NULL check
Eric van Gyzen [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
Ryan Stone [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.
Bartek Rutkowski [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
Ryan Stone [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
Josh Paetzel [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.
Hans Petter Selasky [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,
Edward Tomasz Napierala [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.
Hans Petter Selasky [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().
Hans Petter Selasky [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.
Hans Petter Selasky [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.
Andrey V. Elsukov [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.
Edward Tomasz Napierala [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 Schouten [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.
Konstantin Belousov [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

7 years agoDo not allocate char[MNAMELEN] on stack in nfsclient.
Konstantin Belousov [Thu, 16 Feb 2017 06:34:20 +0000 (06:34 +0000)]
Do not allocate char[MNAMELEN] on stack in nfsclient.

Right now this is not critical, but will be after planned increase of
MNAMELEN from 88 to 1k.

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

7 years agoUse uintmax_t to print st_nlink.
Konstantin Belousov [Thu, 16 Feb 2017 06:32:39 +0000 (06:32 +0000)]
Use uintmax_t to print st_nlink.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoMinor style fixes.
Konstantin Belousov [Thu, 16 Feb 2017 06:31:36 +0000 (06:31 +0000)]
Minor style fixes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agomakefs: use a macro to simplify per-fs function declarations
Ed Maste [Thu, 16 Feb 2017 03:12:47 +0000 (03:12 +0000)]
makefs: use a macro to simplify per-fs function declarations

makefs.h 1.28

Obtained from: NetBSD

7 years ago7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid
Josh Paetzel [Thu, 16 Feb 2017 01:44:56 +0000 (01:44 +0000)]
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 agoUse symbolic constants for OSC support / control negotiations.
Warner Losh [Wed, 15 Feb 2017 23:49:28 +0000 (23:49 +0000)]
Use symbolic constants for OSC support / control negotiations.

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

7 years agorwlock: tidy up r313392
Mateusz Guzik [Wed, 15 Feb 2017 23:33:14 +0000 (23:33 +0000)]
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 agoRemove Micro Channel Architecture support. Of the commonly available
Warner Losh [Wed, 15 Feb 2017 23:04:25 +0000 (23:04 +0000)]
Remove Micro Channel Architecture support. Of the commonly available
machines, only a few 486 machines that used it, and those haven't had
enough memory to run FreeBSD for quite some time (often limited to
16MB).

Not to be confused with the Machine Check Architecture, which is still
very much alive and used (and untouched by this commit).

No Objection From: arch@

7 years agoMFV r313781:
Martin Matuska [Wed, 15 Feb 2017 20:17:55 +0000 (20:17 +0000)]
MFV r313781:
Sync libarchive with vendor

Vendor changes:
Make SCHILY.acl.ace header more compact (NFSv4 ACLs)

Vendor bugfixes:
zip reader integer parsing fix (OSS-Fuzz 556)
spelling fixes (issue #863)

7 years agoUpdate vendor/libarchive to git 0edabbad1f44641c64fe9d0cbaed27ed93ab38c2
Martin Matuska [Wed, 15 Feb 2017 20:00:36 +0000 (20:00 +0000)]
Update vendor/libarchive to git 0edabbad1f44641c64fe9d0cbaed27ed93ab38c2

Vendor changes:
Make SCHILY.acl.ace header more compact (NFSv4 ACLs)

Vendor bugfixes:
zip reader integer parsing fix (OSS-Fuzz 556)
spelling fixes (issue #863)

7 years agoprefix UFS symbols with UFS_ to reduce namespace pollution
Ed Maste [Wed, 15 Feb 2017 19:50:26 +0000 (19:50 +0000)]
prefix UFS symbols with UFS_ to reduce namespace pollution

Specifically:
  ROOTINO -> UFS_ROOTINO
  WINO -> UFS_WINO
  NXADDR -> UFS_NXADDR
  NDADDR -> UFS_NDADDR
  NIADDR -> UFS_NIADDR
  MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_

Reviewed by: kib, mckusick
Obtained from: NetBSD
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9536

7 years agoFix handling of negative sbspace() return values.
Alexander Motin [Wed, 15 Feb 2017 19:46:00 +0000 (19:46 +0000)]
Fix handling of negative sbspace() return values.

I found that at least with Chelsio NICs TOE sockets quite often report
negative sbspace() values.  Using unsigned variable to store it resulted
in attempts to aggregate too much data in one sosend() call, that caused
errors and following connection termination.

MFC after: 2 weeks

7 years agoImprove code readability and fix compilation error when using clang 4.x.
Hans Petter Selasky [Wed, 15 Feb 2017 18:31:09 +0000 (18:31 +0000)]
Improve code readability and fix compilation error when using clang 4.x.

Found by: emaste @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUn-break vt(4) for {powerpc,powerpc64,sparc64} LINT kernel builds
Ravi Pokala [Wed, 15 Feb 2017 17:33:03 +0000 (17:33 +0000)]
Un-break vt(4) for {powerpc,powerpc64,sparc64} LINT kernel builds

The {powerpc,powerpc64,sparc64} LINT kernel builds fail with this error:

    sys/dev/vt/vt_buf.c:198: warning: 'vtbuf_htw' defined but not used

Move vtbuf_htw() inside the '#if SC_NO_CUTPASTE' block where it belongs, and
put it in the proper order.

This fixes the immedate issue w/ vt(4), but all three then fail on different
issues.

Reviewed by: emaste

7 years agoChange the "devfs_fsync: vop_stdfsync failed" from panic to a printf.
Edward Tomasz Napierala [Wed, 15 Feb 2017 16:52:21 +0000 (16:52 +0000)]
Change the "devfs_fsync: vop_stdfsync failed" from panic to a printf.
It's not a proper fix, but should be better than what we have now.
Since it got broken some six months ago it results in an incredibly
annoying and trivially reproducible panic every time eg an USB disk
gets disconnected.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agolocaltime: return NULL if time_t out of range of struct tm
Ed Maste [Wed, 15 Feb 2017 15:32:29 +0000 (15:32 +0000)]
localtime: return NULL if time_t out of range of struct tm

Previously we would truncate tm.tm_year for any time_t corresponding to
a year that does not fit in int.  This issue was discovered because it
caused the bash-static build to fail when linking with LLD.

As reported by Rafael Espíndola:

    Configure has

    AC_FUNC_MKTIME

    which expands to a test of mktime that fails with the freebsd
    implementation. Given that, bash compiles a mktime.o file that
    defines just mktime and uses localtime. That goes in a .a file
    that is before libc.

    The freebsd libc defines mktime in localtime.o, which also defines
    localtime among other functions.

    When lld sees an undefined reference to mktime from libc, it uses
    the bash provided one and then tries to find a definition of
    localtime. It is found on libc's localtime.o, but now we have a
    duplicated error.

    The reason it works with bfd is that bash doesn't use mktime
    directly and the undefined reference from libc is resolved to the
    libc implementation. It would also fail to link if bash itself
    directly used mktime.

The bash-static configure test verifies that, for many values of t, either
localtime(t) returns NULL or mktime(localtime(t)) == t.  This test failed
when localtime returned a truncated tm_year.

This was fixed in tzcode in 2004 but has persisted in our tree since
rS2708.

Reported by: Rafael Espíndola
Reviewed by: bapt
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9534

7 years agoLoad the new sp_el0 with interrupts disabled in fork_trampoline. If an
Andrew Turner [Wed, 15 Feb 2017 14:56:47 +0000 (14:56 +0000)]
Load the new sp_el0 with interrupts disabled in fork_trampoline. If an
interrupt arrives in fork_trampoline after sp_el0 was written we may then
switch to a new thread, enter userland so change this stack pointer, then
return to this code with the wrong value. This fixes this case by moving
the load of sp_el0 until after interrupts have been disabled.

Reported by: Mark Millard (markmi@dsl-only.net)
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D9593

7 years agobxe: enable usage with NetXtreme II BCM57840 2x20GbE chip
Roger Pau Monné [Wed, 15 Feb 2017 14:34:40 +0000 (14:34 +0000)]
bxe: enable usage with NetXtreme II BCM57840 2x20GbE chip

Current bxe probe function won't attach to devices with the NetXtreme II
BCM57840 2x20GbE chip, enable it by adding it's chip ID to the list of
supported chips.

Tested on: HP ProLiant WS460c Gen9
Reviewed by: gnn
MFC after: 1 week
Sponsored by: Citrix Systems R&D
Differential Revision: https://reviews.freebsd.org/D9609

7 years agoRegen after r313769.
Edward Tomasz Napierala [Wed, 15 Feb 2017 14:25:50 +0000 (14:25 +0000)]
Regen after r313769.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoFix definition of linux64 ptrace syscall.
Edward Tomasz Napierala [Wed, 15 Feb 2017 14:12:39 +0000 (14:12 +0000)]
Fix definition of linux64 ptrace syscall.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoPort the Linux AMX 10G network driver to FreeBSD as axgbe. It is unlikely
Andrew Turner [Wed, 15 Feb 2017 13:56:04 +0000 (13:56 +0000)]
Port the Linux AMX 10G network driver to FreeBSD as axgbe. It is unlikely
we will import a newer version of the Linux code so the linuxkpi was not
used.

This is still missing 10G support, and multicast has not been tested.

Reviewed by: gnn
Obtained from: ABT Systems Ltd
Sponsored by: SoftIron Inc
Differential Revision: https://reviews.freebsd.org/D8549

7 years agoImport the AMD 10G ethernet driver for the AMD Opteron A1100.
Andrew Turner [Wed, 15 Feb 2017 13:37:32 +0000 (13:37 +0000)]
Import the AMD 10G ethernet driver for the AMD Opteron A1100.

This is from Linux git as of 5eb4dce3b3471ec9d1ea2945fa3d2bab4ac7e100

Obtained from: Linux
Sponsored by: SoftIron Inc