From: Tomas Henzl <thenzl@redhat.com>
To: "Yang, Bo" <Bo.Yang@lsi.com>
Cc: "'James.Bottomley@HansenPartnership.com'"
<James.Bottomley@HansenPartnership.com>,
"'linux-scsi@vger.kernel.org'" <linux-scsi@vger.kernel.org>,
"'akpm@osdl.org'" <akpm@osdl.org>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
"Daftardar, Jayant" <Jayant.Daftardar@lsi.com>
Subject: Re: [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset
Date: Tue, 30 Nov 2010 16:21:58 +0100 [thread overview]
Message-ID: <4CF51696.4070102@redhat.com> (raw)
In-Reply-To: <4B6A08C587958942AA3002690DD4F8C30106A961BD@cosmail02.lsi.com>
On 11/19/2010 05:33 PM, Yang, Bo wrote:
> Change the 30 seconds wait in OCR routine to ssleep and give more time to FW come out from failed status
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-10 04:39:48.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-14
> 15:32:31.000000000 -0500 @@ -2294,7 +2294,6 @@
> process_fw_state_change_wq(struct work_s { struct megasas_instance
> *instance = container_of(work, struct megasas_instance, work_init); -
> u32 wait; unsigned long flags; if (instance->adprecovery !=
> MEGASAS_ADPRESET_SM_INFAULT) { @@ -2320,10 +2319,8 @@
> process_fw_state_change_wq(struct work_s printk(KERN_NOTICE
> "megaraid_sas: HBA recovery state machine," "state 2 starting...\n");
> - /*waitting for about 20 second before start the second init*/ - for
> (wait = 0; wait < 30; wait++) { - msleep(1000); - } + /*waitting for
> about 30 second before start the second init*/ + ssleep(30); if
> (megasas_transition_to_ready(instance)) { printk(KERN_NOTICE
> "megaraid_sas:adapter not ready\n");
> @@ -2487,7 +2484,9 @@ megasas_transition_to_ready(struct megas case
> MFI_STATE_FAULT: printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
> - return -ENODEV; + max_wait = MEGASAS_RESET_WAIT_TIME; + cur_state =
> MFI_STATE_FAULT; + break; case MFI_STATE_WAIT_HANDSHAKE: /*
the line 'max_wait = MEGASAS_RESET_WAIT_TIME;' is in every 'case' statement
the same, I'd suggest to remove it to save some lines, I hope also
this improves readability.
The change to ssleep is OK, I'd suggest to do the same in other cases too.
See an untested patch below (no functional change I hope).
Tomas
Signed-off-by Tomas Henzl<thenzl@redhat.com>
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index eb29d50..9dc5ff0 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -264,12 +264,10 @@ static int
megasas_adp_reset_xscale(struct megasas_instance *instance,
struct megasas_register_set __iomem *regs)
{
- u32 i;
u32 pcidata;
- writel(MFI_ADP_RESET, ®s->inbound_doorbell);
- for (i = 0; i < 3; i++)
- msleep(1000); /* sleep for 3 secs */
+ writel(MFI_ADP_RESET, ®s->inbound_doorbell);
+ ssleep(3); /* sleep for 3 secs */
pcidata = 0;
pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, &pcidata);
printk(KERN_NOTICE "pcidata = %x\n", pcidata);
@@ -279,9 +277,7 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
pci_write_config_dword(instance->pdev,
MFI_1068_PCSR_OFFSET, pcidata);
- for (i = 0; i < 2; i++)
- msleep(1000); /* need to wait 2 secs again */
-
+ ssleep(2); /* need to wait 2 secs again */
pcidata = 0;
pci_read_config_dword(instance->pdev,
MFI_1068_FW_HANDSHAKE_OFFSET, &pcidata);
@@ -2294,7 +2290,6 @@ process_fw_state_change_wq(struct work_struct *work)
{
struct megasas_instance *instance =
container_of(work, struct megasas_instance, work_init);
- u32 wait;
unsigned long flags;
if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
@@ -2320,10 +2315,8 @@ process_fw_state_change_wq(struct work_struct *work)
printk(KERN_NOTICE "megaraid_sas: HBA recovery state machine,"
"state 2 starting...\n");
- /*waitting for about 20 second before start the second init*/
- for (wait = 0; wait < 30; wait++) {
- msleep(1000);
- }
+ /* wait for about 30 second before the second init start */
+ ssleep(30);
if (megasas_transition_to_ready(instance)) {
printk(KERN_NOTICE "megaraid_sas:adapter not ready\n");
@@ -2466,7 +2459,6 @@ static int
megasas_transition_to_ready(struct megasas_instance* instance)
{
int i;
- u8 max_wait;
u32 fw_state;
u32 cur_state;
u32 abs_state, curr_abs_state;
@@ -2487,7 +2479,8 @@ megasas_transition_to_ready(struct megasas_instance* instance)
case MFI_STATE_FAULT:
printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
- return -ENODEV;
+ cur_state = MFI_STATE_FAULT;
+ break;
case MFI_STATE_WAIT_HANDSHAKE:
/*
@@ -2507,7 +2500,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
&instance->reg_set->inbound_doorbell);
}
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_WAIT_HANDSHAKE;
break;
@@ -2522,7 +2514,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
writel(MFI_INIT_HOTPLUG,
&instance->reg_set->inbound_doorbell);
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_BOOT_MESSAGE_PENDING;
break;
@@ -2541,7 +2532,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
writel(MFI_RESET_FLAGS,
&instance->reg_set->inbound_doorbell);
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_OPERATIONAL;
break;
@@ -2549,32 +2539,26 @@ megasas_transition_to_ready(struct megasas_instance* instance)
/*
* This state should not last for more than 2 seconds
*/
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_UNDEFINED;
break;
case MFI_STATE_BB_INIT:
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_BB_INIT;
break;
case MFI_STATE_FW_INIT:
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_FW_INIT;
break;
case MFI_STATE_FW_INIT_2:
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_FW_INIT_2;
break;
case MFI_STATE_DEVICE_SCAN:
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_DEVICE_SCAN;
break;
case MFI_STATE_FLUSH_CACHE:
- max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_FLUSH_CACHE;
break;
@@ -2585,9 +2569,10 @@ megasas_transition_to_ready(struct megasas_instance* instance)
}
/*
- * The cur_state should not last for more than max_wait secs
+ * The cur_state should not last for more than
+ * MEGASAS_RESET_WAIT_TIME secs
*/
- for (i = 0; i < (max_wait * 1000); i++) {
+ for (i = 0; i < (MEGASAS_RESET_WAIT_TIME*1000); i++) {
fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) &
MFI_STATE_MASK ;
curr_abs_state =
@@ -2600,11 +2585,13 @@ megasas_transition_to_ready(struct megasas_instance* instance)
}
/*
- * Return error if fw_state hasn't changed after max_wait
+ * Return error if fw_state hasn't changed
+ * after MEGASAS_RESET_WAIT_TIME
*/
if (curr_abs_state == abs_state) {
printk(KERN_DEBUG "FW state [%d] hasn't changed "
- "in %d secs\n", fw_state, max_wait);
+ "in %d secs\n", fw_state,
+ MEGASAS_RESET_WAIT_TIME);
return -ENODEV;
}
}
prev parent reply other threads:[~2010-11-30 15:22 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 2:34 [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions Yang, Bo
2010-06-18 21:18 ` Yinghai Lu
2010-06-18 21:21 ` Yang, Bo
2010-06-18 21:37 ` Yinghai Lu
2010-06-18 21:56 ` Yang, Bo
2010-06-20 14:54 ` James Bottomley
2010-06-20 15:01 ` James Bottomley
2010-06-20 19:27 ` Yang, Bo
2010-06-20 19:47 ` James Bottomley
2010-06-20 20:19 ` Yang, Bo
2010-06-20 20:48 ` James Bottomley
2010-06-21 15:35 ` Yang, Bo
2010-07-20 13:08 ` Yang, Bo
2010-07-30 18:53 ` Yang, Bo
2010-07-31 17:46 ` James Bottomley
2010-08-05 20:44 ` Yang, Bo
2010-08-06 0:36 ` James Bottomley
2010-08-12 15:20 ` Yang, Bo
2010-08-16 14:22 ` Yang, Bo
2010-08-16 15:06 ` James Bottomley
2010-08-05 19:47 ` Yang, Bo
2010-11-19 16:33 ` [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset Yang, Bo
2010-11-19 16:53 ` [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives Yang, Bo
2010-11-19 17:03 ` [PATCH 3/9] scsi: megaraid_sas - Driver will scan device after receive event MR_EVT_LD_STATE_CHANGE Yang, Bo
2010-11-19 17:08 ` [PATCH 4/9] scsi: megaraid_sas - Driver provide the version to FW Yang, Bo
2010-11-19 17:23 ` [PATCH 5/9] scsi: megaraid_sas - report different io sectors for ieee support Yang, Bo
2010-11-19 17:29 ` [PATCH 6/9] scsi: megaraid_sas - Add the online reset to iMR chip Yang, Bo
2010-11-19 17:37 ` [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR Yang, Bo
2010-11-19 17:43 ` [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW Yang, Bo
2010-11-19 17:53 ` James Bottomley
2010-11-24 15:22 ` Yang, Bo
2010-11-30 15:57 ` Tomas Henzl
2010-11-30 16:11 ` [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR Tomas Henzl
2010-11-30 18:05 ` Yang, Bo
2010-12-01 12:19 ` Tomas Henzl
2010-12-01 15:55 ` Yang, Bo
2010-11-30 15:36 ` [PATCH 6/9] scsi: megaraid_sas - Add the online reset to iMR chip Tomas Henzl
2010-11-19 17:50 ` [PATCH 9/9] scsi: megaraid_sas - Documentation and driver version update Yang, Bo
2010-12-09 17:07 ` [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives James Bottomley
2010-11-30 15:21 ` Tomas Henzl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CF51696.4070102@redhat.com \
--to=thenzl@redhat.com \
--cc=Bo.Yang@lsi.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Jayant.Daftardar@lsi.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).