01 Jun, 2015

40 commits

  • '0' is now used as the default cmd_per_lun value,
    so there's no need to explicitly set it to '1' in the
    host template.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Hannes Reinecke
     
  • update driver version

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Don Brace
     
  • add in support for latest PMC controller

    Reviewed-by: Scott Teel
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Don Brace
     
  • Synchronize completion the reset with completion of outstanding commands

    Extending the newly-added synchronous abort functionality,
    now also synchronize resets with the completion of outstanding commands.
    Rename the wait queue to reflect the fact that it's being used for both
    types of waits. Also, don't complete commands which are terminated
    due to a reset operation.

    fix for controller lockup during reset

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • If hpsa_wait_for_board_state fails, hpsa_kdump_soft_reset
    should propagate its return value (e.g., -ENODEV) rather
    than just returning -1.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • Rather than numbering the hpsa controllers with an
    incrementing 0..n value (e.g., that shows up in
    /proc/interrupts), use the scsi midlayer
    host_no (e.g. matching /sys/class/scsi_host/hostNN).

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • Rework slave allocation:
    - separate the tagging support setup from the hostdata setup
    - make the hostdata setup act consistently when the lookup fails
    - make the hostdata setup act consistently when the device is not added
    - set up the queue depth consistently across these scenarios
    - if the block layer mq support is not available, explicitly enable and
    activate the SCSI layer tcq support (and do this at allocation-time so
    that the tags will be available for INQUIRY commands)

    Tweak slave configuration so that devices which are masked are also
    not attached.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • Add the interrupt number to the interrupt names that
    appear in /proc/interrupts, so they are unique

    Also, delete the IRQ and DAC prints. Other parts of the kernel
    already print the IRQ assignments, and dual-address-cycle support
    has not been interesting since the parallel PCI bus went from
    32 to 64 bits wide.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • Don't create the resubmit workqueue in hpsa_init_one until everything else
    is ready to use, so everything can be freed in reverse order of when they
    were allocated without risking freeing things while workqueue items are
    still active.

    Destroy the workqueue in the right order in
    hpsa_undo_allocations_after_kdump_soft_reset too.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • If registering the special interrupt handlers in hpsa_init_one
    before a soft reset fails, the error exit needs to deallocate
    everything that was allocated before.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • In hpsa_undo_allocations_after_kdump_soft_reset,
    the things allocated in hpsa_init_one step 2 -
    h->resubmit_wq and h->lockup_detected need to
    be freed, in the right order.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • If try_soft_reset fails to re-allocate irqs, the error exit
    starts with free_irq calls, which generate kernel WARN
    messages since they were already freed a few lines earlier.

    Jump to the next exit label to skip the free_irq calls.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • Despite the fact that PCI devices are enabled in this order:
    1. pci_enable_device
    2. pci_request_regions

    Documentation/PCI/pci.txt specifies that they be undone
    in this order
    1. pci_disable_device
    2. pci_release_regions

    Tested by injecting error in the call to pci_enable_device
    in hpsa_init_one -> hpsa_pci_init:
    [ 9.095001] hpsa 0000:04:00.0: failed to enable PCI device
    [ 9.095005] hpsa: probe of 0000:04:00.0 failed with error -22
    (-22 is -EINVAL)
    and then in the call pci_request_regions:
    [ 9.178623] hpsa 0000:04:00.0: failed to obtain PCI resources
    [ 9.178671] hpsa: probe of 0000:04:00.0 failed with error -16
    (-16 is -EBUSY)

    and then by adding
    reset_devices
    to the kernel command line and inject errors into the two
    calls to pci_enable_device and the call to pci_request_regions
    in hpsa_init_one -> hpsa_init_reset_devices.

    (inject on 6th call, 1st to hpsa2)
    [ 62.413750] hpsa 0000:04:00.0: Failed to enable PCI device

    (inject on 7th call, 2nd to hpsa2)
    [ 62.807571] hpsa 0000:04:00.0: failed to enable device.

    (inject on 8th call, 3rd to hpsa2)
    [ 62.697198] hpsa 0000:04:00.0: failed to obtain PCI resources
    [ 62.697234] hpsa: probe of 0000:04:00.0 failed with error -16

    The reset_devices path calls return -ENODEV on failure
    rather than passing the result, which apparently doesn't
    cause the pci driver to print anything.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • Divide the loop in hpsa_scatter_gather() into two, one for the initial SG list
    and a second one for the chained list, if any. This allows the conditional
    check which resets the indicies for the chained list to be performed outside
    the loop instead of being done on every iteration inside the loop.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • Factor out the code which sends the TEST_UNIT_READY from
    wait_for_device_to_become_ready() into its own function.

    Move the code which waits for the TEST_UNIT_READY from
    wait_for_device_to_become_ready() into its own function.

    If a logical drive has failed, resetting it will ensure
    outstanding commands are completed, but polling it with
    TURs after the reset will not work because the TURs will
    never report good status. So successful TUR should not
    be a condition of success for the device reset error
    handler.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • Don't return from the abort request until the target command is complete.
    Mark outstanding commands which have a pending abort, and do not send them
    to the host if we can avoid it.

    If the current command has been aborted, do not call the SCSI command
    completion routine from the I/O path: when the abort returns successfully,
    the SCSI mid-layer will handle the completion implicitly.

    The following race was possible in theory.

    1. LLD is requested to abort a scsi command
    2. scsi command completes
    3. The struct CommandList associated with 2 is made available.
    4. new io request to LLD to another LUN re-uses struct CommandList
    5. abort handler follows scsi_cmnd->host_scribble and
    finds struct CommandList and tries to aborts it.

    Now we have aborted the wrong command.

    Fix by resetting the scsi_cmd field of struct CommandList
    upon completion and making the abort handler check that
    the scsi_cmd pointer in the CommadList struct matches the
    scsi_cmnd that it has been asked to abort.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • cleanup command completions

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • add support for tmf when in ioaccel2 mode

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Joe Handzik
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • The SCSI midlayer already prints more detail about completions,
    and has logging level options to filter them if not wanted.
    These just slow down the system if a lot of errors occur,
    stressing error handling even more.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • report more useful information on aborts

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • Improve initialization error handling in hpsa_init_one
    Clean up style and indent issues
    Rename functions for consistency
    Improve error messaging on allocations
    Fix return status from hpsa_put_ctlr_into_performant_mode
    Correct free order in hpsa_init_one using new function
    hpsa_free_performant_mode
    Prevent inadvertent use of null pointers by nulling out the parent structures
    and zeroing out associated size variables.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • correct return codes for error conditions

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • cmd_alloc can no longer return NULL, so don't check for NULL any more
    (which is unreachable code).

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • improve ioaccel2 error handling, including better handling of
    underrun statuses

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Signed-off-by: Joe Handzik
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Joe Handzik
     
  • Increase the request size for ioaccel2 path.

    The error, if any, returned by hpsa_allocate_ioaccel2_sg_chain_blocks
    to hpsa_alloc_ioaccel2_cmd_and_bft should be returned upstream rather
    than assumed to be -ENOMEM.

    This differs slightly from hpsa_alloc_ioaccel1_cmd_and_bft,
    which does not call another hpsa_allocate function and only
    has -ENOMEM to return from some kmalloc calls.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • refactor freeing of resources into more logical functions

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • refactor error cleanup and shutdown
    disable interrupts and pci_disable_device on critical failures
    add hpsa_free_cfgtables function

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • replace calls to hpsa_free_irqs_and_disable_msix with
    hpsa_free_irqs and hpsa_disable_interrupt_mode

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • get drive queue depth to help avoid task set full conditions.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Joe Handzik
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Joe Handzik
     
  • use ioaccel2 path to submit I/O to physical drives in HBA mode

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Joe Handzik
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Joe Handzik
     
  • offload_enabled changes are deferred until after the
    added/updated prints occur, so the values are incorrect.

    defer printing SSD Smart Path Enabled status information until the
    information is correct

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • clean up command submission

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Webb Scales
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Webb Scales
     
  • allow the controller firmware to queue up commands when the ioaccel device
    queue is full.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • add error handling for failure when registering with SCSI subsystem.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • Factor out hpsa_cmd_init from cmd_alloc(). We also need
    this for resubmitting commands down the default RAID path
    when they have returned from the ioaccel paths with errors.

    In particular, reinitialize the cmd_type and busaddr fields as these
    will not be correct for submitting down the RAID stack path
    after ioaccel command completion.

    This saves time when submitting commands.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • make function names more consistent and meaningful

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Robert Elliott
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Robert Elliott
     
  • expose a detected lockup via sysfs

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • In hba mode, we could get sense data in descriptor format so
    we need to handle that.

    It's possible for CommandStatus to have value 0x0D
    "TMF Function Status", which we should handle. We will get
    this from a P1224 when aborting a non-existent tag, for
    example. The "ScsiStatus" field of the errinfo field
    will contain the TMF function status value.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • make tracking of outstanding commands more robust

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron
     
  • Do not send aborts to logical devices that do not support aborts

    Instead of relying on what the Smart Array claims for supporting logical
    drives, simply try an abort and see how it responds at device discovery
    time. This way devices that do support aborts (e.g. MSA2000) can work
    and we do not waste time trying to send aborts to logical drives that do
    not support them (important for high IOPS devices.)

    While rescanning devices only test whether devices support aborts
    the first time we encounter a device rather than every time.

    Some Smart Arrays required aborts to be sent with tags in
    the wrong endian byte order. To avoid having to know about
    this, we would send two aborts with tags with each endian order.
    On high IOPS devices, this turns out to be not such a hot idea.
    So we now have a list of the devices that got the tag backwards,
    and we only send it one way.

    If all available commands are outstanding and the abort handler
    is invoked, the abort handler may not be able to allocate a command
    and may busy-wait excessivly. Reserve a small number of commands
    for the abort handler and limit the number of concurrent abort
    requests to the number of reserved commands.

    Reviewed-by: Scott Teel
    Reviewed-by: Kevin Barnett
    Reviewed-by: Tomas Henzl
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Don Brace
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Stephen Cameron