]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMFV r288063: make dataset property de-registration operation O(1)
delphij [Fri, 25 Sep 2015 01:05:44 +0000 (01:05 +0000)]
MFV r288063: make dataset property de-registration operation O(1)

A change to a property on a dataset must be propagated to its descendants
in case that property is inherited. For datasets whose information is
not currently loaded into memory (e.g. a snapshot that isn't currently
mounted), there is nothing to do; the property change will take effect
the next time that dataset is loaded. To handle updates to datasets that
are in-core, ZFS registers a callback entry for each property of each
loaded dataset with the dsl directory that holds that dataset. There
is a dsl directory associated with each live dataset that references
both the live dataset and any snapshots of the live dataset. A property
change is effected by doing a traversal of the tree of dsl directories
for a pool, starting at the directory sourcing the change, and invoking
these callbacks.

The current implementation both registers and de-registers properties
individually for each loaded dataset. While registration for a property is
O(1) (insert into a list), de-registration is O(n) (search list and then
remove). The 'n' for de-registration, however, is not limited to the size
(number of snapshots + 1) of the dsl directory. The eviction portion
of the life cycle for the in core state of datasets is asynchronous,
which allows multiple copies of the dataset information to be in-core
at once. Only one of these copies is active at any time with the rest
going through tear down processing, but all copies contribute to the
cost of performing a dsl_prop_unregister().

One way to create multiple, in-flight copies of dataset information
is by performing "zfs list" operations from multiple threads
concurrently. In-core dataset information is loaded on demand and then
evicted when reference counts drops to zero. For datasets that are not
mounted, there is no persistent reference count to keep them resident.
So, a list operation will load them, compute the information required to
do the list operation, and then evict them. When performing this operation
from multiple threads it is possible that some of the in-core dataset
information will be reused, but also possible to lose the race and load
the dataset again, even while the same information is being torn down.

Compounding the performance issue further is a change made for illumos
issue 5056 which made dataset eviction single threaded. In environments
using automation to manage ZFS datasets, it is now possible to create
enough of a backlog of dataset evictions to consume excessive amounts
of kernel memory and to bog down the system.

The fix employed here is to make property de-registration O(1). With this
change in place, it is hoped that a single thread is more than sufficient
to handle eviction processing. If it isn't, the problem can be solved
by increasing the number of threads devoted to the eviction taskq.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h:
    Associate dsl property callback records with both the
    dsl directory and the dsl dataset that is registering the
    callback. Both connections are protected by the dsl directory's
    "dd_lock".

    When linking callbacks into a dsl directory, group them by
    the property type. This helps reduce the space penalty for the
    double association (the property name pointer is stored once
    per dsl_dir instead of in each record) and reduces the number of
    strcmp() calls required to do callback processing when updating
    a single property. Property types are stored in a linked list
    since currently ZFS registers a maximum of 10 property types
    for each dataset.

    Note that the property buckets/records associated with a dsl
    directory are created on demand, but only freed when the dsl
    directory is freed. Given the static nature of property types
    and their small number, there is no benefit to freeing the few
    bytes of memory used to represent the property record earlier.
    When a property record becomes empty, the dsl directory is either
    going to become unreferenced a little later in this thread of
    execution, or there is a high chance that another dataset is
    going to be loaded that would recreate the bucket anyway.

    Replace dsl_prop_unregister() with dsl_prop_unregister_all().
    All callers of dsl_prop_unregister() are trying to remove
    all property registrations for a given dsl dataset anyway. By
    changing the API, we can avoid doing any lookups of callbacks
    by property type and just traverse the list of all callbacks
    for the dataset and free each one.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c:
    Replace use of dsl_prop_unregister() with the new
    dsl_prop_unregister_all() API.

illumos/illumos-gate@03bad06fbb261fd4a7151a70dfeff2f5041cce1f
    Author: Justin Gibbs <gibbs@scsiguy.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Prakash Surya <prakash.surya@delphix.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Illumos issue:
    6171 dsl_prop_unregister() slows down dataset eviction
    https://www.illumos.org/issues/6171

MFC after: 2 weeks

8 years agoRemove EOL whitespace from Makefile.inc1
emaste [Fri, 25 Sep 2015 00:30:53 +0000 (00:30 +0000)]
Remove EOL whitespace from Makefile.inc1

8 years agoDon't recurse with cleanobj.
bdrewery [Fri, 25 Sep 2015 00:07:31 +0000 (00:07 +0000)]
Don't recurse with cleanobj.

bsd.obj.mk handles the needs fine.  When an objdir exists it will
just rm -Rf the objdir.  When it does not exist though it will
call 'clean' and 'cleandepend', which properly recurse in bsd.progs.mk.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unneeded dependency of '.o: .h' that bsd.prog.mk already handles.
bdrewery [Thu, 24 Sep 2015 23:23:58 +0000 (23:23 +0000)]
Remove unneeded dependency of '.o: .h' that bsd.prog.mk already handles.

MFC after: 2 weeks
X-MFC-With: r288198
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd missing CLEANFILES.
bdrewery [Thu, 24 Sep 2015 23:15:24 +0000 (23:15 +0000)]
Add missing CLEANFILES.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove unneeded dependency line.
bdrewery [Thu, 24 Sep 2015 23:08:33 +0000 (23:08 +0000)]
Remove unneeded dependency line.

bsd.prog.mk adds 'ktutil-commands.o: ktutil-commands.h' already.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRename ELFOSABI_SYSV to ELFOSABI_NONE to match current spec
emaste [Thu, 24 Sep 2015 21:04:48 +0000 (21:04 +0000)]
Rename ELFOSABI_SYSV to ELFOSABI_NONE to match current spec

Source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3731

8 years agoreadelf: Correct typo HPUS -> HPUX
emaste [Thu, 24 Sep 2015 18:53:20 +0000 (18:53 +0000)]
readelf: Correct typo HPUS -> HPUX

Submitted by: kib

8 years agoImplement support for reading USB quirks from the kernel environment.
hselasky [Thu, 24 Sep 2015 17:37:30 +0000 (17:37 +0000)]
Implement support for reading USB quirks from the kernel environment.
Refer to the usb_quirk(4) manual page for more details on how to use
this new feature.

Submitted by: Maxime Soule <btik-fbsd@scoubidou.com>
PR: 203249
MFC after: 2 weeks

8 years agoFix running make in src directories without a Makefile giving confusing errors.
bdrewery [Thu, 24 Sep 2015 17:36:18 +0000 (17:36 +0000)]
Fix running make in src directories without a Makefile giving confusing errors.

This fixes the following errors:
  make: don't know how to make bsd.README. Stop
  make: don't know how to make auto.obj.mk. Stop

This is easily seen in sys/dev/*.

The new behavior is now the expected output:
  make: no target to make.

This would happen as MAKESYSPATH (.../share/mk) is auto added to the -I list.
Any directory where make is ran in the src tree that has no local Makefile
would then try executing the target in share/mk/Makefile, which by default
was to build the first entry in FILES.  Of course, because bsd.README and
auto.obj.mk are not in the current directory the error is shown.

This check only works for bmake, but I will still MFC it with an extra
'!defined(.PARSEDIR) ||' guard for stable/10.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoFix up error path handling after the recent churn.
adrian [Thu, 24 Sep 2015 17:23:41 +0000 (17:23 +0000)]
Fix up error path handling after the recent churn.

* Don't free the mbuf in the tx path - it uses the transmit path now,
  so the caller frees the mbuf.
* Don't decrement the node ref upon error - that's up to the caller to
  do as well.

Tested:

* Intel 5300 3x3 wifi, station mode

Noticed by: <s3erios@gmail.com>

8 years agoCorrect UPDATING entry date
emaste [Thu, 24 Sep 2015 16:56:44 +0000 (16:56 +0000)]
Correct UPDATING entry date

8 years agoInstall kernel debug data under /usr/lib/debug
emaste [Thu, 24 Sep 2015 16:55:22 +0000 (16:55 +0000)]
Install kernel debug data under /usr/lib/debug

This avoids needing a large boot partition / file system in order to
accommodate multiple kernels, and provides consistency with userland
debug. This also simplifies the process of moving kernel debug files
to a separate package and installing them on demand.

In addition, change kernel debug file extension to .debug, to match
userland debug files.

When using the supported kernel installation method the
/usr/lib/debug/boot/kernel directory will be renamed (to kernel.old)
as is done with /boot/kernel.

Developers wishing to maintain the historical behavior of installing
debug files in /boot/kernel/ can set KERN_DEBUGDIR="" in src.conf(5).

Reviewed by: bdrewery, brooks, imp, markj
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1006

8 years agoAllow WRITE SAME with NDOB bit set but without UNMAP.
mav [Thu, 24 Sep 2015 15:59:08 +0000 (15:59 +0000)]
Allow WRITE SAME with NDOB bit set but without UNMAP.

This combination was originally forbidden, but allowed at spc4r3.

8 years agoAdd new report types to REPORT LUNS command.
mav [Thu, 24 Sep 2015 12:22:47 +0000 (12:22 +0000)]
Add new report types to REPORT LUNS command.

This is only for completeness, since we have nothing new to report there.

8 years agoUpdate WRITE ATOMIC(16) support to sbc4r8 draft.
mav [Thu, 24 Sep 2015 08:04:47 +0000 (08:04 +0000)]
Update WRITE ATOMIC(16) support to sbc4r8 draft.

This is only a cosmetic change.  We still don't support atomic boundary
field in the CDB, but at least now we do it formally.

8 years agoAdd support for READ BUFFER(16) command.
mav [Thu, 24 Sep 2015 07:16:34 +0000 (07:16 +0000)]
Add support for READ BUFFER(16) command.

8 years agoNote that LIBADD is only valid in /usr/src.
bdrewery [Thu, 24 Sep 2015 00:22:48 +0000 (00:22 +0000)]
Note that LIBADD is only valid in /usr/src.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd very basic LIBADD documentation.
bdrewery [Thu, 24 Sep 2015 00:20:34 +0000 (00:20 +0000)]
Add very basic LIBADD documentation.

Sponsored by: EMC / Isilon Storage Division

8 years agoDocument bsd.progs.mk and add more variables overrides.
bdrewery [Thu, 24 Sep 2015 00:17:00 +0000 (00:17 +0000)]
Document bsd.progs.mk and add more variables overrides.

BINGRP BINMODE BINOWN LINKS MLINKS PROGNAME.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRELDIR is useful without META_MODE. Always define it.
bdrewery [Wed, 23 Sep 2015 23:30:57 +0000 (23:30 +0000)]
RELDIR is useful without META_MODE.  Always define it.

It is the CURDIR without the SRC base location in it.

Sponsored by: EMC / Isilon Storage Division

8 years agoFix most cases of bsd.progs.mk running duplicate or missing commands.
bdrewery [Wed, 23 Sep 2015 23:20:49 +0000 (23:20 +0000)]
Fix most cases of bsd.progs.mk running duplicate or missing commands.

This mostly fixes an interaction with bsd.test.mk with PROGS and SCRIPTS.
This was most notable with 'make clean' and 'make install', which r281055
and r272055 attempted to address but were inadequate.

It also addresses similar issues in bsd.progs.mk when not using bsd.test.mk.

This also fixes cases of NOT running commands in the parent when using
bsd.progs.mk:
  - 'make clean' was not run for the main process for Makefiles which had both
    FILES and SUBDIR but no PROGS or SCRIPTS.  This usually was just a
    leftover Kyuafile.auto.  One such example is usr.bin/bmake/tests/sysmk/t1/2.
  - 'make obj' was not running in the current directory with bsd.test.mk due
    to early inclusion of bsd.subdir.mk.  This was not really a problem due to
    the SUBDIRS using 'mkdir -p' for their objdirs.

There were subtle bugs causing this wrong behavior:
  1. bsd.progs.mk needs to set SCRIPTS to empty when recursing to avoid
     the sub-makes from installing, cleaning or building the SCRIPTS;
     only the parent make should be doing this.  r281055 effectively did
     the same but wasn't enough.
  2. CLEANFILES may contain (especially from *.test.mk) files which only
     the parent should clean, such as from FILES and SCRIPTS.  To resolve
     sub-makes also cleaning these, reset CLEANFILES and CLEANDIRS in the
     children before including bsd.prog.mk.  A tempting alternative would be
     to only handle CLEANFILES in the parent but then the child bsd.prog.mk
     CLEANFILES of per-PROGS wouldn't be setup.
  3. bsd.subdir.mk was included too soon in bsd.test.mk.  It needs to be
     included after bsd.prog.mk as the SCRIPTS logic is short-circuitted if
     'install:' is already defined (which bsd.subdir.mk does).  There is
     actually no need to include bsd.subdir.mk from bsd.test.mk as bsd.prog.mk
     and bsd.obj.mk will do so in the proper order.  The description in r257095
     covers this for FILES and was fixed differently, though changing the
     handling of target(install) in bsd.prog.mk may make sense after more
     research.
  4. bsd.progs.mk had extra logic to handle recursing SCRIPTS if PROGS was
     empty, which isn't its business to be doing.  SCRIPTS is handled fine
     by bsd.prog.mk.  This mostly reverts and reworks the fix in r259209 and
     partially reverts r272055.
  5. bsd.progs.mk has no need to depend 'all:' on SCRIPTS and FILES.  These
     are handled by bsd.prog.mk/bsd.files.mk fine.  This also partially reverts
     r272055.
  6. bsd.progs.mk was not drop-in safe for bsd.prog.mk.  Move the PROGS
     check from r273186 to allow it to be used safely.

Specific tested cases:
  SCRIPTS:no PROGS:no FILES:yes SUBDIR:yes
    usr.bin/bmake/tests/sysmk/t1/2

  SCRIPTS:yes PROGS:no FILES:yes SUBDIR:no
    usr.bin/bmake/tests/sysmk/t1/2/1

  SCRIPTS:yes PROGS:yes FILES:yes SUBDIR:yes
    lib/libthr/tests

  SCRIPTS:yes PROGS:no FILES:yes SUBDIR:no
    usr.bin/yacc/tests
    libexec/atf/atf-sh/tests

A full buildworld/installworld/clean comparison with mtree was also done.
The only relevant difference was the new fixed behavior of removing
Kyuafile.auto from the objdir in 'clean'.

Converting SCRIPTS to be a special case FILES group will make this less
fragile and is being explored.

One known remaining issue is 'cleandepend' removing the tags files for
every recursive call.

Note that the 'make clean' command runs for the CURDIR last, which can make
it appear to run multiple times when cleaning in tests/, but each command is
for a SUBDIR returning up the chain.  This is purely bsd.subdir.mk behavior.

PR: 191055
PR: 191955
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoMETA_MODE: Fix 2nd build causing everything to rebuild due to changed CC.
bdrewery [Wed, 23 Sep 2015 22:36:01 +0000 (22:36 +0000)]
META_MODE: Fix 2nd build causing everything to rebuild due to changed CC.

In the first build the TOOLSDIR does not exit yet which causes CC to default
to the sys.mk version.  Once a TOOLSDIR is created during the build though,
this logic was changing CC to ${TOOLSDIR}/usr/bin/cc even though that file
did not exist.  Thus CC went from 'cc' to '/usr/bin/cc' which forced a
rebuild of everything while using the same compiler.  Check that TOOLSDIR is
not empty to avoid this.  If there is actually a TOOLSDIR cc then it will be
used and properly rebuild.

Sponsored by: EMC / Isilon Storage Division

8 years agoMETA_MODE: Avoid // in meta log for tracked --sysroot files.
bdrewery [Wed, 23 Sep 2015 22:23:59 +0000 (22:23 +0000)]
META_MODE: Avoid // in meta log for tracked --sysroot files.

Sponsored by: EMC / Isilon Storage Division

8 years agoMETA_MODE: Follow-up r287865 and define CCACHE_DIR as realpath'd.
bdrewery [Wed, 23 Sep 2015 21:46:58 +0000 (21:46 +0000)]
META_MODE: Follow-up r287865 and define CCACHE_DIR as realpath'd.

Filemon(4) will record paths as they are seen, not as fully resolved.  make(1)
will take the .MAKE.META.IGNORE_PATHS values and resolve them.  This creates
a discrepancy if CCACHE_DIR is a symlink.  Fix this by ensuring it is
resolved for its actual usage.

Submitted by: sjg

8 years agoSimilar to r266147, don't define PROG in the test subdirs.
bdrewery [Wed, 23 Sep 2015 21:35:58 +0000 (21:35 +0000)]
Similar to r266147, don't define PROG in the test subdirs.

Magic things happen when including bsd.prog.mk in them.

Sponsored by: EMC / Isilon Storage Division

8 years agogeom_dev: Use kenv 'dumpdev' in the same way as rc/etc.d/dumpon
cem [Wed, 23 Sep 2015 21:08:52 +0000 (21:08 +0000)]
geom_dev: Use kenv 'dumpdev' in the same way as rc/etc.d/dumpon

Skip a /dev/ prefix, if one is present, when checking for matching
device names for dump.

Suggested by: avg
Reviewed by: markj
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3725

8 years agoMETA_MODE: Follow-up r287879 and have 'make -V .OBJDIR' still invoke auto.obj.mk.
bdrewery [Wed, 23 Sep 2015 20:46:23 +0000 (20:46 +0000)]
META_MODE: Follow-up r287879 and have 'make -V .OBJDIR' still invoke auto.obj.mk.

When inspecting this value it is more expected to have it show the
automatically-created directory value rather than CURDIR.

Sponsored by: EMC / Isilon Storage Division

8 years agoBring LLVM libunwind snapshot into contrib/llvm/projects
emaste [Wed, 23 Sep 2015 19:30:46 +0000 (19:30 +0000)]
Bring LLVM libunwind snapshot into contrib/llvm/projects

8 years agoImport LLVM libunwind snapshot revision 246528
emaste [Wed, 23 Sep 2015 19:02:06 +0000 (19:02 +0000)]
Import LLVM libunwind snapshot revision 246528

From https://llvm.org/svn/llvm-project/libunwind/trunk/

8 years agoSynchronize mode pages between HA peers.
mav [Wed, 23 Sep 2015 18:33:00 +0000 (18:33 +0000)]
Synchronize mode pages between HA peers.

We allow to modify only few fields in mode pages now, but still it is
not good if they unexpectedly change during failover.  Also this fixes
reporting of "Mode parameters changed" UAs on secondary node.

8 years agoUse ANSI C prototypes. Eliminates -Wold-style-definition warnings.
rodrigc [Wed, 23 Sep 2015 16:16:16 +0000 (16:16 +0000)]
Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.

Submitted by:   Sascha Wildner <swildner@dragonflybsd.org>
Obtained from:  DragonFlyBSD (commit 5d7d35b17f98588c39b30036f1a3fe8802935c2c)

8 years agoMake HA peers announce their parameters on connect.
mav [Wed, 23 Sep 2015 15:49:27 +0000 (15:49 +0000)]
Make HA peers announce their parameters on connect.

HA protocol requires strict version, parameters and configuration match.
Differences there may cause full set of problems up to kernel panic.
To avoid that, validate peer parameters on connect, and abort connection
immediately if some mismatch detected.

8 years agokqueue: simplify kern_kqueue by not refing/unrefing creds too early
mjg [Wed, 23 Sep 2015 12:45:08 +0000 (12:45 +0000)]
kqueue: simplify kern_kqueue by not refing/unrefing creds too early

No functional changes.

8 years ago - Fix a nonsense reordering that somehow slipped into my last diff.
jeff [Wed, 23 Sep 2015 07:44:07 +0000 (07:44 +0000)]
 - Fix a nonsense reordering that somehow slipped into my last diff.

Reported by: pho

8 years agoMFV r288140: update file to 5.25.
delphij [Wed, 23 Sep 2015 05:39:20 +0000 (05:39 +0000)]
MFV r288140: update file to 5.25.

MFC after: 1 month

8 years agoelfdump: report MIPS ELF section type SHT_MIPS_REGINFO
emaste [Wed, 23 Sep 2015 00:32:38 +0000 (00:32 +0000)]
elfdump: report MIPS ELF section type SHT_MIPS_REGINFO

Sponsored by: The FreeBSD Foundation

8 years agoSome refactoring of the buf/vm interface.
jeff [Tue, 22 Sep 2015 23:57:52 +0000 (23:57 +0000)]
Some refactoring of the buf/vm interface.
 - Eliminate bogus page replacement that is inconsistently applied in the
   invalidation loop in brelse.  This has been a no-op in modern times as
   biodone() is responsible for cleaning up after bogus pages.  This
   would've spammed the console with printfs at a minimum.
 - Allow the compiler and human readers alike to reason about allocbuf()
   by splitting it into constituent parts.
 - Separate the VM manipulating and buf manipulating code in brelse() and
   bufdone() so that the intentions are clear.  This makes it evident that
   there are several duplicated buf pages loops that will be consolidated
   at a later time.

Reviewed by: kib
Tested by: pho
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd pass device to arm64 GENERIC (for smartctl)
emaste [Tue, 22 Sep 2015 21:43:08 +0000 (21:43 +0000)]
Add pass device to arm64 GENERIC (for smartctl)

Sponsored by: The FreeBSD Foundation

8 years agoamd64: plug redundant bootAP declaration
mjg [Tue, 22 Sep 2015 21:07:47 +0000 (21:07 +0000)]
amd64: plug redundant bootAP declaration

Reported by: gcc5

8 years agoUse standard lle LLE_EXCLUSIVE request flags instead of
melifaro [Tue, 22 Sep 2015 20:45:04 +0000 (20:45 +0000)]
Use standard lle LLE_EXCLUSIVE request flags instead of
  its redefined version.

8 years agoAdd support for __atomic_FOO_fetch on arm prior to armv6. These return the
andrew [Tue, 22 Sep 2015 19:57:31 +0000 (19:57 +0000)]
Add support for __atomic_FOO_fetch on arm prior to armv6. These return the
new value where the existing functions return the old value.

MFC after: 1 Week

8 years agoReplace toe_nd6_resolve() with nd6_resolve().
melifaro [Tue, 22 Sep 2015 19:05:44 +0000 (19:05 +0000)]
Replace toe_nd6_resolve() with nd6_resolve().

Reviewed by: np

8 years agoCall ast when handling irq from userspace, otherwise we could miss
kib [Tue, 22 Sep 2015 18:30:06 +0000 (18:30 +0000)]
Call ast when handling irq from userspace, otherwise we could miss
reschedule.  Right now arm_cpu_intr() does critical_exit() as the last
action, so the impact is not serious.

Remove duplicated interrupt disable in restore_registers macro, when
returning to usermode.  The do_ast macro disabled interrupts for us.

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3714

8 years agoChange vm_page_unwire() such that it (1) accepts PQ_NONE as the specified
alc [Tue, 22 Sep 2015 18:16:52 +0000 (18:16 +0000)]
Change vm_page_unwire() such that it (1) accepts PQ_NONE as the specified
queue and (2) returns a Boolean indicating whether the page's wire count
transitioned to zero.

Exploit this change in vfs_vmio_release() to avoid pointlessly enqueueing
a page that is about to be freed.

(An earlier version of this change was developed by attilio@ and kmacy@.
Any errors in this version are my own.)

Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division

8 years agoFix crash on parsing some inf files
amdmi3 [Tue, 22 Sep 2015 16:59:41 +0000 (16:59 +0000)]
Fix crash on parsing some inf files

ndiscvt uses 16 entry array for words into which it parses
comma-separated lists of strings, like AddReg line in

    [somesection]
        AddReg = foo.reg, bar.reg, baz.reg, quiz.reg

Overflows were not checked so it crashed on a line with 17 words
encountered in some Broadcom/Dell Wireless 1704 802.11b-g-n driver

So extend the array up to 32 entries and add an overflow check.

Reviewed by: bapt
Approved by: bapt
MFC after: 2 weeks
Differential Revision: D3713

8 years agoaddr2line: skip CUs lacking debug info instead of bailing out
emaste [Tue, 22 Sep 2015 16:51:40 +0000 (16:51 +0000)]
addr2line: skip CUs lacking debug info instead of bailing out

Some binaries (such as the FreeBSD kernel) contain a mixture of CUs
with and without debug information. Previously translate() exited upon
encountering a CU without debug information. Instead, just move on to
the next CU.

Reported by: royger
Reviewed by: royger
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3712

8 years agodmar_ctx_dtr() does not exist since r284869. Remove the static function
bz [Tue, 22 Sep 2015 16:50:59 +0000 (16:50 +0000)]
dmar_ctx_dtr() does not exist since r284869.  Remove the static function
declaration to avoid a cmpile time warning.

8 years agoDon't restore interrupts when we are about to disable them in the next
andrew [Tue, 22 Sep 2015 16:46:34 +0000 (16:46 +0000)]
Don't restore interrupts when we are about to disable them in the next
instruction.

8 years agoRemove unsupported S5 (power off) state since r170976.
jkim [Tue, 22 Sep 2015 16:35:32 +0000 (16:35 +0000)]
Remove unsupported S5 (power off) state since r170976.

Reported by: Iam Smith (smithi at nimnet dot asn dot au)
MFC after: 3 days

8 years agoRe-check for new ast after ast was handled. We should not return to
kib [Tue, 22 Sep 2015 16:29:55 +0000 (16:29 +0000)]
Re-check for new ast after ast was handled.  We should not return to
usermode with pending asts.

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3667

8 years agoUse ANSI C prototypes. Eliminates -Wold-style-definition warnings.
rodrigc [Tue, 22 Sep 2015 15:57:26 +0000 (15:57 +0000)]
Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.

8 years agoUse ANSI C prototypes. Eliminates -Wold-style-definition warnings.
rodrigc [Tue, 22 Sep 2015 15:40:07 +0000 (15:40 +0000)]
Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.

8 years agoHide an unused in FreeBSD function behind #ifdef linux to get rid of
bz [Tue, 22 Sep 2015 15:32:27 +0000 (15:32 +0000)]
Hide an unused in FreeBSD function behind #ifdef linux to get rid of
the compile time warning.

Reviewed by: gnn
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3710

8 years agoAllow AHCI driver attach to all known chips reporting RAID class.
mav [Tue, 22 Sep 2015 15:06:26 +0000 (15:06 +0000)]
Allow AHCI driver attach to all known chips reporting RAID class.

Reported by: Michael BlackHeart <amdmiek@gmail.com>
MFC after: 1 week

8 years agoAdd support for Control extension mode page.
mav [Tue, 22 Sep 2015 14:55:46 +0000 (14:55 +0000)]
Add support for Control extension mode page.

8 years agoarm64 ThunderX PCIe workaround: enumerate only one slot for now
emaste [Tue, 22 Sep 2015 12:56:34 +0000 (12:56 +0000)]
arm64 ThunderX PCIe workaround: enumerate only one slot for now

Otherwise an em(4) NIC is detected 32 times.

Submitted by: wma@semihalf.com
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D3706

8 years agoRemove duplicate and incomplete code handling LUN modify.
mav [Tue, 22 Sep 2015 10:45:50 +0000 (10:45 +0000)]
Remove duplicate and incomplete code handling LUN modify.

Instead reuse code from LUN creation.  This allows most of LUN media
options to be changed live with modify request without full restart.

8 years agoIn binutils' arm-dis.c, avoid left-shifting a negative number.
dim [Tue, 22 Sep 2015 09:35:35 +0000 (09:35 +0000)]
In binutils' arm-dis.c, avoid left-shifting a negative number.

Submitted by: dan.mcgregor_usask.ca (Dan McGregor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D3376

8 years agoUse proper function prototype for readdir().
rodrigc [Tue, 22 Sep 2015 07:40:55 +0000 (07:40 +0000)]
Use proper function prototype for readdir().
Eliminates -Wstrict-prototypes warning

Submitted by: Joerg Sonnenberger <joerg@dragonflybsd.org>
Obtained from: DragonFlyBSD (commit 2a6aec8dab58c89961cabcfdb92e0d0ae256dea4)

8 years agoUse ANSI C prototypes. Eliminates -Wold-style-definition warnings.
rodrigc [Tue, 22 Sep 2015 07:31:40 +0000 (07:31 +0000)]
Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.

8 years agoRevert r287780 until more developers have their say.
hselasky [Tue, 22 Sep 2015 06:51:55 +0000 (06:51 +0000)]
Revert r287780 until more developers have their say.

Differential Revision: https://reviews.freebsd.org/D3521
Requested by: gnn

8 years agonet80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vap
adrian [Tue, 22 Sep 2015 06:34:07 +0000 (06:34 +0000)]
net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vap

Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3658

8 years agoSend a power command to the firmware to shut down the radio as well
adrian [Tue, 22 Sep 2015 05:48:51 +0000 (05:48 +0000)]
Send a power command to the firmware to shut down the radio as well
during rsu_stop().

8 years agobsd.lib.mk: Simplify CLEANFILES handling.
bdrewery [Tue, 22 Sep 2015 05:05:53 +0000 (05:05 +0000)]
bsd.lib.mk: Simplify CLEANFILES handling.

This limits CLEANFILES removal to just bsd.obj.mk now and removes the need
for NOPATH_FILES.

This reverts r96529 which was done due to the command line being too long
for libc.  Since then all architectures now use 256k for ARG_MAX (r170102).
Regardless of that, the libc CLEANFILES is only 72k now.  Others
may be larger but not likely to hit the limit.  If needed, we can improve
the bsd.obj.mk clean: target to split up the list via bmake features.

This also removes some workarounds that are no longer needed.
- a.out removal
- OBJS.tmp, which has not been needed since r117080.
- *.so, which has not been needed since a .so->.So rename in r42450.

This also fixes STATICOBJS and SHLIB_LINK not being in the .NOPATH list.

Sponsored by: EMC / Isilon Storage Division

8 years agoAvoid adding duplicates into OBJS. bsd.lib.mk already handles adding
bdrewery [Tue, 22 Sep 2015 04:55:28 +0000 (04:55 +0000)]
Avoid adding duplicates into OBJS.  bsd.lib.mk already handles adding
entries to OBJS based on SRCS.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agovfs_mountroot_shuffle() never returns non-zero.
bdrewery [Tue, 22 Sep 2015 03:34:07 +0000 (03:34 +0000)]
vfs_mountroot_shuffle() never returns non-zero.

8 years agoUpdate jemalloc to 4.0.2.
jasone [Tue, 22 Sep 2015 03:02:18 +0000 (03:02 +0000)]
Update jemalloc to 4.0.2.

8 years agoBegin fleshing out basic power-on / power-off and A-MPDU TX support.
adrian [Tue, 22 Sep 2015 02:57:18 +0000 (02:57 +0000)]
Begin fleshing out basic power-on / power-off and A-MPDU TX support.

* Add a new method to control NIC poweron / network-sleep / power off;
* Add in A-MPDU TX negotiation support, but comment it out because it
  does break TX traffic;
* blank out the tx buffer before sending a firmware message, just in case;
* go into network-sleep once associated;

TODO:

* figure out why ampdu negotiation isn't working and breaking TX traffic,
  then enable it.

8 years agonet80211 & wireless drivers: remove duplicate defines (noop)
adrian [Tue, 22 Sep 2015 02:48:59 +0000 (02:48 +0000)]
net80211 & wireless drivers: remove duplicate defines (noop)

- IEEE80211_DIR_DSTODS(wh) -> IEEE80211_IS_DSTODS(wh).
- N(a) -> nitems(a).
- Remove LE_READ_2(p)/LE_READ_4(p) definitions (and include ieee80211_input.h instead).
- <drvname>_TXOP_TO_US(txop) -> IEEE80211_TXOP_TO_US(txop).
- Put IEEE80211_RV(v) into ieee80211_proto.h and remove local RV(v) definitions.

Submitted by:   Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision:  https://reviews.freebsd.org/D3705

8 years agonet80211 & wireless drivers: remove duplicate defines (noop)
adrian [Tue, 22 Sep 2015 02:44:59 +0000 (02:44 +0000)]
net80211 & wireless drivers: remove duplicate defines (noop)

* IEEE80211_DIR_DSTODS(wh) -> IEEE80211_IS_DSTODS(wh).
* N(a) -> nitems(a).
* Remove LE_READ_2(p)/LE_READ_4(p) definitions (and include ieee80211_input.h instead).
* <drvname>_TXOP_TO_US(txop) -> IEEE80211_TXOP_TO_US(txop).
* Put IEEE80211_RV(v) into ieee80211_proto.h and remove local RV(v) definitions.

Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3705

8 years agoRemove duplicate use of RV(), LE_* and other macros.
adrian [Tue, 22 Sep 2015 02:25:52 +0000 (02:25 +0000)]
Remove duplicate use of RV(), LE_* and other macros.

Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3705

8 years agoAdd external facing methods to control TX A-MPDU negotiaton.
adrian [Tue, 22 Sep 2015 02:25:29 +0000 (02:25 +0000)]
Add external facing methods to control TX A-MPDU negotiaton.
Some fullmac devices may rely on the stack starting it but not doing it.

Whilst here, remove a duplicate LE_* macro definition, thanks to
Andriy Voskoboinyk <s3erios@gmail.com>.

8 years agoDefine a rateval macro that drivers tend to hard-code.
adrian [Tue, 22 Sep 2015 02:24:13 +0000 (02:24 +0000)]
Define a rateval macro that drivers tend to hard-code.

Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision: https://reviews.freebsd.org/D3705

8 years agoelfdump: report MIPS-specific section type SHT_MIPS_ABIFLAGS
emaste [Tue, 22 Sep 2015 01:45:43 +0000 (01:45 +0000)]
elfdump: report MIPS-specific section type SHT_MIPS_ABIFLAGS

Sponsored by: The FreeBSD Foundation

8 years agongctl dot: Drop invalid trailing semi-colon
cem [Tue, 22 Sep 2015 01:31:01 +0000 (01:31 +0000)]
ngctl dot: Drop invalid trailing semi-colon

PR: 203257
Submitted by: Daniel O'Connor
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd MIPS ELF section type SHT_MIPS_ABIFLAGS definition
emaste [Tue, 22 Sep 2015 00:56:43 +0000 (00:56 +0000)]
Add MIPS ELF section type SHT_MIPS_ABIFLAGS definition

Sponsored by: The FreeBSD Foundation

8 years agoFix installation of 32bit libraries after r288074.
bdrewery [Mon, 21 Sep 2015 21:44:02 +0000 (21:44 +0000)]
Fix installation of 32bit libraries after r288074.

FILES is not used when LIBRARIES_ONLY is set, which is used to build and
install the lib32 sysroot.  All of the csu files do quality as "libraries"
for this case so just undefine LIBRARIES_ONLY.

This is still better than the previous realinstall handling as it does
not hook into META_MODE properly.

Sponsored by: EMC / Isilon Storage Division

8 years agoUse SHAREOWN/SHAREMODE/SHAREGRP rather than LIB* as these are plain ASCII
bdrewery [Mon, 21 Sep 2015 18:52:52 +0000 (18:52 +0000)]
Use SHAREOWN/SHAREMODE/SHAREGRP rather than LIB* as these are plain ASCII
scripts that the linker can load rather than binary library objects.

Effectively no change.

Suggested by: hrs

8 years agoReplace realinstall: and META_MODE staging hacks with FILES mechanism.
bdrewery [Mon, 21 Sep 2015 18:39:13 +0000 (18:39 +0000)]
Replace realinstall: and META_MODE staging hacks with FILES mechanism.

This partially reverts r270170 for lib/csu/i386 while retaining the
change for using bsd.lib.mk.

These FILES groups could go into lib/csu/Makefile.inc but I've kept them
in the Makefiles for clarity.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd the __aeabi_memclr8 symbol, clang 3.7 uses this.
andrew [Mon, 21 Sep 2015 18:35:32 +0000 (18:35 +0000)]
Add the __aeabi_memclr8 symbol, clang 3.7 uses this.

MFC after: 1 week
Sponsored by: ABT Systems Lts

8 years agoMove kbd.c to main sys/conf/files list
emaste [Mon, 21 Sep 2015 17:31:11 +0000 (17:31 +0000)]
Move kbd.c to main sys/conf/files list

It is (optionally) used on all architectures.

Sponsored by: The FreeBSD Foundation

8 years agoRestore the upstream (and documented) behavior of searching for modules
des [Mon, 21 Sep 2015 17:26:35 +0000 (17:26 +0000)]
Restore the upstream (and documented) behavior of searching for modules
both in /usr/lib and /usr/local/lib, thus simplifying the use of modules
from ports, without breaking the compat32 case again.

PR: 191151
MFC after: 3 weeks

8 years agoMove DTrace tools to cross-tools stage
emaste [Mon, 21 Sep 2015 16:07:22 +0000 (16:07 +0000)]
Move DTrace tools to cross-tools stage

Bootstrap tools exist for backwards compatibility support. DTrace tools
tools are also needed for cross builds, so belong in cross-tools.

Reviewed by: imp (earlier), markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2144

8 years agoEnsure that maxproc does not exceed pid_max, at the time of boot.
kib [Mon, 21 Sep 2015 15:02:59 +0000 (15:02 +0000)]
Ensure that maxproc does not exceed pid_max, at the time of boot.
Changes to kern.pid_max mib after the boot can break this relation.

The maxfiles value was calculated by the MAXFILES formula based on
maxproc value, but this change decouples them, and MAXFILES now
references maxusers.  Without manual tuning, the maxfiles default
value remains as it was prior to this commit.  But for systems which
have tuned maxproc and rely on maxfiles to adjust, additional
reconfiguration is needed.

Reported by: rwatson
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoLog iSCSI session reinstatements.
mav [Mon, 21 Sep 2015 13:25:29 +0000 (13:25 +0000)]
Log iSCSI session reinstatements.

False session reinstatements can be result of misconfiguration, when
several initiators use the same initiator name and ISID.

8 years agoCompare mbuf pointer to NULL rather than to 0.
bz [Mon, 21 Sep 2015 12:53:26 +0000 (12:53 +0000)]
Compare mbuf pointer to NULL rather than to 0.
No functional change.

MFC after: 2 weeks

8 years agoIn the UDP over IPv6 implementation several cases are using the wrong protocol,
bz [Mon, 21 Sep 2015 12:32:36 +0000 (12:32 +0000)]
In the UDP over IPv6 implementation several cases are using the wrong protocol,
e.g., based on wrong "next header" assumptions (which does not have to point to
the upper layer protocol), or using hard-coded UDP instead of UDP or UDP-Lite
possibly switching protocols.  Fix those cases for UDP-Lite to work correctly.

PR: 202788
Submitted by: Tiwei Bie (btw mail.ustc.edu.cn) [parts]
Reviewed by: gnn, Tiwei Bie (btw mail.ustc.edu.cn),
kevlo (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3686

8 years agoMFV r287817: 6220 memleak in l2arc on debug build
avg [Mon, 21 Sep 2015 12:23:01 +0000 (12:23 +0000)]
MFV r287817: 6220 memleak in l2arc on debug build

https://github.com/illumos/illumos-gate/commit/c546f36aa898d913ff77674fb5ff97f15b2e08b4
https://www.illumos.org/issues/6220
  5408 introduced a memleak in l2arc, namely the member b_thawed gets leaked when
  an arc_hdr is realloced from full to l2only.

Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: George Wilson <george@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Arne Jansen <sensille@gmx.net>

8 years agoUnify nd6 state switching by using newly-created nd6_llinfo_setstate()
melifaro [Mon, 21 Sep 2015 11:19:53 +0000 (11:19 +0000)]
Unify nd6 state switching by using newly-created nd6_llinfo_setstate()
  function. The change is mostly mechanical with the following exception:
Last piece of nd6_resolve_slow() was refactored: ND6_LLINFO_PERMANENT
  condition was removed as always-true, explicit ND6_LLINFO_NOSTATE ->
  ND6_LLINFO_INCOMPLETE state transition was removed as duplicate.

Reviewed by: ae
Sponsored by: Yandex LLC

8 years agoMake cltd ignore HA ports.
mav [Mon, 21 Sep 2015 10:27:30 +0000 (10:27 +0000)]
Make cltd ignore HA ports.

8 years agoAdd "stale" timer back to nd6_cache_lladdr().
melifaro [Mon, 21 Sep 2015 10:24:34 +0000 (10:24 +0000)]
Add "stale" timer back to nd6_cache_lladdr().
Setting timer was accidentally removed in r276844 due to misleading
  comment on its meaningless. Add it back to restore proper behaviour.

8 years agoBunch of improvements to ctlstat.
mav [Mon, 21 Sep 2015 09:37:49 +0000 (09:37 +0000)]
Bunch of improvements to ctlstat.

Add -p option to allow filtering by ports.
Make -l and -p options work in all modes as filters.
Improve output formatting to better fit columns.

8 years agoDelete /etc/autofs/special_noauto when MK_AUTOFS == no
ngie [Mon, 21 Sep 2015 03:39:13 +0000 (03:39 +0000)]
Delete /etc/autofs/special_noauto when MK_AUTOFS == no

MFC after: 1 week

8 years agoEnable if_dwc for Allwinner A20 based boards.
loos [Mon, 21 Sep 2015 03:17:41 +0000 (03:17 +0000)]
Enable if_dwc for Allwinner A20 based boards.

This enables the gigabit ethernet on cubieboard2 and banana pi.

A special thanks to Netgate who gently provided me with a banana pi almost
a year ago.

8 years agoYes, it supports 802.11n.
adrian [Mon, 21 Sep 2015 02:33:11 +0000 (02:33 +0000)]
Yes, it supports 802.11n.

8 years agoFlip on 11n by default; update TODO items.
adrian [Mon, 21 Sep 2015 02:32:11 +0000 (02:32 +0000)]
Flip on 11n by default; update TODO items.

8 years agoConvert if_rsu to use a deferred transmit task rather than using rsu_start()
adrian [Mon, 21 Sep 2015 02:30:22 +0000 (02:30 +0000)]
Convert if_rsu to use a deferred transmit task rather than using rsu_start()
to do it directly.

Ensure that we re-queue starting transmit upon TX completion.

This solves two issues:

* It stops tx stalls - before this, if the transmit path filled the
  mbuf queue then it'd never start another transmit.

* It enforces ordering - this is very required for 802.11n which
  requires frames to be transmitted in the order they're queued.
  Since everything remotely involved in USB has an unlock/thing/relock
  pattern with that mutex, the only way to guarantee TX ordering is
  to 100% defer it into a separate thread.

This now survives an iperf test and gets a reliable 30mbit/sec.

8 years agoDrain the mbuf queue upon rsu_stop().
adrian [Mon, 21 Sep 2015 02:12:01 +0000 (02:12 +0000)]
Drain the mbuf queue upon rsu_stop().

Correctly (I hope!) remove net80211 references before doing so.
Just doing a dumb mbufq drain isn't enough.

If enough traffic occurs and the mbuf queue fills up then transmit
stalls (which I'm not fixing in this commit!) but then the mbuf queue
stays full until the driver is removed.  There's also the net80211
node refcounting leak.

This just ensures that during rsu_stop and detach the mbuf queue
is purged (and references!) so the queue-full situation can be
recovered from.

8 years agoAdd the A20 glue code for if_dwc.
loos [Mon, 21 Sep 2015 01:51:37 +0000 (01:51 +0000)]
Add the A20 glue code for if_dwc.

This code initializes the GMAC clock and sets the pin mux to rgmii.

It also override the if_dwc defaults to set the alternate descriptor type
and MII clock used on A20.

Tested on cubieboard2 and banana pi.