Skip to contentSkip to conversation

qla2xxx driver bug fixes

PATCH Applied Nilesh Javali 5 participants 28 messages Aug 6, 2020 – Aug 24, 2020

Subsystems (2)
lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

v2 cover qla2xxx driver bug fixes

Martin,

Please apply the attached miscellaneous qla2xxx bug fixes to the scsi tree at your earliest convenience.

v1->v2:
Add patch, "qla2xxx: Revert: Disable T10-DIF feature with FC-NVMe during probe", within the patchset.

Thanks,
Nilesh

Arun Easi (2):
qla2xxx: Allow ql2xextended_error_logging special value 1 to be set
anytime
qla2xxx: Fix WARN_ON in qla_nvme_register_hba

Nilesh Javali (1):
Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Quinn Tran (7):
qla2xxx: flush all sessions on zone disable
qla2xxx: flush IO on zone disable
qla2xxx: Indicate correct supported speeds for Mezz card
qla2xxx: fix login timeout
qla2xxx: reduce noisy debug message
qla2xxx: fix null pointer access while connections disconnect from
subsystem
qla2xxx: Revert: Disable T10-DIF feature with FC-NVMe during probe

Saurav Kashyap (1):
qla2xxx: Check if FW supports MQ before enabling

 drivers/scsi/qla2xxx/qla_dbg.h    |  3 ++
 drivers/scsi/qla2xxx/qla_def.h    |  1 +
 drivers/scsi/qla2xxx/qla_gs.c     | 49 +++++++++++++++++++++++++------
 drivers/scsi/qla2xxx/qla_isr.c    |  4 +--
 drivers/scsi/qla2xxx/qla_mbx.c    |  8 -----
 drivers/scsi/qla2xxx/qla_nvme.c   | 15 +++++++++-
 drivers/scsi/qla2xxx/qla_os.c     |  9 +++---
 drivers/scsi/qla2xxx/qla_target.c |  2 +-
 8 files changed, 66 insertions(+), 25 deletions(-)

base-commit: b12149f2698ce25621ed0413cbb4fc26dd8ab3c1

Signature · 1 line
2.19.0.rc0
author maintainer
#1 lore raw

PATCH v2 1/11 qla2xxx: flush all sessions on zone disable

From: Quinn Tran <[email protected]>

On Zone Disable, certain switch would ignore all commands. This cause timeout for both switch scan command and abort of that command. On detection of this condition, all sessions will be shutdown.

---
 drivers/scsi/qla2xxx/qla_gs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/scsi/qla2xxx/qla_gs.c +12 -0
index 42c3ad27f1cb..c5529da1df59 100644
@@ -3734,6 +3734,18 @@ static void qla2x00_async_gpnft_gnnft_sp_done(srb_t *sp, int res)
 		unsigned long flags;
 		const char *name = sp->name;
 
+		if (res == QLA_OS_TIMER_EXPIRED) {
+			/* switch is ignoring all commands.
+			 * This might be a zone disable behavior.
+			 * This means we hit 64s timeout.
+			 * 22s GPNFT + 44s Abort = 64s
+			 */
+			ql_dbg(ql_dbg_disc, vha, 0xffff,
+			       "%s: Switch Zone check please .\n",
+			       name);
+			qla2x00_mark_all_devices_lost(vha);
+		}
+
 		/*
 		 * We are in an Interrupt context, queue up this
 		 * sp for GNNFT_DONE work. This will allow all
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 1/11
#2 lore raw

Re: [PATCH v2 01/11] qla2xxx: flush all sessions on zone disable

Quoted 44 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

On Zone Disable, certain switch would ignore all commands. This cause timeout for both switch scan command and abort of that command. On detection of this condition, all sessions will be shutdown.

---
drivers/scsi/qla2xxx/qla_gs.c | 12 ++++++++++++

1 file changed, 12 insertions(+)
drivers/scsi/qla2xxx/qla_gs.c +12 -0
index 42c3ad27f1cb..c5529da1df59 100644
@@ -3734,6 +3734,18 @@ static void qla2x00_async_gpnft_gnnft_sp_done(srb_t *sp, int res)
 		unsigned long flags;
 		const char *name = sp->name;
 
+		if (res == QLA_OS_TIMER_EXPIRED) {
+			/* switch is ignoring all commands.
+			 * This might be a zone disable behavior.
+			 * This means we hit 64s timeout.
+			 * 22s GPNFT + 44s Abort = 64s
+			 */
+			ql_dbg(ql_dbg_disc, vha, 0xffff,
+			       "%s: Switch Zone check please .\n",
+			       name);
+			qla2x00_mark_all_devices_lost(vha);
+		}
+
 		/*
 		 * We are in an Interrupt context, queue up this
 		 * sp for GNNFT_DONE work. This will allow all
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#3 lore raw

PATCH v2 2/11 qla2xxx: flush IO on zone disable

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Perform implicit logout to flush io on zone disable.

---
 drivers/scsi/qla2xxx/qla_gs.c | 1 -
 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_gs.c +0 -1
index c5529da1df59..d9ce8d31457a 100644
@@ -3436,7 +3436,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
 			list_for_each_entry(fcport, &vha->vp_fcports, list) {
 				if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) {
 					fcport->scan_state = QLA_FCPORT_SCAN;
-					fcport->logout_on_delete = 0;
 				}
 			}
 			goto login_logout;
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 2/11
#4 lore raw

Re: [PATCH v2 02/11] qla2xxx: flush IO on zone disable

Quoted 30 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

Perform implicit logout to flush io on zone disable.

---
drivers/scsi/qla2xxx/qla_gs.c | 1 -

1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_gs.c +0 -1
index c5529da1df59..d9ce8d31457a 100644
@@ -3436,7 +3436,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
 			list_for_each_entry(fcport, &vha->vp_fcports, list) {
 				if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) {
 					fcport->scan_state = QLA_FCPORT_SCAN;
-					fcport->logout_on_delete = 0;
 				}
 			}
 			goto login_logout;
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#5 lore raw

PATCH v2 3/11 qla2xxx: Indicate correct supported speeds for Mezz card

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Correct the supported speeds for 16G Mezz card.

---
 drivers/scsi/qla2xxx/qla_gs.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +12 -5
index d9ce8d31457a..8c30d9dbb48c 100644
@@ -1505,11 +1505,11 @@ qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd,
 static uint
 qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
 {
+	uint speeds = 0;
+
 	if (IS_CNA_CAPABLE(ha))
 		return FDMI_PORT_SPEED_10GB;
 	if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) {
-		uint speeds = 0;
-
 		if (ha->max_supported_speed == 2) {
 			if (ha->min_supported_speed <= 6)
 				speeds |= FDMI_PORT_SPEED_64GB;
@@ -1536,9 +1536,16 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
 		}
 		return speeds;
 	}
-	if (IS_QLA2031(ha))
-		return FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
-			FDMI_PORT_SPEED_4GB;
+	if (IS_QLA2031(ha)) {
+		if ((ha->pdev->subsystem_vendor == 0x103C) &&
+		    (ha->pdev->subsystem_device == 0x8002)) {
+			speeds = FDMI_PORT_SPEED_16GB;
+		} else {
+			speeds = FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
+				FDMI_PORT_SPEED_4GB;
+		}
+		return speeds;
+	}
 	if (IS_QLA25XX(ha))
 		return FDMI_PORT_SPEED_8GB|FDMI_PORT_SPEED_4GB|
 			FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB;
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 3/11
#6 lore raw

Re: [PATCH v2 03/11] qla2xxx: Indicate correct supported speeds for Mezz card

Quoted 55 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

Correct the supported speeds for 16G Mezz card.

---
drivers/scsi/qla2xxx/qla_gs.c | 17 ++++++++++++-----

1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +0 -0
index d9ce8d31457a..8c30d9dbb48c 100644
@@ -1505,11 +1505,11 @@ qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd,

static uint qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) {

drivers/scsi/qla2xxx/qla_gs.c +2 -0
+	uint speeds = 0;
+
	if (IS_CNA_CAPABLE(ha))
		return FDMI_PORT_SPEED_10GB;
	if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) {
drivers/scsi/qla2xxx/qla_gs.c +0 -2
-		uint speeds = 0;
-
		if (ha->max_supported_speed == 2) {
			if (ha->min_supported_speed <= 6)
				speeds |= FDMI_PORT_SPEED_64GB;
drivers/scsi/qla2xxx/qla_gs.c +10 -3
@@ -1536,9 +1536,16 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
 		}
 		return speeds;
 	}
-	if (IS_QLA2031(ha))
-		return FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
-			FDMI_PORT_SPEED_4GB;
+	if (IS_QLA2031(ha)) {
+		if ((ha->pdev->subsystem_vendor == 0x103C) &&
+		    (ha->pdev->subsystem_device == 0x8002)) {
+			speeds = FDMI_PORT_SPEED_16GB;
+		} else {
+			speeds = FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
+				FDMI_PORT_SPEED_4GB;
+		}
+		return speeds;
+	}
 	if (IS_QLA25XX(ha))
 		return FDMI_PORT_SPEED_8GB|FDMI_PORT_SPEED_4GB|
 			FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB;
Signature · 1 line
2.19.0.rc0

Looks fine.

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#7 lore raw

PATCH v2 4/11 qla2xxx: fix login timeout

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Multipath errors were seen during failback due to login timeout. The remote device sent LOGO, the local host teared down the session and did relogin. The RSCN arrived indicates remote device is going through failover after which the relogin is in a 20s timeout phase. At this point the driver is stuck in the relogin process. Add a fix to delete the session as part of abort/flush the login.

---
 drivers/scsi/qla2xxx/qla_gs.c     | 19 ++++++++++++++++---
 drivers/scsi/qla2xxx/qla_target.c |  2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +16 -3
index 8c30d9dbb48c..2d7a47a2873b 100644
@@ -3536,10 +3536,23 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
 		}
 
 		if (fcport->scan_state != QLA_FCPORT_FOUND) {
+			bool do_delete = false;
+
+			if (fcport->scan_needed &&
+			    fcport->disc_state == DSC_LOGIN_PEND) {
+				/* his cable just got disconnected after we
+				 * send him a login. Do delete to prevent
+				 * timeout
+				 */
+				fcport->logout_on_delete = 1;
+				do_delete = true;
+			}
+
 			fcport->scan_needed = 0;
-			if ((qla_dual_mode_enabled(vha) ||
-				qla_ini_mode_enabled(vha)) &&
-			    atomic_read(&fcport->state) == FCS_ONLINE) {
+			if (((qla_dual_mode_enabled(vha) ||
+			      qla_ini_mode_enabled(vha)) &&
+			    atomic_read(&fcport->state) == FCS_ONLINE) ||
+				do_delete) {
 				if (fcport->loop_id != FC_NO_LOOP_ID) {
 					if (fcport->flags & FCF_FCP2_DEVICE)
 						fcport->logout_on_delete = 0;
drivers/scsi/qla2xxx/qla_target.c +1 -1
index fbb80a043b4f..90289162dbd4 100644
@@ -1270,7 +1270,7 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
 
 	qla24xx_chk_fcp_state(sess);
 
-	ql_dbg(ql_dbg_tgt, sess->vha, 0xe001,
+	ql_dbg(ql_dbg_disc, sess->vha, 0xe001,
 	    "Scheduling sess %p for deletion %8phC\n",
 	    sess, sess->port_name);
 
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 4/11
#8 lore raw

Re: [PATCH v2 04/11] qla2xxx: fix login timeout

Quoted 26 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

Multipath errors were seen during failback due to login timeout. The remote device sent LOGO, the local host teared down the session and did relogin. The RSCN arrived indicates remote device is going through failover after which the relogin is in a 20s timeout phase. At this point the driver is stuck in the relogin process. Add a fix to delete the session as part of abort/flush the login.

---
drivers/scsi/qla2xxx/qla_gs.c | 19 ++++++++++++++++---
drivers/scsi/qla2xxx/qla_target.c | 2 +-

2 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +0 -0
index 8c30d9dbb48c..2d7a47a2873b 100644
@@ -3536,10 +3536,23 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
 		}

drivers/scsi/qla2xxx/qla_gs.c void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) · line 3546

Quoted 10 lines
drivers/scsi/qla2xxx/qla_gs.c +8 -0
 
 		if (fcport->scan_state != QLA_FCPORT_FOUND) {
+			bool do_delete = false;
+
+			if (fcport->scan_needed &&
+			    fcport->disc_state == DSC_LOGIN_PEND) {
+				/* his cable just got disconnected after we
+				 * send him a login. Do delete to prevent
+				 * timeout
+				 */

Small nit.. the comment should describe who is “his” in this case

Quoted 31 lines
drivers/scsi/qla2xxx/qla_gs.c +8 -3
+				fcport->logout_on_delete = 1;
+				do_delete = true;
+			}
+
 			fcport->scan_needed = 0;
-			if ((qla_dual_mode_enabled(vha) ||
-				qla_ini_mode_enabled(vha)) &&
-			    atomic_read(&fcport->state) == FCS_ONLINE) {
+			if (((qla_dual_mode_enabled(vha) ||
+			      qla_ini_mode_enabled(vha)) &&
+			    atomic_read(&fcport->state) == FCS_ONLINE) ||
+				do_delete) {
 				if (fcport->loop_id != FC_NO_LOOP_ID) {
 					if (fcport->flags & FCF_FCP2_DEVICE)
 						fcport->logout_on_delete = 0;
drivers/scsi/qla2xxx/qla_target.c +1 -1
index fbb80a043b4f..90289162dbd4 100644
@@ -1270,7 +1270,7 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
 
 	qla24xx_chk_fcp_state(sess);
 
-	ql_dbg(ql_dbg_tgt, sess->vha, 0xe001,
+	ql_dbg(ql_dbg_disc, sess->vha, 0xe001,
 	    "Scheduling sess %p for deletion %8phC\n",
 	    sess, sess->port_name);
 
Signature · 1 line
2.19.0.rc0

Other than small nit.

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#9 lore raw

PATCH v2 5/11 qla2xxx: reduce noisy debug message

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Update debug level and message for ELS IOCB done.

---
 drivers/scsi/qla2xxx/qla_isr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +2 -2
index 27bcd346af7c..ab5275dbc338 100644
@@ -2024,8 +2024,8 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
 				res = DID_ERROR << 16;
 			}
 		}
-		ql_dbg(ql_dbg_user, vha, 0x503f,
-		    "ELS IOCB Done -%s error hdl=%x comp_status=0x%x error subcode 1=0x%x error subcode 2=0x%x total_byte=0x%x\n",
+		ql_dbg(ql_dbg_disc, vha, 0x503f,
+		    "ELS IOCB Done -%s hdl=%x comp_status=0x%x error subcode 1=0x%x error subcode 2=0x%x total_byte=0x%x\n",
 		    type, sp->handle, comp_status, fw_status[1], fw_status[2],
 		    le32_to_cpu(ese->total_byte_count));
 		goto els_ct_done;
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 5/11
#10 lore raw

Re: [PATCH v2 05/11] qla2xxx: reduce noisy debug message

Quoted 32 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

Update debug level and message for ELS IOCB done.

---
drivers/scsi/qla2xxx/qla_isr.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +2 -2
index 27bcd346af7c..ab5275dbc338 100644
@@ -2024,8 +2024,8 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
 				res = DID_ERROR << 16;
 			}
 		}
-		ql_dbg(ql_dbg_user, vha, 0x503f,
-		    "ELS IOCB Done -%s error hdl=%x comp_status=0x%x error subcode 1=0x%x error subcode 2=0x%x total_byte=0x%x\n",
+		ql_dbg(ql_dbg_disc, vha, 0x503f,
+		    "ELS IOCB Done -%s hdl=%x comp_status=0x%x error subcode 1=0x%x error subcode 2=0x%x total_byte=0x%x\n",
 		    type, sp->handle, comp_status, fw_status[1], fw_status[2],
 		    le32_to_cpu(ese->total_byte_count));
 		goto els_ct_done;
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#11 lore raw

PATCH v2 6/11 qla2xxx: Allow ql2xextended_error_logging special value 1 to be set anytime

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

ql2xextended_error_logging could now be set anytime to 1 to get the default mask value, as opposed to load time only.

---
 drivers/scsi/qla2xxx/qla_dbg.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/qla2xxx/qla_dbg.h +3 -0
index 91eb6901815c..e1d7de63e8f8 100644
@@ -380,5 +380,8 @@ extern int qla24xx_soft_reset(struct qla_hw_data *);
 static inline int
 ql_mask_match(uint level)
 {
+	if (ql2xextended_error_logging == 1)
+		ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
+
 	return (level & ql2xextended_error_logging) == level;
 }
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 6/11
#12 lore raw

Re: [PATCH v2 06/11] qla2xxx: Allow ql2xextended_error_logging special value 1 to be set anytime

Quoted 26 lines · Nilesh Javali

From: Arun Easi <[email protected]>

ql2xextended_error_logging could now be set anytime to 1 to get the default mask value, as opposed to load time only.

---
drivers/scsi/qla2xxx/qla_dbg.h | 3 +++

1 file changed, 3 insertions(+)
drivers/scsi/qla2xxx/qla_dbg.h +0 -0
index 91eb6901815c..e1d7de63e8f8 100644
@@ -380,5 +380,8 @@ extern int qla24xx_soft_reset(struct qla_hw_data *);

static inline int
ql_mask_match(uint level)
{

drivers/scsi/qla2xxx/qla_dbg.h +3 -0
+	if (ql2xextended_error_logging == 1)
+		ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
+
Quoted 5 lines
	return (level & ql2xextended_error_logging) == level;
}
Signature · 1 line
2.19.0.rc0

Looks Good.

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#13 lore raw

PATCH v2 7/11 qla2xxx: Fix WARN_ON in qla_nvme_register_hba

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

qla_nvme_register_hba puts out a warning when there are not enough queue pairs available for FC-NVME.
Just fail the NVME registration rather than a WARNING + Call Trace.

---
 drivers/scsi/qla2xxx/qla_def.h  |  1 +
 drivers/scsi/qla2xxx/qla_nvme.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_def.h +1 -0
index 8c92af5e4390..1bc090d8a71b 100644
@@ -3880,6 +3880,7 @@ struct qla_hw_data {
 		uint32_t	scm_supported_f:1;
 				/* Enabled in Driver */
 		uint32_t	scm_enabled:1;
+		uint32_t	max_req_queue_warned:1;
 	} flags;
 
 	uint16_t max_exchg;
drivers/scsi/qla2xxx/qla_nvme.c +9 -1
index d66d47a0f958..be1d49f5c622 100644
@@ -686,7 +686,15 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	tmpl = &qla_nvme_fc_transport;
 
 	WARN_ON(vha->nvme_local_port);
-	WARN_ON(ha->max_req_queues < 3);
+
+	if (ha->max_req_queues < 3) {
+		if (!ha->flags.max_req_queue_warned)
+			ql_log(ql_log_info, vha, 0x2120,
+			       "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n",
+			       __func__, ha->max_req_queues);
+		ha->flags.max_req_queue_warned = 1;
+		return ret;
+	}
 
 	qla_nvme_fc_transport.max_hw_queues =
 	    min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 7/11
#14 lore raw

Re: [PATCH v2 07/11] qla2xxx: Fix WARN_ON in qla_nvme_register_hba

Quoted 53 lines · Nilesh Javali

From: Arun Easi <[email protected]>

qla_nvme_register_hba puts out a warning when there are not enough queue pairs available for FC-NVME.
Just fail the NVME registration rather than a WARNING + Call Trace.

---
drivers/scsi/qla2xxx/qla_def.h | 1 +
drivers/scsi/qla2xxx/qla_nvme.c | 10 +++++++++-

2 files changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_def.h +1 -0
index 8c92af5e4390..1bc090d8a71b 100644
@@ -3880,6 +3880,7 @@ struct qla_hw_data {
 		uint32_t	scm_supported_f:1;
 				/* Enabled in Driver */
 		uint32_t	scm_enabled:1;
+		uint32_t	max_req_queue_warned:1;
 	} flags;
 
 	uint16_t max_exchg;
drivers/scsi/qla2xxx/qla_nvme.c +9 -1
index d66d47a0f958..be1d49f5c622 100644
@@ -686,7 +686,15 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	tmpl = &qla_nvme_fc_transport;
 
 	WARN_ON(vha->nvme_local_port);
-	WARN_ON(ha->max_req_queues < 3);
+
+	if (ha->max_req_queues < 3) {
+		if (!ha->flags.max_req_queue_warned)
+			ql_log(ql_log_info, vha, 0x2120,
+			       "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n",
+			       __func__, ha->max_req_queues);
+		ha->flags.max_req_queue_warned = 1;
+		return ret;
+	}
 
 	qla_nvme_fc_transport.max_hw_queues =
 	    min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),
Signature · 1 line
2.19.0.rc0

Makes Sense

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#15 lore raw

PATCH v2 8/11 qla2xxx: Check if FW supports MQ before enabling

In reply to Nilesh Javali

From: Saurav Kashyap <[email protected]>

OS boot during Boot from SAN was stuck at dracut emergency shell after enabling nvme driver parameter. For non MQ support the driver was enabling MQ. Add a check to confirm if FW supports MQ.

---
 drivers/scsi/qla2xxx/qla_os.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +5 -0
index 9b59f032a569..fda812b9b564 100644
@@ -2017,6 +2017,11 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
 	/* Determine queue resources */
 	ha->max_req_queues = ha->max_rsp_queues = 1;
 	ha->msix_count = QLA_BASE_VECTORS;
+
+	/* Check if FW supports MQ or not */
+	if (!(ha->fw_attributes & BIT_6))
+		goto mqiobase_exit;
+
 	if (!ql2xmqsupport || !ql2xnvmeenable ||
 	    (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
 		goto mqiobase_exit;
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 8/11
#16 lore raw

Re: [PATCH v2 08/11] qla2xxx: Check if FW supports MQ before enabling

Quoted 35 lines · Nilesh Javali

From: Saurav Kashyap <[email protected]>

OS boot during Boot from SAN was stuck at dracut emergency shell after enabling nvme driver parameter. For non MQ support the driver was enabling MQ. Add a check to confirm if FW supports MQ.

---
drivers/scsi/qla2xxx/qla_os.c | 5 +++++

1 file changed, 5 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +5 -0
index 9b59f032a569..fda812b9b564 100644
@@ -2017,6 +2017,11 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
 	/* Determine queue resources */
 	ha->max_req_queues = ha->max_rsp_queues = 1;
 	ha->msix_count = QLA_BASE_VECTORS;
+
+	/* Check if FW supports MQ or not */
+	if (!(ha->fw_attributes & BIT_6))
+		goto mqiobase_exit;
+
 	if (!ql2xmqsupport || !ql2xnvmeenable ||
 	    (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
 		goto mqiobase_exit;
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#17 lore raw

PATCH v2 9/11 qla2xxx: fix null pointer access while connections disconnect from subsystem

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

NVMEAsync command is being submitted to QLA, while the same nvme controller is in the middle of reset. The reset path has deleted the association and freed aen_op->fcp_req.private. Add a check for this private pointer before issuing the command.

...
6 [ffffb656ca11fce0] page_fault at ffffffff8c00114e

    [exception RIP: qla_nvme_post_cmd+394]
    RIP: ffffffffc0d012ba  RSP: ffffb656ca11fd98  RFLAGS: 00010206
    RAX: ffff8fb039eda228  RBX: ffff8fb039eda200  RCX: 00000000000da161
    RDX: ffffffffc0d4d0f0  RSI: ffffffffc0d26c9b  RDI: ffff8fb039eda220
    RBP: 0000000000000013   R8: ffff8fb47ff6aa80   R9: 0000000000000002
    R10: 0000000000000000  R11: ffffb656ca11fdc8  R12: ffff8fb27d04a3b0
    R13: ffff8fc46dd98a58  R14: 0000000000000000  R15: ffff8fc4540f0000
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

7 [ffffb656ca11fe08] nvme_fc_start_fcp_op at ffffffffc0241568 [nvme_fc] 8 [ffffb656ca11fe50] nvme_fc_submit_async_event at ffffffffc0241901 [nvme_fc] 9 [ffffb656ca11fe68] nvme_async_event_work at ffffffffc014543d [nvme_core]
10 [ffffb656ca11fe98] process_one_work at ffffffff8b6cd437
11 [ffffb656ca11fed8] worker_thread at ffffffff8b6cdcef
12 [ffffb656ca11ff10] kthread at ffffffff8b6d3402
13 [ffffb656ca11ff50] ret_from_fork at ffffffff8c000255

--
PID: 37824 TASK: ffff8fb033063d80 CPU: 20 COMMAND: "kworker/u97:451"
0 [ffffb656ce1abc28] __schedule at ffffffff8be629e3
1 [ffffb656ce1abcc8] schedule at ffffffff8be62fe8
2 [ffffb656ce1abcd0] schedule_timeout at ffffffff8be671ed
3 [ffffb656ce1abd70] wait_for_completion at ffffffff8be639cf
4 [ffffb656ce1abdd0] flush_work at ffffffff8b6ce2d5
5 [ffffb656ce1abe70] nvme_stop_ctrl at ffffffffc0144900 [nvme_core] 6 [ffffb656ce1abe80] nvme_fc_reset_ctrl_work at ffffffffc0243445 [nvme_fc] 7 [ffffb656ce1abe98] process_one_work at ffffffff8b6cd437
8 [ffffb656ce1abed8] worker_thread at ffffffff8b6cdb50
9 [ffffb656ce1abf10] kthread at ffffffff8b6d3402
10 [ffffb656ce1abf50] ret_from_fork at ffffffff8c000255

---
 drivers/scsi/qla2xxx/qla_nvme.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +5 -0
index be1d49f5c622..f451683db75c 100644
@@ -535,6 +535,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	struct nvme_private *priv = fd->private;
 	struct qla_nvme_rport *qla_rport = rport->private;
 
+	if (!priv) {
+		/* nvme association has been torn down */
+		return rval;
+	}
+
 	fcport = qla_rport->fcport;
 
 	if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 9/11
#18 lore raw

Re: [PATCH v2 09/11] qla2xxx: fix null pointer access while connections disconnect from subsystem

Quoted 68 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

NVMEAsync command is being submitted to QLA, while the same nvme controller is in the middle of reset. The reset path has deleted the association and freed aen_op->fcp_req.private. Add a check for this private pointer before issuing the command.

...
6 [ffffb656ca11fce0] page_fault at ffffffff8c00114e
[exception RIP: qla_nvme_post_cmd+394]

   RIP: ffffffffc0d012ba  RSP: ffffb656ca11fd98  RFLAGS: 00010206
   RAX: ffff8fb039eda228  RBX: ffff8fb039eda200  RCX: 00000000000da161
   RDX: ffffffffc0d4d0f0  RSI: ffffffffc0d26c9b  RDI: ffff8fb039eda220
   RBP: 0000000000000013   R8: ffff8fb47ff6aa80   R9: 0000000000000002
   R10: 0000000000000000  R11: ffffb656ca11fdc8  R12: ffff8fb27d04a3b0
   R13: ffff8fc46dd98a58  R14: 0000000000000000  R15: ffff8fc4540f0000
   ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

7 [ffffb656ca11fe08] nvme_fc_start_fcp_op at ffffffffc0241568 [nvme_fc] 8 [ffffb656ca11fe50] nvme_fc_submit_async_event at ffffffffc0241901 [nvme_fc] 9 [ffffb656ca11fe68] nvme_async_event_work at ffffffffc014543d [nvme_core] 10 [ffffb656ca11fe98] process_one_work at ffffffff8b6cd437
11 [ffffb656ca11fed8] worker_thread at ffffffff8b6cdcef
12 [ffffb656ca11ff10] kthread at ffffffff8b6d3402
13 [ffffb656ca11ff50] ret_from_fork at ffffffff8c000255

--
PID: 37824 TASK: ffff8fb033063d80 CPU: 20 COMMAND: "kworker/u97:451" 0 [ffffb656ce1abc28] __schedule at ffffffff8be629e3
1 [ffffb656ce1abcc8] schedule at ffffffff8be62fe8
2 [ffffb656ce1abcd0] schedule_timeout at ffffffff8be671ed
3 [ffffb656ce1abd70] wait_for_completion at ffffffff8be639cf
4 [ffffb656ce1abdd0] flush_work at ffffffff8b6ce2d5
5 [ffffb656ce1abe70] nvme_stop_ctrl at ffffffffc0144900 [nvme_core] 6 [ffffb656ce1abe80] nvme_fc_reset_ctrl_work at ffffffffc0243445 [nvme_fc] 7 [ffffb656ce1abe98] process_one_work at ffffffff8b6cd437
8 [ffffb656ce1abed8] worker_thread at ffffffff8b6cdb50
9 [ffffb656ce1abf10] kthread at ffffffff8b6d3402
10 [ffffb656ce1abf50] ret_from_fork at ffffffff8c000255

---
drivers/scsi/qla2xxx/qla_nvme.c | 5 +++++

1 file changed, 5 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +5 -0
index be1d49f5c622..f451683db75c 100644
@@ -535,6 +535,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	struct nvme_private *priv = fd->private;
 	struct qla_nvme_rport *qla_rport = rport->private;
 
+	if (!priv) {
+		/* nvme association has been torn down */
+		return rval;
+	}
+
 	fcport = qla_rport->fcport;
 
 	if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#19 lore raw

PATCH v2 10/11 Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

In reply to Nilesh Javali

FCoE adapter initialization failed for ISP8021.

This reverts commit 3cb182b3fa8b7a61f05c671525494697cba39c6a.

---
 drivers/scsi/qla2xxx/qla_mbx.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +0 -8
index 73883435ab58..93aafef7f21c 100644
@@ -334,14 +334,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
 			if (time_after(jiffies, wait_time))
 				break;
 
-			/*
-			 * Check if it's UNLOADING, cause we cannot poll in
-			 * this case, or else a NULL pointer dereference
-			 * is triggered.
-			 */
-			if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)))
-				return QLA_FUNCTION_TIMEOUT;
-
 			/* Check for pending interrupts. */
 			qla2x00_poll(ha->rsp_q_map[0]);
 
Signature · 1 line
2.19.0.rc0
#20 lore raw

Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Quoted 3 lines · Nilesh Javali

FCoE adapter initialization failed for ISP8021.

This reverts commit 3cb182b3fa8b7a61f05c671525494697cba39c6a.

But wouldn't this revert not also bring back the crash from 3cb182b3fa8b ("scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"):

This patch fixes a crash on qla2x00_mailbox_command caused when the driver is on UNLOADING state and tries to call qla2x00_poll, which triggers a NULL pointer dereference.

#21 lore raw

RE: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Hi Daniel,

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Daniel Wagner
Sent: Friday, August 7, 2020 1:24 PM
To: Nilesh Javali <[email protected]>
Cc: [email protected]; [email protected]; GR-QLogic- Storage-Upstream <[email protected]>
Subject: Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Quoted 7 lines
Quoted 3 lines · Nilesh Javali

FCoE adapter initialization failed for ISP8021.

This reverts commit 3cb182b3fa8b7a61f05c671525494697cba39c6a.

But wouldn't this revert not also bring back the crash from 3cb182b3fa8b ("scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"):

This patch was never there in OOT driver, and we never hit an original problem. I have tested this patch myself and this have gone through test cycles as well. If an original issue is hit again, we will do an analysis and provide the fix. This revert fixes a load issues with ISP82XX.

Thanks,
~Saurav

Quoted 5 lines

This patch fixes a crash on qla2x00_mailbox_command caused when the
driver
is on UNLOADING state and tries to call qla2x00_poll, which triggers a NULL pointer dereference.

Reviewed-by
#22 lore raw

Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Quoted 24 lines · Saurav Kashyap

Hi Daniel,

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Daniel Wagner
Sent: Friday, August 7, 2020 1:24 PM
To: Nilesh Javali <[email protected]>
Cc: [email protected]; [email protected]; GR-QLogic- Storage-Upstream <[email protected]>
Subject: Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Quoted 7 lines
Quoted 3 lines · Nilesh Javali

FCoE adapter initialization failed for ISP8021.

This reverts commit 3cb182b3fa8b7a61f05c671525494697cba39c6a.

But wouldn't this revert not also bring back the crash from 3cb182b3fa8b ("scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"):

Quoted 12 lines

This patch was never there in OOT driver, and we never hit an original problem. I have tested this patch myself and this have gone through test cycles as well. If an original issue is hit again, we will do an analysis and provide the fix. This revert fixes a load issues with ISP82XX.

Thanks,
~Saurav

Quoted 5 lines

This patch fixes a crash on qla2x00_mailbox_command caused when the
driver
is on UNLOADING state and tries to call qla2x00_poll, which triggers a NULL pointer dereference.

If my memory serves me right. This crash reported was never reproduced during my testing when this patch was submitted and nor did it cause any issue. So I am fine with this change being reverted.

--
Himanshu Madhani Oracle Linux Engineering

#23 lore raw

Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Hi Saurav,

Sorry for the late response, was on holiday.

Quoted 4 lines · Saurav Kashyap

This patch was never there in OOT driver, and we never hit an original problem. I have tested this patch myself and this have gone through test cycles as well. If an original issue is hit again, we will do an analysis and provide the fix. This revert fixes a load issues with ISP82XX.

Ok. Maybe this info could be added to the commit message (next time).

Thanks,
Daniel

#24 lore raw

RE: [EXT] Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

Quoted 21 lines

-----Original Message-----
From: Daniel Wagner <[email protected]>
Sent: Monday, August 24, 2020 1:34 PM
To: Himanshu Madhani <[email protected]>
Cc: Saurav Kashyap <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; linux- [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic-Storage- [email protected]>
Subject: [EXT] Re: [PATCH v2 10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"

External Email

----------------------------------------------------------------------
Hi Saurav,

Sorry for the late response, was on holiday.

Quoted 1 line

On Aug 10, 2020, at 4:55 AM, Saurav Kashyap <[email protected]>

Quoted 8 lines
Quoted 1 line · wrote:

This patch was never there in OOT driver, and we never hit an original

problem. I have tested this patch myself

Quoted 1 line

and this have gone through test cycles as well. If an original issue is hit again,

we will do an analysis and provide

Quoted 1 line

the fix. This revert fixes a load issues with ISP82XX.

Ok. Maybe this info could be added to the commit message (next time).

Make sense.

Thanks,
~Saurav

Quoted 5 lines

Thanks,
Daniel

author maintainer
#25 lore raw

PATCH v2 11/11 qla2xxx: Revert: Disable T10-DIF feature with FC-NVMe during probe

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

FCP T10-PI and NVME features are independent of each other. This patch allows both features to co-exist.

Fixes 5da05a26b8305a6 ("scsi: qla2xxx: Disable T10-DIF feature with FC-NVMe during probe")
---
 drivers/scsi/qla2xxx/qla_os.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +0 -4
index fda812b9b564..8da00ba54aec 100644
@@ -2834,10 +2834,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* This may fail but that's ok */
 	pci_enable_pcie_error_reporting(pdev);
 
-	/* Turn off T10-DIF when FC-NVMe is enabled */
-	if (ql2xnvmeenable)
-		ql2xenabledif = 0;
-
 	ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
 	if (!ha) {
 		ql_log_pci(ql_log_fatal, pdev, 0x0009,
Signature · 1 line
2.19.0.rc0
Reviewed-by on v2 11/11
#26 lore raw

Re: [PATCH v2 11/11] qla2xxx: Revert: Disable T10-DIF feature with FC-NVMe during probe

Quoted 34 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

FCP T10-PI and NVME features are independent of each other. This patch allows both features to co-exist.

Fixes 5da05a26b8305a6 ("scsi: qla2xxx: Disable T10-DIF feature with FC-NVMe during probe")

---
drivers/scsi/qla2xxx/qla_os.c | 4 ----

1 file changed, 4 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +0 -4
index fda812b9b564..8da00ba54aec 100644
@@ -2834,10 +2834,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* This may fail but that's ok */
 	pci_enable_pcie_error_reporting(pdev);
 
-	/* Turn off T10-DIF when FC-NVMe is enabled */
-	if (ql2xnvmeenable)
-		ql2xenabledif = 0;
-
 	ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
 	if (!ha) {
 		ql_log_pci(ql_log_fatal, pdev, 0x0009,
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

#27 lore raw
In reply to Nilesh Javali
Quoted 10 lines · Nilesh Javali

Martin,

Please apply the attached miscellaneous qla2xxx bug fixes to the scsi tree at your earliest convenience.

v1->v2:
Add patch, "qla2xxx: Revert: Disable T10-DIF feature with FC-NVMe during probe", within the patchset.

[...]

Applied to 5.9/scsi-fixes, thanks!

[01/11] scsi: qla2xxx: Flush all sessions on zone disable

        https://git.kernel.org/mkp/scsi/c/10ae30ba6648
[02/11] scsi: qla2xxx: Flush I/O on zone disable
        https://git.kernel.org/mkp/scsi/c/a117579d0205
[03/11] scsi: qla2xxx: Indicate correct supported speeds for Mezz card
        https://git.kernel.org/mkp/scsi/c/4709272f6327
[04/11] scsi: qla2xxx: Fix login timeout
        https://git.kernel.org/mkp/scsi/c/abb31aeaa9b2
[05/11] scsi: qla2xxx: Reduce noisy debug message
        https://git.kernel.org/mkp/scsi/c/81b9d1e19d62
[06/11] scsi: qla2xxx: Allow ql2xextended_error_logging special value 1 to be set anytime
        https://git.kernel.org/mkp/scsi/c/49030003a38a
[07/11] scsi: qla2xxx: Fix WARN_ON in qla_nvme_register_hba
        https://git.kernel.org/mkp/scsi/c/897d68eb816b
[08/11] scsi: qla2xxx: Check if FW supports MQ before enabling
        https://git.kernel.org/mkp/scsi/c/dffa11453313
[09/11] scsi: qla2xxx: Fix null pointer access during disconnect from subsystem
        https://git.kernel.org/mkp/scsi/c/83949613fac6
[10/11] Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"
        https://git.kernel.org/mkp/scsi/c/de7e6194301a
[11/11] Revert "scsi: qla2xxx: Disable T10-DIF feature with FC-NVMe during probe"
        https://git.kernel.org/mkp/scsi/c/dca93232b361
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering