qla2xxx driver bug fixes
Subsystems (3)
Nilesh Javali
maintainercover qla2xxx driver bug fixes
Martin,
Please apply the qla2xxx driver bug fixes to the scsi tree at your earliest convenience.
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 | 86 +++++++++++++++--------------- drivers/scsi/qla2xxx/qla_version.h | 6 +-- 11 files changed, 191 insertions(+), 61 deletions(-)
base-commit: 9b5ac8ab4e8bf5636d1d425aee68ddf45af12057
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 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
@@ -2877,6 +2877,9 @@ qla2x00_process_vendor_specific(struct scsi_qla_host *vha, struct bsg_job *bsg_jcase 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
@@ -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
@@ -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
@@ -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
Re: [PATCH 01/10] qla2xxx: Add support for mailbox passthru
Quoted 168 lines · Nilesh Javali
From: Bikash Hazarika <[email protected]>
This interface will allow user space application(s) to send a mailbox command to the FW.
Signed-off-by Bikash Hazarika <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
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@@ -2877,6 +2877,9 @@ qla2x00_process_vendor_specific(struct scsi_qla_host *vha, struct bsg_job *bsg_jcase 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@@ -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@@ -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@@ -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
Looks Good.
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 2/10 qla2xxx: Display 16G only as supported speeds for 3830c card
In reply to Nilesh JavaliFrom: 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
@@ -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
Re: [PATCH 02/10] qla2xxx: Display 16G only as supported speeds for 3830c card
Quoted 32 lines · 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.
Signed-off-by Saurav Kashyap <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_gs.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/scsi/qla2xxx/qla_gs.c +2
-1@@ -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
--
Himanshu Madhani Oracle Linux Engineering
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Nilesh Javali
maintainerPATCH 3/10 qla2xxx: Check for firmware capability before creating QPair
In reply to Nilesh JavaliFrom: 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
@@ -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
Re: [PATCH 03/10] qla2xxx: Check for firmware capability before creating QPair
Quoted 33 lines · Nilesh Javali
From: Saurav Kashyap <[email protected]>
Add firmware capability check of multiQ specific for ISP25XX before creating qpair.
Signed-off-by Saurav Kashyap <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_os.c| 4 ++++1 file changed, 4 insertions(+)drivers/scsi/qla2xxx/qla_os.c +4
-0@@ -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
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 4/10 qla2xxx: Fix crash in NVME abort path
In reply to Nilesh JavaliFrom: 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 ffffffffa6ac06edThe crash was due to a stale SRB structure access after it was aborted. Fixed the issue by removing stale access.
--- drivers/scsi/qla2xxx/qla_nvme.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +12 -2
@@ -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
Re: [PATCH 04/10] qla2xxx: Fix crash in NVME abort path
Quoted 27 lines · 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
Quoted 3 lines
The crash was due to a stale SRB structure access after it was aborted. Fixed the issue by removing stale access.
Add following
Quoted 49 lines
Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_nvme.c| 14 ++++++++++++--1 file changed, 12 insertions(+), 2 deletions(-)drivers/scsi/qla2xxx/qla_nvme.c +12
-2@@ -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:
Quoted 4 lines
/* kref_get was done before work was schedule. */Signature · 1 line
2.19.0.rc0
Otherwise
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 5/10 qla2xxx: edif: Use link event to wake up app
In reply to Nilesh JavaliFrom: 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.
--- drivers/scsi/qla2xxx/qla_init.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +7 -8
@@ -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
Re: [PATCH 05/10] qla2xxx: edif: Use link event to wake up app
Quoted 15 lines · 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 theapp_startcall.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.
Missing
Quoted 36 lines
Signed-off-by Quinn Tran <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_init.c| 15 +++++++--------1 file changed, 7 insertions(+), 8 deletions(-)drivers/scsi/qla2xxx/qla_init.c +7
-8@@ -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
Otherwise
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 6/10 qla2xxx: Fix kernel crash when accessing port_speed sysfs file
In reply to Nilesh JavaliFrom: 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
--- drivers/scsi/qla2xxx/qla_attr.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +22 -2
@@ -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
Re: [PATCH 06/10] qla2xxx: Fix kernel crash when accessing port_speed sysfs file
Quoted 34 lines · Nilesh Javali
From: Arun Easi <[email protected]>
Kernel crashes when accessing
port_speedsysfs 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
Quoted 9 lines
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
Missing yet another
Quoted 54 lines
Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_attr.c| 24 ++++++++++++++++++++++--1 file changed, 22 insertions(+), 2 deletions(-)drivers/scsi/qla2xxx/qla_attr.c +12
-0@@ -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, structdevice_attribute*attr,
char *buf)drivers/scsi/qla2xxx/qla_attr.c +10
-2@@ -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); }
Quoted 4 lines
static
ssize_tSignature · 1 line
2.19.0.rc0
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 7/10 qla2xxx: Call process_response_queue() in Tx path
In reply to Nilesh JavaliFrom: Shreyas Deodhar <[email protected]>
Process responses in Tx path if any available for better performance.
--- drivers/scsi/qla2xxx/qla_nvme.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +6 -0
@@ -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
Re: [PATCH 07/10] qla2xxx: Call process_response_queue() in Tx path
Quoted 8 lines · Nilesh Javali
From: Shreyas Deodhar <[email protected]>
Process responses in Tx path if any available for better performance.
I’ll let you decide if you want to add this to all stable or not, but if you decide this needs to go into stable then add
Quoted 35 lines
Signed-off-by Shreyas Deodhar<[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_nvme.c| 6 ++++++1 file changed, 6 insertions(+)drivers/scsi/qla2xxx/qla_nvme.c +6
-0@@ -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:
Quoted 5 lines
spin_unlock_irqrestore(&qpair->qp_lock, flags);Signature · 1 line
2.19.0.rc0
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 8/10 qla2xxx: Move heart beat handling from dpc thread to workqueue
In reply to Nilesh JavaliFrom: 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.
--- drivers/scsi/qla2xxx/qla_def.h | 4 +- drivers/scsi/qla2xxx/qla_init.c | 2 + drivers/scsi/qla2xxx/qla_os.c | 74 +++++++++++++++------------------ 3 files changed, 38 insertions(+), 42 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -2
@@ -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 hb_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
@@ -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 +34 -40
120 lines not on this page · raw message
Signature · 1 line
2.19.0.rc0
Re: [PATCH 08/10] qla2xxx: Move heart beat handling from dpc thread to workqueue
Quoted 13 lines · 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_hbto 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")
Quoted 21 lines
Signed-off-by Manish Rangankar <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_def.h | 4 +- drivers/scsi/qla2xxx/qla_init.c | 2 + drivers/scsi/qla2xxx/qla_os.c | 74 +++++++++++++++------------------ 3 files changed, 38 insertions(+), 42 deletions(-)drivers/scsi/qla2xxx/qla_def.h +1
-0@@ -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 */
drivers/scsi/qla2xxx/qla_def.h struct qla_hw_data { · line 4611
Quoted 4 lines
drivers/scsi/qla2xxx/qla_def.h +1
-0@@ -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 hb_work;
Use heartbeat_work (which is not awfully long and reads better.
Quoted 43 lines
drivers/scsi/qla2xxx/qla_def.h +0
-2struct 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 63drivers/scsi/qla2xxx/qla_init.c +2
-0@@ -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 +0
-0
drivers/scsi/qla2xxx/qla_os.c qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time) · line 2797
Quoted 4 lines
drivers/scsi/qla2xxx/qla_os.c +1
-0@@ -2794,6 +2794,16 @@ qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)return atomic_read (&vha->loop_state) ==LOOP_READY ; } +static void qla_hb_work_fn (struct work_struct *work)
^^^^^^^^^^^^^^
Use qla_heartbeat_work_fn for better readability
Quoted 40 lines
drivers/scsi/qla2xxx/qla_os.c +10
-11+{ +struct qla_hw_data *ha =container_of (work, + struct qla_hw_data, hb_work); +struct scsi_qla_host *base_vha =pci_get_drvdata (ha->pdev); + +if (!ha->flags.mbox_busy && base_vha->flags.init_done) +qla_no_op_mb (base_vha); +} +static void qla2x00_iocb_work_fn (struct work_struct *work) { struct scsi_qla_host *vha = container_of(work,@@ -3232,6 +3242,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) host->transportt, sht->vendor_id);INIT_WORK (&base_vha->iocb_work, qla2x00_iocb_work_fn); +INIT_WORK (&ha->hb_work, qla_hb_work_fn);/* Set up the irqs */ ret =qla2x00_request_irqs (ha, rsp);@@ -7118,17 +7129,6 @@ qla2x00_do_dpc(void *data)qla2x00_lip_reset (base_vha); } -if (test_bit (HEARTBEAT_CHK , &base_vha->dpc_flags)) { -/* -* if there is a mb in progress then that's -* enough of a check to see if fw is still ticking. -*/ -if (!ha->flags.mbox_busy && base_vha->flags.init_done) -qla_no_op_mb (base_vha); - -clear_bit (HEARTBEAT_CHK , &base_vha->dpc_flags); - } - ha->dpc_active =0 ;
end_loop:set_current_state(TASK_INTERRUPTIBLE);drivers/scsi/qla2xxx/qla_os.c +0
-0@@ -7187,57 +7187,51 @@ qla2x00_rst_aen(scsi_qla_host_t *vha)
drivers/scsi/qla2xxx/qla_os.c qla2x00_rst_aen(scsi_qla_host_t *vha) · line 7194
Quoted 10 lines
drivers/scsi/qla2xxx/qla_os.c +3
-3static bool qla_do_heartbeat (struct scsi_qla_host *vha) { -u64 cmd_cnt, prev_cmd_cnt; -bool do_hb = false;struct qla_hw_data *ha = vha->hw; -int i; +u32 cmpl_cnt; +u16 i; +bool do_hb = false;
use do_heartbeat which is self-explanatory and reads better
Quoted 68 lines
drivers/scsi/qla2xxx/qla_os.c +16
-7-/* if cmds are still pending down in fw, then do hb */ -if (ha->base_qpair->cmd_cnt != ha->base_qpair->cmd_completion_cnt) { +/* +* Allow do_hb only if we don’t have any active interrupts, +* but there are still IOs outstanding with firmware. +*/ + cmpl_cnt = ha->base_qpair->cmd_completion_cnt; +if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && + cmpl_cnt != ha->base_qpair->cmd_cnt) { do_hb = true; goto skip; } + ha->base_qpair->prev_completion_cnt = cmpl_cnt;for (i =0 ; i < ha->max_qpairs; i++) { -if (ha->queue_pair_map[i] && - ha->queue_pair_map[i]->cmd_cnt != - ha->queue_pair_map[i]->cmd_completion_cnt) { - do_hb = true; -break ; +if (ha->queue_pair_map[i]) { + cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; +if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && + cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { + do_hb = true; +break ; + } + ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; } }skip:
drivers/scsi/qla2xxx/qla_os.c +0
-15- prev_cmd_cnt = ha->prev_cmd_cnt; - cmd_cnt = ha->base_qpair->cmd_cnt; -for (i =0 ; i < ha->max_qpairs; i++) { -if (ha->queue_pair_map[i]) - cmd_cnt += ha->queue_pair_map[i]->cmd_cnt; - } - ha->prev_cmd_cnt = cmd_cnt; - -if (!do_hb && ((cmd_cnt - prev_cmd_cnt) >50 )) -/* -* IOs are completing before periodic hb check. -* IOs seems to be running, do hb for sanity check. -*/ - do_hb = true; -return do_hb; }static void
qla_heart_beat(struct scsi_qla_host *vha){drivers/scsi/qla2xxx/qla_os.c +2
-0+struct qla_hw_data *ha = vha->hw; +if (vha->vp_idx) return; if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) return;drivers/scsi/qla2xxx/qla_os.c +2
-4-if (qla_do_heartbeat (vha)) { -set_bit (HEARTBEAT_CHK , &vha->dpc_flags); -qla2xxx_wake_dpc (vha); - } +if (qla_do_heartbeat (vha)) +queue_work (ha->wq, &ha->hb_work);}
Quoted 4 lines
/**************************************************************************
Signature · 1 line
2.19.0.rc0
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 9/10 qla2xxx: Fix use after free in eh_abort path
In reply to Nilesh JavaliFrom: 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
--- drivers/scsi/qla2xxx/qla_os.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +5 -3
@@ -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 = ∁
@@ -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
Re: [PATCH 09/10] qla2xxx: Fix use after free in eh_abort path
Quoted 19 lines · Nilesh Javali
From: Quinn Tran <[email protected]>
In
eh_abortpath, 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_faultatffffffffb0389778
[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
Quoted 8 lines
10 [
ffff8b1ebf803cb0]enqueue_entityatffffffffafce708f
11 [ffff8b1ebf803d00]enqueue_task_fairatffffffffafce7b8812 [ffff8b1ebf803dd8]qla24xx_process_response_queueatffffffffc04fc9a6[qla2xxx]
13 [ffff8b1ebf803e78]qla24xx_msix_rsp_qatffffffffc04ff01b[qla2xxx] 14 [ffff8b1ebf803eb0]__handle_irq_event_percpuatffffffffafd50714Fixes f45bca8c5052 ("scsi: qla2xxx: Fix double scsi_done for abort path")
Quoted 53 lines
Signed-off-by David Jeffery <[email protected]>Signed-off-by Laurence Oberman <[email protected]>Signed-off-by Quinn Tran <[email protected]>Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_os.c| 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)drivers/scsi/qla2xxx/qla_os.c +5
-3@@ -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 = ∁@@ -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
Looks good.
--
Himanshu Madhani Oracle Linux Engineering
Nilesh Javali
maintainerPATCH 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
@@ -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
Re: [PATCH 10/10] qla2xxx: Update version to 10.02.07.100-k
Quoted 29 lines · Nilesh Javali
Signed-off-by Nilesh Javali <[email protected]>---
drivers/scsi/qla2xxx/qla_version.h| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)drivers/scsi/qla2xxx/qla_version.h +3
-3@@ -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 100Signature · 1 line
2.19.0.rc0
--
Himanshu Madhani Oracle Linux Engineering
On 9/8/21 12:28 AM, Nilesh Javali wrote:> Martin,
Quoted 7 lines
Please apply the qla2xxx driver bug fixes to the scsi tree at your earliest convenience.
Thanks,
Nilesh
why linux-nvme ?
Quoted 11 lines
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 | 86 +++++++++++++++--------------- drivers/scsi/qla2xxx/qla_version.h | 6 +--
no drivers/nvme/ in the above change log.
Quoted 5 lines
11 files changed, 191 insertions(+), 61 deletions(-)base-commit:
9b5ac8ab4e8bf5636d1d425aee68ddf45af12057
Nilesh Javali
maintainerChaitanya,
Quoted 15 lines
-----Original Message-----
From: Chaitanya Kulkarni <[email protected]>
Sent: Wednesday, September 8, 2021 1:28 PM
To: Nilesh Javali <[email protected]>; [email protected]; linux- [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH 00/10] qla2xxx driver bug fixesExternal Email
----------------------------------------------------------------------
On 9/8/21 12:28 AM, Nilesh Javali wrote:> Martin,Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Please apply the qla2xxx driver bug fixes to the scsi tree at your earliest convenience.
Thanks,
Nileshwhy linux-nvme ?
Please ignore. This is meant for Linux-scsi only. I apologize for mistakenly sending it to Linux-nvme.
--
Nilesh