summaryrefslogtreecommitdiff
path: root/drivers/scsi/be2iscsi/be_mgmt.c
diff options
context:
space:
mode:
authorJitendra Bhivare <jitendra.bhivare@avagotech.com>2016-01-20 11:40:45 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2016-02-24 05:27:02 +0300
commit6ac999efeeff98f203eda8cf46d5016e99f58b0c (patch)
tree01af7f763c301355719201b7b531072c78bc5415 /drivers/scsi/be2iscsi/be_mgmt.c
parent420eb6d7efc4591ef1968106cdaa980ea06fe00e (diff)
downloadlinux-6ac999efeeff98f203eda8cf46d5016e99f58b0c.tar.xz
be2iscsi: Fix soft lockup in mgmt_get_all_if_id path using bmbx
We are taking mbox_lock spinlock which disables pre-emption before we poll for mbox completion. Waiting there with spinlock held in excess of 20s will cause soft lockup. Actual fix is to change mbox_lock to mutex. The changes are done in phases. This is the first part. 1. Changed mgmt_get_all_if_id to use MCC where after posting lock is released. 2. Changed be_mbox_db_ready_wait to busy wait for 12s max and removed wait_event_timeout. Added error handling code for IO reads. OPCODE_COMMON_QUERY_FIRMWARE_CONFIG mbox command takes 8s time when unreachable boot targets configured. Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_mgmt.c')
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index aea3e6b9477d..7b54b23e756e 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -809,27 +809,39 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
{
struct be_ctrl_info *ctrl = &phba->ctrl;
- struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
- struct be_cmd_get_all_if_id_req *req = embedded_payload(wrb);
- struct be_cmd_get_all_if_id_req *pbe_allid = req;
+ struct be_mcc_wrb *wrb;
+ struct be_cmd_get_all_if_id_req *req;
+ struct be_cmd_get_all_if_id_req *pbe_allid;
+ unsigned int tag;
int status = 0;
- memset(wrb, 0, sizeof(*wrb));
-
spin_lock(&ctrl->mbox_lock);
+ tag = alloc_mcc_tag(phba);
+ if (!tag) {
+ spin_unlock(&ctrl->mbox_lock);
+ return -ENOMEM;
+ }
+
+ wrb = wrb_from_mccq(phba);
+ req = embedded_payload(wrb);
+ wrb->tag0 |= tag;
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID,
sizeof(*req));
- status = be_mbox_notify(ctrl);
- if (!status)
- phba->interface_handle = pbe_allid->if_hndl_list[0];
- else {
+ be_mcc_notify(phba);
+ spin_unlock(&ctrl->mbox_lock);
+
+ status = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
+ if (status) {
beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
"BG_%d : Failed in mgmt_get_all_if_id\n");
+ return -EBUSY;
}
- spin_unlock(&ctrl->mbox_lock);
+
+ pbe_allid = embedded_payload(wrb);
+ phba->interface_handle = pbe_allid->if_hndl_list[0];
return status;
}