All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
To: linux-scsi@vger.kernel.org, michaelc@cs.wisc.edu
Cc: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Subject: [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free
Date: Mon,  1 Feb 2016 15:42:51 +0530	[thread overview]
Message-ID: <1454321571-16167-13-git-send-email-jitendra.bhivare@avagotech.com> (raw)
In-Reply-To: <1454321571-16167-1-git-send-email-jitendra.bhivare@avagotech.com>

FW got into UE after running IO stress test

With kernel change to split session lock in frwd_lock and back_lock for tx
and rx path correspondingly, in the IO path, common resource used in driver
such as WRB was left unprotected.

Add wrb_lock spinlock to protect allocation and freeing of WRB.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_main.c | 5 +++++
 drivers/scsi/be2iscsi/be_main.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index fa2b589..0892ee2 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1190,12 +1190,14 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context,
 {
 	struct wrb_handle *pwrb_handle;
 
+	spin_lock_bh(&pwrb_context->wrb_lock);
 	pwrb_handle = pwrb_context->pwrb_handle_base[pwrb_context->alloc_index];
 	pwrb_context->wrb_handles_available--;
 	if (pwrb_context->alloc_index == (wrbs_per_cxn - 1))
 		pwrb_context->alloc_index = 0;
 	else
 		pwrb_context->alloc_index++;
+	spin_unlock_bh(&pwrb_context->wrb_lock);
 
 	return pwrb_handle;
 }
@@ -1227,12 +1229,14 @@ beiscsi_put_wrb_handle(struct hwi_wrb_context *pwrb_context,
 		       struct wrb_handle *pwrb_handle,
 		       unsigned int wrbs_per_cxn)
 {
+	spin_lock_bh(&pwrb_context->wrb_lock);
 	pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle;
 	pwrb_context->wrb_handles_available++;
 	if (pwrb_context->free_index == (wrbs_per_cxn - 1))
 		pwrb_context->free_index = 0;
 	else
 		pwrb_context->free_index++;
+	spin_unlock_bh(&pwrb_context->wrb_lock);
 }
 
 /**
@@ -2920,6 +2924,7 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
 			}
 			num_cxn_wrbh--;
 		}
+		spin_lock_init(&pwrb_context->wrb_lock);
 	}
 	idx = 0;
 	for (index = 0; index < phba->params.cxns_per_ctrl; index++) {
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 5ded3fa..30a4606 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -304,6 +304,7 @@ struct invalidate_command_table {
 #define BEISCSI_GET_ULP_FROM_CRI(phwi_ctrlr, cri) \
 	(phwi_ctrlr->wrb_context[cri].ulp_num)
 struct hwi_wrb_context {
+	spinlock_t wrb_lock;
 	struct list_head wrb_handle_list;
 	struct list_head wrb_handle_drvr_list;
 	struct wrb_handle **pwrb_handle_base;
-- 
2.5.0


  parent reply	other threads:[~2016-02-01 10:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
2016-02-01 11:10   ` Johannes Thumshirn
2016-02-01 11:15   ` James Bottomley
2016-02-02  1:44     ` Martin K. Petersen
2016-02-01 10:12 ` [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields Jitendra Bhivare
2016-02-01 11:13   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 03/12] be2iscsi: Remove redundant MCC processing code Jitendra Bhivare
2016-02-01 11:17   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
2016-02-01 11:26   ` Johannes Thumshirn
2016-02-01 12:26   ` kbuild test robot
2016-02-01 10:12 ` [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function Jitendra Bhivare
2016-02-01 11:27   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state Jitendra Bhivare
2016-02-01 11:29   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion Jitendra Bhivare
2016-02-01 11:41   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection Jitendra Bhivare
2016-02-01 11:45   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free Jitendra Bhivare
2016-02-01 12:14   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks Jitendra Bhivare
2016-02-01 12:24   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock Jitendra Bhivare
2016-02-01 12:26   ` Johannes Thumshirn
2016-02-01 10:12 ` Jitendra Bhivare [this message]
2016-02-01 12:27   ` [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free Johannes Thumshirn

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=1454321571-16167-13-git-send-email-jitendra.bhivare@avagotech.com \
    --to=jitendra.bhivare@avagotech.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /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.