Skip to contentSkip to conversation

qla2xxx driver bug fixes

PATCH Applied Nilesh Javali 3 participants 15 messages Sep 8, 2021 – Sep 22, 2021

Subsystems (2)
lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

v2 cover qla2xxx driver bug fixes

Martin,

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

v2:
- Added Fixes and Cc tags for few fixes
- Replace hb with heartbeat to make more readable
- Added Reviewed-by tag

Thanks,
Nilesh

Arun Easi (2):
qla2xxx: Fix crash in NVME abort path
qla2xxx: Fix kernel crash when accessing port_speed sysfs file

Bikash Hazarika (1):
qla2xxx: Add support for mailbox passthru

Manish Rangankar (1):
qla2xxx: Move heart beat handling from dpc thread to workqueue

Nilesh Javali (1):
qla2xxx: Update version to 10.02.07.100-k

Quinn Tran (2):
qla2xxx: edif: Use link event to wake up app
qla2xxx: Fix use after free in eh_abort path

Saurav Kashyap (2):
qla2xxx: Display 16G only as supported speeds for 3830c card
qla2xxx: Check for firmware capability before creating QPair

Shreyas Deodhar (1):
qla2xxx: Call process_response_queue() in Tx path

 drivers/scsi/qla2xxx/qla_attr.c    | 24 +++++++-
 drivers/scsi/qla2xxx/qla_bsg.c     | 48 ++++++++++++++++
 drivers/scsi/qla2xxx/qla_bsg.h     |  7 +++
 drivers/scsi/qla2xxx/qla_def.h     |  4 +-
 drivers/scsi/qla2xxx/qla_gbl.h     |  4 ++
 drivers/scsi/qla2xxx/qla_gs.c      |  3 +-
 drivers/scsi/qla2xxx/qla_init.c    | 17 +++---
 drivers/scsi/qla2xxx/qla_mbx.c     | 33 +++++++++++
 drivers/scsi/qla2xxx/qla_nvme.c    | 20 ++++++-
 drivers/scsi/qla2xxx/qla_os.c      | 90 +++++++++++++++---------------
 drivers/scsi/qla2xxx/qla_version.h |  6 +-
 11 files changed, 193 insertions(+), 63 deletions(-)

base-commit: 9b5ac8ab4e8bf5636d1d425aee68ddf45af12057

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

PATCH v2 1/10 qla2xxx: Add support for mailbox passthru

From: Bikash Hazarika <[email protected]>

This interface will allow user space application(s) to send a mailbox command to the FW.

---
 drivers/scsi/qla2xxx/qla_bsg.c | 48 ++++++++++++++++++++++++++++++++++
 drivers/scsi/qla2xxx/qla_bsg.h |  7 +++++
 drivers/scsi/qla2xxx/qla_gbl.h |  4 +++
 drivers/scsi/qla2xxx/qla_mbx.c | 33 +++++++++++++++++++++++
 4 files changed, 92 insertions(+)
drivers/scsi/qla2xxx/qla_bsg.c +48 -0
index 4b5d28d89d69..0c33fb0de21a 100644
@@ -2877,6 +2877,9 @@ qla2x00_process_vendor_specific(struct scsi_qla_host *vha, struct bsg_job *bsg_j
 	case QL_VND_MANAGE_HOST_PORT:
 		return qla2x00_manage_host_port(bsg_job);
 
+	case QL_VND_MBX_PASSTHRU:
+		return qla2x00_mailbox_passthru(bsg_job);
+
 	default:
 		return -ENOSYS;
 	}
@@ -3013,3 +3016,48 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
 	sp->free(sp);
 	return 0;
 }
+
+int qla2x00_mailbox_passthru(struct bsg_job *bsg_job)
+{
+	struct fc_bsg_reply *bsg_reply = bsg_job->reply;
+	scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
+	int ret = -EINVAL;
+	int ptsize = sizeof(struct qla_mbx_passthru);
+	struct qla_mbx_passthru *req_data = NULL;
+	uint32_t req_data_len;
+
+	req_data_len = bsg_job->request_payload.payload_len;
+	if (req_data_len != ptsize) {
+		ql_log(ql_log_warn, vha, 0xf0a3, "req_data_len invalid.\n");
+		return -EIO;
+	}
+	req_data = kzalloc(ptsize, GFP_KERNEL);
+	if (!req_data) {
+		ql_log(ql_log_warn, vha, 0xf0a4,
+		       "req_data memory allocation failure.\n");
+		return -ENOMEM;
+	}
+
+	/* Copy the request buffer in req_data */
+	sg_copy_to_buffer(bsg_job->request_payload.sg_list,
+			  bsg_job->request_payload.sg_cnt, req_data, ptsize);
+	ret = qla_mailbox_passthru(vha, req_data->mbx_in, req_data->mbx_out);
+
+	/* Copy the req_data in  request buffer */
+	sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+			    bsg_job->reply_payload.sg_cnt, req_data, ptsize);
+
+	bsg_reply->reply_payload_rcv_len = ptsize;
+	if (ret == QLA_SUCCESS)
+		bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK;
+	else
+		bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_ERR;
+
+	bsg_job->reply_len = sizeof(*bsg_job->reply);
+	bsg_reply->result = DID_OK << 16;
+	bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len);
+
+	kfree(req_data);
+
+	return ret;
+}
drivers/scsi/qla2xxx/qla_bsg.h +7 -0
index dd793cf8bc1e..0f8a4c7e52a2 100644
@@ -36,6 +36,7 @@
 #define QL_VND_GET_HOST_STATS		0x24
 #define QL_VND_GET_TGT_STATS		0x25
 #define QL_VND_MANAGE_HOST_PORT		0x26
+#define QL_VND_MBX_PASSTHRU		0x2B
 
 /* BSG Vendor specific subcode returns */
 #define EXT_STATUS_OK			0
@@ -187,6 +188,12 @@ struct qla_port_param {
 	uint16_t speed;
 } __attribute__ ((packed));
 
+struct qla_mbx_passthru {
+	uint16_t reserved1[2];
+	uint16_t mbx_in[32];
+	uint16_t mbx_out[32];
+	uint32_t reserved2[16];
+} __packed;
 
 /* FRU VPD */
 
drivers/scsi/qla2xxx/qla_gbl.h +4 -0
index 1c3f055d41b8..8aadcdeca6cb 100644
@@ -662,9 +662,13 @@ extern int qla2xxx_get_vpd_field(scsi_qla_host_t *, char *, char *, size_t);
 
 extern void qla2xxx_flash_npiv_conf(scsi_qla_host_t *);
 extern int qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *);
+extern int qla2x00_mailbox_passthru(struct bsg_job *bsg_job);
 int __qla_copy_purex_to_buffer(struct scsi_qla_host *vha, void **pkt,
 	struct rsp_que **rsp, u8 *buf, u32 buf_len);
 
+int qla_mailbox_passthru(scsi_qla_host_t *vha, uint16_t *mbx_in,
+			 uint16_t *mbx_out);
+
 /*
  * Global Function Prototypes in qla_dbg.c source file.
  */
drivers/scsi/qla2xxx/qla_mbx.c +33 -0
index 7811c4952035..9eb41dd39043 100644
@@ -7011,3 +7011,36 @@ void qla_no_op_mb(struct scsi_qla_host *vha)
 			"Failed %s %x\n", __func__, rval);
 	}
 }
+
+int qla_mailbox_passthru(scsi_qla_host_t *vha,
+			 uint16_t *mbx_in, uint16_t *mbx_out)
+{
+	mbx_cmd_t mc;
+	mbx_cmd_t *mcp = &mc;
+	int rval = -EINVAL;
+
+	memset(&mc, 0, sizeof(mc));
+	/* Receiving all 32 register's contents */
+	memcpy(&mcp->mb, (char *)mbx_in, (32 * sizeof(uint16_t)));
+
+	mcp->out_mb = 0xFFFFFFFF;
+	mcp->in_mb = 0xFFFFFFFF;
+
+	mcp->tov = MBX_TOV_SECONDS;
+	mcp->flags = 0;
+	mcp->bufp = NULL;
+
+	rval = qla2x00_mailbox_command(vha, mcp);
+
+	if (rval != QLA_SUCCESS) {
+		ql_dbg(ql_dbg_mbx, vha, 0xf0a2,
+			"Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
+	} else {
+		ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0xf0a3, "Done %s.\n",
+		       __func__);
+		/* passing all 32 register's contents */
+		memcpy(mbx_out, &mcp->mb, 32 * sizeof(uint16_t));
+	}
+
+	return rval;
+}
Signature · 1 line
2.19.0.rc0
#2 lore raw

Re: [PATCH v2 01/10] qla2xxx: Add support for mailbox passthru

drivers/scsi/qla2xxx/qla_bsg.h struct qla_port_param { · line 196

Quoted 6 lines · Nilesh Javali
drivers/scsi/qla2xxx/qla_bsg.h +6 -0
+struct qla_mbx_passthru {
+	uint16_t reserved1[2];
+	uint16_t mbx_in[32];
+	uint16_t mbx_out[32];
+	uint32_t reserved2[16];
+} __packed;

Why does this data structure start with 4 reserved bytes?

Thanks,

Bart.

author maintainer
#3 lore raw

RE: [EXT] Re: [PATCH v2 01/10] qla2xxx: Add support for mailbox passthru

Bart,

Quoted 14 lines

-----Original Message-----
From: Bart Van Assche <[email protected]>
Sent: Wednesday, September 8, 2021 11:58 PM
To: Nilesh Javali <[email protected]>; [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v2 01/10] qla2xxx: Add support for mailbox passthru

External Email

----------------------------------------------------------------------
On 9/8/21 9:46 AM, Nilesh Javali wrote:

Quoted 8 lines

drivers/scsi/qla2xxx/qla_bsg.h struct qla_port_param { · line 196

Quoted 6 lines
drivers/scsi/qla2xxx/qla_bsg.h +6 -0
+struct qla_mbx_passthru {
+	uint16_t reserved1[2];
+	uint16_t mbx_in[32];
+	uint16_t mbx_out[32];
+	uint32_t reserved2[16];
+} __packed;

Why does this data structure start with 4 reserved bytes?

Specifically, more than the driver, the reserved bytes would be used by the application, and driver uses only the mbx_in and mbx_out fields to access 32 register content.

Thanks,
Nilesh

author maintainer
#4 lore raw

PATCH v2 2/10 qla2xxx: Display 16G only as supported speeds for 3830c card

In reply to Nilesh Javali

From: Saurav Kashyap <[email protected]>

This card is unique and doesn't support lower speeds, hence update the fdmi field to display 16G only.

---
 drivers/scsi/qla2xxx/qla_gs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_gs.c +2 -1
index ebc8fdb0b43d..28b574e20ef3 100644
@@ -1537,7 +1537,8 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
 	}
 	if (IS_QLA2031(ha)) {
 		if ((ha->pdev->subsystem_vendor == 0x103C) &&
-		    (ha->pdev->subsystem_device == 0x8002)) {
+		    ((ha->pdev->subsystem_device == 0x8002) ||
+		    (ha->pdev->subsystem_device == 0x8086))) {
 			speeds = FDMI_PORT_SPEED_16GB;
 		} else {
 			speeds = FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
Signature · 1 line
2.19.0.rc0
author maintainer
#5 lore raw

PATCH v2 3/10 qla2xxx: Check for firmware capability before creating QPair

In reply to Nilesh Javali

From: Saurav Kashyap <[email protected]>

Add firmware capability check of multiQ specific for ISP25XX before creating qpair.

---
 drivers/scsi/qla2xxx/qla_os.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +4 -0
index d2e40aaba734..a1e861ecfc01 100644
@@ -3364,6 +3364,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	    host->can_queue, base_vha->req,
 	    base_vha->mgmt_svr_loop_id, host->sg_tablesize);
 
+	/* Check if FW supports MQ or not for ISP25xx */
+	if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6))
+		ha->mqenable = 0;
+
 	if (ha->mqenable) {
 		bool startit = false;
 
Signature · 1 line
2.19.0.rc0
author maintainer
#6 lore raw

PATCH v2 4/10 qla2xxx: Fix crash in NVME abort path

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

System crash was seen when I/O was run against a NVME target and when I/O aborts were occurring.

Crash stack is:

    -- relevant crash stack --
    BUG: kernel NULL pointer dereference, address: 0000000000000010
    :
    #6 [ffffae1f8666bdd0] page_fault at ffffffffa740122e
       [exception RIP: qla_nvme_abort_work+339]
       RIP: ffffffffc0f592e3  RSP: ffffae1f8666be80  RFLAGS: 00010297
       RAX: 0000000000000000  RBX: ffff9b581fc8af80  RCX: ffffffffc0f83bd0
       RDX: 0000000000000001  RSI: ffff9b5839c6c7c8  RDI: 0000000008000000
       RBP: ffff9b6832f85000   R8: ffffffffc0f68160   R9: ffffffffc0f70652
       R10: ffffae1f862ffdc8  R11: 0000000000000300  R12: 000000000000010d
       R13: 0000000000000000  R14: ffff9b5839cea000  R15: 0ffff9b583fab170
       ORIG_RAX: ffffffffffffffff   CS: 0010  SS: 0018
    #7 [ffffae1f8666be98] process_one_work at ffffffffa6aba184
    #8 [ffffae1f8666bed8] worker_thread at ffffffffa6aba39d
    #9 [ffffae1f8666bf10] kthread at ffffffffa6ac06ed

The crash was due to a stale SRB structure access after it was aborted. Fixed the issue by removing stale access.

Fixes 2cabf10dbbe38 (“scsi: qla2xxx: Fix hang on NVMe command timeouts ”)
---
 drivers/scsi/qla2xxx/qla_nvme.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +12 -2
index 1c5da2dbd6f9..877b2b625020 100644
@@ -228,6 +228,8 @@ static void qla_nvme_abort_work(struct work_struct *work)
 	fc_port_t *fcport = sp->fcport;
 	struct qla_hw_data *ha = fcport->vha->hw;
 	int rval, abts_done_called = 1;
+	bool io_wait_for_abort_done;
+	uint32_t handle;
 
 	ql_dbg(ql_dbg_io, fcport->vha, 0xffff,
 	       "%s called for sp=%p, hndl=%x on fcport=%p desc=%p deleted=%d\n",
@@ -244,12 +246,20 @@ static void qla_nvme_abort_work(struct work_struct *work)
 		goto out;
 	}
 
+	/*
+	 * sp may not be valid after abort_command if return code is either
+	 * SUCCESS or ERR_FROM_FW codes, so cache the value here.
+	 */
+	io_wait_for_abort_done = ql2xabts_wait_nvme &&
+					QLA_ABTS_WAIT_ENABLED(sp);
+	handle = sp->handle;
+
 	rval = ha->isp_ops->abort_command(sp);
 
 	ql_dbg(ql_dbg_io, fcport->vha, 0x212b,
 	    "%s: %s command for sp=%p, handle=%x on fcport=%p rval=%x\n",
 	    __func__, (rval != QLA_SUCCESS) ? "Failed to abort" : "Aborted",
-	    sp, sp->handle, fcport, rval);
+	    sp, handle, fcport, rval);
 
 	/*
 	 * If async tmf is enabled, the abort callback is called only on
@@ -264,7 +274,7 @@ static void qla_nvme_abort_work(struct work_struct *work)
 	 * are waited until ABTS complete. This kref is decreased
 	 * at qla24xx_abort_sp_done function.
 	 */
-	if (abts_done_called && ql2xabts_wait_nvme && QLA_ABTS_WAIT_ENABLED(sp))
+	if (abts_done_called && io_wait_for_abort_done)
 		return;
 out:
 	/* kref_get was done before work was schedule. */
Signature · 1 line
2.19.0.rc0
author maintainer
#7 lore raw

PATCH v2 5/10 qla2xxx: edif: Use link event to wake up app

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Authentication application may be running and in the past tried to probe driver (app_start) but unsuccessful. This could be due to the bsg layer not ready to service the request. On successful link up, driver will use the netlink Link Up event to notify app to retry the app_start call.

In another case, app does not poll for new npiv host. This link up event would notify app of the presence of a new SCSI Host.

Fixes 4de067e5df12c ("scsi: qla2xxx: edif: Add N2N support for EDIF”)
---
 drivers/scsi/qla2xxx/qla_init.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +7 -8
index 1e4e3e83b5c7..c6b3d0e7489e 100644
@@ -5335,15 +5335,14 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
 			    "LOOP READY.\n");
 			ha->flags.fw_init_done = 1;
 
+			/*
+			 * use link up to wake up app to get ready for
+			 * authentication.
+			 */
 			if (ha->flags.edif_enabled &&
-			    !(vha->e_dbell.db_flags & EDB_ACTIVE) &&
-			    N2N_TOPO(vha->hw)) {
-				/*
-				 * use port online to wake up app to get ready
-				 * for authentication
-				 */
-				qla2x00_post_aen_work(vha, FCH_EVT_PORT_ONLINE, 0);
-			}
+			    !(vha->e_dbell.db_flags & EDB_ACTIVE))
+				qla2x00_post_aen_work(vha, FCH_EVT_LINKUP,
+						      ha->link_data_rate);
 
 			/*
 			 * Process any ATIO queue entries that came in
Signature · 1 line
2.19.0.rc0
author maintainer
#8 lore raw

PATCH v2 6/10 qla2xxx: Fix kernel crash when accessing port_speed sysfs file

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

Kernel crashes when accessing port_speed sysfs file. The issue happens on a CNA when the local array was accessed beyond bounds. Fix this by changing the lookup.

BUG: unable to handle kernel paging request at 0000000000004000
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
CPU: 15 PID: 455213 Comm: sosreport Kdump: loaded Not tainted
4.18.0-305.7.1.el8_4.x86_64 #1
RIP: 0010:string_nocheck+0x12/0x70
Code: 00 00 4c 89 e2 be 20 00 00 00 48 89 ef e8 86 9a 00 00 4c 01
e3 eb 81 90 49 89 f2 48 89 ce 48 89 f8 48 c1 fe 30 66 85 f6 74 4f <44> 0f b6 0a
45 84 c9 74 46 83 ee 01 41 b8 01 00 00 00 48 8d 7c 37
RSP: 0018:ffffb5141c1afcf0 EFLAGS: 00010286
RAX: ffff8bf4009f8000 RBX: ffff8bf4009f9000 RCX: ffff0a00ffffff04
RDX: 0000000000004000 RSI: ffffffffffffffff RDI: ffff8bf4009f8000
RBP: 0000000000004000 R08: 0000000000000001 R09: ffffb5141c1afb84
R10: ffff8bf4009f9000 R11: ffffb5141c1afce6 R12: ffff0a00ffffff04
R13: ffffffffc08e21aa R14: 0000000000001000 R15: ffffffffc08e21aa
FS:  00007fc4ebfff700(0000) GS:ffff8c717f7c0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000004000 CR3: 000000edfdee6006 CR4: 00000000001706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  string+0x40/0x50
  vsnprintf+0x33c/0x520
  scnprintf+0x4d/0x90
  qla2x00_port_speed_show+0xb5/0x100 [qla2xxx]
  dev_attr_show+0x1c/0x40
  sysfs_kf_seq_show+0x9b/0x100
  seq_read+0x153/0x410
  vfs_read+0x91/0x140
  ksys_read+0x4f/0xb0
  do_syscall_64+0x5b/0x1a0
  entry_SYSCALL_64_after_hwframe+0x65/0xca
Fixes 4910b524ac9e6 ("scsi: qla2xxx: Add support for setting port speed”)
---
 drivers/scsi/qla2xxx/qla_attr.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +22 -2
index d09776b77af2..cb5f2ecb652d 100644
@@ -1868,6 +1868,18 @@ qla2x00_port_speed_store(struct device *dev, struct device_attribute *attr,
 	return strlen(buf);
 }
 
+static const struct {
+	u16 rate;
+	char *str;
+} port_speed_str[] = {
+	{ PORT_SPEED_4GB, "4" },
+	{ PORT_SPEED_8GB, "8" },
+	{ PORT_SPEED_16GB, "16" },
+	{ PORT_SPEED_32GB, "32" },
+	{ PORT_SPEED_64GB, "64" },
+	{ PORT_SPEED_10GB, "10" },
+};
+
 static ssize_t
 qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,
     char *buf)
@@ -1875,7 +1887,8 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,
 	struct scsi_qla_host *vha = shost_priv(dev_to_shost(dev));
 	struct qla_hw_data *ha = vha->hw;
 	ssize_t rval;
-	char *spd[7] = {"0", "0", "0", "4", "8", "16", "32"};
+	u16 i;
+	char *speed = "Unknown";
 
 	rval = qla2x00_get_data_rate(vha);
 	if (rval != QLA_SUCCESS) {
@@ -1884,7 +1897,14 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,
 		return -EINVAL;
 	}
 
-	return scnprintf(buf, PAGE_SIZE, "%s\n", spd[ha->link_data_rate]);
+	for (i = 0; i < ARRAY_SIZE(port_speed_str); i++) {
+		if (port_speed_str[i].rate != ha->link_data_rate)
+			continue;
+		speed = port_speed_str[i].str;
+		break;
+	}
+
+	return scnprintf(buf, PAGE_SIZE, "%s\n", speed);
 }
 
 static ssize_t
Signature · 1 line
2.19.0.rc0
author maintainer
#9 lore raw

PATCH v2 7/10 qla2xxx: Call process_response_queue() in Tx path

In reply to Nilesh Javali

From: Shreyas Deodhar <[email protected]>

Process responses in Tx path if any available for better performance.

Fixes e84067d743010 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and

transport registration”)

---
 drivers/scsi/qla2xxx/qla_nvme.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +6 -0
index 877b2b625020..0ae1e081cb03 100644
@@ -399,6 +399,7 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp)
 	uint16_t	avail_dsds;
 	struct dsd64	*cur_dsd;
 	struct req_que *req = NULL;
+	struct rsp_que *rsp = NULL;
 	struct scsi_qla_host *vha = sp->fcport->vha;
 	struct qla_hw_data *ha = vha->hw;
 	struct qla_qpair *qpair = sp->qpair;
@@ -410,6 +411,7 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp)
 
 	/* Setup qpair pointers */
 	req = qpair->req;
+	rsp = qpair->rsp;
 	tot_dsds = fd->sg_cnt;
 
 	/* Acquire qpair specific lock */
@@ -571,6 +573,10 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp)
 	/* Set chip new ring index. */
 	wrt_reg_dword(req->req_q_in, req->ring_index);
 
+	if (vha->flags.process_response_queue &&
+	    rsp->ring_ptr->signature != RESPONSE_PROCESSED)
+		qla24xx_process_response_queue(vha, rsp);
+
 queuing_error:
 	spin_unlock_irqrestore(&qpair->qp_lock, flags);
 
Signature · 1 line
2.19.0.rc0
author maintainer
#10 lore raw

PATCH v2 8/10 qla2xxx: Move heart beat handling from dpc thread to workqueue

In reply to Nilesh Javali

From: Manish Rangankar <[email protected]>

DPC thread gets restricted due to a no-op mailbox, which is a blocking call and has a high execution frequency. To free up the DPC thread we move no-op handling to the workqueue. Also, modified qla_do_hb to send no-op MBC if we don’t have any active interrupts, but there are still IOs outstanding with firmware.

Fixes d94d8158e184 ("scsi: qla2xxx: Add heartbeat check")
---
 drivers/scsi/qla2xxx/qla_def.h  |  4 +-
 drivers/scsi/qla2xxx/qla_init.c |  2 +
 drivers/scsi/qla2xxx/qla_os.c   | 78 +++++++++++++++------------------
 3 files changed, 40 insertions(+), 44 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -2
index be2eb75ee1a3..8924eeb9367d 100644
@@ -3750,6 +3750,7 @@ struct qla_qpair {
 	struct qla_fw_resources fwres ____cacheline_aligned;
 	u32	cmd_cnt;
 	u32	cmd_completion_cnt;
+	u32	prev_completion_cnt;
 };
 
 /* Place holder for FW buffer parameters */
@@ -4607,6 +4608,7 @@ struct qla_hw_data {
 	struct qla_chip_state_84xx *cs84xx;
 	struct isp_operations *isp_ops;
 	struct workqueue_struct *wq;
+	struct work_struct heartbeat_work;
 	struct qlfc_fw fw_buf;
 
 	/* FCP_CMND priority support */
@@ -4708,7 +4710,6 @@ struct qla_hw_data {
 
 	struct qla_hw_data_stat stat;
 	pci_error_state_t pci_error_state;
-	u64 prev_cmd_cnt;
 	struct dma_pool *purex_dma_pool;
 	struct btree_head32 host_map;
 
@@ -4854,7 +4855,6 @@ typedef struct scsi_qla_host {
 #define SET_ZIO_THRESHOLD_NEEDED 32
 #define ISP_ABORT_TO_ROM	33
 #define VPORT_DELETE		34
-#define HEARTBEAT_CHK		38
 
 #define PROCESS_PUREX_IOCB	63
 
drivers/scsi/qla2xxx/qla_init.c +2 -0
index c6b3d0e7489e..a9a4243cb15a 100644
@@ -7025,12 +7025,14 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
 	ha->chip_reset++;
 	ha->base_qpair->chip_reset = ha->chip_reset;
 	ha->base_qpair->cmd_cnt = ha->base_qpair->cmd_completion_cnt = 0;
+	ha->base_qpair->prev_completion_cnt = 0;
 	for (i = 0; i < ha->max_qpairs; i++) {
 		if (ha->queue_pair_map[i]) {
 			ha->queue_pair_map[i]->chip_reset =
 				ha->base_qpair->chip_reset;
 			ha->queue_pair_map[i]->cmd_cnt =
 			    ha->queue_pair_map[i]->cmd_completion_cnt = 0;
+			ha->base_qpair->prev_completion_cnt = 0;
 		}
 	}
 
drivers/scsi/qla2xxx/qla_os.c +36 -42

122 lines not on this page · raw message

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

PATCH v2 9/10 qla2xxx: Fix use after free in eh_abort path

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

In eh_abort path, driver prematurely exit the call to upper layer. This patch would check for command is aborted / completed by FW before exiting the call.

9 [ffff8b1ebf803c00] page_fault at ffffffffb0389778
[exception RIP: qla2x00_status_entry+0x48d]

  RIP: ffffffffc04fa62d  RSP: ffff8b1ebf803cb0  RFLAGS: 00010082
  RAX: 00000000ffffffff  RBX: 00000000000e0000  RCX: 0000000000000000
  RDX: 0000000000000000  RSI: 00000000000013d8  RDI: fffff3253db78440
  RBP: ffff8b1ebf803dd0   R8: ffff8b1ebcd9b0c0   R9: 0000000000000000
  R10: ffff8b1e38a30808  R11: 0000000000001000  R12: 00000000000003e9
  R13: 0000000000000000  R14: ffff8b1ebcd9d740  R15: 0000000000000028
  ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

10 [ffff8b1ebf803cb0] enqueue_entity at ffffffffafce708f
11 [ffff8b1ebf803d00] enqueue_task_fair at ffffffffafce7b88 12 [ffff8b1ebf803dd8] qla24xx_process_response_queue at ffffffffc04fc9a6 [qla2xxx]
13 [ffff8b1ebf803e78] qla24xx_msix_rsp_q at ffffffffc04ff01b [qla2xxx] 14 [ffff8b1ebf803eb0] __handle_irq_event_percpu at ffffffffafd50714

Fixes f45bca8c5052 ("scsi: qla2xxx: Fix double scsi_done for abort path")
---
 drivers/scsi/qla2xxx/qla_os.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +5 -3
index 0c446438dcd3..03ff2596715b 100644
@@ -1258,6 +1258,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	uint32_t ratov_j;
 	struct qla_qpair *qpair;
 	unsigned long flags;
+	int fast_fail_status = SUCCESS;
 
 	if (qla2x00_isp_reg_stat(ha)) {
 		ql_log(ql_log_info, vha, 0x8042,
@@ -1266,9 +1267,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 		return FAILED;
 	}
 
+	/* Save any FAST_IO_FAIL value to return later if abort succeeds */
 	ret = fc_block_scsi_eh(cmd);
 	if (ret != 0)
-		return ret;
+		fast_fail_status = ret;
 
 	sp = scsi_cmd_priv(cmd);
 	qpair = sp->qpair;
@@ -1276,7 +1278,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	vha->cmd_timeout_cnt++;
 
 	if ((sp->fcport && sp->fcport->deleted) || !qpair)
-		return SUCCESS;
+		return fast_fail_status != SUCCESS ? fast_fail_status : FAILED;
 
 	spin_lock_irqsave(qpair->qp_lock_ptr, flags);
 	sp->comp = &comp;
@@ -1311,7 +1313,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 			    __func__, ha->r_a_tov/10);
 			ret = FAILED;
 		} else {
-			ret = SUCCESS;
+			ret = fast_fail_status;
 		}
 		break;
 	default:
Signature · 1 line
2.19.0.rc0
author maintainer
#12 lore raw

PATCH v2 10/10 qla2xxx: Update version to 10.02.07.100-k

In reply to Nilesh Javali
---
 drivers/scsi/qla2xxx/qla_version.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_version.h +3 -3
index 055040cbef9b..4b117165bf8b 100644
@@ -6,9 +6,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "10.02.06.200-k"
+#define QLA2XXX_VERSION      "10.02.07.100-k"
 
 #define QLA_DRIVER_MAJOR_VER	10
 #define QLA_DRIVER_MINOR_VER	2
-#define QLA_DRIVER_PATCH_VER	6
-#define QLA_DRIVER_BETA_VER	200
+#define QLA_DRIVER_PATCH_VER	7
+#define QLA_DRIVER_BETA_VER	100
Signature · 1 line
2.19.0.rc0
#13 lore raw
In reply to Nilesh Javali

Nilesh,

Quoted 2 lines

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

Applied to 5.16/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#14 lore raw
In reply to Nilesh Javali
Quoted 11 lines · Nilesh Javali

Martin,

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

v2:
- Added Fixes and Cc tags for few fixes
- Replace hb with heartbeat to make more readable
- Added Reviewed-by tag

[...]

Applied to 5.16/scsi-queue, thanks!

[01/10] qla2xxx: Add support for mailbox passthru

        https://git.kernel.org/mkp/scsi/c/9e1c3206960f
[02/10] qla2xxx: Display 16G only as supported speeds for 3830c card
        https://git.kernel.org/mkp/scsi/c/52cca50d35f8
[03/10] qla2xxx: Check for firmware capability before creating QPair
        https://git.kernel.org/mkp/scsi/c/8192817efbc3
[04/10] qla2xxx: Fix crash in NVME abort path
        https://git.kernel.org/mkp/scsi/c/e6e22e6cc296
[05/10] qla2xxx: edif: Use link event to wake up app
        https://git.kernel.org/mkp/scsi/c/527d46e0b014
[06/10] qla2xxx: Fix kernel crash when accessing port_speed sysfs file
        https://git.kernel.org/mkp/scsi/c/3ef68d4f0c9e
[07/10] qla2xxx: Call process_response_queue() in Tx path
        https://git.kernel.org/mkp/scsi/c/38c61709e662
[08/10] qla2xxx: Move heart beat handling from dpc thread to workqueue
        https://git.kernel.org/mkp/scsi/c/3a4e1f3b3a3c
[09/10] qla2xxx: Fix use after free in eh_abort path
        https://git.kernel.org/mkp/scsi/c/3d33b303d4f3
[10/10] qla2xxx: Update version to 10.02.07.100-k
        https://git.kernel.org/mkp/scsi/c/b0fe235dad77
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering