* [PATCH 1/9] qla4xxx: Perform context resets in case of context failures.
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 2/9] qla4xxx: Fix CPU lockups when ql4xdontresethba set vikas.chaudhary
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti, Shyam Sunder
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
For 4032, context reset was the same as chip reset, and any firmware
issue was recovered by performing a chip reset.
For 82xx, the iSCSI firmware runs along with FCoE and the NIC
firmware contexts, and an error encountered doesnot essentially mean
that a chip reset is necessary.
Perform Chip resets only in the following cases:
1. Mailbox system error.
2. Mailbox command timeout.
3. fw_heartbeat_counter counter stops incrementing.
For all other cases, only perform a context reset.
1. Command Completion with an invalid srb.
2. Other mailbox failures.
JIRA Key: UPSISCSI-47
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Shyam Sunder <shyam.sunder@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_isr.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 827e930..9582886 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -123,13 +123,13 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
srb = qla4xxx_del_from_active_array(ha, le32_to_cpu(sts_entry->handle));
if (!srb) {
- DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Status Entry invalid "
- "handle 0x%x, sp=%p. This cmd may have already "
- "been completed.\n", ha->host_no, __func__,
- le32_to_cpu(sts_entry->handle), srb));
- ql4_printk(KERN_WARNING, ha, "%s invalid status entry:"
- " handle=0x%0x\n", __func__, sts_entry->handle);
- set_bit(DPC_RESET_HA, &ha->dpc_flags);
+ ql4_printk(KERN_WARNING, ha, "%s invalid status entry: "
+ "handle=0x%0x, srb=%p\n", __func__,
+ sts_entry->handle, srb);
+ if (is_qla8022(ha))
+ set_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags);
+ else
+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
return;
}
@@ -563,7 +563,11 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
case MBOX_ASTS_DHCP_LEASE_EXPIRED:
DEBUG2(printk("scsi%ld: AEN %04x, ERROR Status, "
"Reset HA\n", ha->host_no, mbox_status));
- set_bit(DPC_RESET_HA, &ha->dpc_flags);
+ if (is_qla8022(ha))
+ set_bit(DPC_RESET_HA_FW_CONTEXT,
+ &ha->dpc_flags);
+ else
+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
break;
case MBOX_ASTS_LINK_UP:
@@ -617,9 +621,13 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
(mbox_sts[2] == ACB_STATE_ACQUIRING)))
set_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags);
else if ((mbox_sts[3] == ACB_STATE_ACQUIRING) &&
- (mbox_sts[2] == ACB_STATE_VALID))
- set_bit(DPC_RESET_HA, &ha->dpc_flags);
- else if ((mbox_sts[3] == ACB_STATE_UNCONFIGURED))
+ (mbox_sts[2] == ACB_STATE_VALID)) {
+ if (is_qla8022(ha))
+ set_bit(DPC_RESET_HA_FW_CONTEXT,
+ &ha->dpc_flags);
+ else
+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
+ } else if ((mbox_sts[3] == ACB_STATE_UNCONFIGURED))
complete(&ha->disable_acb_comp);
break;
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 2/9] qla4xxx: Fix CPU lockups when ql4xdontresethba set
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
2011-12-02 6:42 ` [PATCH 1/9] qla4xxx: Perform context resets in case of context failures vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 3/9] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1 vikas.chaudhary
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti, Mike Hernandez
From: Mike Hernandez <michael.hernandez@qlogic.com>
Fix issue where CPU lockup is seen when ql4xdontresethba is set and
driver is "stuck" in NEED_RESET state handler.
JIRA Key: UPSISCSI-120
Signed-off-by: Mike Hernandez <michael.hernandez@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_nx.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index f484ff4..7fc29c6 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -1836,6 +1836,10 @@ int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha)
* reset handler */
dev_init_timeout = jiffies +
(ha->nx_dev_init_timeout * HZ);
+ } else {
+ qla4_8xxx_idc_unlock(ha);
+ msleep(1000);
+ qla4_8xxx_idc_lock(ha);
}
qla4_8xxx_idc_unlock(ha);
break;
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 3/9] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
2011-12-02 6:42 ` [PATCH 1/9] qla4xxx: Perform context resets in case of context failures vikas.chaudhary
2011-12-02 6:42 ` [PATCH 2/9] qla4xxx: Fix CPU lockups when ql4xdontresethba set vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 21:56 ` Mike Christie
2011-12-02 6:42 ` [PATCH 4/9] qla4xxx: Don't recover adapter if device state is FAILED vikas.chaudhary
` (6 subsequent siblings)
9 siblings, 1 reply; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti, Sarang Radke
From: Sarang Radke <sarang.radke@qlogic.com>
abort all active commands from eh_host_reset in-case
of ql4xdontresethba=1
Fix following call trace:-
Nov 21 14:50:47 172.17.140.111 qla4xxx 0000:13:00.4: qla4_8xxx_disable_msix: qla4xxx (rsp_q)
Nov 21 14:50:47 172.17.140.111 qla4xxx 0000:13:00.4: PCI INT A disabled
Nov 21 14:50:47 172.17.140.111 slab error in kmem_cache_destroy(): cache `qla4xxx_srbs': Can't free all objects
Nov 21 14:50:47 172.17.140.111 Pid: 9154, comm: rmmod Tainted: G O 3.2.0-rc2+ #2
Nov 21 14:50:47 172.17.140.111 Call Trace:
Nov 21 14:50:47 172.17.140.111 [<c051231a>] ? kmem_cache_destroy+0x9a/0xb0
Nov 21 14:50:47 172.17.140.111 [<c0489c4a>] ? sys_delete_module+0x14a/0x210
Nov 21 14:50:47 172.17.140.111 [<c04fd552>] ? do_munmap+0x202/0x280
Nov 21 14:50:47 172.17.140.111 [<c04a6d4e>] ? audit_syscall_entry+0x1ae/0x1d0
Nov 21 14:50:47 172.17.140.111 [<c083019f>] ? sysenter_do_call+0x12/0x28
Nov 21 14:51:50 172.17.140.111 SLAB: cache with size 64 has lost its name
Nov 21 14:51:50 172.17.140.111 iscsi: registered transport (qla4xxx)
Nov 21 14:51:50 172.17.140.111 qla4xxx 0000:13:00.4: PCI INT A -> GSI 28 (level, low) -> IRQ 28
JIRA Key: UPSISCSI-197
Signed-off-by: Sarang Radke <sarang.radke@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_os.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 4169c8b..d9a6aa5 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4816,6 +4816,20 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
}
/**
+ * qla4xxx_is_eh_active:
+ * @shost: Pointer to SCSI Host struct
+ *
+ * This routine finds that if reset host is called in EH
+ * scenario or from some application like sg_reset
+ **/
+static int qla4xxx_is_eh_active(struct Scsi_Host *shost)
+{
+ if (shost->shost_state == SHOST_RECOVERY)
+ return 1;
+ return 0;
+}
+
+/**
* qla4xxx_eh_host_reset - kernel callback
* @cmd: Pointer to Linux's SCSI command structure
*
@@ -4832,6 +4846,11 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
if (ql4xdontresethba) {
DEBUG2(printk("scsi%ld: %s: Don't Reset HBA\n",
ha->host_no, __func__));
+
+ /* Clear outstanding srb in queues */
+ if (qla4xxx_is_eh_active(cmd->device->host))
+ qla4xxx_abort_active_cmds(ha, DID_ABORT << 16);
+
return FAILED;
}
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 3/9] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1
2011-12-02 6:42 ` [PATCH 3/9] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1 vikas.chaudhary
@ 2011-12-02 21:56 ` Mike Christie
2011-12-06 10:46 ` Vikas Chaudhary
0 siblings, 1 reply; 13+ messages in thread
From: Mike Christie @ 2011-12-02 21:56 UTC (permalink / raw)
To: vikas.chaudhary
Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand,
poornima.vonti, Sarang Radke
On 12/02/2011 12:42 AM, vikas.chaudhary@qlogic.com wrote:
>
> /**
> + * qla4xxx_is_eh_active:
You need a description of the function above after the colon. And
actually qla4xxx is doing a dash in other places. So you should do:
/**
* qla4xxx_is_eh_active - check if eh is rinning
And just to make sure, if the host state is in SHOST_CANCEL_RECOVERY the
drivers shutdown code will have cleaned up the command right? It looks
like it, but I was not 100% sure.
> + * @shost: Pointer to SCSI Host struct
> + *
> + * This routine finds that if reset host is called in EH
> + * scenario or from some application like sg_reset
> + **/
> +static int qla4xxx_is_eh_active(struct Scsi_Host *shost)
> +{
> + if (shost->shost_state == SHOST_RECOVERY)
> + return 1;
> + return 0;
> +}
> +
> +/**
> * qla4xxx_eh_host_reset - kernel callback
> * @cmd: Pointer to Linux's SCSI command structure
> *
> @@ -4832,6 +4846,11 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
> if (ql4xdontresethba) {
> DEBUG2(printk("scsi%ld: %s: Don't Reset HBA\n",
> ha->host_no, __func__));
> +
> + /* Clear outstanding srb in queues */
> + if (qla4xxx_is_eh_active(cmd->device->host))
> + qla4xxx_abort_active_cmds(ha, DID_ABORT << 16);
> +
> return FAILED;
> }
>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 3/9] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1
2011-12-02 21:56 ` Mike Christie
@ 2011-12-06 10:46 ` Vikas Chaudhary
0 siblings, 0 replies; 13+ messages in thread
From: Vikas Chaudhary @ 2011-12-06 10:46 UTC (permalink / raw)
To: Mike Christie
Cc: jbottomley@parallels.com, scsi, Lalit Chandivade, Ravi Anand,
Poornima Vonti, Sarang Radke
On 03/12/11 3:26 AM, "Mike Christie" <michaelc@cs.wisc.edu> wrote:
>On 12/02/2011 12:42 AM, vikas.chaudhary@qlogic.com wrote:
>>
>> /**
>> + * qla4xxx_is_eh_active:
>
>You need a description of the function above after the colon. And
>actually qla4xxx is doing a dash in other places. So you should do:
>
>/**
> * qla4xxx_is_eh_active - check if eh is rinning
>
>And just to make sure, if the host state is in SHOST_CANCEL_RECOVERY the
>drivers shutdown code will have cleaned up the command right? It looks
>like it, but I was not 100% sure.
I updated patch to take care of command cleanup on driver shutdown.
I am sending updated patch in next email.
Thanks,
Vikas.
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/9] qla4xxx: Don't recover adapter if device state is FAILED
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (2 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 3/9] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1 vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 5/9] qla4xxx: Wait for disable_acb before doing set_acb vikas.chaudhary
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti, Sarang Radke
From: Sarang Radke <sarang.radke@qlogic.com>
Multiple reset request don't get handled correctly as
the driver tries to recover adapter which is in FAILED state.
JIRA Key: UPSISCSI-198
Signed-off-by: Sarang Radke <sarang.radke@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_os.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index d9a6aa5..c5ae676 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2414,6 +2414,7 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha)
{
int status = QLA_ERROR;
uint8_t reset_chip = 0;
+ uint32_t dev_state;
/* Stall incoming I/O until we are done */
scsi_block_requests(ha->host);
@@ -2501,6 +2502,25 @@ recover_ha_init_adapter:
* Since we don't want to block the DPC for too long
* with multiple resets in the same thread,
* utilize DPC to retry */
+ if (is_qla8022(ha)) {
+ qla4_8xxx_idc_lock(ha);
+ dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
+ qla4_8xxx_idc_unlock(ha);
+ if (dev_state == QLA82XX_DEV_FAILED) {
+ ql4_printk(KERN_INFO, ha, "%s: don't retry "
+ "recover adapter. H/W is in Failed "
+ "state\n", __func__);
+ qla4xxx_dead_adapter_cleanup(ha);
+ clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags);
+ clear_bit(DPC_RESET_HA, &ha->dpc_flags);
+ clear_bit(DPC_RESET_HA_FW_CONTEXT,
+ &ha->dpc_flags);
+ status = QLA_ERROR;
+
+ goto exit_recover;
+ }
+ }
+
if (!test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags)) {
ha->retry_reset_ha_cnt = MAX_RESET_HA_RETRIES;
DEBUG2(printk("scsi%ld: recover adapter - retrying "
@@ -2539,6 +2559,7 @@ recover_ha_init_adapter:
clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags);
}
+exit_recover:
ha->adapter_error_count++;
if (test_bit(AF_ONLINE, &ha->flags))
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 5/9] qla4xxx: Wait for disable_acb before doing set_acb
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (3 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 4/9] qla4xxx: Don't recover adapter if device state is FAILED vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 6/9] qla4xxx: Fix the IDC locking mechanism vikas.chaudhary
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
In function qla4xxx_iface_set_param wait for disable_acb to
complete so that set_acb will not fail.
JIRA Key: UPSISCSI-121
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_os.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index c5ae676..c6f9e7b 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -935,7 +935,16 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t len)
goto exit_init_fw_cb;
}
- qla4xxx_disable_acb(ha);
+ rval = qla4xxx_disable_acb(ha);
+ if (rval != QLA_SUCCESS) {
+ ql4_printk(KERN_ERR, ha, "%s: disable acb mbx failed\n",
+ __func__);
+ rval = -EIO;
+ goto exit_init_fw_cb;
+ }
+
+ wait_for_completion_timeout(&ha->disable_acb_comp,
+ DISABLE_ACB_TOV * HZ);
qla4xxx_initcb_to_acb(init_fw_cb);
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 6/9] qla4xxx: Fix the IDC locking mechanism
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (4 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 5/9] qla4xxx: Wait for disable_acb before doing set_acb vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 7/9] qla4xxx: Fix qla4xxx_dump_buffer to dump buffer correctly vikas.chaudhary
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti, Nilesh Javali
From: Nilesh Javali <nilesh.javali@qlogic.com>
This ensures the transition of dev_state from COLD to
INITIALIZING is within lock and atomic.
JIRA Key: UPSISCSI-158
Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_nx.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 7fc29c6..8d6bc1b 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -1792,8 +1792,11 @@ int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha)
int rval = QLA_SUCCESS;
unsigned long dev_init_timeout;
- if (!test_bit(AF_INIT_DONE, &ha->flags))
+ if (!test_bit(AF_INIT_DONE, &ha->flags)) {
+ qla4_8xxx_idc_lock(ha);
qla4_8xxx_set_drv_active(ha);
+ qla4_8xxx_idc_unlock(ha);
+ }
dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
ql4_printk(KERN_INFO, ha, "1:Device state is 0x%x = %s\n", dev_state,
@@ -1802,8 +1805,8 @@ int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha)
/* wait for 30 seconds for device to go ready */
dev_init_timeout = jiffies + (ha->nx_dev_init_timeout * HZ);
+ qla4_8xxx_idc_lock(ha);
while (1) {
- qla4_8xxx_idc_lock(ha);
if (time_after_eq(jiffies, dev_init_timeout)) {
ql4_printk(KERN_WARNING, ha, "Device init failed!\n");
@@ -1819,15 +1822,14 @@ int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha)
/* NOTE: Make sure idc unlocked upon exit of switch statement */
switch (dev_state) {
case QLA82XX_DEV_READY:
- qla4_8xxx_idc_unlock(ha);
goto exit;
case QLA82XX_DEV_COLD:
rval = qla4_8xxx_device_bootstrap(ha);
- qla4_8xxx_idc_unlock(ha);
goto exit;
case QLA82XX_DEV_INITIALIZING:
qla4_8xxx_idc_unlock(ha);
msleep(1000);
+ qla4_8xxx_idc_lock(ha);
break;
case QLA82XX_DEV_NEED_RESET:
if (!ql4xdontresethba) {
@@ -1841,31 +1843,32 @@ int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha)
msleep(1000);
qla4_8xxx_idc_lock(ha);
}
- qla4_8xxx_idc_unlock(ha);
break;
case QLA82XX_DEV_NEED_QUIESCENT:
- qla4_8xxx_idc_unlock(ha);
/* idc locked/unlocked in handler */
qla4_8xxx_need_qsnt_handler(ha);
- qla4_8xxx_idc_lock(ha);
- /* fall thru needs idc_locked */
+ break;
case QLA82XX_DEV_QUIESCENT:
qla4_8xxx_idc_unlock(ha);
msleep(1000);
+ qla4_8xxx_idc_lock(ha);
break;
case QLA82XX_DEV_FAILED:
qla4_8xxx_idc_unlock(ha);
qla4xxx_dead_adapter_cleanup(ha);
rval = QLA_ERROR;
+ qla4_8xxx_idc_lock(ha);
goto exit;
default:
qla4_8xxx_idc_unlock(ha);
qla4xxx_dead_adapter_cleanup(ha);
rval = QLA_ERROR;
+ qla4_8xxx_idc_lock(ha);
goto exit;
}
}
exit:
+ qla4_8xxx_idc_unlock(ha);
return rval;
}
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 7/9] qla4xxx: Fix qla4xxx_dump_buffer to dump buffer correctly
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (5 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 6/9] qla4xxx: Fix the IDC locking mechanism vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 8/9] qla4xxx: check for FW alive before calling chip_reset vikas.chaudhary
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
KERN_INFO in printk adding new line character that mess-up
dump print format. Remove KERN_INFO to fix dump format.
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_dbg.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.c b/drivers/scsi/qla4xxx/ql4_dbg.c
index af62c3c..8d58ae2 100644
--- a/drivers/scsi/qla4xxx/ql4_dbg.c
+++ b/drivers/scsi/qla4xxx/ql4_dbg.c
@@ -20,12 +20,12 @@ void qla4xxx_dump_buffer(void *b, uint32_t size)
printk("------------------------------------------------------------"
"--\n");
for (cnt = 0; cnt < size; c++) {
- printk(KERN_INFO "%02x", *c);
+ printk("%02x", *c);
if (!(++cnt % 16))
- printk(KERN_INFO "\n");
+ printk("\n");
else
- printk(KERN_INFO " ");
+ printk(" ");
}
printk(KERN_INFO "\n");
}
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 8/9] qla4xxx: check for FW alive before calling chip_reset
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (6 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 7/9] qla4xxx: Fix qla4xxx_dump_buffer to dump buffer correctly vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-02 6:42 ` [PATCH 9/9] qla4xxx: Update driver version to 5.02.00-k10 vikas.chaudhary
2011-12-06 20:15 ` [PATCH 0/9] qla4xxx: Patches for scsi-misc Mike Christie
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti, Shyam Sunder, Nilesh Javali
From: Shyam Sunder <shyam.sunder@qlogic.com>
Check for firmware alive and do premature completion of
mbox commands in case of FW hung before doing chip_reset
JIRA Key: UPSISCSI-47
Signed-off-by: Shyam Sunder <shyam.sunder@qlogic.com>
Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_def.h | 1 +
drivers/scsi/qla4xxx/ql4_os.c | 75 +++++++++++++++++++++++++++-------------
2 files changed, 52 insertions(+), 24 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index fd5edc6..22a3ff0 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -177,6 +177,7 @@
#define LOGIN_TOV 12
#define MAX_RESET_HA_RETRIES 2
+#define FW_ALIVE_WAIT_TOV 3
#define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index c6f9e7b..89ba7cd 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1975,9 +1975,10 @@ mem_alloc_error_exit:
*
* Context: Interrupt
**/
-static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
+static int qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
{
- uint32_t fw_heartbeat_counter, halt_status;
+ uint32_t fw_heartbeat_counter;
+ int status = QLA_SUCCESS;
fw_heartbeat_counter = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
/* If PEG_ALIVE_COUNTER is 0xffffffff, AER/EEH is in progress, ignore */
@@ -1985,7 +1986,7 @@ static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Device in frozen "
"state, QLA82XX_PEG_ALIVE_COUNTER is 0xffffffff\n",
ha->host_no, __func__));
- return;
+ return status;
}
if (ha->fw_heartbeat_counter == fw_heartbeat_counter) {
@@ -1993,8 +1994,6 @@ static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
/* FW not alive after 2 seconds */
if (ha->seconds_since_last_heartbeat == 2) {
ha->seconds_since_last_heartbeat = 0;
- halt_status = qla4_8xxx_rd_32(ha,
- QLA82XX_PEG_HALT_STATUS1);
ql4_printk(KERN_INFO, ha,
"scsi(%ld): %s, Dumping hw/fw registers:\n "
@@ -2002,7 +2001,9 @@ static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
" 0x%x,\n PEG_NET_0_PC: 0x%x, PEG_NET_1_PC:"
" 0x%x,\n PEG_NET_2_PC: 0x%x, PEG_NET_3_PC:"
" 0x%x,\n PEG_NET_4_PC: 0x%x\n",
- ha->host_no, __func__, halt_status,
+ ha->host_no, __func__,
+ qla4_8xxx_rd_32(ha,
+ QLA82XX_PEG_HALT_STATUS1),
qla4_8xxx_rd_32(ha,
QLA82XX_PEG_HALT_STATUS2),
qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_0 +
@@ -2015,24 +2016,13 @@ static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
0x3c),
qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_4 +
0x3c));
-
- /* Since we cannot change dev_state in interrupt
- * context, set appropriate DPC flag then wakeup
- * DPC */
- if (halt_status & HALT_STATUS_UNRECOVERABLE)
- set_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags);
- else {
- printk("scsi%ld: %s: detect abort needed!\n",
- ha->host_no, __func__);
- set_bit(DPC_RESET_HA, &ha->dpc_flags);
- }
- qla4xxx_wake_dpc(ha);
- qla4xxx_mailbox_premature_completion(ha);
+ status = QLA_ERROR;
}
} else
ha->seconds_since_last_heartbeat = 0;
ha->fw_heartbeat_counter = fw_heartbeat_counter;
+ return status;
}
/**
@@ -2043,14 +2033,13 @@ static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
**/
void qla4_8xxx_watchdog(struct scsi_qla_host *ha)
{
- uint32_t dev_state;
-
- dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
+ uint32_t dev_state, halt_status;
/* don't poll if reset is going on */
if (!(test_bit(DPC_RESET_ACTIVE, &ha->dpc_flags) ||
test_bit(DPC_RESET_HA, &ha->dpc_flags) ||
test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags))) {
+ dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
if (dev_state == QLA82XX_DEV_NEED_RESET &&
!test_bit(DPC_RESET_HA, &ha->dpc_flags)) {
if (!ql4xdontresethba) {
@@ -2058,7 +2047,6 @@ void qla4_8xxx_watchdog(struct scsi_qla_host *ha)
"NEED RESET!\n", __func__);
set_bit(DPC_RESET_HA, &ha->dpc_flags);
qla4xxx_wake_dpc(ha);
- qla4xxx_mailbox_premature_completion(ha);
}
} else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT &&
!test_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags)) {
@@ -2068,7 +2056,24 @@ void qla4_8xxx_watchdog(struct scsi_qla_host *ha)
qla4xxx_wake_dpc(ha);
} else {
/* Check firmware health */
- qla4_8xxx_check_fw_alive(ha);
+ if (qla4_8xxx_check_fw_alive(ha)) {
+ halt_status = qla4_8xxx_rd_32(ha,
+ QLA82XX_PEG_HALT_STATUS1);
+
+ /* Since we cannot change dev_state in interrupt
+ * context, set appropriate DPC flag then wakeup
+ * DPC */
+ if (halt_status & HALT_STATUS_UNRECOVERABLE)
+ set_bit(DPC_HA_UNRECOVERABLE,
+ &ha->dpc_flags);
+ else {
+ ql4_printk(KERN_INFO, ha, "%s: detect "
+ "abort needed!\n", __func__);
+ set_bit(DPC_RESET_HA, &ha->dpc_flags);
+ }
+ qla4xxx_mailbox_premature_completion(ha);
+ qla4xxx_wake_dpc(ha);
+ }
}
}
}
@@ -2424,6 +2429,7 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha)
int status = QLA_ERROR;
uint8_t reset_chip = 0;
uint32_t dev_state;
+ unsigned long wait;
/* Stall incoming I/O until we are done */
scsi_block_requests(ha->host);
@@ -2474,8 +2480,29 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha)
* or if stop_firmware fails for ISP-82xx.
* This is the default case for ISP-4xxx */
if (!is_qla8022(ha) || reset_chip) {
+ if (!is_qla8022(ha))
+ goto chip_reset;
+
+ /* Check if 82XX firmware is alive or not
+ * We may have arrived here from NEED_RESET
+ * detection only */
+ if (test_bit(AF_FW_RECOVERY, &ha->flags))
+ goto chip_reset;
+
+ wait = jiffies + (FW_ALIVE_WAIT_TOV * HZ);
+ while (time_before(jiffies, wait)) {
+ if (qla4_8xxx_check_fw_alive(ha)) {
+ qla4xxx_mailbox_premature_completion(ha);
+ break;
+ }
+
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(HZ);
+ }
+
if (!test_bit(AF_FW_RECOVERY, &ha->flags))
qla4xxx_cmd_wait(ha);
+chip_reset:
qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
qla4xxx_abort_active_cmds(ha, DID_RESET << 16);
DEBUG2(ql4_printk(KERN_INFO, ha,
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 9/9] qla4xxx: Update driver version to 5.02.00-k10
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (7 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 8/9] qla4xxx: check for FW alive before calling chip_reset vikas.chaudhary
@ 2011-12-02 6:42 ` vikas.chaudhary
2011-12-06 20:15 ` [PATCH 0/9] qla4xxx: Patches for scsi-misc Mike Christie
9 siblings, 0 replies; 13+ messages in thread
From: vikas.chaudhary @ 2011-12-02 6:42 UTC (permalink / raw)
To: jbottomley, michaelc
Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
poornima.vonti
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
drivers/scsi/qla4xxx/ql4_version.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index 5254e57..26a3fa3 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
* See LICENSE.qla4xxx for copyright and licensing details.
*/
-#define QLA4XXX_DRIVER_VERSION "5.02.00-k9"
+#define QLA4XXX_DRIVER_VERSION "5.02.00-k10"
--
1.7.8.rc2.3.g0911
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 0/9] qla4xxx: Patches for scsi-misc
2011-12-02 6:42 [PATCH 0/9] qla4xxx: Patches for scsi-misc vikas.chaudhary
` (8 preceding siblings ...)
2011-12-02 6:42 ` [PATCH 9/9] qla4xxx: Update driver version to 5.02.00-k10 vikas.chaudhary
@ 2011-12-06 20:15 ` Mike Christie
9 siblings, 0 replies; 13+ messages in thread
From: Mike Christie @ 2011-12-06 20:15 UTC (permalink / raw)
To: vikas.chaudhary
Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand,
poornima.vonti
On 12/02/2011 12:42 AM, vikas.chaudhary@qlogic.com wrote:
> From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
>
> James,
>
> Please apply the following patches to scsi-misc for inclusion in mainline.
> These patches are on top of patchset posted by Mike Christie:-
> http://marc.info/?l=linux-scsi&m=132279682021696&w=2
>
> Mike Hernandez (1):
> qla4xxx: Fix CPU lockups when ql4xdontresethba set
>
> Nilesh Javali (1):
> qla4xxx: Fix the IDC locking mechanism
>
> Sarang Radke (2):
> qla4xxx: fix call trace on rmmod with ql4xdontresethba=1
> qla4xxx: Don't recover adapter if device state is FAILED
>
> Shyam Sunder (1):
> qla4xxx: check for FW alive before calling chip_reset
>
> Vikas Chaudhary (4):
> qla4xxx: Perform context resets in case of context failures.
> qla4xxx: Wait for disable_acb before doing set_acb
> qla4xxx: Fix qla4xxx_dump_buffer to dump buffer correctly
> qla4xxx: Update driver version to 5.02.00-k10
>
With the updated 3rd patch "[PATCH v2 3/9] qla4xxx: fix call trace on
rmmod with ql4xdontresethba=1" it looks ok to me.
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
^ permalink raw reply [flat|nested] 13+ messages in thread