All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, Dick Kennedy <dick.kennedy@broadcom.com>,
	James Smart <james.smart@broadcom.com>
Subject: [PATCH v2 12/20] lpfc: Limit amount of work processed in IRQ
Date: Fri,  4 Aug 2017 17:47:23 -0700	[thread overview]
Message-ID: <20170805004731.1335-13-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170805004731.1335-1-jsmart2021@gmail.com>

From: Dick Kennedy <dick.kennedy@broadcom.com>

Various oops being seen on being in the ISR too long and cpu
lockups, when under heavy load.

The amount of work being posted off of completion queues kept
the ISR running almost all the time

Correct the issue by limiting the amount of work per itteration.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_sli.c  | 31 +++++++++++++++++++------------
 drivers/scsi/lpfc/lpfc_sli4.h |  1 +
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index d68afec00f57..9ccd8fed0bed 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -80,8 +80,8 @@ static int lpfc_sli4_fp_handle_cqe(struct lpfc_hba *, struct lpfc_queue *,
 				    struct lpfc_cqe *);
 static int lpfc_sli4_post_sgl_list(struct lpfc_hba *, struct list_head *,
 				       int);
-static void lpfc_sli4_hba_handle_eqe(struct lpfc_hba *, struct lpfc_eqe *,
-			uint32_t);
+static int lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba,
+				    struct lpfc_eqe *eqe, uint32_t qidx);
 static bool lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba);
 static bool lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba);
 static int lpfc_sli4_abort_nvme_io(struct lpfc_hba *phba,
@@ -13010,7 +13010,7 @@ lpfc_sli4_sp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
  * completion queue, and then return.
  *
  **/
-static void
+static int
 lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 	struct lpfc_queue *speq)
 {
@@ -13034,7 +13034,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 			lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
 					"0365 Slow-path CQ identifier "
 					"(%d) does not exist\n", cqid);
-		return;
+		return 0;
 	}
 
 	/* Save EQ associated with this CQ */
@@ -13071,7 +13071,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 		lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
 				"0370 Invalid completion queue type (%d)\n",
 				cq->type);
-		return;
+		return 0;
 	}
 
 	/* Catch the no cq entry condition, log an error */
@@ -13086,6 +13086,8 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 	/* wake up worker thread if there are works to be done */
 	if (workposted)
 		lpfc_worker_wake_up(phba);
+
+	return ecount;
 }
 
 /**
@@ -13393,7 +13395,7 @@ lpfc_sli4_fp_handle_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
  * queue and process all the entries on the completion queue, rearm the
  * completion queue, and then return.
  **/
-static void
+static int
 lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 			uint32_t qidx)
 {
@@ -13409,7 +13411,7 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 				"event: majorcode=x%x, minorcode=x%x\n",
 				bf_get_le32(lpfc_eqe_major_code, eqe),
 				bf_get_le32(lpfc_eqe_minor_code, eqe));
-		return;
+		return 0;
 	}
 
 	/* Get the reference to the corresponding CQ */
@@ -13446,8 +13448,9 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 
 	/* Otherwise this is a Slow path event */
 	if (cq == NULL) {
-		lpfc_sli4_sp_handle_eqe(phba, eqe, phba->sli4_hba.hba_eq[qidx]);
-		return;
+		ecount = lpfc_sli4_sp_handle_eqe(phba, eqe,
+						 phba->sli4_hba.hba_eq[qidx]);
+		return ecount;
 	}
 
 process_cq:
@@ -13456,7 +13459,7 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 				"0368 Miss-matched fast-path completion "
 				"queue identifier: eqcqid=%d, fcpcqid=%d\n",
 				cqid, cq->queue_id);
-		return;
+		return 0;
 	}
 
 	/* Save EQ associated with this CQ */
@@ -13486,6 +13489,8 @@ lpfc_sli4_hba_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
 	/* wake up worker thread if there are works to be done */
 	if (workposted)
 		lpfc_worker_wake_up(phba);
+
+	return ecount;
 }
 
 static void
@@ -13706,6 +13711,7 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id)
 	struct lpfc_eqe *eqe;
 	unsigned long iflag;
 	int ecount = 0;
+	int ccount = 0;
 	int hba_eqidx;
 
 	/* Get the driver's phba structure from the dev_id */
@@ -13757,8 +13763,9 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id)
 		if (eqe == NULL)
 			break;
 
-		lpfc_sli4_hba_handle_eqe(phba, eqe, hba_eqidx);
-		if (!(++ecount % fpeq->entry_repost))
+		ccount += lpfc_sli4_hba_handle_eqe(phba, eqe, hba_eqidx);
+		if (!(++ecount % fpeq->entry_repost) ||
+		    ccount > LPFC_MAX_ISR_CQE)
 			break;
 		fpeq->EQ_processed++;
 	}
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 7a1d74e9e877..540454b03587 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -158,6 +158,7 @@ struct lpfc_queue {
 #define LPFC_MQ_REPOST		8
 #define LPFC_CQ_REPOST		64
 #define LPFC_RQ_REPOST		64
+#define LPFC_MAX_ISR_CQE	64
 #define LPFC_RELEASE_NOTIFICATION_INTERVAL	32  /* For WQs */
 	uint32_t queue_id;	/* Queue ID assigned by the hardware */
 	uint32_t assoc_qid;     /* Queue ID associated with, for CQ/WQ/MQ */
-- 
2.13.1

  parent reply	other threads:[~2017-08-05  0:48 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-05  0:47 [PATCH v2 00/20] lpfc updates for 11.4.0.3 James Smart
2017-08-05  0:47 ` [PATCH v2 01/20] lpfc: Fix plogi collision that causes illegal state transition James Smart
2017-08-07  7:49   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 02/20] lpfc: Fix loop mode target discovery James Smart
2017-08-07  7:55   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 03/20] lpfc: Fix rediscovery on switch blade pull James Smart
2017-08-07  7:56   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 04/20] lpfc: Fix oops when NVME Target is discovered in a nonNVME environment James Smart
2017-08-07  8:00   ` Johannes Thumshirn
2017-08-07 20:34     ` James Smart
2017-08-05  0:47 ` [PATCH v2 05/20] lpfc: convert info messages to standard messages James Smart
2017-08-07  8:00   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 06/20] lpfc: Correct return error codes to align with nvme_fc transport James Smart
2017-08-07  8:07   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 07/20] lpfc: Fix handling of FCP and NVME FC4 types in Pt2Pt topology James Smart
2017-08-07  8:18   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 08/20] lpfc: Fix duplicate NVME rport entries and namespaces James Smart
2017-08-07  8:33   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 09/20] lpfc: Fix crash in lpfc nvmet when fc port is reset James Smart
2017-08-07  8:34   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 10/20] lpfc: Fix NVME PRLI handling during RSCN James Smart
2017-08-07  8:35   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 11/20] lpfc: Correct issues with FAWWN and FDISCs James Smart
2017-08-05  0:47 ` James Smart [this message]
2017-08-07  8:43   ` [PATCH v2 12/20] lpfc: Limit amount of work processed in IRQ Johannes Thumshirn
2017-08-07 20:50     ` James Smart
2017-08-05  0:47 ` [PATCH v2 13/20] lpfc: Fix MRQ > 1 context list handling James Smart
2017-08-07  9:02   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 14/20] lpfc: Fix relative offset error on large nvmet target ios James Smart
2017-08-07  9:02   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 15/20] lpfc: Fix nvme target failure after 2nd adapter reset James Smart
2017-08-07  9:05   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 16/20] lpfc: Fix bad sgl reposting " James Smart
2017-08-07  9:06   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 17/20] lpfc: remove console log clutter James Smart
2017-08-07  9:06   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 18/20] lpfc: Add Buffer to Buffer credit recovery support James Smart
2017-08-07  9:08   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 19/20] scsi: lpfc: fix "integer constant too large" error on 32bit archs James Smart
2017-08-07  9:09   ` Johannes Thumshirn
2017-08-05  0:47 ` [PATCH v2 20/20] lpfc: lpfc version bump 11.4.0.3 James Smart
2017-08-07  9:08   ` 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=20170805004731.1335-13-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=james.smart@broadcom.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.