* [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver
@ 2014-05-29 15:52 Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 01/24] hpsa: add new Smart Array PCI IDs (May 2014) Stephen M. Cameron
` (23 more replies)
0 siblings, 24 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
Not a lot of extensive changes in this set, some new PCI IDs,
some small bug fixes, quieting some noisy messages, allowing
more reply queues, setting irq affinity hints, and some minor
locking improvments.
Two patches are slightly changed since they were first sent due
to reviewer comments and some new or previously unnoticed
checkpatch complaints.
"hpsa: fix handling of hpsa_volume_offline return value"
was changed slightly to avoid some type casting, and
"hpsa: use gcc aligned attribute instead of manually padding structs"
was changed to use "__align(x)" instead of "__attribute((aligned(x)))"
drivers/scsi/hpsa.c | 297 +++++++++++++++++++++++++++++------------------
drivers/scsi/hpsa.h | 43 ++++---
drivers/scsi/hpsa_cmd.h | 49 +++-----
3 files changed, 226 insertions(+), 163 deletions(-)
--
-- steve
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 2 01/24] hpsa: add new Smart Array PCI IDs (May 2014)
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 02/24] hpsa: fix missing check of kzalloc return value Stephen M. Cameron
` (22 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Scott Teel <scott.teel@hp.com>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@vger.kernel.org
---
drivers/scsi/hpsa.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9a6e4a2..fda6cf1 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -115,9 +115,15 @@ static const struct pci_device_id hpsa_pci_device_id[] = {
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C3},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C4},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C5},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C6},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C7},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C8},
{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21C9},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CA},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CB},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CC},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CD},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CE},
{PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0076},
{PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0087},
{PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x007D},
@@ -165,9 +171,15 @@ static struct board_type products[] = {
{0x21C3103C, "Smart Array", &SA5_access},
{0x21C4103C, "Smart Array", &SA5_access},
{0x21C5103C, "Smart Array", &SA5_access},
+ {0x21C6103C, "Smart Array", &SA5_access},
{0x21C7103C, "Smart Array", &SA5_access},
{0x21C8103C, "Smart Array", &SA5_access},
{0x21C9103C, "Smart Array", &SA5_access},
+ {0x21CA103C, "Smart Array", &SA5_access},
+ {0x21CB103C, "Smart Array", &SA5_access},
+ {0x21CC103C, "Smart Array", &SA5_access},
+ {0x21CD103C, "Smart Array", &SA5_access},
+ {0x21CE103C, "Smart Array", &SA5_access},
{0x00761590, "HP Storage P1224 Array Controller", &SA5_access},
{0x00871590, "HP Storage P1224e Array Controller", &SA5_access},
{0x007D1590, "HP Storage P1228 Array Controller", &SA5_access},
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 02/24] hpsa: fix missing check of kzalloc return value
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 01/24] hpsa: add new Smart Array PCI IDs (May 2014) Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 03/24] hpsa: remove unused fields from struct ctlr_info Stephen M. Cameron
` (21 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Scott Teel <scott.teel@hp.com>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@vger.kernel.org
---
drivers/scsi/hpsa.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index fda6cf1..ef66905 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2848,6 +2848,8 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
/* Get the list of physical devices */
physicals = kzalloc(reportsize, GFP_KERNEL);
+ if (physicals == NULL)
+ return 0;
if (hpsa_scsi_do_report_phys_luns(h, (struct ReportLUNdata *) physicals,
reportsize, extended)) {
dev_err(&h->pdev->dev,
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 03/24] hpsa: remove unused fields from struct ctlr_info
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 01/24] hpsa: add new Smart Array PCI IDs (May 2014) Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 02/24] hpsa: fix missing check of kzalloc return value Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 04/24] hpsa: allow passthru ioctls to work with bidirectional commands Stephen M. Cameron
` (20 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
The fields "major", "max_outstanding", and "usage_count"
of struct ctlr_info were not used for anything.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
---
drivers/scsi/hpsa.c | 2 --
drivers/scsi/hpsa.h | 3 ---
2 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ef66905..7ba4e30 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5481,8 +5481,6 @@ static void start_io(struct ctlr_info *h)
* condition.
*/
h->commands_outstanding++;
- if (h->commands_outstanding > h->max_outstanding)
- h->max_outstanding = h->commands_outstanding;
/* Tell the controller execute command */
spin_unlock_irqrestore(&h->lock, flags);
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 44235a2..b988e04 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -115,11 +115,8 @@ struct ctlr_info {
int nr_cmds; /* Number of commands allowed on this controller */
struct CfgTable __iomem *cfgtable;
int interrupts_enabled;
- int major;
int max_commands;
int commands_outstanding;
- int max_outstanding; /* Debug */
- int usage_count; /* number of opens all all minor devices */
# define PERF_MODE_INT 0
# define DOORBELL_INT 1
# define SIMPLE_MODE_INT 2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 04/24] hpsa: allow passthru ioctls to work with bidirectional commands
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (2 preceding siblings ...)
2014-05-29 15:52 ` [PATCH 2 03/24] hpsa: remove unused fields from struct ctlr_info Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 05/24] hpsa: change doorbell reset delay to ten seconds Stephen M. Cameron
` (19 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Treat the the data direction bits as a bit mask allowing both
READ and WRITE at the same time instead of testing for equality
to see if it's a exclusively a READ or a WRITE.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
---
drivers/scsi/hpsa.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 7ba4e30..1df9a8a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4956,7 +4956,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
buff = kmalloc(iocommand.buf_size, GFP_KERNEL);
if (buff == NULL)
return -EFAULT;
- if (iocommand.Request.Type.Direction == XFER_WRITE) {
+ if (iocommand.Request.Type.Direction & XFER_WRITE) {
/* Copy the data into the buffer we created */
if (copy_from_user(buff, iocommand.buf,
iocommand.buf_size)) {
@@ -5019,7 +5019,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
rc = -EFAULT;
goto out;
}
- if (iocommand.Request.Type.Direction == XFER_READ &&
+ if ((iocommand.Request.Type.Direction & XFER_READ) &&
iocommand.buf_size > 0) {
/* Copy the data out of the buffer we created */
if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) {
@@ -5096,7 +5096,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
status = -ENOMEM;
goto cleanup1;
}
- if (ioc->Request.Type.Direction == XFER_WRITE) {
+ if (ioc->Request.Type.Direction & XFER_WRITE) {
if (copy_from_user(buff[sg_used], data_ptr, sz)) {
status = -ENOMEM;
goto cleanup1;
@@ -5148,7 +5148,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
status = -EFAULT;
goto cleanup0;
}
- if (ioc->Request.Type.Direction == XFER_READ && ioc->buf_size > 0) {
+ if ((ioc->Request.Type.Direction & XFER_READ) && ioc->buf_size > 0) {
/* Copy the data out of the buffer we created */
BYTE __user *ptr = ioc->buf;
for (i = 0; i < sg_used; i++) {
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 05/24] hpsa: change doorbell reset delay to ten seconds
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (3 preceding siblings ...)
2014-05-29 15:52 ` [PATCH 2 04/24] hpsa: allow passthru ioctls to work with bidirectional commands Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 06/24] hpsa: use gcc aligned attribute instead of manually padding structs Stephen M. Cameron
` (18 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Justin Lindley <justin.lindley@hp.com>
After 3.22 firmware, PMC firmware guys tell us the
previous 5 second delay after a reset now needs to
be 10 secs to avoid a PCIe error due to the driver
looking at the controller too soon after the reset.
Signed-off-by: Justin Lindley <justin.lindley@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
drivers/scsi/hpsa.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 1df9a8a..2220b32 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5831,12 +5831,12 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,
dev_info(&pdev->dev, "using doorbell to reset controller\n");
writel(use_doorbell, vaddr + SA5_DOORBELL);
- /* PMC hardware guys tell us we need a 5 second delay after
+ /* PMC hardware guys tell us we need a 10 second delay after
* doorbell reset and before any attempt to talk to the board
* at all to ensure that this actually works and doesn't fall
* over in some weird corner cases.
*/
- msleep(5000);
+ msleep(10000);
} else { /* Try to do it the PCI power state way */
/* Quoting from the Open CISS Specification: "The Power
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 06/24] hpsa: use gcc aligned attribute instead of manually padding structs
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (4 preceding siblings ...)
2014-05-29 15:52 ` [PATCH 2 05/24] hpsa: change doorbell reset delay to ten seconds Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 07/24] hpsa: remove dev_dbg() calls from hot paths Stephen M. Cameron
` (17 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
---
drivers/scsi/hpsa.c | 3 ---
drivers/scsi/hpsa_cmd.h | 33 ++++++---------------------------
2 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 2220b32..b1ecfd8 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6925,7 +6925,6 @@ reinit_after_soft_reset:
* the 5 lower bits of the address are used by the hardware. and by
* the driver. See comments in hpsa.h for more info.
*/
-#define COMMANDLIST_ALIGNMENT 128
BUILD_BUG_ON(sizeof(struct CommandList) % COMMANDLIST_ALIGNMENT);
h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
@@ -7398,7 +7397,6 @@ static int hpsa_alloc_ioaccel_cmd_and_bft(struct ctlr_info *h)
* because the 7 lower bits of the address are used by the
* hardware.
*/
-#define IOACCEL1_COMMANDLIST_ALIGNMENT 128
BUILD_BUG_ON(sizeof(struct io_accel1_cmd) %
IOACCEL1_COMMANDLIST_ALIGNMENT);
h->ioaccel_cmd_pool =
@@ -7436,7 +7434,6 @@ static int ioaccel2_alloc_cmds_and_bft(struct ctlr_info *h)
if (h->ioaccel_maxsg > IOACCEL2_MAXSGENTRIES)
h->ioaccel_maxsg = IOACCEL2_MAXSGENTRIES;
-#define IOACCEL2_COMMANDLIST_ALIGNMENT 128
BUILD_BUG_ON(sizeof(struct io_accel2_cmd) %
IOACCEL2_COMMANDLIST_ALIGNMENT);
h->ioaccel2_cmd_pool =
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index b5cc705..db89245 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -375,6 +375,7 @@ struct ctlr_info; /* defined in hpsa.h */
* or a bus address.
*/
+#define COMMANDLIST_ALIGNMENT 128
struct CommandList {
struct CommandListHeader Header;
struct RequestBlock Request;
@@ -389,21 +390,7 @@ struct CommandList {
struct list_head list;
struct completion *waiting;
void *scsi_cmd;
-
-/* on 64 bit architectures, to get this to be 32-byte-aligned
- * it so happens we need PAD_64 bytes of padding, on 32 bit systems,
- * we need PAD_32 bytes of padding (see below). This does that.
- * If it happens that 64 bit and 32 bit systems need different
- * padding, PAD_32 and PAD_64 can be set independently, and.
- * the code below will do the right thing.
- */
-#define IS_32_BIT ((8 - sizeof(long))/4)
-#define IS_64_BIT (!IS_32_BIT)
-#define PAD_32 (40)
-#define PAD_64 (12)
-#define COMMANDLIST_PAD (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
- u8 pad[COMMANDLIST_PAD];
-};
+} __aligned(COMMANDLIST_ALIGNMENT);
/* Max S/G elements in I/O accelerator command */
#define IOACCEL1_MAXSGENTRIES 24
@@ -413,6 +400,7 @@ struct CommandList {
* Structure for I/O accelerator (mode 1) commands.
* Note that this structure must be 128-byte aligned in size.
*/
+#define IOACCEL1_COMMANDLIST_ALIGNMENT 128
struct io_accel1_cmd {
u16 dev_handle; /* 0x00 - 0x01 */
u8 reserved1; /* 0x02 */
@@ -440,12 +428,7 @@ struct io_accel1_cmd {
struct vals32 host_addr; /* 0x70 - 0x77 */
u8 CISS_LUN[8]; /* 0x78 - 0x7F */
struct SGDescriptor SG[IOACCEL1_MAXSGENTRIES];
-#define IOACCEL1_PAD_64 0
-#define IOACCEL1_PAD_32 0
-#define IOACCEL1_PAD (IS_32_BIT * IOACCEL1_PAD_32 + \
- IS_64_BIT * IOACCEL1_PAD_64)
- u8 pad[IOACCEL1_PAD];
-};
+} __aligned(IOACCEL1_COMMANDLIST_ALIGNMENT);
#define IOACCEL1_FUNCTION_SCSIIO 0x00
#define IOACCEL1_SGLOFFSET 32
@@ -510,14 +493,11 @@ struct io_accel2_scsi_response {
u8 sense_data_buff[32]; /* sense/response data buffer */
};
-#define IOACCEL2_64_PAD 76
-#define IOACCEL2_32_PAD 76
-#define IOACCEL2_PAD (IS_32_BIT * IOACCEL2_32_PAD + \
- IS_64_BIT * IOACCEL2_64_PAD)
/*
* Structure for I/O accelerator (mode 2 or m2) commands.
* Note that this structure must be 128-byte aligned in size.
*/
+#define IOACCEL2_COMMANDLIST_ALIGNMENT 128
struct io_accel2_cmd {
u8 IU_type; /* IU Type */
u8 direction; /* direction, memtype, and encryption */
@@ -544,8 +524,7 @@ struct io_accel2_cmd {
u32 tweak_upper; /* Encryption tweak, upper 4 bytes */
struct ioaccel2_sg_element sg[IOACCEL2_MAXSGENTRIES];
struct io_accel2_scsi_response error_data;
- u8 pad[IOACCEL2_PAD];
-};
+} __aligned(IOACCEL2_COMMANDLIST_ALIGNMENT);
/*
* defines for Mode 2 command struct
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 07/24] hpsa: remove dev_dbg() calls from hot paths
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (5 preceding siblings ...)
2014-05-29 15:52 ` [PATCH 2 06/24] hpsa: use gcc aligned attribute instead of manually padding structs Stephen M. Cameron
@ 2014-05-29 15:52 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently Stephen M. Cameron
` (16 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:52 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
They are not completely free of cost when disabled and
when enabled emitting debug output for every command
submitted produces far too much output to be useful.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
---
drivers/scsi/hpsa.h | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index b988e04..da67c07 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -342,8 +342,6 @@ struct offline_device_entry {
static void SA5_submit_command(struct ctlr_info *h,
struct CommandList *c)
{
- dev_dbg(&h->pdev->dev, "Sending %x, tag = %x\n", c->busaddr,
- c->Header.Tag.lower);
writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
(void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
}
@@ -351,8 +349,6 @@ static void SA5_submit_command(struct ctlr_info *h,
static void SA5_submit_command_ioaccel2(struct ctlr_info *h,
struct CommandList *c)
{
- dev_dbg(&h->pdev->dev, "Sending %x, tag = %x\n", c->busaddr,
- c->Header.Tag.lower);
if (c->cmd_type == CMD_IOACCEL2)
writel(c->busaddr, h->vaddr + IOACCEL2_INBOUND_POSTQ_32);
else
@@ -474,7 +470,6 @@ static bool SA5_intr_pending(struct ctlr_info *h)
{
unsigned long register_value =
readl(h->vaddr + SA5_INTR_STATUS);
- dev_dbg(&h->pdev->dev, "intr_pending %lx\n", register_value);
return register_value & SA5_INTR_PENDING;
}
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently.
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (6 preceding siblings ...)
2014-05-29 15:52 ` [PATCH 2 07/24] hpsa: remove dev_dbg() calls from hot paths Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-06-02 9:27 ` Christoph Hellwig
2014-05-29 15:53 ` [PATCH 2 09/24] hpsa: allocate reply queues individually Stephen M. Cameron
` (15 subsequent siblings)
23 siblings, 1 reply; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
No sense having 8 or 16 reply queues if you only have 4 cpus,
and likewise no sense limiting to 8 reply queues if you have
many more cpus.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
---
drivers/scsi/hpsa.c | 2 ++
drivers/scsi/hpsa_cmd.h | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index b1ecfd8..b903e86 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6157,6 +6157,8 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
dev_info(&h->pdev->dev, "MSIX\n");
h->msix_vector = MAX_REPLY_QUEUES;
+ if (h->msix_vector > num_online_cpus())
+ h->msix_vector = num_online_cpus();
err = pci_enable_msix(h->pdev, hpsa_msix_entries,
h->msix_vector);
if (err > 0) {
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index db89245..104b67b 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -615,7 +615,7 @@ struct TransTable_struct {
u32 RepQCount;
u32 RepQCtrAddrLow32;
u32 RepQCtrAddrHigh32;
-#define MAX_REPLY_QUEUES 8
+#define MAX_REPLY_QUEUES 64
struct vals32 RepQAddr[MAX_REPLY_QUEUES];
};
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 09/24] hpsa: allocate reply queues individually
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (7 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 10/24] hpsa: set irq affinity hints to route MSI-X vectors across CPUs Stephen M. Cameron
` (14 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Now that we can allocate more than 4 reply queues (up to 64)
we shouldn't try to make them share the same allocation but
should allocate them separately.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
---
drivers/scsi/hpsa.c | 53 +++++++++++++++++++++++++++++++--------------------
drivers/scsi/hpsa.h | 13 ++++++-------
2 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index b903e86..9c44f26 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -695,7 +695,7 @@ static inline void addQ(struct list_head *list, struct CommandList *c)
static inline u32 next_command(struct ctlr_info *h, u8 q)
{
u32 a;
- struct reply_pool *rq = &h->reply_queue[q];
+ struct reply_queue_buffer *rq = &h->reply_queue[q];
unsigned long flags;
if (h->transMethod & CFGTBL_Trans_io_accel1)
@@ -6700,6 +6700,20 @@ static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h)
#endif /* CONFIG_PCI_MSI */
}
+static void hpsa_free_reply_queues(struct ctlr_info *h)
+{
+ int i;
+
+ for (i = 0; i < h->nreply_queues; i++) {
+ if (!h->reply_queue[i].head)
+ continue;
+ pci_free_consistent(h->pdev, h->reply_queue_size,
+ h->reply_queue[i].head, h->reply_queue[i].busaddr);
+ h->reply_queue[i].head = NULL;
+ h->reply_queue[i].busaddr = 0;
+ }
+}
+
static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
{
hpsa_free_irqs_and_disable_msix(h);
@@ -6707,8 +6721,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
hpsa_free_cmd_pool(h);
kfree(h->ioaccel1_blockFetchTable);
kfree(h->blockFetchTable);
- pci_free_consistent(h->pdev, h->reply_pool_size,
- h->reply_pool, h->reply_pool_dhandle);
+ hpsa_free_reply_queues(h);
if (h->vaddr)
iounmap(h->vaddr);
if (h->transtable)
@@ -7157,8 +7170,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct ErrorInfo),
h->errinfo_pool, h->errinfo_pool_dhandle);
- pci_free_consistent(h->pdev, h->reply_pool_size,
- h->reply_pool, h->reply_pool_dhandle);
+ hpsa_free_reply_queues(h);
kfree(h->cmd_pool_bits);
kfree(h->blockFetchTable);
kfree(h->ioaccel1_blockFetchTable);
@@ -7271,7 +7283,8 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
*/
/* Controller spec: zero out this buffer. */
- memset(h->reply_pool, 0, h->reply_pool_size);
+ for (i = 0; i < h->nreply_queues; i++)
+ memset(h->reply_queue[i].head, 0, h->reply_queue_size);
bft[7] = SG_ENTRIES_IN_CMD + 4;
calc_bucket_map(bft, ARRAY_SIZE(bft),
@@ -7287,8 +7300,7 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
for (i = 0; i < h->nreply_queues; i++) {
writel(0, &h->transtable->RepQAddr[i].upper);
- writel(h->reply_pool_dhandle +
- (h->max_commands * sizeof(u64) * i),
+ writel(h->reply_queue[i].busaddr,
&h->transtable->RepQAddr[i].lower);
}
@@ -7336,8 +7348,10 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
h->ioaccel1_blockFetchTable);
/* initialize all reply queue entries to unused */
- memset(h->reply_pool, (u8) IOACCEL_MODE1_REPLY_UNUSED,
- h->reply_pool_size);
+ for (i = 0; i < h->nreply_queues; i++)
+ memset(h->reply_queue[i].head,
+ (u8) IOACCEL_MODE1_REPLY_UNUSED,
+ h->reply_queue_size);
/* set all the constant fields in the accelerator command
* frames once at init time to save CPU cycles later.
@@ -7493,16 +7507,17 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
}
}
- /* TODO, check that this next line h->nreply_queues is correct */
h->nreply_queues = h->msix_vector > 0 ? h->msix_vector : 1;
hpsa_get_max_perf_mode_cmds(h);
/* Performant mode ring buffer and supporting data structures */
- h->reply_pool_size = h->max_commands * sizeof(u64) * h->nreply_queues;
- h->reply_pool = pci_alloc_consistent(h->pdev, h->reply_pool_size,
- &(h->reply_pool_dhandle));
+ h->reply_queue_size = h->max_commands * sizeof(u64);
for (i = 0; i < h->nreply_queues; i++) {
- h->reply_queue[i].head = &h->reply_pool[h->max_commands * i];
+ h->reply_queue[i].head = pci_alloc_consistent(h->pdev,
+ h->reply_queue_size,
+ &(h->reply_queue[i].busaddr));
+ if (!h->reply_queue[i].head)
+ goto clean_up;
h->reply_queue[i].size = h->max_commands;
h->reply_queue[i].wraparound = 1; /* spec: init to 1 */
h->reply_queue[i].current_entry = 0;
@@ -7511,18 +7526,14 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
/* Need a block fetch table for performant mode */
h->blockFetchTable = kmalloc(((SG_ENTRIES_IN_CMD + 1) *
sizeof(u32)), GFP_KERNEL);
-
- if ((h->reply_pool == NULL)
- || (h->blockFetchTable == NULL))
+ if (!h->blockFetchTable)
goto clean_up;
hpsa_enter_performant_mode(h, trans_support);
return;
clean_up:
- if (h->reply_pool)
- pci_free_consistent(h->pdev, h->reply_pool_size,
- h->reply_pool, h->reply_pool_dhandle);
+ hpsa_free_reply_queues(h);
kfree(h->blockFetchTable);
}
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index da67c07..fa63576 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -57,11 +57,12 @@ struct hpsa_scsi_dev_t {
};
-struct reply_pool {
+struct reply_queue_buffer {
u64 *head;
size_t size;
u8 wraparound;
u32 current_entry;
+ dma_addr_t busaddr;
};
#pragma pack(1)
@@ -173,11 +174,9 @@ struct ctlr_info {
/*
* Performant mode completion buffers
*/
- u64 *reply_pool;
- size_t reply_pool_size;
- struct reply_pool reply_queue[MAX_REPLY_QUEUES];
+ size_t reply_queue_size;
+ struct reply_queue_buffer reply_queue[MAX_REPLY_QUEUES];
u8 nreply_queues;
- dma_addr_t reply_pool_dhandle;
u32 *blockFetchTable;
u32 *ioaccel1_blockFetchTable;
u32 *ioaccel2_blockFetchTable;
@@ -391,7 +390,7 @@ static void SA5_performant_intr_mask(struct ctlr_info *h, unsigned long val)
static unsigned long SA5_performant_completed(struct ctlr_info *h, u8 q)
{
- struct reply_pool *rq = &h->reply_queue[q];
+ struct reply_queue_buffer *rq = &h->reply_queue[q];
unsigned long flags, register_value = FIFO_EMPTY;
/* msi auto clears the interrupt pending bit. */
@@ -506,7 +505,7 @@ static bool SA5_ioaccel_mode1_intr_pending(struct ctlr_info *h)
static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q)
{
u64 register_value;
- struct reply_pool *rq = &h->reply_queue[q];
+ struct reply_queue_buffer *rq = &h->reply_queue[q];
unsigned long flags;
BUG_ON(q >= h->nreply_queues);
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 10/24] hpsa: set irq affinity hints to route MSI-X vectors across CPUs
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (8 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 09/24] hpsa: allocate reply queues individually Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 11/24] hpsa: use per-cpu variable for lockup_detected Stephen M. Cameron
` (13 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
---
drivers/scsi/hpsa.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9c44f26..e8090e2 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6608,6 +6608,17 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h)
h->ioaccel_cmd_pool, h->ioaccel_cmd_pool_dhandle);
}
+static void hpsa_irq_affinity_hints(struct ctlr_info *h)
+{
+ int i, cpu, rc;
+
+ cpu = cpumask_first(cpu_online_mask);
+ for (i = 0; i < h->msix_vector; i++) {
+ rc = irq_set_affinity_hint(h->intr[i], get_cpu_mask(cpu));
+ cpu = cpumask_next(cpu, cpu_online_mask);
+ }
+}
+
static int hpsa_request_irq(struct ctlr_info *h,
irqreturn_t (*msixhandler)(int, void *),
irqreturn_t (*intxhandler)(int, void *))
@@ -6627,6 +6638,7 @@ static int hpsa_request_irq(struct ctlr_info *h,
rc = request_irq(h->intr[i], msixhandler,
0, h->devname,
&h->q[i]);
+ hpsa_irq_affinity_hints(h);
} else {
/* Use single reply pool */
if (h->msix_vector > 0 || h->msi_vector) {
@@ -6678,12 +6690,15 @@ static void free_irqs(struct ctlr_info *h)
if (!h->msix_vector || h->intr_mode != PERF_MODE_INT) {
/* Single reply queue, only one irq to free */
i = h->intr_mode;
+ irq_set_affinity_hint(h->intr[i], NULL);
free_irq(h->intr[i], &h->q[i]);
return;
}
- for (i = 0; i < h->msix_vector; i++)
+ for (i = 0; i < h->msix_vector; i++) {
+ irq_set_affinity_hint(h->intr[i], NULL);
free_irq(h->intr[i], &h->q[i]);
+ }
}
static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h)
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 11/24] hpsa: use per-cpu variable for lockup_detected
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (9 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 10/24] hpsa: set irq affinity hints to route MSI-X vectors across CPUs Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 12/24] hpsa: avoid unnecessary readl on every command submission Stephen M. Cameron
` (12 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Avoid excessive locking by using per-cpu variable for lockup_detected
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Scott Teel <scott.teel@hp.com>
---
drivers/scsi/hpsa.c | 80 ++++++++++++++++++++++++++++++++++-----------------
drivers/scsi/hpsa.h | 2 +
2 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index e8090e2..acb88e5 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -48,6 +48,7 @@
#include <linux/bitmap.h>
#include <linux/atomic.h>
#include <linux/jiffies.h>
+#include <linux/percpu.h>
#include <asm/div64.h>
#include "hpsa_cmd.h"
#include "hpsa.h"
@@ -1991,20 +1992,26 @@ static inline void hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,
wait_for_completion(&wait);
}
+static u32 lockup_detected(struct ctlr_info *h)
+{
+ int cpu;
+ u32 rc, *lockup_detected;
+
+ cpu = get_cpu();
+ lockup_detected = per_cpu_ptr(h->lockup_detected, cpu);
+ rc = *lockup_detected;
+ put_cpu();
+ return rc;
+}
+
static void hpsa_scsi_do_simple_cmd_core_if_no_lockup(struct ctlr_info *h,
struct CommandList *c)
{
- unsigned long flags;
-
/* If controller lockup detected, fake a hardware error. */
- spin_lock_irqsave(&h->lock, flags);
- if (unlikely(h->lockup_detected)) {
- spin_unlock_irqrestore(&h->lock, flags);
+ if (unlikely(lockup_detected(h)))
c->err_info->CommandStatus = CMD_HARDWARE_ERR;
- } else {
- spin_unlock_irqrestore(&h->lock, flags);
+ else
hpsa_scsi_do_simple_cmd_core(h, c);
- }
}
#define MAX_DRIVER_CMD_RETRIES 25
@@ -3964,7 +3971,6 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
struct hpsa_scsi_dev_t *dev;
unsigned char scsi3addr[8];
struct CommandList *c;
- unsigned long flags;
int rc = 0;
/* Get the ptr to our adapter structure out of cmd->host. */
@@ -3977,14 +3983,11 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
}
memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr));
- spin_lock_irqsave(&h->lock, flags);
- if (unlikely(h->lockup_detected)) {
- spin_unlock_irqrestore(&h->lock, flags);
+ if (unlikely(lockup_detected(h))) {
cmd->result = DID_ERROR << 16;
done(cmd);
return 0;
}
- spin_unlock_irqrestore(&h->lock, flags);
c = cmd_alloc(h);
if (c == NULL) { /* trouble... */
dev_err(&h->pdev->dev, "cmd_alloc returned NULL!\n");
@@ -4096,16 +4099,13 @@ static int do_not_scan_if_controller_locked_up(struct ctlr_info *h)
* we can prevent new rescan threads from piling up on a
* locked up controller.
*/
- spin_lock_irqsave(&h->lock, flags);
- if (unlikely(h->lockup_detected)) {
- spin_unlock_irqrestore(&h->lock, flags);
+ if (unlikely(lockup_detected(h))) {
spin_lock_irqsave(&h->scan_lock, flags);
h->scan_finished = 1;
wake_up_all(&h->scan_wait_queue);
spin_unlock_irqrestore(&h->scan_lock, flags);
return 1;
}
- spin_unlock_irqrestore(&h->lock, flags);
return 0;
}
@@ -6761,16 +6761,38 @@ static void fail_all_cmds_on_list(struct ctlr_info *h, struct list_head *list)
}
}
+static void set_lockup_detected_for_all_cpus(struct ctlr_info *h, u32 value)
+{
+ int i, cpu;
+
+ cpu = cpumask_first(cpu_online_mask);
+ for (i = 0; i < num_online_cpus(); i++) {
+ u32 *lockup_detected;
+ lockup_detected = per_cpu_ptr(h->lockup_detected, cpu);
+ *lockup_detected = value;
+ cpu = cpumask_next(cpu, cpu_online_mask);
+ }
+ wmb(); /* be sure the per-cpu variables are out to memory */
+}
+
static void controller_lockup_detected(struct ctlr_info *h)
{
unsigned long flags;
+ u32 lockup_detected;
h->access.set_intr_mask(h, HPSA_INTR_OFF);
spin_lock_irqsave(&h->lock, flags);
- h->lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
+ lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
+ if (!lockup_detected) {
+ /* no heartbeat, but controller gave us a zero. */
+ dev_warn(&h->pdev->dev,
+ "lockup detected but scratchpad register is zero\n");
+ lockup_detected = 0xffffffff;
+ }
+ set_lockup_detected_for_all_cpus(h, lockup_detected);
spin_unlock_irqrestore(&h->lock, flags);
dev_warn(&h->pdev->dev, "Controller lockup detected: 0x%08x\n",
- h->lockup_detected);
+ lockup_detected);
pci_disable_device(h->pdev);
spin_lock_irqsave(&h->lock, flags);
fail_all_cmds_on_list(h, &h->cmpQ);
@@ -6905,7 +6927,7 @@ static void hpsa_monitor_ctlr_worker(struct work_struct *work)
struct ctlr_info *h = container_of(to_delayed_work(work),
struct ctlr_info, monitor_ctlr_work);
detect_controller_lockup(h);
- if (h->lockup_detected)
+ if (lockup_detected(h))
return;
if (hpsa_ctlr_needs_rescan(h) || hpsa_offline_devices_ready(h)) {
@@ -6969,6 +6991,13 @@ reinit_after_soft_reset:
spin_lock_init(&h->offline_device_lock);
spin_lock_init(&h->scan_lock);
spin_lock_init(&h->passthru_count_lock);
+
+ /* Allocate and clear per-cpu variable lockup_detected */
+ h->lockup_detected = alloc_percpu(u32);
+ if (!h->lockup_detected)
+ goto clean1;
+ set_lockup_detected_for_all_cpus(h, 0);
+
rc = hpsa_pci_init(h);
if (rc != 0)
goto clean1;
@@ -7092,6 +7121,8 @@ clean4:
free_irqs(h);
clean2:
clean1:
+ if (h->lockup_detected)
+ free_percpu(h->lockup_detected);
kfree(h);
return rc;
}
@@ -7100,16 +7131,10 @@ static void hpsa_flush_cache(struct ctlr_info *h)
{
char *flush_buf;
struct CommandList *c;
- unsigned long flags;
/* Don't bother trying to flush the cache if locked up */
- spin_lock_irqsave(&h->lock, flags);
- if (unlikely(h->lockup_detected)) {
- spin_unlock_irqrestore(&h->lock, flags);
+ if (unlikely(lockup_detected(h)))
return;
- }
- spin_unlock_irqrestore(&h->lock, flags);
-
flush_buf = kzalloc(4, GFP_KERNEL);
if (!flush_buf)
return;
@@ -7193,6 +7218,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)
kfree(h->hba_inquiry_data);
pci_disable_device(pdev);
pci_release_regions(pdev);
+ free_percpu(h->lockup_detected);
kfree(h);
}
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index fa63576..8e8310e 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -191,7 +191,7 @@ struct ctlr_info {
u64 last_heartbeat_timestamp;
u32 heartbeat_sample_interval;
atomic_t firmware_flash_in_progress;
- u32 lockup_detected;
+ u32 *lockup_detected;
struct delayed_work monitor_ctlr_work;
int remove_in_progress;
u32 fifo_recently_full;
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 12/24] hpsa: avoid unnecessary readl on every command submission
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (10 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 11/24] hpsa: use per-cpu variable for lockup_detected Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 13/24] hpsa: Rearrange start_io to avoid one unlock/lock sequence in main io path Stephen M. Cameron
` (11 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
for controllers which support either of the ioaccel transport methods.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
---
drivers/scsi/hpsa.c | 7 +++++++
drivers/scsi/hpsa.h | 15 ++++++++++++++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index acb88e5..ad73017 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -7323,6 +7323,13 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
* 10 = 6 s/g entry or 24k
*/
+ /* If the controller supports either ioaccel method then
+ * we can also use the RAID stack submit path that does not
+ * perform the superfluous readl() after each command submission.
+ */
+ if (trans_support & (CFGTBL_Trans_io_accel1 | CFGTBL_Trans_io_accel2))
+ access = SA5_performant_access_no_read;
+
/* Controller spec: zero out this buffer. */
for (i = 0; i < h->nreply_queues; i++)
memset(h->reply_queue[i].head, 0, h->reply_queue_size);
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 8e8310e..1855469 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -345,6 +345,12 @@ static void SA5_submit_command(struct ctlr_info *h,
(void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
}
+static void SA5_submit_command_no_read(struct ctlr_info *h,
+ struct CommandList *c)
+{
+ writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
+}
+
static void SA5_submit_command_ioaccel2(struct ctlr_info *h,
struct CommandList *c)
{
@@ -352,7 +358,6 @@ static void SA5_submit_command_ioaccel2(struct ctlr_info *h,
writel(c->busaddr, h->vaddr + IOACCEL2_INBOUND_POSTQ_32);
else
writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
- (void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
}
/*
@@ -563,6 +568,14 @@ static struct access_method SA5_performant_access = {
SA5_performant_completed,
};
+static struct access_method SA5_performant_access_no_read = {
+ SA5_submit_command_no_read,
+ SA5_performant_intr_mask,
+ SA5_fifo_full,
+ SA5_performant_intr_pending,
+ SA5_performant_completed,
+};
+
struct board_type {
u32 board_id;
char *product_name;
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 13/24] hpsa: Rearrange start_io to avoid one unlock/lock sequence in main io path
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (11 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 12/24] hpsa: avoid unnecessary readl on every command submission Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 14/24] hpsa: define extended_report_lun_entry data structure Stephen M. Cameron
` (10 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
---
drivers/scsi/hpsa.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ad73017..c6ed5ea 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -194,7 +194,8 @@ static int number_of_controllers;
static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id);
static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id);
static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg);
-static void start_io(struct ctlr_info *h);
+static void lock_and_start_io(struct ctlr_info *h);
+static void start_io(struct ctlr_info *h, unsigned long *flags);
#ifdef CONFIG_COMPAT
static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg);
@@ -845,8 +846,8 @@ static void enqueue_cmd_and_start_io(struct ctlr_info *h,
spin_lock_irqsave(&h->lock, flags);
addQ(&h->reqQ, c);
h->Qdepth++;
+ start_io(h, &flags);
spin_unlock_irqrestore(&h->lock, flags);
- start_io(h);
}
static inline void removeQ(struct CommandList *c)
@@ -5452,13 +5453,12 @@ static void __iomem *remap_pci_mem(ulong base, ulong size)
/* Takes cmds off the submission queue and sends them to the hardware,
* then puts them on the queue of cmds waiting for completion.
+ * Assumes h->lock is held
*/
-static void start_io(struct ctlr_info *h)
+static void start_io(struct ctlr_info *h, unsigned long *flags)
{
struct CommandList *c;
- unsigned long flags;
- spin_lock_irqsave(&h->lock, flags);
while (!list_empty(&h->reqQ)) {
c = list_entry(h->reqQ.next, struct CommandList, list);
/* can't do anything if fifo is full */
@@ -5483,10 +5483,18 @@ static void start_io(struct ctlr_info *h)
h->commands_outstanding++;
/* Tell the controller execute command */
- spin_unlock_irqrestore(&h->lock, flags);
+ spin_unlock_irqrestore(&h->lock, *flags);
h->access.submit_command(h, c);
- spin_lock_irqsave(&h->lock, flags);
+ spin_lock_irqsave(&h->lock, *flags);
}
+}
+
+static void lock_and_start_io(struct ctlr_info *h)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&h->lock, flags);
+ start_io(h, &flags);
spin_unlock_irqrestore(&h->lock, flags);
}
@@ -5554,7 +5562,7 @@ static inline void finish_cmd(struct CommandList *c)
else if (c->cmd_type == CMD_IOCTL_PEND)
complete(c->waiting);
if (unlikely(io_may_be_stalled))
- start_io(h);
+ lock_and_start_io(h);
}
static inline u32 hpsa_tag_contains_index(u32 tag)
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 14/24] hpsa: define extended_report_lun_entry data structure
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (12 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 13/24] hpsa: Rearrange start_io to avoid one unlock/lock sequence in main io path Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 15/24] hpsa: kill annoying messages about SSD Smart Path retries Stephen M. Cameron
` (9 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
---
drivers/scsi/hpsa.c | 21 ++++++++-------------
drivers/scsi/hpsa_cmd.h | 12 +++++++++++-
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c6ed5ea..96436bb 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2869,26 +2869,20 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
nphysicals = be32_to_cpu(*((__be32 *)physicals->LUNListLength)) /
responsesize;
-
/* find ioaccel2 handle in list of physicals: */
for (i = 0; i < nphysicals; i++) {
+ struct ext_report_lun_entry *entry = &physicals->LUN[i];
+
/* handle is in bytes 28-31 of each lun */
- if (memcmp(&((struct ReportExtendedLUNdata *)
- physicals)->LUN[i][20], &find, 4) != 0) {
+ if (entry->ioaccel_handle != find)
continue; /* didn't match */
- }
found = 1;
- memcpy(scsi3addr, &((struct ReportExtendedLUNdata *)
- physicals)->LUN[i][0], 8);
+ memcpy(scsi3addr, entry->lunid, 8);
if (h->raid_offload_debug > 0)
dev_info(&h->pdev->dev,
- "%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
+ "%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%8phN\n",
__func__, find,
- ((struct ReportExtendedLUNdata *)
- physicals)->LUN[i][20],
- scsi3addr[0], scsi3addr[1], scsi3addr[2],
- scsi3addr[3], scsi3addr[4], scsi3addr[5],
- scsi3addr[6], scsi3addr[7]);
+ entry->ioaccel_handle, scsi3addr);
break; /* found it */
}
@@ -2973,7 +2967,8 @@ u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,
return RAID_CTLR_LUNID;
if (i < logicals_start)
- return &physdev_list->LUN[i - (raid_ctlr_position == 0)][0];
+ return &physdev_list->LUN[i -
+ (raid_ctlr_position == 0)].lunid[0];
if (i < last_device)
return &logdev_list->LUN[i - nphysicals -
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 104b67b..649b463 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -238,11 +238,21 @@ struct ReportLUNdata {
u8 LUN[HPSA_MAX_LUN][8];
};
+struct ext_report_lun_entry {
+ u8 lunid[8];
+ u8 wwid[8];
+ u8 device_type;
+ u8 device_flags;
+ u8 lun_count; /* multi-lun device, how many luns */
+ u8 redundant_paths;
+ u32 ioaccel_handle; /* ioaccel1 only uses lower 16 bits */
+};
+
struct ReportExtendedLUNdata {
u8 LUNListLength[4];
u8 extended_response_flag;
u8 reserved[3];
- u8 LUN[HPSA_MAX_LUN][24];
+ struct ext_report_lun_entry LUN[HPSA_MAX_LUN];
};
struct SenseSubsystem_info {
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 15/24] hpsa: kill annoying messages about SSD Smart Path retries
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (13 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 14/24] hpsa: define extended_report_lun_entry data structure Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 16/24] hpsa: fix event filtering to prevent excessive rescans with old firmware Stephen M. Cameron
` (8 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
There's nothing the user can or should do about these messages,
the commands are retried down the normal RAID path, and the
messages just flood the logs and sap performance.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
---
drivers/scsi/hpsa.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 96436bb..8359884 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1653,16 +1653,6 @@ static void process_ioaccel2_completion(struct ctlr_info *h,
if (is_logical_dev_addr_mode(dev->scsi3addr) &&
c2->error_data.serv_response ==
IOACCEL2_SERV_RESPONSE_FAILURE) {
- if (c2->error_data.status ==
- IOACCEL2_STATUS_SR_IOACCEL_DISABLED)
- dev_warn(&h->pdev->dev,
- "%s: Path is unavailable, retrying on standard path.\n",
- "HP SSD Smart Path");
- else
- dev_warn(&h->pdev->dev,
- "%s: Error 0x%02x, retrying on standard path.\n",
- "HP SSD Smart Path", c2->error_data.status);
-
dev->offload_enabled = 0;
h->drv_req_rescan = 1; /* schedule controller for a rescan */
cmd->result = DID_SOFT_ERROR << 16;
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 16/24] hpsa: fix event filtering to prevent excessive rescans with old firmware
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (14 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 15/24] hpsa: kill annoying messages about SSD Smart Path retries Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 17/24] hpsa: remove bad unlikely annotation from device list updating code Stephen M. Cameron
` (7 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
CTLR_STATE_CHANGE_EVENT and CTLR_STATE_CHANGE_EVENT_REDUNDANT_CNTRL
do not require rescans to be initiated. Current firmware filters out
these events already, but some out of date firmware doesn't, so the
driver needs to filter them out too. Without this change and with out
of date firmware you may see the driver spending a lot of time
scanning devices unnecessarily on some Smart Arrays.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Justin Lindley <justin.lindley@hp.com>
---
drivers/scsi/hpsa.h | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 1855469..18f5093 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -228,11 +228,9 @@ struct ctlr_info {
#define CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE (1 << 31)
#define RESCAN_REQUIRED_EVENT_BITS \
- (CTLR_STATE_CHANGE_EVENT | \
- CTLR_ENCLOSURE_HOT_PLUG_EVENT | \
+ (CTLR_ENCLOSURE_HOT_PLUG_EVENT | \
CTLR_STATE_CHANGE_EVENT_PHYSICAL_DRV | \
CTLR_STATE_CHANGE_EVENT_LOGICAL_DRV | \
- CTLR_STATE_CHANGE_EVENT_REDUNDANT_CNTRL | \
CTLR_STATE_CHANGE_EVENT_AIO_ENABLED_DISABLED | \
CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE)
spinlock_t offline_device_lock;
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 17/24] hpsa: remove bad unlikely annotation from device list updating code
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (15 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 16/24] hpsa: fix event filtering to prevent excessive rescans with old firmware Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 18/24] hpsa: report check condition even if no sense data present for ioaccel2 mode Stephen M. Cameron
` (6 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Justin Lindley <justin.lindley@hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
---
drivers/scsi/hpsa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 8359884..9d4a0bd 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3060,7 +3060,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
ndev_allocated++;
}
- if (unlikely(is_scsi_rev_5(h)))
+ if (is_scsi_rev_5(h))
raid_ctlr_position = 0;
else
raid_ctlr_position = nphysicals + nlogicals;
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 18/24] hpsa: report check condition even if no sense data present for ioaccel2 mode
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (16 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 17/24] hpsa: remove bad unlikely annotation from device list updating code Stephen M. Cameron
@ 2014-05-29 15:53 ` Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 19/24] hpsa: fix memory leak in hpsa_hba_mode_enabled Stephen M. Cameron
` (5 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:53 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
It shouldn't happen that we get a check condition with no sense data, but if it
does, we shouldn't just drop the check condition on the floor.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Justin Lindley <justin.lindley@hp.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
---
drivers/scsi/hpsa.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9d4a0bd..3446b8d 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1556,9 +1556,13 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
dev_warn(&h->pdev->dev,
"%s: task complete with check condition.\n",
"HP SSD Smart Path");
+ cmd->result |= SAM_STAT_CHECK_CONDITION;
if (c2->error_data.data_present !=
- IOACCEL2_SENSE_DATA_PRESENT)
+ IOACCEL2_SENSE_DATA_PRESENT) {
+ memset(cmd->sense_buffer, 0,
+ SCSI_SENSE_BUFFERSIZE);
break;
+ }
/* copy the sense data */
data_len = c2->error_data.sense_data_len;
if (data_len > SCSI_SENSE_BUFFERSIZE)
@@ -1568,7 +1572,6 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
sizeof(c2->error_data.sense_data_buff);
memcpy(cmd->sense_buffer,
c2->error_data.sense_data_buff, data_len);
- cmd->result |= SAM_STAT_CHECK_CONDITION;
retry = 1;
break;
case IOACCEL2_STATUS_SR_TASK_COMP_BUSY:
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 19/24] hpsa: fix memory leak in hpsa_hba_mode_enabled
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (17 preceding siblings ...)
2014-05-29 15:53 ` [PATCH 2 18/24] hpsa: report check condition even if no sense data present for ioaccel2 mode Stephen M. Cameron
@ 2014-05-29 15:54 ` Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 20/24] hpsa: do not ignore failure of sense controller parameters command Stephen M. Cameron
` (4 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:54 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Joe Handzik <joseph.t.handzik@hp.com>
And while we're at it fix a magic number
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
drivers/scsi/hpsa.c | 7 ++++++-
drivers/scsi/hpsa.h | 1 +
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3446b8d..e2f85e7 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2973,6 +2973,7 @@ u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,
static int hpsa_hba_mode_enabled(struct ctlr_info *h)
{
int rc;
+ int hba_mode_enabled;
struct bmic_controller_parameters *ctlr_params;
ctlr_params = kzalloc(sizeof(struct bmic_controller_parameters),
GFP_KERNEL);
@@ -2985,7 +2986,11 @@ static int hpsa_hba_mode_enabled(struct ctlr_info *h)
kfree(ctlr_params);
return 0;
}
- return ctlr_params->nvram_flags & (1 << 3) ? 1 : 0;
+
+ hba_mode_enabled =
+ ((ctlr_params->nvram_flags & HBA_MODE_ENABLED_FLAG) != 0);
+ kfree(ctlr_params);
+ return hba_mode_enabled;
}
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 18f5093..24472ce 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -91,6 +91,7 @@ struct bmic_controller_parameters {
u8 automatic_drive_slamming;
u8 reserved1;
u8 nvram_flags;
+#define HBA_MODE_ENABLED_FLAG (1 << 3)
u8 cache_nvram_flags;
u8 drive_config_flags;
u16 reserved2;
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 20/24] hpsa: do not ignore failure of sense controller parameters command
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (18 preceding siblings ...)
2014-05-29 15:54 ` [PATCH 2 19/24] hpsa: fix memory leak in hpsa_hba_mode_enabled Stephen M. Cameron
@ 2014-05-29 15:54 ` Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 21/24] hpsa: remove messages about volume status VPD inquiry page not supported Stephen M. Cameron
` (3 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:54 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
drivers/scsi/hpsa.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index e2f85e7..b4b745b 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2979,12 +2979,12 @@ static int hpsa_hba_mode_enabled(struct ctlr_info *h)
GFP_KERNEL);
if (!ctlr_params)
- return 0;
+ return -ENOMEM;
rc = hpsa_bmic_ctrl_mode_sense(h, RAID_CTLR_LUNID, 0, ctlr_params,
sizeof(struct bmic_controller_parameters));
- if (rc != 0) {
+ if (rc) {
kfree(ctlr_params);
- return 0;
+ return rc;
}
hba_mode_enabled =
@@ -3031,6 +3031,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
memset(lunzerobits, 0, sizeof(lunzerobits));
rescan_hba_mode = hpsa_hba_mode_enabled(h);
+ if (rescan_hba_mode < 0)
+ goto out;
if (!h->hba_mode_enabled && rescan_hba_mode)
dev_warn(&h->pdev->dev, "HBA mode enabled\n");
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 21/24] hpsa: remove messages about volume status VPD inquiry page not supported
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (19 preceding siblings ...)
2014-05-29 15:54 ` [PATCH 2 20/24] hpsa: do not ignore failure of sense controller parameters command Stephen M. Cameron
@ 2014-05-29 15:54 ` Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 22/24] hpsa: fix bad comparison of signed with unsigned in hpsa_update_scsi_devices Stephen M. Cameron
` (2 subsequent siblings)
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:54 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
They are annoying and do not help anyone.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Justin Lindley <justin.lindley@hp.com>
Reviewed-by: Mike Miller <michael.miller@hp.com>
---
drivers/scsi/hpsa.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index b4b745b..654e341 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2516,27 +2516,21 @@ static int hpsa_get_volume_status(struct ctlr_info *h,
return HPSA_VPD_LV_STATUS_UNSUPPORTED;
/* Does controller have VPD for logical volume status? */
- if (!hpsa_vpd_page_supported(h, scsi3addr, HPSA_VPD_LV_STATUS)) {
- dev_warn(&h->pdev->dev, "Logical volume status VPD page is unsupported.\n");
+ if (!hpsa_vpd_page_supported(h, scsi3addr, HPSA_VPD_LV_STATUS))
goto exit_failed;
- }
/* Get the size of the VPD return buffer */
rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | HPSA_VPD_LV_STATUS,
buf, HPSA_VPD_HEADER_SZ);
- if (rc != 0) {
- dev_warn(&h->pdev->dev, "Logical volume status VPD inquiry failed.\n");
+ if (rc != 0)
goto exit_failed;
- }
size = buf[3];
/* Now get the whole VPD buffer */
rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | HPSA_VPD_LV_STATUS,
buf, size + HPSA_VPD_HEADER_SZ);
- if (rc != 0) {
- dev_warn(&h->pdev->dev, "Logical volume status VPD inquiry failed.\n");
+ if (rc != 0)
goto exit_failed;
- }
status = buf[4]; /* status byte */
kfree(buf);
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 22/24] hpsa: fix bad comparison of signed with unsigned in hpsa_update_scsi_devices
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (20 preceding siblings ...)
2014-05-29 15:54 ` [PATCH 2 21/24] hpsa: remove messages about volume status VPD inquiry page not supported Stephen M. Cameron
@ 2014-05-29 15:54 ` Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 23/24] hpsa: return -ENOMEM not -1 on kzalloc failure in hpsa_get_device_id Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 24/24] hpsa: fix handling of hpsa_volume_offline return value Stephen M. Cameron
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:54 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Joe Handzik <joseph.t.handzik@hp.com>
rescan_hba_mode was defined as a u8 so could never be less than zero:
rescan_hba_mode = hpsa_hba_mode_enabled(h);
if (rescan_hba_mode < 0)
goto out;
Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/scsi/hpsa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 654e341..c5b24e6 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3010,7 +3010,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 24;
int i, n_ext_target_devs, ndevs_to_allocate;
int raid_ctlr_position;
- u8 rescan_hba_mode;
+ int rescan_hba_mode;
DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);
currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_DEVICES, GFP_KERNEL);
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 23/24] hpsa: return -ENOMEM not -1 on kzalloc failure in hpsa_get_device_id
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (21 preceding siblings ...)
2014-05-29 15:54 ` [PATCH 2 22/24] hpsa: fix bad comparison of signed with unsigned in hpsa_update_scsi_devices Stephen M. Cameron
@ 2014-05-29 15:54 ` Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 24/24] hpsa: fix handling of hpsa_volume_offline return value Stephen M. Cameron
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:54 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Mike Miller <michael.miller@canonical.com>
---
drivers/scsi/hpsa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c5b24e6..af51e7d 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2430,7 +2430,7 @@ static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr,
buflen = 16;
buf = kzalloc(64, GFP_KERNEL);
if (!buf)
- return -1;
+ return -ENOMEM;
rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | 0x83, buf, 64);
if (rc == 0)
memcpy(device_id, &buf[8], buflen);
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 2 24/24] hpsa: fix handling of hpsa_volume_offline return value
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
` (22 preceding siblings ...)
2014-05-29 15:54 ` [PATCH 2 23/24] hpsa: return -ENOMEM not -1 on kzalloc failure in hpsa_get_device_id Stephen M. Cameron
@ 2014-05-29 15:54 ` Stephen M. Cameron
23 siblings, 0 replies; 28+ messages in thread
From: Stephen M. Cameron @ 2014-05-29 15:54 UTC (permalink / raw)
To: james.bottomley
Cc: webb.scales, martin.petersen, linux-scsi, justin.lindley,
stephenmcameron, joseph.t.handzik, thenzl, michael.miller,
scott.teel, hch, dan.carpenter
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Make return value an int instead of an unsigned char so that
we do not lose negative error return values.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/scsi/hpsa.c | 12 ++++++++----
drivers/scsi/hpsa_cmd.h | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index af51e7d..31184b3 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2543,11 +2543,11 @@ exit_failed:
/* Determine offline status of a volume.
* Return either:
* 0 (not offline)
- * -1 (offline for unknown reasons)
+ * 0xff (offline for unknown reasons)
* # (integer code indicating one of several NOT READY states
* describing why a volume is to be kept offline)
*/
-static unsigned char hpsa_volume_offline(struct ctlr_info *h,
+static int hpsa_volume_offline(struct ctlr_info *h,
unsigned char scsi3addr[])
{
struct CommandList *c;
@@ -2646,11 +2646,15 @@ static int hpsa_update_device_info(struct ctlr_info *h,
if (this_device->devtype == TYPE_DISK &&
is_logical_dev_addr_mode(scsi3addr)) {
+ int volume_offline;
+
hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
hpsa_get_ioaccel_status(h, scsi3addr, this_device);
- this_device->volume_offline =
- hpsa_volume_offline(h, scsi3addr);
+ volume_offline = hpsa_volume_offline(h, scsi3addr);
+ if (volume_offline < 0 || volume_offline > 0xff)
+ volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED;
+ this_device->volume_offline = volume_offline & 0xff;
} else {
this_device->raid_level = RAID_UNKNOWN;
this_device->offload_config = 0;
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 649b463..b5125dc 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -151,7 +151,7 @@
#define HPSA_VPD_HEADER_SZ 4
/* Logical volume states */
-#define HPSA_VPD_LV_STATUS_UNSUPPORTED -1
+#define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff
#define HPSA_LV_OK 0x0
#define HPSA_LV_UNDERGOING_ERASE 0x0F
#define HPSA_LV_UNDERGOING_RPI 0x12
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently.
2014-05-29 15:53 ` [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently Stephen M. Cameron
@ 2014-06-02 9:27 ` Christoph Hellwig
2014-06-02 14:52 ` scameron
0 siblings, 1 reply; 28+ messages in thread
From: Christoph Hellwig @ 2014-06-02 9:27 UTC (permalink / raw)
To: Stephen M. Cameron
Cc: james.bottomley, webb.scales, martin.petersen, linux-scsi,
justin.lindley, stephenmcameron, joseph.t.handzik, thenzl,
michael.miller, scott.teel, hch, dan.carpenter, linux-pci
On Thu, May 29, 2014 at 10:53:02AM -0500, Stephen M. Cameron wrote:
> From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
>
> No sense having 8 or 16 reply queues if you only have 4 cpus,
> and likewise no sense limiting to 8 reply queues if you have
> many more cpus.
I've applied this as it looks good as-is, but shouldn't we also
cap the number of MSI-X vectors in common code so that we avoid
adding this as boilerplate code to lots of drivers?
>
> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> Reviewed-by: Mike Miller <michael.miller@canonical.com>
> Reviewed-by: Scott Teel <scott.teel@hp.com>
> ---
> drivers/scsi/hpsa.c | 2 ++
> drivers/scsi/hpsa_cmd.h | 2 +-
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index b1ecfd8..b903e86 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -6157,6 +6157,8 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
> if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
> dev_info(&h->pdev->dev, "MSIX\n");
> h->msix_vector = MAX_REPLY_QUEUES;
> + if (h->msix_vector > num_online_cpus())
> + h->msix_vector = num_online_cpus();
> err = pci_enable_msix(h->pdev, hpsa_msix_entries,
> h->msix_vector);
> if (err > 0) {
> diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
> index db89245..104b67b 100644
> --- a/drivers/scsi/hpsa_cmd.h
> +++ b/drivers/scsi/hpsa_cmd.h
> @@ -615,7 +615,7 @@ struct TransTable_struct {
> u32 RepQCount;
> u32 RepQCtrAddrLow32;
> u32 RepQCtrAddrHigh32;
> -#define MAX_REPLY_QUEUES 8
> +#define MAX_REPLY_QUEUES 64
> struct vals32 RepQAddr[MAX_REPLY_QUEUES];
> };
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently.
2014-06-02 9:27 ` Christoph Hellwig
@ 2014-06-02 14:52 ` scameron
2014-06-02 15:00 ` scameron
0 siblings, 1 reply; 28+ messages in thread
From: scameron @ 2014-06-02 14:52 UTC (permalink / raw)
To: Christoph Hellwig
Cc: james.bottomley, webb.scales, martin.petersen, linux-scsi,
justin.lindley, stephenmcameron, joseph.t.handzik, thenzl,
michael.miller, scott.teel, hch, dan.carpenter, linux-pci,
scameron
On Mon, Jun 02, 2014 at 02:27:51AM -0700, Christoph Hellwig wrote:
> On Thu, May 29, 2014 at 10:53:02AM -0500, Stephen M. Cameron wrote:
> > From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> >
> > No sense having 8 or 16 reply queues if you only have 4 cpus,
> > and likewise no sense limiting to 8 reply queues if you have
> > many more cpus.
>
> I've applied this as it looks good as-is, but shouldn't we also
> cap the number of MSI-X vectors in common code so that we avoid
> adding this as boilerplate code to lots of drivers?
Maybe so. Thinking about CPU hotplug, is num_online_cpus()
the right cap? Maybe num_possible_cpus() is better in case
additional cpus coming online are anticipated?
-- steve
>
> >
> > Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> > Reviewed-by: Mike Miller <michael.miller@canonical.com>
> > Reviewed-by: Scott Teel <scott.teel@hp.com>
> > ---
> > drivers/scsi/hpsa.c | 2 ++
> > drivers/scsi/hpsa_cmd.h | 2 +-
> > 2 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > index b1ecfd8..b903e86 100644
> > --- a/drivers/scsi/hpsa.c
> > +++ b/drivers/scsi/hpsa.c
> > @@ -6157,6 +6157,8 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
> > if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
> > dev_info(&h->pdev->dev, "MSIX\n");
> > h->msix_vector = MAX_REPLY_QUEUES;
> > + if (h->msix_vector > num_online_cpus())
> > + h->msix_vector = num_online_cpus();
> > err = pci_enable_msix(h->pdev, hpsa_msix_entries,
> > h->msix_vector);
> > if (err > 0) {
> > diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
> > index db89245..104b67b 100644
> > --- a/drivers/scsi/hpsa_cmd.h
> > +++ b/drivers/scsi/hpsa_cmd.h
> > @@ -615,7 +615,7 @@ struct TransTable_struct {
> > u32 RepQCount;
> > u32 RepQCtrAddrLow32;
> > u32 RepQCtrAddrHigh32;
> > -#define MAX_REPLY_QUEUES 8
> > +#define MAX_REPLY_QUEUES 64
> > struct vals32 RepQAddr[MAX_REPLY_QUEUES];
> > };
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> ---end quoted text---
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently.
2014-06-02 14:52 ` scameron
@ 2014-06-02 15:00 ` scameron
0 siblings, 0 replies; 28+ messages in thread
From: scameron @ 2014-06-02 15:00 UTC (permalink / raw)
To: Christoph Hellwig
Cc: james.bottomley, webb.scales, martin.petersen, linux-scsi,
justin.lindley, stephenmcameron, joseph.t.handzik, thenzl,
michael.miller, scott.teel, hch, dan.carpenter, linux-pci,
scameron
On Mon, Jun 02, 2014 at 09:52:06AM -0500, scameron@beardog.cce.hp.com wrote:
> On Mon, Jun 02, 2014 at 02:27:51AM -0700, Christoph Hellwig wrote:
> > On Thu, May 29, 2014 at 10:53:02AM -0500, Stephen M. Cameron wrote:
> > > From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> > >
> > > No sense having 8 or 16 reply queues if you only have 4 cpus,
> > > and likewise no sense limiting to 8 reply queues if you have
> > > many more cpus.
> >
> > I've applied this as it looks good as-is, but shouldn't we also
> > cap the number of MSI-X vectors in common code so that we avoid
> > adding this as boilerplate code to lots of drivers?
>
> Maybe so. Thinking about CPU hotplug, is num_online_cpus()
> the right cap? Maybe num_possible_cpus() is better in case
> additional cpus coming online are anticipated?
On second thought, might there be PCI devices which have multiple
MSIX vectors to signal different things? I know for smart array
the idea has occasionally been floated to have an additional vector
to signal something to the host that is not a command completion,
although we never implemented such a thing. Had we done so,
we would then need num_online_cpus() + 1 vectors.
So maybe it's not a good idea to put such a limit in the generic
pci code in case some device works in such a way.
-- steve
>
> >
> > >
> > > Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> > > Reviewed-by: Mike Miller <michael.miller@canonical.com>
> > > Reviewed-by: Scott Teel <scott.teel@hp.com>
> > > ---
> > > drivers/scsi/hpsa.c | 2 ++
> > > drivers/scsi/hpsa_cmd.h | 2 +-
> > > 2 files changed, 3 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > > index b1ecfd8..b903e86 100644
> > > --- a/drivers/scsi/hpsa.c
> > > +++ b/drivers/scsi/hpsa.c
> > > @@ -6157,6 +6157,8 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
> > > if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
> > > dev_info(&h->pdev->dev, "MSIX\n");
> > > h->msix_vector = MAX_REPLY_QUEUES;
> > > + if (h->msix_vector > num_online_cpus())
> > > + h->msix_vector = num_online_cpus();
> > > err = pci_enable_msix(h->pdev, hpsa_msix_entries,
> > > h->msix_vector);
> > > if (err > 0) {
> > > diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
> > > index db89245..104b67b 100644
> > > --- a/drivers/scsi/hpsa_cmd.h
> > > +++ b/drivers/scsi/hpsa_cmd.h
> > > @@ -615,7 +615,7 @@ struct TransTable_struct {
> > > u32 RepQCount;
> > > u32 RepQCtrAddrLow32;
> > > u32 RepQCtrAddrHigh32;
> > > -#define MAX_REPLY_QUEUES 8
> > > +#define MAX_REPLY_QUEUES 64
> > > struct vals32 RepQAddr[MAX_REPLY_QUEUES];
> > > };
> > >
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > ---end quoted text---
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2014-06-02 15:00 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-29 15:52 [PATCH 2 00/24] Resend of May 2014 patches for hpsa driver Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 01/24] hpsa: add new Smart Array PCI IDs (May 2014) Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 02/24] hpsa: fix missing check of kzalloc return value Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 03/24] hpsa: remove unused fields from struct ctlr_info Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 04/24] hpsa: allow passthru ioctls to work with bidirectional commands Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 05/24] hpsa: change doorbell reset delay to ten seconds Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 06/24] hpsa: use gcc aligned attribute instead of manually padding structs Stephen M. Cameron
2014-05-29 15:52 ` [PATCH 2 07/24] hpsa: remove dev_dbg() calls from hot paths Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 08/24] hpsa: choose number of reply queues more intelligently Stephen M. Cameron
2014-06-02 9:27 ` Christoph Hellwig
2014-06-02 14:52 ` scameron
2014-06-02 15:00 ` scameron
2014-05-29 15:53 ` [PATCH 2 09/24] hpsa: allocate reply queues individually Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 10/24] hpsa: set irq affinity hints to route MSI-X vectors across CPUs Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 11/24] hpsa: use per-cpu variable for lockup_detected Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 12/24] hpsa: avoid unnecessary readl on every command submission Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 13/24] hpsa: Rearrange start_io to avoid one unlock/lock sequence in main io path Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 14/24] hpsa: define extended_report_lun_entry data structure Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 15/24] hpsa: kill annoying messages about SSD Smart Path retries Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 16/24] hpsa: fix event filtering to prevent excessive rescans with old firmware Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 17/24] hpsa: remove bad unlikely annotation from device list updating code Stephen M. Cameron
2014-05-29 15:53 ` [PATCH 2 18/24] hpsa: report check condition even if no sense data present for ioaccel2 mode Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 19/24] hpsa: fix memory leak in hpsa_hba_mode_enabled Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 20/24] hpsa: do not ignore failure of sense controller parameters command Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 21/24] hpsa: remove messages about volume status VPD inquiry page not supported Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 22/24] hpsa: fix bad comparison of signed with unsigned in hpsa_update_scsi_devices Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 23/24] hpsa: return -ENOMEM not -1 on kzalloc failure in hpsa_get_device_id Stephen M. Cameron
2014-05-29 15:54 ` [PATCH 2 24/24] hpsa: fix handling of hpsa_volume_offline return value Stephen M. Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).