Commit Graph

106020 Commits

Author SHA1 Message Date
Bjoern A. Zeeb
5ddb05c2fe Compare the newly allocated array elements to NULL in order to see
if the malloc succeeded.

Spotted by:	reading kernel compile time log
MFC after:	2 weeks
2015-09-25 23:07:17 +00:00
Alexander Motin
86b7954b92 Properly lock LUN in ctl_failover_lun(). 2015-09-25 22:45:23 +00:00
Ed Maste
7fc0791608 Remove apostrophe from AP's for consistency (arm64 mp_machdep) 2015-09-25 21:04:31 +00:00
Alexander Motin
f44570f617 Fix bit masks changed for the wrong commands in r288221. 2015-09-25 19:46:34 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Alexander Motin
5d4dfee032 Constify ctl_serialize_table. 2015-09-25 18:49:25 +00:00
Conrad Meyer
2f1c4e0ebf sbuf: Process more than one char at a time
Revamp sbuf_put_byte() to sbuf_put_bytes() in the obvious fashion and
fixup callers.

Add a thin shim around sbuf_put_bytes() with the old ABI to avoid ugly
changes to some callers.

Reviewed by:	jhb, markj
Obtained from:	Dan Sledz
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3717
2015-09-25 18:37:14 +00:00
Alexander Motin
c30a4c1871 Remove some dead code found by Clang analyzer. 2015-09-25 18:15:34 +00:00
Alexander Motin
67cc546dfc Remove stale comments and some excessive empty lines. 2015-09-25 16:34:59 +00:00
Konstantin Belousov
b2557db607 Use per-cpu values for base and last in tc_cpu_ticks(). The values
are updated lockess, different CPUs write its own view of timecounter
state.  The critical section is done for safety, callers of
tc_cpu_ticks() are supposed to already enter critical section, or to
own a spinlock.

The change fixes sporadical reports of too high values reported for
the (W)CPU on platforms that do not provide cpu ticker and use
tc_cpu_ticks(), in particular, arm*.

Diagnosed and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-25 13:03:57 +00:00
Alexander Motin
e675024a02 Switch I/O time accounting from system time to uptime.
While there, make num_dmas accounted independently of CTL_TIME_IO.
2015-09-25 10:14:39 +00:00
Alexander Motin
6c068d4bf3 Collect DMA statistics on secondary HA node. 2015-09-25 09:55:51 +00:00
Alexander Motin
116c5818ec Make HA handle datamove and done in a universal way, using port methods.
Now from primary node point of view requests transferred from secondary
node should look almost normal and always have valid port.
2015-09-25 09:14:29 +00:00
Alexander Motin
21d963e528 Remove some control_softc references. 2015-09-25 07:27:23 +00:00
Xin LI
8012d6910c 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@03bad06fbb
    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
2015-09-25 01:05:44 +00:00
Hans Petter Selasky
a130076f26 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
2015-09-24 17:37:30 +00:00
Adrian Chadd
1ff8129a59 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>
2015-09-24 17:23:41 +00:00
Ed Maste
05117b57a5 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
2015-09-24 16:55:22 +00:00
Alexander Motin
6c2acea564 Allow WRITE SAME with NDOB bit set but without UNMAP.
This combination was originally forbidden, but allowed at spc4r3.
2015-09-24 15:59:08 +00:00
Alexander Motin
4ef0129a46 Add new report types to REPORT LUNS command.
This is only for completeness, since we have nothing new to report there.
2015-09-24 12:22:47 +00:00
Alexander Motin
a6daea64fd 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.
2015-09-24 08:04:47 +00:00
Alexander Motin
de988746be Add support for READ BUFFER(16) command. 2015-09-24 07:16:34 +00:00
Conrad Meyer
b4d7290796 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
2015-09-23 21:08:52 +00:00
Alexander Motin
ca85b7c4e9 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.
2015-09-23 18:33:00 +00:00
Alexander Motin
a85700a912 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.
2015-09-23 15:49:27 +00:00
Mateusz Guzik
3c44a3495f kqueue: simplify kern_kqueue by not refing/unrefing creds too early
No functional changes.
2015-09-23 12:45:08 +00:00
Jeff Roberson
589c956a5a - Fix a nonsense reordering that somehow slipped into my last diff.
Reported by:	pho
2015-09-23 07:44:07 +00:00
Jeff Roberson
8264830c95 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
2015-09-22 23:57:52 +00:00
Ed Maste
2ed39a2216 Add pass device to arm64 GENERIC (for smartctl)
Sponsored by:	The FreeBSD Foundation
2015-09-22 21:43:08 +00:00
Mateusz Guzik
c025b81442 amd64: plug redundant bootAP declaration
Reported by:	gcc5
2015-09-22 21:07:47 +00:00
Alexander V. Chernikov
f506d933b5 Use standard lle LLE_EXCLUSIVE request flags instead of
its redefined version.
2015-09-22 20:45:04 +00:00
Andrew Turner
faca5970b0 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
2015-09-22 19:57:31 +00:00
Alexander V. Chernikov
8e5aadb617 Replace toe_nd6_resolve() with nd6_resolve().
Reviewed by:	np
2015-09-22 19:05:44 +00:00
Konstantin Belousov
37864a5451 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
2015-09-22 18:30:06 +00:00
Alan Cox
15aaea7892 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
2015-09-22 18:16:52 +00:00
Bjoern A. Zeeb
6b1ad46a3b dmar_ctx_dtr() does not exist since r284869. Remove the static function
declaration to avoid a cmpile time warning.
2015-09-22 16:50:59 +00:00
Andrew Turner
9063d39e49 Don't restore interrupts when we are about to disable them in the next
instruction.
2015-09-22 16:46:34 +00:00
Konstantin Belousov
d50c68b2f0 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
2015-09-22 16:29:55 +00:00
Bjoern A. Zeeb
9293cfeb42 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
2015-09-22 15:32:27 +00:00
Alexander Motin
98ef2a6198 Allow AHCI driver attach to all known chips reporting RAID class.
Reported by:	Michael BlackHeart <amdmiek@gmail.com>
MFC after:	1 week
2015-09-22 15:06:26 +00:00
Alexander Motin
c53993057b Add support for Control extension mode page. 2015-09-22 14:55:46 +00:00
Ed Maste
a9ee805d45 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
2015-09-22 12:56:34 +00:00
Alexander Motin
4ce7a0868c 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.
2015-09-22 10:45:50 +00:00
Hans Petter Selasky
c55f4c9445 Revert r287780 until more developers have their say.
Differential Revision:	https://reviews.freebsd.org/D3521
Requested by:		gnn
2015-09-22 06:51:55 +00:00
Adrian Chadd
0cf00015be 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
2015-09-22 06:34:07 +00:00
Adrian Chadd
44369387a1 Send a power command to the firmware to shut down the radio as well
during rsu_stop().
2015-09-22 05:48:51 +00:00
Bryan Drewery
6c5c24c98c vfs_mountroot_shuffle() never returns non-zero. 2015-09-22 03:34:07 +00:00
Adrian Chadd
6acf853d7a 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.
2015-09-22 02:57:18 +00:00
Adrian Chadd
82e8c646b4 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
2015-09-22 02:48:59 +00:00