No need to check whether interrupt pending for MSI(X) and
conversely, no need to check whether MSI(X) interrupts are
being used when checking if interrupts are pending.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Empirically, this improves performance slightly (~2% max IOPS) by
allowing cmd_alloc to remember where it left off searching for
free commands between calls instead of always starting its search
at command 0.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
This means changing the allocator to reference count commands.
The reference count is now the authoritative indicator of whether a
command is allocated or not. The h->cmd_pool_bits bitmap is now
only a heuristic hint to speed up the allocation process, it is no
longer the authoritative record of allocated commands.
Since we changed the command allocator to use reference counting
as the authoritative indicator of whether a command is allocated,
fail_all_outstanding_cmds needs to use the reference count not
h->cmd_pool_bits for this purpose.
Fix hpsa_drain_accel_commands to use the reference count as the
authoritative indicator of whether a command is allocated instead of
the h->cmd_pool_bits bitmap.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
When using the ioaccel submission methods, requests destined for RAID volumes
are sometimes diverted to physical devices. The OS has no or limited
knowledge of these physical devices, so it is up to the driver to avoid
pushing the device too hard. It is better to honor the physical device queue
limit rather than making the device spew zillions of TASK SET FULL responses.
This is so that hpsa based devices support /sys/block/sdNN/device/queue_type
of simple, which lets the SCSI midlayer automatically adjust the queue_depth
based on TASK SET FULL and GOOD status.
Adjust the queue depth for a new device after it is created based on the
maximum queue depths of the physical devices that constitute the
device. This drops the maximum queue depth from .can_queue of 1024 to
something like 174 for single-drive RAID-0, 348 for two-drive RAID-1, etc.
It also adjusts for the ratio of data to parity drives.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Webb Scales <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Instead of kicking the commands all the way back to the mid
layer, use a work queue. This enables having a mechanism for
the driver to be able to resubmit the commands down the "normal"
raid path without turning off the ioaccel feature entirely
whenever an error is encountered on the ioaccel path, and
prevent excessive rescanning of devices.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Factor out the bottom part of the queuecommand function
which is the part that builds commands for submitting down
the "normal' RAID stack path of a Smart Array.
Need to factor this out to improve how commands that
were initially sent down one of the "ioaccellerated"
paths but which have some sort of error condition are
retried down the "normal" path.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
The original reasoning behind doing this was faulty. An error
of some sort would be encountered, accelerated i/o would be
disabled for that logical drive, the command would be kicked
back out to the SCSI midlayer for a retry, and since i/o accelerator
mode was disabled, it would get retried down the RAID path.
However, something needs to turn ioaccellerator mode back on,
and this rescan request was what did that. However, it was racy,
and extremely bad for performance to rescan all devices, so,
don't do that.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
By not doing maintaining a list of queued commands, we can eliminate some spin
locking in the main i/o path and gain significant improvement in IOPS. Remove
the queuing code and the code that calls it; remove now-unused interrupt code;
remove DIRECT_LOOKUP_BIT.
Now that the passthru commands share the same command pool as
the main i/o path, and the total size of the pool is less than
or equal to the number of commands that will fit in the hardware
fifo, there is no need to check to see if we are exceeding the
hardware fifo's depth.
Reviewed-by: Scott Teel <[email protected]>
Reviewed-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
We have commands reserved for internal use.
This is laying the groundwork for removing the internal
queue of commands from the driver so that the locks that
protect that queue may be removed.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
We need to reserve some commands for device rescans,
aborts, and the pass through ioctls, etc. so we cannot
give them all to the scsi mid layer.
This is in preparation for removing cmd_special_alloc and
cmd_special_free so that we can stop queuing commands internally
in the driver so that we can remove the locks thta protect the
queue that we will no longer have.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
If hpsa_allocate_cmd_pool failed, we were calling two functions unnecessarily:
hpsa_free_sg_chain_blocks(h);
hpsa_free_cmd_pool(h);
This didn't cause any problem, as those functions can tolerate being called
when what they free hasn't been allocated (relevant pointers would be NULL)
but it is potentially confusing.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Encapsulate the conditional predicate which tests for legacy controllers
in a separate function and rework the code comments.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Webb Scales <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
There is nothing worrisome about the "Waiting for controller to
respond to no-op" print, so use dev_info rather than dev_warn.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
If the board ID lookup function fails, return the return
code rather than return -ENODEV.
The only board ID failure reason right now is -ENODEV,
so this just provides more informative prints in kdump
and adapts to future changes.
Tested with error injection while booting with
reset_devices
on the kernel command line:
[ 62.804324] injecting error in inj_hpsa_lookup_board_id: 1 11
[ 62.804423] hpsa 0000:04:00.0: Board ID not found
(the pci probe layer does not print an additional
message if -ENODEV is the reason)
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Return the real reason for kdump_hard_reset failure rather
than change them all to -ENODEV.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
The queue depth printed at startup is in decimal, so
shouldn't have a 0x prefix.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
In MSI and MSI-X mode, where hpsa asks for more than one interrupt,
hpsa_request_irqs forgets if the first request_irq call failed
if later ones succeed.
It needs to exit the loop on any failure rather than continue,
freeing all irqs that were requested until that point.
Also, it needs to clear out the q numbers up to MAX_REPLY_QUEUES.
The same is true for the general hpsa_free_irqs function.
Tested with error injection of -ENOSYS on the 4th call:
[ 9.277691] injecting error in inj_request_irq: 1 4
[ 9.277780] hpsa 0000:02:00.0: failed to get irq 35 for hpsa1
[ 10.711623] scsi host1: Error handler scsi_eh_1 exiting
[ 10.739170] hpsa: probe of 0000:02:00.0 failed with error -38
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
HP now uses RAID-6 rather than RAID-ADG (Advanced Data Guarding)
as the marketing name for our implementation of RAID-6.
The driver considers RAID-1 and RAID-1+0 to be the same level, and
considers RAID-1ADM and RAID-1+0ADM to be the same level. Parenthesis
can be used to reflect the optional +0 portion of both those RAID levels.
Rename: RAID-ADG to RAID-6
RAID-1(1+0) to RAID-1(+0)
RAID-1(ADM) to RAID-1(+0)ADM
Also, add another const after the pointer type as suggested
by checkpatch.pl so the array is:
static const char * const raid_label[]
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Robert Elliott <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
We change drive queue depths to match drive reported queue depths.
The name of the SML function was changed from scsi_adjust_queue_depth
changed to scsi_change_queue_depth.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Change how SA controllers are reset by changing PCI power levels.
The hpsa driver was finding the PCI_PM_CTRL_STATE_MASK offset
then reading/writing a bitmask to change the power state. There
are kernel functions that do the same operations. Better to use
the kernel functions.
Signed-off-by: Don Brace <[email protected]>
Reviewed-by: Scott Teel <[email protected]>
Reviewed-by: Webb Scales <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Sometimes when the card is restarted it may cause -
"irq 16: nobody cared (try booting with the "irqpoll" option)"
that is likely caused so, that the card, after the hard reset
finishes, pulls on the irq. Disabling the ints before or after
the hpsa_kdump_hard_reset_controller fixes it.
At this point we can't know in which state the card is,
so using SA5_INTR_OFF + SA5_REPLY_INTR_MASK_OFFSET defines directly,
instead of the function the drivers provides, seems to be apropriate.
Reviewed-by: Scott Teel <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Correct endiness issues reported by sparse. SA controllers are
little endian. This patch ensures endiness correctness.
Signed-off-by: Don Brace <[email protected]>
Reviewed-by: Scott Teel <[email protected]>
Reviewed-by: Webb Scales <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
The following patch fixes an issue observed with 4k sector disks
where the max_hw_sectors attribute was getting set too large in
sd_revalidate_disk. Since sdkp->max_xfer_blocks is in units
of SCSI logical blocks and queue_max_hw_sectors is in units of
512 byte blocks, on a 4k sector disk, every time we went through
sd_revalidate_disk, we were taking the current value of
queue_max_hw_sectors and increasing it by a factor of 8. Fix
this by only shifting sdkp->max_xfer_blocks.
Cc: [email protected]
Signed-off-by: Brian King <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
This fixes a regression caused by commit 1d5203 ("scsi: handle more device
handler setup/teardown in common code").
The bug is that the alua detach() callout will try to access the
sddev->scsi_dh_data, but we have already set it to NULL. This patch
moves the clearing of that field to after detach() is called.
Signed-off-by: Mike Christie <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
This patch fix is to use default firmware configuration files
present in the adapter incase if not available in standard
/lib/firmware/* dir. Additional cleanup is done to reuse flash
related defines from cxgb4 header file.
Please apply over net-next since it depends on previous commit.
Signed-off-by: Praveen Madhavan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Conflicts:
arch/arm/boot/dts/imx6sx-sdb.dts
net/sched/cls_bpf.c
Two simple sets of overlapping changes.
Signed-off-by: David S. Miller <[email protected]>
Pull one more module fix from Rusty Russell:
"SCSI was using module_refcount() to figure out when the module was
unloading: this broke with new atomic refcounting. The code is still
suspicious, but this solves the WARN_ON()"
* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
scsi: always increment reference count
This is the blk-mq part to support tag allocation policy. The default
allocation policy isn't changed (though it's not a strict FIFO). The new
policy is round-robin for libata. But it's a try-best implementation. If
multiple tasks are competing, the tags returned will be mixed (which is
unavoidable even with !mq, as requests from different tasks can be
mixed in queue)
Cc: Jens Axboe <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
The libata tag allocation is using a round-robin policy. Next patch will
make libata use block generic tag allocation, so let's add a policy to
tag allocation.
Currently two policies: FIFO (default) and round-robin.
Cc: Jens Axboe <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
James reported:
> After e513cc1 module: Remove stop_machine from module unloading,
> module_refcount() is returning (unsigned long)-1 when called from within
> a routine that runs in module_exit. This is confusing the scsi device
> put code which is coded to detect a module_refcount() of zero for
> running within a module exit routine and not try to do another
> module_put. The fix is to restore the original behaviour of
> module_refcount() and return zero if we're running inside an exit
> routine.
The correct fix is to turn try_module_get() into __module_get(), and
always do the module_put().
Acked-by: James Bottomley <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
cppcheck found the following issue:
(warning) Logical conjunction always evaluates to false:
alloc_len < 4 && alloc_len > 65535.
..the test should be instead:
if (alloc_len < 4 || alloc_len > 65536)
This error was introduced by recent commit 38d5c8336e
("scsi_debug: add Report supported opcodes+tmfs; Compare and write")
Signed-off-by: Colin Ian King <[email protected]>
Acked-by: Douglas Gilbert <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Some devices might not implement config space access
(e.g. remoteproc used not to - before 3.9).
virtio/scsi needs config space access so make it
fail gracefully if not there.
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
This change adds support for Qualcomm Technologies Inc platforms that
use UFS driver. for example, it adds :
- PM specific operations during hibern8, suspend, resume, clock setup
- qcom-ufs generic phy driver initialization, calibration,
power-on/off sequence, etc.
- UFS Controller specific configuration
- Rate, Gear, Mode negotiation between device and controller
Signed-off-by: Yaniv Gardi <[email protected]>
Reviewed-by: Dov Levenglick <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
The midlayer scsi logging already logs the command and sense code
if the logging level is high enough, no need to duplicate that
in the sr driver.
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: James Bottomley <[email protected]>
Reviewed-by: Ewan D. Milne <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
The midlayer logging already prints the cdb details if the logging
level is high enough, no need to duplicate this in the ch driver.
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: James Bottomley <[email protected]>
Reviewed-by: Ewan D. Milne <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>