]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 years agoAdd missing space
bryanv [Wed, 27 Mar 2013 07:11:29 +0000 (07:11 +0000)]
Add missing space

MFC after: 3 days

11 years agoCommit initial (unfinished!) support for the AR933x series of embedded
adrian [Wed, 27 Mar 2013 03:38:58 +0000 (03:38 +0000)]
Commit initial (unfinished!) support for the AR933x series of embedded
CPUs.

The AR933x is a mips24k based SoC with an AR9380 series SoC on board,
two gigabit ethernet interfaces and an internal 10/100mbit ethernet
switch.  There's also the normal interfaces (USB, ethernet, uart, GPIO.)

The downside? There's a non-ns8250 UART device.

With a very basic UART driver (not in this commit) the SoC is initialised
and boots up.  I'll commit the UART code soon and then link it into the
general setup path.

This code is a re-implementation based from the Linux kernel / openwrt
AR933x support.

TODO:

* UART (obviously)
* All of the ethernet, USB and wifi SoC glue, including ethernet PLL
  programming.

11 years agoAdd the reference clock for each supported chip.
adrian [Wed, 27 Mar 2013 03:33:19 +0000 (03:33 +0000)]
Add the reference clock for each supported chip.

Obtained from: Linux (openwrt)

11 years agoFix printf format issue on i386.
jimharris [Wed, 27 Mar 2013 00:37:00 +0000 (00:37 +0000)]
Fix printf format issue on i386.

Reported by: bz

11 years ago* Stop processing after HAL_EIO; this is what the reference driver does.
adrian [Wed, 27 Mar 2013 00:35:45 +0000 (00:35 +0000)]
* Stop processing after HAL_EIO; this is what the reference driver does.
* If we hit an empty queue condition (which I haven't yet root caused, grr.)
  .. make sure we release the lock before continuing.

11 years agoPanic should the SCI framework ever request a pointer into the ccb's
jimharris [Wed, 27 Mar 2013 00:15:22 +0000 (00:15 +0000)]
Panic should the SCI framework ever request a pointer into the ccb's
data buffer for a ccb that is unmapped.

This case is currently not possible, since the SCI framework only
requests these pointers for doing SCSI/ATA translation of non-
READ/WRITE commands.  The panic is more to protect against the
unlikely future scenario where additional commands could be unmapped.

Sponsored by: Intel

11 years agoLoosen restrictions for quoted strings. Now we can use more complex strings
jkim [Tue, 26 Mar 2013 23:58:13 +0000 (23:58 +0000)]
Loosen restrictions for quoted strings.  Now we can use more complex strings
and "escaped" quote characters.

MFC after: 1 month

11 years agoFix interval-based rotations when the -t flag is used. In this case, find
markj [Tue, 26 Mar 2013 23:11:30 +0000 (23:11 +0000)]
Fix interval-based rotations when the -t flag is used. In this case, find
the most-recently archived logfile and use its mtime to determine whether
or not to rotate, as in the non-timestamped case.

Previously we would just try to use the mtime of <logfile>.0, which always
results in a rotation since it generally doesn't exist in the -t case.

PR: bin/166448
Approved by: emaste (co-mentor)
Tested by: Marco Steinbach <coco executive-computing.de>
MFC after: 2 weeks

11 years agoReport support for unmapped I/O by adding PIM_UNMAPPED flag.
jimharris [Tue, 26 Mar 2013 23:04:06 +0000 (23:04 +0000)]
Report support for unmapped I/O by adding PIM_UNMAPPED flag.

Submitted by: jhb, scottl

11 years agoaccept(2): Mention inheritance of O_ASYNC and signal destination.
jilles [Tue, 26 Mar 2013 22:46:56 +0000 (22:46 +0000)]
accept(2): Mention inheritance of O_ASYNC and signal destination.

While almost nobody uses O_ASYNC, and rightly so, the inheritance of the
related properties across accept() is a portability issue like the
inheritance of O_NONBLOCK.

11 years agoClean up debug prints.
jimharris [Tue, 26 Mar 2013 22:17:10 +0000 (22:17 +0000)]
Clean up debug prints.

1) Consistently use device_printf.
2) Make dump_completion and dump_command into something more
    human-readable.

Sponsored by: Intel
Reviewed by: carl

11 years agoUse errno and strerror to print more descriptive messages when operations
jimharris [Tue, 26 Mar 2013 22:14:47 +0000 (22:14 +0000)]
Use errno and strerror to print more descriptive messages when operations
fail in nvmecontrol(8).

While here, use consistent checks of return values from stat, open and
ioctl.

Sponsored by: Intel
Suggested by: carl
Reviewed by: carl

11 years agoMove common code from the different nvme_allocate_request functions into a
jimharris [Tue, 26 Mar 2013 22:13:07 +0000 (22:13 +0000)]
Move common code from the different nvme_allocate_request functions into a
separate function.

Sponsored by: Intel
Suggested by: carl
Reviewed by: carl

11 years agoChange a number of malloc(9) calls to use M_WAITOK instead of
jimharris [Tue, 26 Mar 2013 22:11:34 +0000 (22:11 +0000)]
Change a number of malloc(9) calls to use M_WAITOK instead of
M_NOWAIT.

Sponsored by: Intel
Suggested by: carl
Reviewed by: carl

11 years agoReplace usages of mtx_pool_find used for admin commands with a polling
jimharris [Tue, 26 Mar 2013 22:09:51 +0000 (22:09 +0000)]
Replace usages of mtx_pool_find used for admin commands with a polling
mechanism.

Now that all requests are timed, we are guaranteed to get a completion
notification, even if it is an abort status due to a timed out admin
command.

This has the effect of simplifying the controller and namespace setup
code, so that it reads straight through rather than broken up into
a bunch of different callback functions.

Sponsored by: Intel
Reviewed by: carl

11 years agoAbort and do not retry any outstanding admin commands left over after
jimharris [Tue, 26 Mar 2013 22:06:05 +0000 (22:06 +0000)]
Abort and do not retry any outstanding admin commands left over after
a controller reset.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd the ability to internally mark a controller as failed, if it is unable to
jimharris [Tue, 26 Mar 2013 21:58:38 +0000 (21:58 +0000)]
Add the ability to internally mark a controller as failed, if it is unable to
start or reset.  Also add a notifier for NVMe consumers for controller fail
conditions and plumb this notifier for nvd(4) to destroy the associated
GEOM disks when a failure occurs.

This requires a bit of work to cover the races when a consumer is sending
I/O requests to a controller that is transitioning to the failed state.  To
help cover this condition, add a task to defer completion of I/Os submitted
to a failed controller, so that the consumer will still always receive its
completions in a different context than the submission.

Sponsored by: Intel
Reviewed by: carl

11 years agoJust disable the controller instead of deleting IO queues during detach.
jimharris [Tue, 26 Mar 2013 21:48:41 +0000 (21:48 +0000)]
Just disable the controller instead of deleting IO queues during detach.

This is just as effective, and removes the need for a bunch of admin commands
to a controller that's going to be disabled shortly anyways.

Sponsored by: Intel
Reviewed by: carl

11 years agoHave nvd(4) register for controller notifications.
jimharris [Tue, 26 Mar 2013 21:45:37 +0000 (21:45 +0000)]
Have nvd(4) register for controller notifications.

Also have nvd maintain controller/namespace relationships internally.

Sponsored by: Intel
Reviewed by: carl

11 years agoSet Pre-boot Software Load Count to 0 at the end of the controller
jimharris [Tue, 26 Mar 2013 21:42:53 +0000 (21:42 +0000)]
Set Pre-boot Software Load Count to 0 at the end of the controller
start process.

The spec indicates the OS driver should use Set Features (Software
Progress Marker) to set the pre-boot software load count to 0
after the OS driver has successfully been initialized.  This allows
pre-boot software to determine if there have been any issues with the
OS loading.

Sponsored by: Intel
Reviewed by: carl

11 years agoRemove the is_started flag from struct nvme_controller.
jimharris [Tue, 26 Mar 2013 21:19:26 +0000 (21:19 +0000)]
Remove the is_started flag from struct nvme_controller.

This flag was originally added to communicate to the sysctl code
which oids should be built, but there are easier ways to do this.  This
needs to be cleaned up prior to adding new controller states - for example,
controller failure.

Sponsored by: Intel
Reviewed by: carl

11 years agoEnsure the controller's MDTS is accounted for in max_xfer_size.
jimharris [Tue, 26 Mar 2013 21:16:53 +0000 (21:16 +0000)]
Ensure the controller's MDTS is accounted for in max_xfer_size.

The controller's IDENTIFY data contains MDTS (Max Data Transfer Size) to
allow the controller to specify the maximum I/O data transfer size.  nvme(4)
already provides a default maximum, but make sure it does not exceed what
MDTS reports.

Sponsored by: Intel
Reviewed by: carl

11 years agoCap the number of retry attempts to a configurable number. This ensures
jimharris [Tue, 26 Mar 2013 21:14:51 +0000 (21:14 +0000)]
Cap the number of retry attempts to a configurable number.  This ensures
that if a specific I/O repeatedly times out, we don't retry it indefinitely.

The default number of retries will be 4, but is adjusted using hw.nvme.retry_count.

Sponsored by: Intel
Reviewed by: carl

11 years agoPass associated log page data to async event consumers, if requested.
jimharris [Tue, 26 Mar 2013 21:08:32 +0000 (21:08 +0000)]
Pass associated log page data to async event consumers, if requested.

Sponsored by: Intel
Reviewed by: carl

11 years agoWhen an asynchronous event request is completed, automatically fetch the
jimharris [Tue, 26 Mar 2013 21:05:15 +0000 (21:05 +0000)]
When an asynchronous event request is completed, automatically fetch the
specified log page.

This satisfies the spec condition that future async events of the same type
will not be sent until the associated log page is fetched.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd structure definitions and controller command function for firmware
jimharris [Tue, 26 Mar 2013 21:03:03 +0000 (21:03 +0000)]
Add structure definitions and controller command function for firmware
log pages.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd structure definitions and a controller command function for
jimharris [Tue, 26 Mar 2013 21:01:53 +0000 (21:01 +0000)]
Add structure definitions and a controller command function for
error log pages.

Sponsored by: Intel
Reviewed by: carl

11 years agoCreate struct nvme_status.
jimharris [Tue, 26 Mar 2013 21:00:18 +0000 (21:00 +0000)]
Create struct nvme_status.

NVMe error log entries include status, so breaking this out into
its own data structure allows it to be included in both the
nvme_completion data structure as well as error log entry data
structures.

While here, expose nvme_completion_is_error(), and change all of
the places that were explicitly looking at sc/sct bits to use this
macro instead.

Sponsored by: Intel
Reviewed by: carl

11 years agoMake nvme_ctrlr_reset a nop if a reset is already in progress.
jimharris [Tue, 26 Mar 2013 20:56:58 +0000 (20:56 +0000)]
Make nvme_ctrlr_reset a nop if a reset is already in progress.

This protects against cases where a controller crashes with multiple
I/O outstanding, each timing out and requesting controller resets
simultaneously.

While here, remove a debugging printf from a previous commit, and add
more logging around I/O that need to be resubmitted after a controller
reset.

Sponsored by: Intel
Reviewed by: carl

11 years agoBy default, always escalate to controller reset when an I/O times out.
jimharris [Tue, 26 Mar 2013 20:32:57 +0000 (20:32 +0000)]
By default, always escalate to controller reset when an I/O times out.

While aborts are typically cleaner than a full controller reset, many times
an I/O timeout indicates other controller-level issues where aborts may not
work.  NVMe drivers for other operating systems are also defaulting to
controller reset rather than aborts for timed out I/O.

Sponsored by: Intel
Reviewed by: carl

11 years agoAlways define and use PROGNAME
emaste [Tue, 26 Mar 2013 20:32:46 +0000 (20:32 +0000)]
Always define and use PROGNAME

This avoids having separate cases in the install rule for PROGNAME set and
not set.  This is a minor cleanup in advance of further support for
standalone debug files.

11 years agoDtrace: dtrace.c erroneously checks for memory alignment on amd64.
pfg [Tue, 26 Mar 2013 20:17:08 +0000 (20:17 +0000)]
Dtrace: dtrace.c erroneously checks for memory alignment on amd64.

Merge change from illumos:

3511 dtrace.c erroneously checks for memory alignment on amd64

Illumos Revision: c93cc65

Reference:
https://www.illumos.org/issues/3511

Obtained from: Illumos
MFC after: 3 weeks

11 years agoUnconditionally include ${SRCCONF} if overridden
emaste [Tue, 26 Mar 2013 20:11:09 +0000 (20:11 +0000)]
Unconditionally include ${SRCCONF} if overridden

This avoids silently failing to include ${SRCCONF} specified by a make(1)
invocation.

11 years agoImplement the replacement EDMA FIFO code.
adrian [Tue, 26 Mar 2013 20:04:45 +0000 (20:04 +0000)]
Implement the replacement EDMA FIFO code.

(Yes, the previous code temporarily broke EDMA TX. I'm sorry; I should've
actually setup ATH_BUF_FIFOEND on frames so txq->axq_fifo_depth was
cleared!)

This code implements a whole bunch of sorely needed EDMA TX improvements
along with CABQ TX support.

The specifics:

* When filling/refilling the FIFO, use the new TXQ staging queue
  for FIFO frames

* Tag frames with ATH_BUF_FIFOPTR and ATH_BUF_FIFOEND correctly.
  For now the non-CABQ transmit path pushes one frame into the TXQ
  staging queue without setting up the intermediary link pointers
  to chain them together, so draining frames from the txq staging
  queue to the FIFO queue occurs AMPDU / MPDU at a time.

* In the CABQ case, manually tag the list with ATH_BUF_FIFOPTR and
  ATH_BUF_FIFOEND so a chain of frames is pushed into the FIFO
  at once.

* Now that frames are in a FIFO pending queue, we can top up the
  FIFO after completing a single frame.  This means we can keep
  it filled rather than waiting for it drain and _then_ adding
  more frames.

* The EDMA restart routine now walks the FIFO queue in the TXQ
  rather than the pending queue and re-initialises the FIFO with
  that.

* When restarting EDMA, we may have partially completed sending
  a list.  So stamp the first frame that we see in a list with
  ATH_BUF_FIFOPTR and push _that_ into the hardware.

* When completing frames, only check those on the FIFO queue.
  We should never ever queue frames from the pending queue
  direct to the hardware, so there's no point in checking.

* Until I figure out what's going on, make sure if the TXSTATUS
  for an empty queue pops up, complain loudly and continue.
  This will stop the panics that people are seeing.  I'll add
  some code later which will assist in ensuring I'm populating
  each descriptor with the correct queue ID.

* When considering whether to queue frames to the hardware queue
  directly or software queue frames, make sure the depth of
  the FIFO is taken into account now.

* When completing frames, tag them with ATH_BUF_BUSY if they're
  not the final frame in a FIFO list.  The same holding descriptor
  behaviour is required when handling descriptors linked together
  with a link pointer as the hardware will re-read the previous
  descriptor to refresh the link pointer before contiuning.

* .. and if we complete the FIFO list (ie, the buffer has
  ATH_BUF_FIFOEND set), then we don't need the holding buffer
  any longer.  Thus, free it.

Tested:

* AR9380/AR9580, STA and hostap
* AR9280, STA/hostap

TODO:

* I don't yet trust that the EDMA restart routine is totally correct
  in all circumstances.  I'll continue to thrash this out under heavy
  multiple-TXQ traffic load and fix whatever pops up.

11 years agoAdd a tunable for the I/O timeout interval. Default is still 30 seconds,
jimharris [Tue, 26 Mar 2013 20:02:35 +0000 (20:02 +0000)]
Add a tunable for the I/O timeout interval.  Default is still 30 seconds,
but can be adjusted between a min/max of 5 and 120 seconds.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd handling for controller fatal status (csts.cfs).
jimharris [Tue, 26 Mar 2013 19:58:17 +0000 (19:58 +0000)]
Add handling for controller fatal status (csts.cfs).

On any I/O timeout, check for csts.cfs==1.  If set, the controller
is reporting fatal status and we reset the controller immediately,
rather than trying to abort the timed out command.

This changeset also includes deferring the controller start portion
of the reset to a separate task.  This ensures we are always performing
a controller start operation from a consistent context.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd API for nvme consumers to access controller and namespace identify data.
jimharris [Tue, 26 Mar 2013 19:52:57 +0000 (19:52 +0000)]
Add API for nvme consumers to access controller and namespace identify data.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd controller reset capability to nvme(4) and ability to explicitly
jimharris [Tue, 26 Mar 2013 19:50:46 +0000 (19:50 +0000)]
Add controller reset capability to nvme(4) and ability to explicitly
invoke it from nvmecontrol(8).

Controller reset will be performed in cases where I/O are repeatedly
timing out, the controller reports an unrecoverable condition, or
when explicitly requested via IOCTL or an nvme consumer.  Since the
controller may be in such a state where it cannot even process queue
deletion requests, we will perform a controller reset without trying
to clean up anything on the controller first.

Sponsored by: Intel
Reviewed by: carl

11 years agoAdd per-TXQ EDMA FIFO staging queue support.
adrian [Tue, 26 Mar 2013 19:46:51 +0000 (19:46 +0000)]
Add per-TXQ EDMA FIFO staging queue support.

Each set of frames pushed into a FIFO is represented by a list of
ath_bufs - the first ath_buf in the FIFO list is marked with
ATH_BUF_FIFOPTR; the last ath_buf in the FIFO list is marked with
ATH_BUF_FIFOEND.

Multiple lists of frames are just glued together in the TAILQ as per
normal - except that at the end of a FIFO list, the descriptor link
pointer will be NULL and it'll be tagged with ATH_BUF_FIFOEND.

For non-EDMA chipsets this is a no-op - the ath_txq frame list (axq_q)
stays the same and is treated the same.

For EDMA chipsets the frames are pushed into axq_q and then when
the FIFO is to be (re) filled, frames will be moved onto the FIFO
queue and then pushed into the FIFO.

So:

* Add a new queue in each hardware TXQ (ath_txq) for staging FIFO frame
  lists.  It's a TAILQ (like the normal hardware frame queue) rather than
  the ath9k list-of-lists to represent FIFO entries.

* Add new ath_buf flags - ATH_TX_FIFOPTR and ATH_TX_FIFOEND.

* When allocating ath_buf entries, clear out the flag value before
  returning it or it'll end up having stale flags.

* When cloning ath_buf entries, only clone ATH_BUF_MGMT.  Don't clone
  the FIFO related flags.

* Extend ath_tx_draintxq() to first drain the FIFO staging queue, _then_
  drain the normal hardware queue.

Tested:

* AR9280, hostap
* AR9280, STA
* AR9380/AR9580 - hostap

TODO:

* Test on other chipsets, just to be thorough.

11 years agoInvert the meaning of -S (added in r247405) and document its meaning. Also,
markj [Tue, 26 Mar 2013 19:43:18 +0000 (19:43 +0000)]
Invert the meaning of -S (added in r247405) and document its meaning. Also,
don't carp about the watchdog command taking too long until after the
watchdog has been patted, and don't carp via warnx(3) unless -S is set
since syslog(3) already logs to standard error otherwise.

Discussed with: alfred
Reviewed by: alfred
Approved by: emaste (co-mentor)

11 years agoMake sure to set OBJS consistently in the cases where SRCS is and isn't
markj [Tue, 26 Mar 2013 18:46:40 +0000 (18:46 +0000)]
Make sure to set OBJS consistently in the cases where SRCS is and isn't
already defined. Setting it with "+=" makes it possible for other make
scripts (e.g. bsd.dtrace.mk) to include additional object files in the
linker arguments.

Approved by: emaste (co-mentor)

11 years agoKeep a doubly-linked list of outstanding trackers.
jimharris [Tue, 26 Mar 2013 18:45:16 +0000 (18:45 +0000)]
Keep a doubly-linked list of outstanding trackers.

This enables in-order re-submission of I/O after a controller reset.

Sponsored by: Intel

11 years agoCreate a generic nvme_ctrlr_cmd_get_log_page function, and change the
jimharris [Tue, 26 Mar 2013 18:43:53 +0000 (18:43 +0000)]
Create a generic nvme_ctrlr_cmd_get_log_page function, and change the
health information log page function to use it.

Sponsored by: Intel

11 years agoExpose the get/set features API to nvme consumers.
jimharris [Tue, 26 Mar 2013 18:42:05 +0000 (18:42 +0000)]
Expose the get/set features API to nvme consumers.

Sponsored by: Intel

11 years agoAdd an interface for nvme shim drivers (i.e. nvd) to register for
jimharris [Tue, 26 Mar 2013 18:39:54 +0000 (18:39 +0000)]
Add an interface for nvme shim drivers (i.e. nvd) to register for
notifications when new nvme controllers are added to the system.

Sponsored by: Intel

11 years agoEnable asynchronous event requests on non-Chatham devices.
jimharris [Tue, 26 Mar 2013 18:37:36 +0000 (18:37 +0000)]
Enable asynchronous event requests on non-Chatham devices.

Also add logic to clean up all outstanding asynchronous event requests
when resetting or shutting down the controller, since these requests
will not be explicitly completed by the controller itself.

Sponsored by: Intel

11 years agoMove controller destruction code from nvme_detach() to new nvme_ctrlr_destruct()
jimharris [Tue, 26 Mar 2013 18:34:19 +0000 (18:34 +0000)]
Move controller destruction code from nvme_detach() to new nvme_ctrlr_destruct()
function.

Sponsored by: Intel

11 years agoSpecify command timeout interval on a per-command type basis.
jimharris [Tue, 26 Mar 2013 18:31:46 +0000 (18:31 +0000)]
Specify command timeout interval on a per-command type basis.

This is primarily driven by the need to disable timeouts for asynchronous
event requests, which by nature should not be timed out.

Sponsored by: Intel

11 years agoExplicitly abort a timed out command, if the ABORT command sent to the
jimharris [Tue, 26 Mar 2013 18:29:04 +0000 (18:29 +0000)]
Explicitly abort a timed out command, if the ABORT command sent to the
controller indicates the command was not found.

Sponsored by: Intel

11 years agoBreak out the code for completing an nvme_tracker object into a separate
jimharris [Tue, 26 Mar 2013 18:27:22 +0000 (18:27 +0000)]
Break out the code for completing an nvme_tracker object into a separate
function.

This allows for completions outside the normal completion path, for example
when an ABORT command fails due to the controller reporting the targeted
command does not exist.  This is mainly for protection against a faulty
controller, but we need to clean up our internal request nonetheless.

Sponsored by: Intel

11 years agoAdd support for ABORT commands, including issuing these commands when
jimharris [Tue, 26 Mar 2013 18:23:35 +0000 (18:23 +0000)]
Add support for ABORT commands, including issuing these commands when
an I/O times out.

Also ensure that we retry commands that are aborted due to a timeout.

Sponsored by: Intel

11 years agoAdd an internal _nvme_qpair_submit_request function, which performs
jimharris [Tue, 26 Mar 2013 18:20:11 +0000 (18:20 +0000)]
Add an internal _nvme_qpair_submit_request function, which performs
the submit action assuming the qpair lock has already been acquired.

Also change nvme_qpair_submit_request to just lock/unlock the mutex
around a call to this new function.

This fixes a recursive mutex acquisition in the retry path.

Sponsored by: Intel

11 years agoMake the DSM range count 0-based. Previously we were deallocating one more
jimharris [Tue, 26 Mar 2013 18:16:30 +0000 (18:16 +0000)]
Make the DSM range count 0-based.  Previously we were deallocating one more
LBA than we should have been.

Sponsored by: Intel

11 years agoDo not look at the namespace's thin provisioning field to determine if DSM
jimharris [Tue, 26 Mar 2013 18:01:24 +0000 (18:01 +0000)]
Do not look at the namespace's thin provisioning field to determine if DSM
command is supported.  The two are not related.

Sponsored by: Intel

11 years agoIntroduce vm_radix_isleaf() and use it in a couple places. As compared to
alc [Tue, 26 Mar 2013 17:30:40 +0000 (17:30 +0000)]
Introduce vm_radix_isleaf() and use it in a couple places.  As compared to
using vm_radix_node_page() == NULL, the compiler is able to generate one
less conditional branch when vm_radix_isleaf() is used.  More use cases
involving the inner loops of vm_radix_insert(), vm_radix_lookup{,_ge,_le}(),
and vm_radix_remove() will follow.

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

11 years agoReturn ENOMEM if malloc() fails.
glebius [Tue, 26 Mar 2013 14:08:14 +0000 (14:08 +0000)]
Return ENOMEM if malloc() fails.

11 years agoCleanup: wrap long lines, cleanup comments, etc.
glebius [Tue, 26 Mar 2013 14:05:37 +0000 (14:05 +0000)]
Cleanup: wrap long lines, cleanup comments, etc.

11 years agogeom_slice.c and its consumers like GEOM_LABEL are not touching the data
mav [Tue, 26 Mar 2013 07:55:24 +0000 (07:55 +0000)]
geom_slice.c and its consumers like GEOM_LABEL are not touching the data
unless hotspots are used.  Pass G_PF_ACCEPT_UNMAPPED flag through except
such rare cases (obsolete GEOM_SUNLABEL and GEOM_BSD).

11 years agoGEOM NOP does not touch the data, so pass G_PF_ACCEPT_UNMAPPED flag through.
mav [Tue, 26 Mar 2013 05:58:49 +0000 (05:58 +0000)]
GEOM NOP does not touch the data, so pass G_PF_ACCEPT_UNMAPPED flag through.

11 years agoRemove extra bio_data and bio_length copying to child request after calling
mav [Tue, 26 Mar 2013 05:42:12 +0000 (05:42 +0000)]
Remove extra bio_data and bio_length copying to child request after calling
g_clone_bio(), that already copied them.

11 years agoRemove the mcast path calls to ath_hal_gettxdesclinkptr() for axq_link -
adrian [Tue, 26 Mar 2013 04:56:54 +0000 (04:56 +0000)]
Remove the mcast path calls to ath_hal_gettxdesclinkptr() for axq_link -
they're no longer needed for the legacy path and they're not wanted
for the EDMA path.

Tested:

* AR9280, hostap + CABQ
* AR9380/AR9580, hostap + CABQ

11 years agoRemove this dead code - it's no longer relevant (as yes, we do actually
adrian [Tue, 26 Mar 2013 04:53:40 +0000 (04:53 +0000)]
Remove this dead code - it's no longer relevant (as yes, we do actually
support TX on EDMA chips.)

11 years agoConvert the CABQ queue code over to use the HAL link pointer method
adrian [Tue, 26 Mar 2013 04:52:16 +0000 (04:52 +0000)]
Convert the CABQ queue code over to use the HAL link pointer method
instead of axq_link.

This (among a bunch of uncommitted work) is required for EDMA chips
to correctly transmit frames on the CABQ.

Tested:

* AR9280, hostap mode
* AR9380/AR9580, hostap mode (staggered beacons)

TODO:

* This code only really gets called when burst beacons are used;
  it glues multiple CABQ queues together when sending to the hardware.
* More thorough bursted beacon testing! (first requires some work with
  the beacon queue code for bursted beacons, as that currently uses the
  link pointer and will fail on EDMA chips.)

11 years agoConvert the EDMA multicast queue code over to use the HAL method to set
adrian [Tue, 26 Mar 2013 04:48:58 +0000 (04:48 +0000)]
Convert the EDMA multicast queue code over to use the HAL method to set
the descriptor link pointer, rather than directly.

This is needed on AR9380 and later (ie, EDMA) NICs so the multicast queue
has a chance in hell of being put together right.

Tested:

* AR9380, AR9580 in hostap mode, CABQ traffic (but with other patches..)

11 years agoMigrate the multicast queue assembly code to not use the axq_link pointer
adrian [Tue, 26 Mar 2013 04:47:40 +0000 (04:47 +0000)]
Migrate the multicast queue assembly code to not use the axq_link pointer
and instead use the HAL method to set the link pointer.

Tested:

* AR9280, hostap mode, CABQ frames being queued and transmitted

11 years agoDo not pass unmapped buffers to drivers that cannot handle them
kan [Tue, 26 Mar 2013 01:17:06 +0000 (01:17 +0000)]
Do not pass unmapped buffers to drivers that cannot handle them

In physio, check if device can handle unmapped IO and pass an
appropriately mapped buffer to the driver strategy routine. The
only driver in the tree that can handle unmapped buffers is one
exposed by GEOM, so mark it as such with the new flag in the
driver cdevsw structure.

This fixes insta-panics on hosts, running dconschat, as /dev/fwmem
is an example of the driver that makes use of physio routine, but
bypasses the g_down thread, where the buffer gets mapped normally.

Discussed with: kib (earlier version)

11 years agoDtrace: Add SUN MDB-like type-aware print() action.
pfg [Mon, 25 Mar 2013 20:38:09 +0000 (20:38 +0000)]
Dtrace: Add SUN MDB-like type-aware print() action.

Merge change from illumos:

1694 Add type-aware print() action

This is a very nice feature implemented in upstream Dtrace.
A complete description is available here:
http://dtrace.org/blogs/eschrock/2011/10/26/your-mdb-fell-into-my-dtrace/

This change bumps the DT_VERS_* number to 1.9.0 in
accordance to what is done in illumos.

While here also include some minor cleanups to ease further merging
and appease clang with a fix by Fabian Keil.

Illumos Revisions: 13501:c3a7090dbc16
13483:f413e6c5d297

Reference:
https://www.illumos.org/issues/1560
https://www.illumos.org/issues/1694

Tested by: Fabian Keil
Obtained from: Illumos
MFC after: 1 month

11 years agohrStorageSize and hrStorageUsed are 32 bit integers, reporting a fs
trociny [Mon, 25 Mar 2013 19:12:36 +0000 (19:12 +0000)]
hrStorageSize and hrStorageUsed are 32 bit integers, reporting a fs
size and usage in hrStorageAllocationUnits. If the file system has
more than 2^31 allocations it can not be shown correctly and the
meters are useless.

In such cases follow net-snmp behaviour and increase
hrStorageAllocationUnits so the values fit under INT_MAX.

PR: bin/177183
Submitted by: Eugene Grosbein egrosbein rdtc.ru
MFC after: 2 weeks

11 years agoDtrace: add toupper()/tolower() and enhancements to lltostr().
pfg [Mon, 25 Mar 2013 15:40:57 +0000 (15:40 +0000)]
Dtrace: add toupper()/tolower() and enhancements to lltostr().

Merge changes from illumos:

1451 DTrace needs toupper()/tolower() subroutines
1457 lltostr() D subroutine should take an optional base

This change bumps the DT_VERS_* number to 1.8.1 in
accordance to what is done in illumos.

The test suite we currently include is outdated and
doesnt support some updates in tst.subr.d which had to
be left out for now.

Illumos Revisions: r13458 5e394d8db762
r13459 c3454574dd1a

Reference:
https://www.illumos.org/issues/1451
https://www.illumos.org/issues/1457

Tested by: Fabian Keil
Obtained from: Illumos
MFC after: 1 month

11 years agoUnlock IPMI sc while performing requests via KCS and SMIC interfaces.
melifaro [Mon, 25 Mar 2013 14:30:34 +0000 (14:30 +0000)]
Unlock IPMI sc while performing requests via KCS and SMIC interfaces.
It is already done in SSIF interface code.
This reduces contention/spinning reported by many users.

PR: kern/172166
Submitted by: Eric van Gyzen <eric at vangyzen.net>
MFC after: 2 weeks

11 years agoRead Asynchronous Notification statuses only if Port Multiplier or ATAPI
mav [Mon, 25 Mar 2013 13:58:17 +0000 (13:58 +0000)]
Read Asynchronous Notification statuses only if Port Multiplier or ATAPI
device are connected. ATA disks are not using ANs, while the extra register
read operation is quite expensive.

11 years agoo Typo: IEE -> IEEE.
maxim [Mon, 25 Mar 2013 12:38:45 +0000 (12:38 +0000)]
o Typo: IEE -> IEEE.

PR: docs/173069
Submitted by: Bjorn Heidotting
MFC after: 1 week

11 years agoCache the callout precision argument as part of the informations required
davide [Mon, 25 Mar 2013 09:43:50 +0000 (09:43 +0000)]
Cache the callout precision argument as part of the informations required
for migrating callouts to new CPU. This value is passed to
callout_cc_add() in order to update properly precision field in case of
rescheduling/migration.

Reviewed by: mav

11 years agoDepending on combination of running commands (NCQ/non-NCQ) try to avoid
mav [Mon, 25 Mar 2013 08:50:51 +0000 (08:50 +0000)]
Depending on combination of running commands (NCQ/non-NCQ) try to avoid
extra read from PxCI/PxSACT registers.  If only NCQ commands are running, we
don't really need PxCI.  If only non-NCQ commands are running we don't need
PxSACT.  Mixed set may happen only on controllers with FIS-based switching
when port multiplier is attached, and then we have to read both registers.

MFC after: 1 month

11 years agoWhen we are removing a specific set, call ipfw_expire_dyn_rules only once.
ae [Mon, 25 Mar 2013 07:43:46 +0000 (07:43 +0000)]
When we are removing a specific set, call ipfw_expire_dyn_rules only once.

Obtained from: Yandex LLC
MFC after: 1 week

11 years agoMake GEOM MULTIPATH to report unmapped bio support if underling path report
mav [Mon, 25 Mar 2013 07:24:58 +0000 (07:24 +0000)]
Make GEOM MULTIPATH to report unmapped bio support if underling path report
it.  GEOM MULTIPATH itself never touches the data and so transparent.

11 years agoRemove two bzero()s that are erasing only few more bytes then set later.
mav [Mon, 25 Mar 2013 06:31:17 +0000 (06:31 +0000)]
Remove two bzero()s that are erasing only few more bytes then set later.

11 years agoIn GEOM DISK:
mav [Mon, 25 Mar 2013 05:45:24 +0000 (05:45 +0000)]
In GEOM DISK:
 - Replace single done mutex with per-disk ones.  On system with several
disks on several HBAs that removes small, but measurable lock congestion.
 - Modify disk destruction process to not destroy the mutex prematurely.
 - Remove some extra pointer derefences.

11 years agoAdd shlib-compat under tools.
gleb [Mon, 25 Mar 2013 00:31:14 +0000 (00:31 +0000)]
Add shlib-compat under tools.

shlib-compat is ABI compatibility checker for shared libraries with
symbol versioning.

11 years agosh(1): Mention possible ambiguities with $(( and ((.
jilles [Sun, 24 Mar 2013 22:48:45 +0000 (22:48 +0000)]
sh(1): Mention possible ambiguities with $(( and ((.

In some other shells, things like $((a);(b)) are command substitutions.

Also, there are shells that have an extension ((ARITH)) that evaluates an
arithmetic expression and returns status 1 if the result is zero, 0
otherwise. This extension may lead to ambiguity with two subshells starting
in sequence.

11 years agoNote that output is in seconds, not msec.
mckusick [Sun, 24 Mar 2013 22:37:10 +0000 (22:37 +0000)]
Note that output is in seconds, not msec.
KNF indentation.
No functional change.
No change to printf strings.
No change to casting of printf arguments.

Reported by: Bruce Evans

11 years agoDtrace: add optional size argument to tracemem().
pfg [Sun, 24 Mar 2013 19:12:08 +0000 (19:12 +0000)]
Dtrace: add optional size argument to tracemem().

Merge change from illumos:

1455 DTrace tracemem() should take an optional size argument

Our local enhancements to dt_print_bytes were equivalent to
those in illumos but we made it match the illumos version
to ease further code merges.

For now leave out tst.smallsize.d and tst.smallsize.d.out
since those don't seem to work cleanly on FreeBSD.

This change bumps the DT_VERS_* number to 1.7.1 in accordance
to what is done in illumos.

Illumos Revision: 13457:571b0355c2e3

Reference:
https://www.illumos.org/issues/1455

Tested by: Fabian Keil
Obtained from: Illumos
MFC after: 1 month

11 years agoSet the backlink in mmc commands to the mmc request that contains them.
ian [Sun, 24 Mar 2013 17:23:10 +0000 (17:23 +0000)]
Set the backlink in mmc commands to the mmc request that contains them.

11 years agoNo need to erase all 64 bytes of CFIS area if we never use more then 16.
mav [Sun, 24 Mar 2013 16:51:21 +0000 (16:51 +0000)]
No need to erase all 64 bytes of CFIS area if we never use more then 16.

11 years agoMicro-optimize the control flow in a few places. Eliminate a panic call
alc [Sun, 24 Mar 2013 16:43:07 +0000 (16:43 +0000)]
Micro-optimize the control flow in a few places.  Eliminate a panic call
that could never be reached in vm_radix_insert().  (If the pointer being
checked by the panic call were ever NULL, the immmediately preceding loop
would have already crashed on a NULL pointer dereference.)

Reviewed by: attilio (an earlier version)
Sponsored by: EMC / Isilon Storage Division

11 years agoAdd 2 more obsolete files and a missing date.
antoine [Sun, 24 Mar 2013 12:39:26 +0000 (12:39 +0000)]
Add 2 more obsolete files and a missing date.

11 years agoResolve clang compile errors on amd64/i386 for certain by casting.
sbruno [Sun, 24 Mar 2013 10:41:29 +0000 (10:41 +0000)]
Resolve clang compile errors on amd64/i386 for certain by casting.

compile tested with clang on i386, amd64
compile tested with gcc on i386, amd64, sparc64

Submitted by: delphij

11 years agoFix long known deadlock between geom dev destruction and d_close() call.
mav [Sun, 24 Mar 2013 10:14:25 +0000 (10:14 +0000)]
Fix long known deadlock between geom dev destruction and d_close() call.
Use destroy_dev_sched_cb() to not wait for device destruction while holding
GEOM topology lock (that actually caused deadlock).  Use request counting
protected by mutex to properly wait for outstanding requests completion in
cases of device closing and geom destruction.  Unlike r227009, this code
does not block taskqueue thread for indefinite time, waiting for completion.

11 years agoAdd new regulatory domain.
adrian [Sun, 24 Mar 2013 04:42:56 +0000 (04:42 +0000)]
Add new regulatory domain.

Obtained from: Qualcomm Atheros

11 years agoMove the TXQ lock earlier in this routine - so to correctly protect the
adrian [Sun, 24 Mar 2013 04:09:54 +0000 (04:09 +0000)]
Move the TXQ lock earlier in this routine - so to correctly protect the
link pointer check.

11 years agoFix the locking changes due to the TXQ change drive-by.
adrian [Sun, 24 Mar 2013 04:09:29 +0000 (04:09 +0000)]
Fix the locking changes due to the TXQ change drive-by.

Tested:

* AR9580, STA mode

11 years agoMake g_wither_washer() to not loop by itself, but only when there was some
mav [Sun, 24 Mar 2013 03:15:20 +0000 (03:15 +0000)]
Make g_wither_washer() to not loop by itself, but only when there was some
more topology change done that may require its attention.  Add few missing
g_do_wither() calls in respective places to signal it.

This fixes potential infinite loop here when some provider is withered, but
still opened or connected for some reason and so can not be destroyed.  For
example, see r227009 and r227510.

11 years agoMinor formatting fix for printf() to fix clang builds.
sbruno [Sun, 24 Mar 2013 02:04:19 +0000 (02:04 +0000)]
Minor formatting fix for printf() to fix clang builds.

Submitted by: db
Reviewed by: gjb

11 years agoCompile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies
dim [Sun, 24 Mar 2013 01:35:37 +0000 (01:35 +0000)]
Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies
on signed integer overflow wrapping.  Otherwise mktime(3) and timegm(3)
can hang, in case the timestamp passed in struct tm is not representable
in a time_t.  Specifically, any timestamp after 2038-01-19 03:14:07, in
combination with a 32-bit time_t.

Note that it would be better to change the code to not rely on undefined
behaviour, but it is contributed code, and it is not entirely trivial to
fix the issue properly.

MFC after: 3 days

11 years agoOverhaul the TXQ locking (again!) as part of some beacon/cabq timing
adrian [Sun, 24 Mar 2013 00:03:12 +0000 (00:03 +0000)]
Overhaul the TXQ locking (again!) as part of some beacon/cabq timing
related issues.

Moving the TX locking under one lock made things easier to progress on
but it had one important side-effect - it increased the latency when
handling CABQ setup when sending beacons.

This commit introduces a bunch of new changes and a few unrelated changs
that are just easier to lump in here.

The aim is to have the CABQ locking separate from other locking.
The CABQ transmit path in the beacon process thus doesn't have to grab
the general TX lock, reducing lock contention/latency and making it
more likely that we'll make the beacon TX timing.

The second half of this commit is the CABQ related setup changes needed
for sane looking EDMA CABQ support.  Right now the EDMA TX code naively
assumes that only one frame (MPDU or A-MPDU) is being pushed into each
FIFO slot.  For the CABQ this isn't true - a whole list of frames is
being pushed in - and thus CABQ handling breaks very quickly.

The aim here is to setup the CABQ list and then push _that list_ to
the hardware for transmission.  I can then extend the EDMA TX code
to stamp that list as being "one" FIFO entry (likely by tagging the
last buffer in that list as "FIFO END") so the EDMA TX completion code
correctly tracks things.

Major:

* Migrate the per-TXQ add/removal locking back to per-TXQ, rather than
  a single lock.

* Leave the software queue side of things under the ATH_TX_LOCK lock,
  (continuing) to serialise things as they are.

* Add a new function which is called whenever there's a beacon miss,
  to print out some debugging.  This is primarily designed to help
  me figure out if the beacon miss events are due to a noisy environment,
  issues with the PHY/MAC, or other.

* Move the CABQ setup/enable to occur _after_ all the VAPs have been
  looked at.  This means that for multiple VAPS in bursted mode, the
  CABQ gets primed once all VAPs are checked, rather than being primed
  on the first VAP and then having frames appended after this.

Minor:

* Add a (disabled) twiddle to let me enable/disable cabq traffic.
  It's primarily there to let me easily debug what's going on with beacon
  and CABQ setup/traffic; there's some DMA engine hangs which I'm finally
  trying to trace down.

* Clear bf_next when flushing frames; it should quieten some warnings
  that show up when a node goes away.

Tested:

* AR9280, STA/hostap, up to 4 vaps (staggered)
* AR5416, STA/hostap, up to 4 vaps (staggered)

TODO:

* (Lots) more AR9380 and later testing, as I may have missed something here.
* Leverage this to fix CABQ hanling for AR9380 and later chips.
* Force bursted beaconing on the chips that default to staggered beacons and
  ensure the CABQ stuff is all sane (eg, the MORE bits that aren't being
  correctly set when chaining descriptors.)

11 years agoCABQ calculation changes to try and fix some weird corner cases leading
adrian [Sat, 23 Mar 2013 23:51:11 +0000 (23:51 +0000)]
CABQ calculation changes to try and fix some weird corner cases leading
to stuck beacons.

* Set the cabq readytime (ie, how long to burst for) to 50% of the total
  beacon interval time
* fix the cabq adjustment calculation based on how the beacon offset is
  calculated (the SWBA/DBA time offset.)

This is all still a bit magic voodoo but it does seem to have further
quietened issues with missed/stuck beacons under my local testing.
In any case, it better matches what the reference HAL implements.

Obtained from: Qualcomm Atheros

11 years agoMore indentation fixes.
adrian [Sat, 23 Mar 2013 23:27:16 +0000 (23:27 +0000)]
More indentation fixes.

11 years agoExpose the beacon miss counter.
adrian [Sat, 23 Mar 2013 23:20:38 +0000 (23:20 +0000)]
Expose the beacon miss counter.

11 years agoDo not call malloc(M_WAITOK) while bodev->fence_lock mutex is
kib [Sat, 23 Mar 2013 22:23:15 +0000 (22:23 +0000)]
Do not call malloc(M_WAITOK) while bodev->fence_lock mutex is
held. The ttm_buffer_object_transfer() does not need the mutex locked
at all, except for the call to the driver sync_obj_ref() method.

Reported and tested by: dumbbell
MFC after:   2 weeks

11 years agoMerge bugfix from vendor master branch:
mm [Sat, 23 Mar 2013 21:34:10 +0000 (21:34 +0000)]
Merge bugfix from vendor master branch:

Limit write requests to at most INT_MAX.
This prevents a certain common programming error (passing -1 to write)
from leading to other problems deeper in the library.

References:
https://github.com/libarchive/libarchive/commit/22531545514043e0

Reported by: Xin Li <delphij@FreeBSD.org>
Obtained from:  libarchive (master branch)