public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Jayamohan Kallickal <jayamohank@gmail.com>
Cc: jbottomley@parallels.com, linux-scsi@vger.kernel.org,
	Jayamohan Kallickal <jayamohan.kallickal@emulex.com>,
	John Soni Jose <sony.john-n@emulex.com>
Subject: Re: [PATCH 06/22] be2iscsi: Fix soft lock up issue during UE or if FW taking time to respond
Date: Mon, 16 Sep 2013 22:18:51 -0500	[thread overview]
Message-ID: <5237CA1B.2090907@cs.wisc.edu> (raw)
In-Reply-To: <1379049014-32716-6-git-send-email-jayamohan.kallickal@emulex.com>

On 09/13/2013 12:09 AM, Jayamohan Kallickal wrote:
>  The timeout set in MBX_CMD is 100sec and the ready bit checking in BMBX
>  mode is done for 4sec. After 4sec the task is scheduled out for 5 secs
>  to avoid kernel soft lockup stack trace. The loop of 4sec ready bit check
>  and then schedule out is done until the following conditon occur
>   - The Ready Bit is Set
>   - The timeout set in MBX_CMD expires
> 
> Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
> ---
>  drivers/scsi/be2iscsi/be.h      |    2 +-
>  drivers/scsi/be2iscsi/be_cmds.c |   47 +++++++++++++++++++++++++--------------
>  drivers/scsi/be2iscsi/be_main.c |    5 ++---
>  3 files changed, 33 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
> index 777e7c0..2e28f6c 100644
> --- a/drivers/scsi/be2iscsi/be.h
> +++ b/drivers/scsi/be2iscsi/be.h
> @@ -128,7 +128,7 @@ struct be_ctrl_info {
>  
>  #define PAGE_SHIFT_4K 12
>  #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
> -#define mcc_timeout		120000 /* 5s timeout */
> +#define mcc_timeout		120000 /* 12s timeout */
>  
>  /* Returns number of pages spanned by the data starting at the given addr */
>  #define PAGES_4K_SPANNED(_address, size)				\
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index f7788e5..01e1915 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -490,33 +490,46 @@ int be_mcc_notify_wait(struct beiscsi_hba *phba)
>   **/
>  static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl)
>  {
> +#define BEISCSI_MBX_RDY_BIT_TIMEOUT	4000	/* 4sec */
>  	void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET;
>  	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
> -	uint32_t wait = 0;
> +	unsigned long timeout;
> +	bool read_flag = false;
> +	int ret = 0, i;
>  	u32 ready;
>  
> -	do {
> +	if (beiscsi_error(phba))
> +		return -EIO;
>  
> -		if (beiscsi_error(phba))
> -			return -EIO;
> +	timeout = jiffies + (HZ * 110);
>  
> -		ready = ioread32(db) & MPU_MAILBOX_DB_RDY_MASK;
> -		if (ready)
> -			break;
> +	do {
> +		for (i = 0; i < BEISCSI_MBX_RDY_BIT_TIMEOUT; i++) {
> +			ready = ioread32(db) & MPU_MAILBOX_DB_RDY_MASK;
> +			if (ready) {
> +				read_flag = true;
> +				break;
> +			}
> +			mdelay(1);
> +		}
>  
> -		if (wait > BEISCSI_HOST_MBX_TIMEOUT) {
> -			beiscsi_log(phba, KERN_ERR,
> -				    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> -				    "BC_%d : FW Timed Out\n");
> +		if (!read_flag) {
> +			set_current_state(TASK_INTERRUPTIBLE);
> +			schedule_timeout(HZ * 5);
> +			set_current_state(TASK_RUNNING);
> +		}
> +	} while ((time_before(jiffies, timeout)) && !read_flag);
> +

I think you can use wait_event_timeout instead of all this.


  reply	other threads:[~2013-09-17  3:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13  5:09 [PATCH 01/22] be2iscsi: Fix Template HDR IOCTL Jayamohan Kallickal
2013-09-13  5:09 ` [PATCH 02/22] be2iscsi: Fix the MCCQ count leakage Jayamohan Kallickal
2013-09-13  5:09 ` [PATCH 03/22] be2iscsi: Fix repeated issue of MAC ADDR get IOCTL Jayamohan Kallickal
2013-09-13  5:09 ` [PATCH 04/22] be2iscsi: Fix negotiated parameters upload to FW Jayamohan Kallickal
2013-09-17  2:58   ` Mike Christie
2013-09-17  4:28     ` Jayamohan Kallickal
2013-09-17 21:15       ` Mike Christie
2013-09-18  5:37         ` Jayamohan Kallickal
2013-09-18  7:34           ` Mike Christie
2013-09-17 21:23       ` Mike Christie
2013-09-13  5:09 ` [PATCH 05/22] be2iscsi: Fix locking mechanism in Unsol Path Jayamohan Kallickal
2013-09-13  5:09 ` [PATCH 06/22] be2iscsi: Fix soft lock up issue during UE or if FW taking time to respond Jayamohan Kallickal
2013-09-17  3:18   ` Mike Christie [this message]
2013-09-13  5:09 ` [PATCH 07/22] be2iscsi: Config parameters update for Dual Chute Support Jayamohan Kallickal
2013-09-13  5:09 ` [PATCH 08/22] be2iscsi: Fix changes in ASYNC Path for SKH-R adapter Jayamohan Kallickal
2013-09-13  5:09 ` [PATCH 09/22] be2iscsi: Fix Template HDR support for Dual Chute mode Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 10/22] be2iscsi: Fix SGL Initilization and posting Pages for Dual Chute Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 11/22] be2iscsi: Fix WRB_Q posting to support Dual Chute mode Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 12/22] be2iscsi: Fix CID allocation/freeing to support Dual Chute Mode Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 13/22] be2iscsi: Fix connection offload to support Dual Chute Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 14/22] be2iscsi: Fix chute cleanup during drivers unload Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 15/22] be2iscsi: Dispaly CID available for connection offload Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 16/22] be2iscsi: Display Port Identifier for each iSCSI function Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 17/22] be2iscsi: Fix MSIx creation for SKH-R adapter Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 18/22] be2iscsi: Fix log level for protocol specific logs Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 19/22] be2iscsi: Fix Insufficient Buffer Error returned in MBX Completion Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 20/22] be2iscsi: Invalidate WRB in Abort/Reset Path Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 21/22] be2iscsi: Fix AER handling in driver Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 22/22] be2iscsi: Bump driver version Jayamohan Kallickal
2013-09-13  5:10 ` [PATCH 00/22] be2iscsi: Update to 10.0.635.0 Jayamohan Kallickal

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=5237CA1B.2090907@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=jayamohan.kallickal@emulex.com \
    --cc=jayamohank@gmail.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sony.john-n@emulex.com \
    /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