From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <jbottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Kashyap Desai <kashyap.desai@lsi.com>,
Adam Radford <aradford@gmail.com>
Subject: [PATCH 1/6] megaraid_sas: Do not wait forever
Date: Thu, 16 Jan 2014 11:25:31 +0100 [thread overview]
Message-ID: <1389867936-118685-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1389867936-118685-1-git-send-email-hare@suse.de>
If the firmware is incommunicado for whatever reason the driver
will wait forever during initialisation, causing all sorts
of hangcheck timers to trigger.
We should rather wait for a defined time, and give up on the
command if no response was received.
Cc: Kashyap Desai <kashyap.desai@lsi.com>
Cc: Adam Radford <aradford@gmail.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/megaraid/megaraid_sas_base.c | 43 ++++++++++++++++++-------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 3b7ad10..95d4e5c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -911,9 +911,11 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance,
instance->instancet->issue_dcmd(instance, cmd);
- wait_event(instance->int_cmd_wait_q, cmd->cmd_status != ENODATA);
+ wait_event_timeout(instance->int_cmd_wait_q,
+ cmd->cmd_status != ENODATA,
+ MEGASAS_INTERNAL_CMD_WAIT_TIME * HZ);
- return 0;
+ return cmd->cmd_status == ENODATA ? -ENODATA : 0;
}
/**
@@ -932,11 +934,12 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance,
{
struct megasas_cmd *cmd;
struct megasas_abort_frame *abort_fr;
+ int status;
cmd = megasas_get_cmd(instance);
if (!cmd)
- return -1;
+ return -ENOMEM;
abort_fr = &cmd->frame->abort;
@@ -960,11 +963,14 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance,
/*
* Wait for this cmd to complete
*/
- wait_event(instance->abort_cmd_wait_q, cmd->cmd_status != 0xFF);
+ wait_event_timeout(instance->abort_cmd_wait_q,
+ cmd->cmd_status != 0xFF,
+ MEGASAS_INTERNAL_CMD_WAIT_TIME * HZ);
cmd->sync_cmd = 0;
+ status = cmd->cmd_status;
megasas_return_cmd(instance, cmd);
- return 0;
+ return status == 0xFF ? -ENODATA : 0;
}
/**
@@ -3902,6 +3908,7 @@ megasas_get_seq_num(struct megasas_instance *instance,
struct megasas_dcmd_frame *dcmd;
struct megasas_evt_log_info *el_info;
dma_addr_t el_info_h = 0;
+ int rc;
cmd = megasas_get_cmd(instance);
@@ -3933,23 +3940,23 @@ megasas_get_seq_num(struct megasas_instance *instance,
dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(el_info_h);
dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct megasas_evt_log_info));
- megasas_issue_blocked_cmd(instance, cmd);
-
- /*
- * Copy the data back into callers buffer
- */
- eli->newest_seq_num = le32_to_cpu(el_info->newest_seq_num);
- eli->oldest_seq_num = le32_to_cpu(el_info->oldest_seq_num);
- eli->clear_seq_num = le32_to_cpu(el_info->clear_seq_num);
- eli->shutdown_seq_num = le32_to_cpu(el_info->shutdown_seq_num);
- eli->boot_seq_num = le32_to_cpu(el_info->boot_seq_num);
-
+ rc = megasas_issue_blocked_cmd(instance, cmd);
+ if (!rc) {
+ /*
+ * Copy the data back into callers buffer
+ */
+ eli->newest_seq_num = le32_to_cpu(el_info->newest_seq_num);
+ eli->oldest_seq_num = le32_to_cpu(el_info->oldest_seq_num);
+ eli->clear_seq_num = le32_to_cpu(el_info->clear_seq_num);
+ eli->shutdown_seq_num = le32_to_cpu(el_info->shutdown_seq_num);
+ eli->boot_seq_num = le32_to_cpu(el_info->boot_seq_num);
+ }
pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info),
el_info, el_info_h);
megasas_return_cmd(instance, cmd);
- return 0;
+ return rc;
}
/**
@@ -5045,7 +5052,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
* cmd to the SCSI mid-layer
*/
cmd->sync_cmd = 1;
- megasas_issue_blocked_cmd(instance, cmd);
+ error = megasas_issue_blocked_cmd(instance, cmd);
cmd->sync_cmd = 0;
/*
--
1.7.12.4
next prev parent reply other threads:[~2014-01-16 10:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 10:25 [PATCH 0/6] megaraid_sas: Fix system stall with iommu enabled Hannes Reinecke
2014-01-16 10:25 ` Hannes Reinecke [this message]
2014-01-24 7:46 ` [PATCH 1/6] megaraid_sas: Do not wait forever Desai, Kashyap
2014-01-24 8:24 ` Hannes Reinecke
2014-01-24 8:34 ` Desai, Kashyap
2014-01-24 10:04 ` Hannes Reinecke
2014-01-16 10:25 ` [PATCH 2/6] megaraid_sas_fusion: Fixup fire_cmd syntax Hannes Reinecke
2014-01-16 10:25 ` [PATCH 3/6] megaraid_sas_fusion: correctly pass queue info pointer Hannes Reinecke
2014-01-24 8:41 ` Desai, Kashyap
2014-01-16 10:25 ` [PATCH 4/6] megaraid_sas: catch errors from megasas_get_map_info() Hannes Reinecke
2014-01-24 8:35 ` Desai, Kashyap
2014-01-16 10:25 ` [PATCH 5/6] megaraid_sas_fusion: Return correct error value in megasas_get_ld_map_info() Hannes Reinecke
2014-01-24 8:45 ` Desai, Kashyap
2014-01-16 10:25 ` [PATCH 6/6] megaraid_sas: check return value for megasas_get_pd_list() Hannes Reinecke
2014-01-24 8:38 ` Desai, Kashyap
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=1389867936-118685-2-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=aradford@gmail.com \
--cc=jbottomley@parallels.com \
--cc=kashyap.desai@lsi.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.