linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurence Oberman <loberman@redhat.com>
To: Himanshu Madhani <hmadhani@marvell.com>,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 11/14] qla2xxx: Check for MB timeout while capturing ISP27/28xx FW dump
Date: Thu, 12 Sep 2019 16:22:08 -0400	[thread overview]
Message-ID: <2b190236d26b4d769ca5d4dedc748f1abf2a276d.camel@redhat.com> (raw)
In-Reply-To: <20190912180918.6436-12-hmadhani@marvell.com>

On Thu, 2019-09-12 at 11:09 -0700, Himanshu Madhani wrote:
> From: Quinn Tran <qutran@marvell.com>
> 
> Add mailbox timeout checkout for ISP 27xx/28xx during FW dump
> procedure. Without the timeout check, hardware lock can
> be held for long period. This patch would shorten the dump
> procedure, if a timeout condition is encountered.
> 
> Signed-off-by: Quinn Tran <qutran@marvell.com>
> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
> ---
>  drivers/scsi/qla2xxx/qla_tmpl.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c
> b/drivers/scsi/qla2xxx/qla_tmpl.c
> index 294d77c02cdf..b948d94c8b3c 100644
> --- a/drivers/scsi/qla2xxx/qla_tmpl.c
> +++ b/drivers/scsi/qla2xxx/qla_tmpl.c
> @@ -10,6 +10,7 @@
>  #define ISPREG(vha)	(&(vha)->hw->iobase->isp24)
>  #define IOBAR(reg)	offsetof(typeof(*(reg)), iobase_addr)
>  #define IOBASE(vha)	IOBAR(ISPREG(vha))
> +#define INVALID_ENTRY ((struct qla27xx_fwdt_entry
> *)0xffffffffffffffffUL)
>  
>  static inline void
>  qla27xx_insert16(uint16_t value, void *buf, ulong *len)
> @@ -261,6 +262,7 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host
> *vha,
>  	ulong start = le32_to_cpu(ent->t262.start_addr);
>  	ulong end = le32_to_cpu(ent->t262.end_addr);
>  	ulong dwords;
> +	int rc;
>  
>  	ql_dbg(ql_dbg_misc, vha, 0xd206,
>  	    "%s: rdram(%x) [%lx]\n", __func__, ent->t262.ram_area,
> *len);
> @@ -308,7 +310,13 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host
> *vha,
>  	dwords = end - start + 1;
>  	if (buf) {
>  		buf += *len;
> -		qla24xx_dump_ram(vha->hw, start, buf, dwords, &buf);
> +		rc = qla24xx_dump_ram(vha->hw, start, buf, dwords,
> &buf);
> +		if (rc != QLA_SUCCESS) {
> +			ql_dbg(ql_dbg_async, vha, 0xffff,
> +			    "%s: dump ram MB failed. Area %xh start
> %lxh end %lxh\n",
> +			    __func__, area, start, end);
> +			return INVALID_ENTRY;
> +		}
>  	}
>  	*len += dwords * sizeof(uint32_t);
>  done:
> @@ -838,6 +846,13 @@ qla27xx_walk_template(struct scsi_qla_host *vha,
>  		ent = qla27xx_find_entry(type)(vha, ent, buf, len);
>  		if (!ent)
>  			break;
> +
> +		if (ent == INVALID_ENTRY) {
> +			*len = 0;
> +			ql_dbg(ql_dbg_async, vha, 0xffff,
> +			    "Unable to capture FW dump");
> +			goto bailout;
> +		}
>  	}
>  
>  	if (tmp->count)
> @@ -847,6 +862,9 @@ qla27xx_walk_template(struct scsi_qla_host *vha,
>  	if (ent)
>  		ql_dbg(ql_dbg_misc, vha, 0xd019,
>  		    "%s: missing end entry\n", __func__);
> +
> +bailout:
> +	cpu_to_le32s(&tmp->count);	/* endianize residual count
> */
>  }
>  
>  static void
> @@ -1010,7 +1028,9 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int
> hardware_locked)
>  			}
>  			len = qla27xx_execute_fwdt_template(vha,
>  			    fwdt->template, buf);
> -			if (len != fwdt->dump_size) {
> +			if (len == 0) {
> +				goto bailout;
> +			} else if (len != fwdt->dump_size) {
>  				ql_log(ql_log_warn, vha, 0xd013,
>  				    "-> fwdt%u fwdump residual=%+ld\n",
>  				    j, fwdt->dump_size - len);
> @@ -1025,6 +1045,7 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int
> hardware_locked)
>  		qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP);
>  	}
>  
> +bailout:
>  #ifndef __CHECKER__
>  	if (!hardware_locked)
>  		spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);

Being aware of this issue I reviewed it for sanity and code. I cant
speak to functions that interract with the firmware though.
Looks good otherwise

Reviewed-by: Laurence Oberman <loberman@redhat.com>


  reply	other threads:[~2019-09-12 20:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 18:09 [PATCH v2 00/14] qla2xxx: Bug fixes for the driver Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 01/14] qla2xxx: Silence fwdump template message Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 02/14] qla2xxx: Fix unbound sleep in fcport delete path Himanshu Madhani
2019-09-30 15:54   ` Bart Van Assche
2019-09-12 18:09 ` [PATCH v2 03/14] qla2xxx: Fix stale mem access on driver unload Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 04/14] qla2xxx: Optimize NPIV tear down process Himanshu Madhani
2019-09-26 10:52   ` Martin Wilck
2019-09-26 16:56     ` [EXT] " Quinn Tran
2019-09-27  6:33       ` Martin Wilck
2019-09-12 18:09 ` [PATCH v2 05/14] qla2xxx: Fix N2N link reset Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 06/14] qla2xxx: Fix N2N link up fail Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 07/14] qla2xxx: Fix Nport ID display value Himanshu Madhani
2019-09-13 22:32   ` Roman Bolshakov
2019-09-12 18:09 ` [PATCH v2 08/14] qla2xxx: Dual FCP-NVMe target port support Himanshu Madhani
2019-10-10  2:27   ` Martin K. Petersen
2019-09-12 18:09 ` [PATCH v2 09/14] qla2xxx: Add error handling for PLOGI ELS passthrough Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 10/14] qla2xxx: Set remove flag for all VP Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 11/14] qla2xxx: Check for MB timeout while capturing ISP27/28xx FW dump Himanshu Madhani
2019-09-12 20:22   ` Laurence Oberman [this message]
2019-09-12 18:09 ` [PATCH v2 12/14] qla2xxx: Capture FW dump on MPI heartbeat stop event Himanshu Madhani
2019-09-12 20:22   ` Laurence Oberman
2019-09-12 18:09 ` [PATCH v2 13/14] qla2xxx: Improve logging for scan thread Himanshu Madhani
2019-09-12 18:09 ` [PATCH v2 14/14] qla2xxx: Update driver version to 10.01.00.20-k Himanshu Madhani
2019-09-24  3:13 ` [PATCH v2 00/14] qla2xxx: Bug fixes for the driver Martin K. Petersen

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=2b190236d26b4d769ca5d4dedc748f1abf2a276d.camel@redhat.com \
    --to=loberman@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hmadhani@marvell.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).