lpfc updates for 11.4.0.1
Subsystems (2)
cover lpfc updates for 11.4.0.1
This patch set provides a number of bug fixes.
The patches were cut against the Martin's 4.13/scsi-queue tree. There are no outside dependencies. The patches should merge via Martin's tree.
James Smart (11):
Fix system panic when express lane enabled.
Fix nvme_info sysfs output to be consistent
Vport creation is failing with "Link Down" error
Reduce time spent in IRQ for received NVME commands
Break up IO ctx list into a separate get and put list
Fix SLI3 drivers attempting NVME ELS commands.
Fix crash after firmware flash when IO is running.
Fix crash doing IO with resets
Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort request. Driver responds LS_RJT to Beacon Off ELS - Linux
lpfc: update to revision to 11.4.0.1
drivers/scsi/lpfc/lpfc_attr.c | 13 +++--- drivers/scsi/lpfc/lpfc_debugfs.c | 11 ++++-- drivers/scsi/lpfc/lpfc_els.c | 38 +++++++++--------- drivers/scsi/lpfc/lpfc_hbadisc.c | 3 +- drivers/scsi/lpfc/lpfc_init.c | 37 ++++++++++------- drivers/scsi/lpfc/lpfc_nvmet.c | 85 ++++++++++++++++++++++++++++------------ drivers/scsi/lpfc/lpfc_sli.c | 27 ++++++------- drivers/scsi/lpfc/lpfc_sli4.h | 9 +++-- drivers/scsi/lpfc/lpfc_version.h | 2 +- 9 files changed, 137 insertions(+), 88 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/11 Fix system panic when express lane enabled.
There is a null pointer dereference that can happen in the FOF interrupt handler.
The driver was not setting up cq->assoc_qp_for sli4_hba->oas_cq.
Initialize cq->assoc_qp before accessing it.
--- drivers/scsi/lpfc/lpfc_sli.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/lpfc/lpfc_sli.c +3 -0
@@ -13560,6 +13560,9 @@ lpfc_sli4_fof_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe)return ; } +/* Save EQ associated with this CQ */ + cq->assoc_qp = phba->sli4_hba.fof_eq; +/* Process all the entries to the OAS CQ */ while ((cqe =lpfc_sli4_cq_get (cq))) { workposted |=lpfc_sli4_fp_handle_cqe (phba, cq, cqe);
Signature · 1 line
2.11.0
Re: [PATCH 01/11] Fix system panic when express lane enabled.
Quoted 19 lines · James Smart
There is a null pointer dereference that can happen in the FOF interrupt handler.
The driver was not setting up
cq->assoc_qp_forsli4_hba->oas_cq.Initialize
cq->assoc_qpbefore accessing it.Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_sli.c | 3 +++ 1 file changed, 3 insertions(+)drivers/scsi/lpfc/lpfc_sli.c +0
-0
drivers/scsi/lpfc/lpfc_sli.c lpfc_sli4_fof_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe) · line 13568
Quoted 9 lines
drivers/scsi/lpfc/lpfc_sli.c +3
-0@@ -13560,6 +13560,9 @@ lpfc_sli4_fof_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe)return ; } +/* Save EQ associated with this CQ */ + cq->assoc_qp = phba->sli4_hba.fof_eq; +/* Process all the entries to the OAS CQ */ while ((cqe =lpfc_sli4_cq_get (cq))) { workposted |=lpfc_sli4_fp_handle_cqe (phba, cq, cqe);
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 2/11 Fix nvme_info sysfs output to be consistent
In reply to James SmartFirst line of nvme_info output is not consistent
There is an Extra colon in the format.
First line of output will contain one of the following strings:
NVME Initiator Enabled
NVME Target Enabled
NVME Disabled
--- drivers/scsi/lpfc/lpfc_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_attr.c +1 -1
@@ -171,7 +171,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,else statep ="INIT" ; len +=snprintf (buf + len,PAGE_SIZE - len, -"NVME Target: Enabled State %s\n" , +"NVME Target Enabled State %s\n" , statep); len += snprintf(buf + len, PAGE_SIZE - len, "%s%d WWPN x%llx WWNN x%llx DID x%06x\n",
Signature · 1 line
2.11.0
Re: [PATCH 02/11] Fix nvme_info sysfs output to be consistent
Quoted 21 lines · James Smart
First line of
nvme_infooutput is not consistentThere is an Extra colon in the format.
First line of output will contain one of the following strings:
NVME Initiator Enabled
NVME Target Enabled
NVME DisabledSigned-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_attr.c +0
-0
drivers/scsi/lpfc/lpfc_attr.c lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, · line 177
Quoted 8 lines
drivers/scsi/lpfc/lpfc_attr.c +1
-1@@ -171,7 +171,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,else statep ="INIT" ; len +=snprintf (buf + len,PAGE_SIZE - len, -"NVME Target: Enabled State %s\n" , +"NVME Target Enabled State %s\n" , statep); len += snprintf(buf + len, PAGE_SIZE - len, "%s%d WWPN x%llx WWNN x%llx DID x%06x\n",
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 3/11 Vport creation is failing with "Link Down" error
In reply to James SmartVport creation fails for SLI-3 adapters.
Mailbox submission fails because mailbox interrupt is disabled. Mailbox interrupt is disabled during port reset.
Do reset only for physical port.
--- drivers/scsi/lpfc/lpfc_init.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +12 -9
@@ -3691,14 +3691,6 @@ lpfc_get_wwpn(struct lpfc_hba *phba)LPFC_MBOXQ_t *mboxq;MAILBOX_t *mb; -if (phba->sli_rev <LPFC_SLI_REV4 ) { -/* Reset the port first */ -lpfc_sli_brdrestart (phba); - rc =lpfc_sli_chipset_init (phba); -if (rc) -return (uint64_t )-1 ; - } - mboxq = (LPFC_MBOXQ_t *)mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (!mboxq)
@@ -3852,8 +3844,19 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)int i;uint64_t wwn;bool use_no_reset_hba = false; +int rc; - wwn =lpfc_get_wwpn (phba); +if (lpfc_no_hba_reset_cnt) { +if (phba->sli_rev <LPFC_SLI_REV4 && + dev == &phba->pcidev->dev) { +/* Reset the port first */ +lpfc_sli_brdrestart (phba); + rc =lpfc_sli_chipset_init (phba); +if (rc) +return NULL ; + } + wwn =lpfc_get_wwpn (phba); + }for (i =0 ; i < lpfc_no_hba_reset_cnt; i++) {if (wwn == lpfc_no_hba_reset[i]) {
Signature · 1 line
2.11.0
Re: [PATCH 03/11] Vport creation is failing with "Link Down" error
Quoted 44 lines · James Smart
Vport creation fails for SLI-3 adapters.
Mailbox submission fails because mailbox interrupt is disabled. Mailbox interrupt is disabled during port reset.
Do reset only for physical port.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_init.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)drivers/scsi/lpfc/lpfc_init.c +5
-9@@ -3691,14 +3691,6 @@ lpfc_get_wwpn(struct lpfc_hba *phba)LPFC_MBOXQ_t *mboxq;MAILBOX_t *mb; -if (phba->sli_rev <LPFC_SLI_REV4 ) { -/* Reset the port first */ -lpfc_sli_brdrestart (phba); - rc =lpfc_sli_chipset_init (phba); -if (rc) -return (uint64_t )-1 ; - } - mboxq = (LPFC_MBOXQ_t *)mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (!mboxq)@@ -3852,8 +3844,19 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)int i;uint64_t wwn;bool use_no_reset_hba = false; +int rc; - wwn =lpfc_get_wwpn (phba); +if (lpfc_no_hba_reset_cnt) { +if (phba->sli_rev <LPFC_SLI_REV4 && + dev == &phba->pcidev->dev) { +/* Reset the port first */
drivers/scsi/lpfc/lpfc_init.c lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · line 3862
Quoted 10 lines
drivers/scsi/lpfc/lpfc_init.c +7
-0+lpfc_sli_brdrestart (phba); + rc =lpfc_sli_chipset_init (phba); +if (rc) +return NULL ; + } + wwn =lpfc_get_wwpn (phba); + }for (i =0 ; i < lpfc_no_hba_reset_cnt; i++) {if (wwn == lpfc_no_hba_reset[i]) {
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 4/11 Reduce time spent in IRQ for received NVME commands
In reply to James SmartRemoved unnecessary bzero of context area. Due to size of sg list, added a substantial delay and played havoc on cpu caches.
--- drivers/scsi/lpfc/lpfc_nvmet.c | 2 -- 1 file changed, 2 deletions(-)
drivers/scsi/lpfc/lpfc_nvmet.c +0 -2
@@ -205,7 +205,6 @@ lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf) sid =sli4_sid_from_fc_hdr (fc_hdr); ctxp = (struct lpfc_nvmet_rcv_ctx *)ctx_buf->context; -memset (ctxp,0 ,sizeof (ctxp->ctx)); ctxp->wqeq =NULL ; ctxp->txrdy =NULL ; ctxp->offset =0 ;
@@ -1422,7 +1421,6 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,"6414 NVMET Context corrupt %d %d oxid x%x\n" , ctxp->state, ctxp->entry_cnt, ctxp->oxid); } -memset (ctxp,0 ,sizeof (ctxp->ctx)); ctxp->wqeq =NULL ; ctxp->txrdy =NULL ; ctxp->offset =0 ;
Signature · 1 line
2.11.0
Re: [PATCH 04/11] Reduce time spent in IRQ for received NVME commands
Quoted 23 lines · James Smart
Removed unnecessary bzero of context area. Due to size of sg list, added a substantial delay and played havoc on cpu caches.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_nvmet.c | 2 -- 1 file changed, 2 deletions(-)drivers/scsi/lpfc/lpfc_nvmet.c +0
-1@@ -205,7 +205,6 @@ lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf) sid =sli4_sid_from_fc_hdr (fc_hdr); ctxp = (struct lpfc_nvmet_rcv_ctx *)ctx_buf->context; -memset (ctxp,0 ,sizeof (ctxp->ctx)); ctxp->wqeq =NULL ; ctxp->txrdy =NULL ; ctxp->offset =0 ;
drivers/scsi/lpfc/lpfc_nvmet.c lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, · line 1426
Quoted 7 lines
drivers/scsi/lpfc/lpfc_nvmet.c +0
-1@@ -1422,7 +1421,6 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,"6414 NVMET Context corrupt %d %d oxid x%x\n" , ctxp->state, ctxp->entry_cnt, ctxp->oxid); } -memset (ctxp,0 ,sizeof (ctxp->ctx)); ctxp->wqeq =NULL ; ctxp->txrdy =NULL ; ctxp->offset =0 ;
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 5/11 Break up IO ctx list into a separate get and put list
In reply to James SmartSince unsol rcv ISR and command cmpl ISR both access/lock this list, a separate get/put lists will reduce contention.
Replaced
struct list_head lpfc_nvmet_ctx_list;
with
struct list_head lpfc_nvmet_ctx_get_list;
struct list_head lpfc_nvmet_ctx_put_list;
and all correpsonding locks and counters.
--- drivers/scsi/lpfc/lpfc_attr.c | 11 ++++-- drivers/scsi/lpfc/lpfc_debugfs.c | 11 ++++-- drivers/scsi/lpfc/lpfc_init.c | 16 +++++--- drivers/scsi/lpfc/lpfc_nvmet.c | 82 +++++++++++++++++++++++++++++----------- drivers/scsi/lpfc/lpfc_sli4.h | 9 +++-- 5 files changed, 89 insertions(+), 40 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +7 -4
@@ -245,15 +245,18 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,atomic_read (&tgtp->xmt_abort_rsp), atomic_read(&tgtp->xmt_abort_rsp_error)); -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); tot = phba->sli4_hba.nvmet_xri_cnt - - phba->sli4_hba.nvmet_ctx_cnt; -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + (phba->sli4_hba.nvmet_ctx_get_cnt + + phba->sli4_hba.nvmet_ctx_put_cnt); +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock); +spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); len +=snprintf (buf + len,PAGE_SIZE - len,"IO_CTX: %08x WAIT: cur %08x tot %08x\n" "CTX Outstanding %08llx\n" , - phba->sli4_hba.nvmet_ctx_cnt, + phba->sli4_hba.nvmet_xri_cnt, phba->sli4_hba.nvmet_io_wait_cnt, phba->sli4_hba.nvmet_io_wait_total, tot);
drivers/scsi/lpfc/lpfc_debugfs.c +7 -4
@@ -848,15 +848,18 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size)spin_unlock (&phba->sli4_hba.abts_nvme_buf_list_lock); } -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); tot = phba->sli4_hba.nvmet_xri_cnt - - phba->sli4_hba.nvmet_ctx_cnt; -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + (phba->sli4_hba.nvmet_ctx_get_cnt + + phba->sli4_hba.nvmet_ctx_put_cnt); +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock); +spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); len +=snprintf (buf + len, size - len,"IO_CTX: %08x WAIT: cur %08x tot %08x\n" "CTX Outstanding %08llx\n" , - phba->sli4_hba.nvmet_ctx_cnt, + phba->sli4_hba.nvmet_xri_cnt, phba->sli4_hba.nvmet_io_wait_cnt, phba->sli4_hba.nvmet_io_wait_total, tot);
drivers/scsi/lpfc/lpfc_init.c +10 -6
@@ -1281,10 +1281,13 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)/* Check outstanding IO count */ if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) {if (phba->nvmet_support) { -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); tot = phba->sli4_hba.nvmet_xri_cnt - - phba->sli4_hba.nvmet_ctx_cnt; -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + (phba->sli4_hba.nvmet_ctx_get_cnt + + phba->sli4_hba.nvmet_ctx_put_cnt); +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock); +spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); }else { tot =atomic_read (&phba->fc4NvmeIoCmpls); data1 = atomic_read(
@@ -3487,7 +3490,6 @@ lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba)/* For NVMET, ALL remaining XRIs are dedicated for IO processing */ nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; -if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) {/* els xri-sgl expanded */ xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt;
@@ -5935,7 +5937,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)spin_lock_init (&phba->sli4_hba.abts_nvme_buf_list_lock);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvme_buf_list);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); -INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_list); +INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_get_list); +INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_put_list);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_io_wait_list);/* Fast-path XRI aborted CQ Event work queue list */
@@ -5944,7 +5947,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)/* This abort list used by worker thread */ spin_lock_init (&phba->sli4_hba.sgl_list_lock); -spin_lock_init (&phba->sli4_hba.nvmet_io_lock); +spin_lock_init (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock_init (&phba->sli4_hba.nvmet_ctx_put_lock);spin_lock_init (&phba->sli4_hba.nvmet_io_wait_lock);/*
drivers/scsi/lpfc/lpfc_nvmet.c +59 -23
123 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli4.h +6 -3
@@ -621,7 +621,8 @@ struct lpfc_sli4_hba {uint16_t scsi_xri_start;uint16_t els_xri_cnt;uint16_t nvmet_xri_cnt; -uint16_t nvmet_ctx_cnt; +uint16_t nvmet_ctx_get_cnt; +uint16_t nvmet_ctx_put_cnt;uint16_t nvmet_io_wait_cnt;uint16_t nvmet_io_wait_total;struct list_head lpfc_els_sgl_list;
@@ -630,7 +631,8 @@ struct lpfc_sli4_hba {struct list_head lpfc_abts_nvmet_ctx_list;struct list_head lpfc_abts_scsi_buf_list;struct list_head lpfc_abts_nvme_buf_list; -struct list_head lpfc_nvmet_ctx_list; +struct list_head lpfc_nvmet_ctx_get_list; +struct list_head lpfc_nvmet_ctx_put_list;struct list_head lpfc_nvmet_io_wait_list;struct lpfc_sglq **lpfc_sglq_active_list;struct list_head lpfc_rpi_hdr_list;
@@ -662,7 +664,8 @@ struct lpfc_sli4_hba {spinlock_t abts_nvme_buf_list_lock;/* list of aborted SCSI IOs */ spinlock_t abts_scsi_buf_list_lock;/* list of aborted SCSI IOs */ spinlock_t sgl_list_lock;/* list of aborted els IOs */ -spinlock_t nvmet_io_lock; +spinlock_t nvmet_ctx_get_lock;/* list of avail XRI contexts */ +spinlock_t nvmet_ctx_put_lock;/* list of avail XRI contexts */ spinlock_t nvmet_io_wait_lock;/* IOs waiting for ctx resources */ uint32_t physical_port;
Signature · 1 line
2.11.0
Re: [PATCH 05/11] Break up IO ctx list into a separate get and put list
Quoted 37 lines · James Smart
Since unsol rcv ISR and command cmpl ISR both access/lock this list, a separate get/put lists will reduce contention.
Replaced
structlist_headlpfc_nvmet_ctx_list;
with
structlist_headlpfc_nvmet_ctx_get_list;
structlist_headlpfc_nvmet_ctx_put_list;
and all correpsonding locks and counters.Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_attr.c | 11 ++++-- drivers/scsi/lpfc/lpfc_debugfs.c | 11 ++++-- drivers/scsi/lpfc/lpfc_init.c | 16 +++++--- drivers/scsi/lpfc/lpfc_nvmet.c | 82 +++++++++++++++++++++++++++++----------- drivers/scsi/lpfc/lpfc_sli4.h | 9 +++-- 5 files changed, 89 insertions(+), 40 deletions(-)drivers/scsi/lpfc/lpfc_attr.c +5
-3@@ -245,15 +245,18 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,atomic_read (&tgtp->xmt_abort_rsp), atomic_read(&tgtp->xmt_abort_rsp_error)); -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); tot = phba->sli4_hba.nvmet_xri_cnt - - phba->sli4_hba.nvmet_ctx_cnt; -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + (phba->sli4_hba.nvmet_ctx_get_cnt + + phba->sli4_hba.nvmet_ctx_put_cnt); +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock);
drivers/scsi/lpfc/lpfc_attr.c lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, · line 262
Quoted 10 lines
drivers/scsi/lpfc/lpfc_attr.c +2
-1+spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); len +=snprintf (buf + len,PAGE_SIZE - len,"IO_CTX: %08x WAIT: cur %08x tot %08x\n" "CTX Outstanding %08llx\n" , - phba->sli4_hba.nvmet_ctx_cnt, + phba->sli4_hba.nvmet_xri_cnt, phba->sli4_hba.nvmet_io_wait_cnt, phba->sli4_hba.nvmet_io_wait_total, tot);
Question is if you need the lock here; after all, we could just store the values in local variables and drop the lock altogether ...
Quoted 17 lines
drivers/scsi/lpfc/lpfc_debugfs.c +5
-3@@ -848,15 +848,18 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size)spin_unlock (&phba->sli4_hba.abts_nvme_buf_list_lock); } -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); tot = phba->sli4_hba.nvmet_xri_cnt - - phba->sli4_hba.nvmet_ctx_cnt; -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + (phba->sli4_hba.nvmet_ctx_get_cnt + + phba->sli4_hba.nvmet_ctx_put_cnt); +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock);
drivers/scsi/lpfc/lpfc_debugfs.c lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) · line 865
Quoted 10 lines
drivers/scsi/lpfc/lpfc_debugfs.c +2
-1+spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); len +=snprintf (buf + len, size - len,"IO_CTX: %08x WAIT: cur %08x tot %08x\n" "CTX Outstanding %08llx\n" , - phba->sli4_hba.nvmet_ctx_cnt, + phba->sli4_hba.nvmet_xri_cnt, phba->sli4_hba.nvmet_io_wait_cnt, phba->sli4_hba.nvmet_io_wait_total, tot);
Same here.
Quoted 70 lines
drivers/scsi/lpfc/lpfc_init.c +10
-6@@ -1281,10 +1281,13 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)/* Check outstanding IO count */ if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) {if (phba->nvmet_support) { -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); tot = phba->sli4_hba.nvmet_xri_cnt - - phba->sli4_hba.nvmet_ctx_cnt; -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + (phba->sli4_hba.nvmet_ctx_get_cnt + + phba->sli4_hba.nvmet_ctx_put_cnt); +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock); +spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); }else { tot =atomic_read (&phba->fc4NvmeIoCmpls); data1 = atomic_read(@@ -3487,7 +3490,6 @@ lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba)/* For NVMET, ALL remaining XRIs are dedicated for IO processing */ nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt; -if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) {/* els xri-sgl expanded */ xri_cnt = nvmet_xri_cnt - phba->sli4_hba.nvmet_xri_cnt;@@ -5935,7 +5937,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)spin_lock_init (&phba->sli4_hba.abts_nvme_buf_list_lock);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvme_buf_list);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvmet_ctx_list); -INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_list); +INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_get_list); +INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_put_list);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_io_wait_list);/* Fast-path XRI aborted CQ Event work queue list */ @@ -5944,7 +5947,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)/* This abort list used by worker thread */ spin_lock_init (&phba->sli4_hba.sgl_list_lock); -spin_lock_init (&phba->sli4_hba.nvmet_io_lock); +spin_lock_init (&phba->sli4_hba.nvmet_ctx_get_lock); +spin_lock_init (&phba->sli4_hba.nvmet_ctx_put_lock);spin_lock_init (&phba->sli4_hba.nvmet_io_wait_lock);/* drivers/scsi/lpfc/lpfc_nvmet.c +4
-4@@ -267,11 +267,11 @@ lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf) }spin_unlock_irqrestore (&phba->sli4_hba.nvmet_io_wait_lock, iflag); -spin_lock_irqsave (&phba->sli4_hba.nvmet_io_lock, iflag); +spin_lock_irqsave (&phba->sli4_hba.nvmet_ctx_put_lock, iflag);list_add_tail (&ctx_buf->list, - &phba->sli4_hba.lpfc_nvmet_ctx_list); - phba->sli4_hba.nvmet_ctx_cnt++; -spin_unlock_irqrestore (&phba->sli4_hba.nvmet_io_lock, iflag); + &phba->sli4_hba.lpfc_nvmet_ctx_put_list); + phba->sli4_hba.nvmet_ctx_put_cnt++; +spin_unlock_irqrestore (&phba->sli4_hba.nvmet_ctx_put_lock, iflag);#endif }
drivers/scsi/lpfc/lpfc_nvmet.c lpfc_nvmet_cleanup_io_context(struct lpfc_hba *phba) · line 869
Quoted 10 lines
drivers/scsi/lpfc/lpfc_nvmet.c +2
-5@@ -865,28 +865,46 @@ lpfc_nvmet_cleanup_io_context(struct lpfc_hba *phba)struct lpfc_nvmet_ctxbuf *ctx_buf, *next_ctx_buf;unsigned long flags; -list_for_each_entry_safe ( - ctx_buf, next_ctx_buf, - &phba->sli4_hba.lpfc_nvmet_ctx_list, list) { -spin_lock_irqsave ( - &phba->sli4_hba.abts_nvme_buf_list_lock, flags); +spin_lock_irqsave (&phba->sli4_hba.nvmet_ctx_get_lock, flags); +spin_lock_irq (&phba->sli4_hba.nvmet_ctx_put_lock);
What is that doing here? Shouldn't it be moved to the next list_for_each?
Quoted 36 lines
drivers/scsi/lpfc/lpfc_nvmet.c +19
-5+list_for_each_entry_safe (ctx_buf, next_ctx_buf, + &phba->sli4_hba.lpfc_nvmet_ctx_get_list, list) { +spin_lock_irq (&phba->sli4_hba.abts_nvme_buf_list_lock);list_del_init (&ctx_buf->list); -spin_unlock_irqrestore ( - &phba->sli4_hba.abts_nvme_buf_list_lock, flags); +spin_unlock_irq (&phba->sli4_hba.abts_nvme_buf_list_lock);__lpfc_clear_active_sglq (phba, ctx_buf->sglq->sli4_lxritag); ctx_buf->sglq->state =SGL_FREED ; ctx_buf->sglq->ndlp =NULL ; -spin_lock_irqsave (&phba->sli4_hba.sgl_list_lock, flags); +spin_lock_irq (&phba->sli4_hba.sgl_list_lock);list_add_tail (&ctx_buf->sglq->list, &phba->sli4_hba.lpfc_nvmet_sgl_list); -spin_unlock_irqrestore (&phba->sli4_hba.sgl_list_lock, - flags); +spin_unlock_irq (&phba->sli4_hba.sgl_list_lock);lpfc_sli_release_iocbq (phba, ctx_buf->iocbq);kfree (ctx_buf->context); } +list_for_each_entry_safe (ctx_buf, next_ctx_buf, + &phba->sli4_hba.lpfc_nvmet_ctx_put_list, list) { +spin_lock_irq (&phba->sli4_hba.abts_nvme_buf_list_lock); +list_del_init (&ctx_buf->list); +spin_unlock_irq (&phba->sli4_hba.abts_nvme_buf_list_lock); +__lpfc_clear_active_sglq (phba, + ctx_buf->sglq->sli4_lxritag); + ctx_buf->sglq->state =SGL_FREED ; + ctx_buf->sglq->ndlp =NULL ; + +spin_lock_irq (&phba->sli4_hba.sgl_list_lock); +list_add_tail (&ctx_buf->sglq->list, + &phba->sli4_hba.lpfc_nvmet_sgl_list);
drivers/scsi/lpfc/lpfc_nvmet.c lpfc_nvmet_cleanup_io_context(struct lpfc_hba *phba) · line 910
Quoted 10 lines
drivers/scsi/lpfc/lpfc_nvmet.c +7
-0+spin_unlock_irq (&phba->sli4_hba.sgl_list_lock); + +lpfc_sli_release_iocbq (phba, ctx_buf->iocbq); +kfree (ctx_buf->context); + } +spin_unlock_irq (&phba->sli4_hba.nvmet_ctx_put_lock); +spin_unlock_irqrestore (&phba->sli4_hba.nvmet_ctx_get_lock, flags); } static int
See above. Holding two locks at the same time as the old one doesn't really reduce contention, no?
Quoted 7 lines
drivers/scsi/lpfc/lpfc_nvmet.c +1
-1@@ -958,12 +976,12 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) "6407 Ran out of NVMET XRIs\n");return -ENOMEM ; } -spin_lock (&phba->sli4_hba.nvmet_io_lock); +spin_lock (&phba->sli4_hba.nvmet_ctx_get_lock); list_add_tail(&ctx_buf->list,
drivers/scsi/lpfc/lpfc_nvmet.c lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) · line 987
Quoted 10 lines
drivers/scsi/lpfc/lpfc_nvmet.c +3
-3- &phba->sli4_hba.lpfc_nvmet_ctx_list); -spin_unlock (&phba->sli4_hba.nvmet_io_lock); + &phba->sli4_hba.lpfc_nvmet_ctx_get_list); +spin_unlock (&phba->sli4_hba.nvmet_ctx_get_lock); } - phba->sli4_hba.nvmet_ctx_cnt = phba->sli4_hba.nvmet_xri_cnt; + phba->sli4_hba.nvmet_ctx_get_cnt = phba->sli4_hba.nvmet_xri_cnt;return 0 ; }
Why is this not not protected by a spinlock?
The very first hunk suggested that it should...
Quoted 63 lines
drivers/scsi/lpfc/lpfc_nvmet.c +23
-5@@ -1370,13 +1388,31 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, goto dropit; } -spin_lock_irqsave (&phba->sli4_hba.nvmet_io_lock, iflag); -if (phba->sli4_hba.nvmet_ctx_cnt) { -list_remove_head (&phba->sli4_hba.lpfc_nvmet_ctx_list, +spin_lock_irqsave (&phba->sli4_hba.nvmet_ctx_get_lock, iflag); +if (phba->sli4_hba.nvmet_ctx_get_cnt) { +list_remove_head (&phba->sli4_hba.lpfc_nvmet_ctx_get_list, ctx_buf, struct lpfc_nvmet_ctxbuf, list); - phba->sli4_hba.nvmet_ctx_cnt--; + phba->sli4_hba.nvmet_ctx_get_cnt--; + }else { +spin_lock (&phba->sli4_hba.nvmet_ctx_put_lock); +if (phba->sli4_hba.nvmet_ctx_put_cnt) { +list_splice (&phba->sli4_hba.lpfc_nvmet_ctx_put_list, + &phba->sli4_hba.lpfc_nvmet_ctx_get_list); +INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_ctx_put_list); + phba->sli4_hba.nvmet_ctx_get_cnt = + phba->sli4_hba.nvmet_ctx_put_cnt; + phba->sli4_hba.nvmet_ctx_put_cnt =0 ; +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock); + +list_remove_head ( + &phba->sli4_hba.lpfc_nvmet_ctx_get_list, + ctx_buf, struct lpfc_nvmet_ctxbuf, list); + phba->sli4_hba.nvmet_ctx_get_cnt--; + }else { +spin_unlock (&phba->sli4_hba.nvmet_ctx_put_lock); + } } -spin_unlock_irqrestore (&phba->sli4_hba.nvmet_io_lock, iflag); +spin_unlock_irqrestore (&phba->sli4_hba.nvmet_ctx_get_lock, iflag); fc_hdr = (struct fc_frame_header *)(nvmebuf->hbuf.virt); oxid =be16_to_cpu (fc_hdr->fh_ox_id);drivers/scsi/lpfc/lpfc_sli4.h +4
-2@@ -621,7 +621,8 @@ struct lpfc_sli4_hba {uint16_t scsi_xri_start;uint16_t els_xri_cnt;uint16_t nvmet_xri_cnt; -uint16_t nvmet_ctx_cnt; +uint16_t nvmet_ctx_get_cnt; +uint16_t nvmet_ctx_put_cnt;uint16_t nvmet_io_wait_cnt;uint16_t nvmet_io_wait_total;struct list_head lpfc_els_sgl_list;@@ -630,7 +631,8 @@ struct lpfc_sli4_hba {struct list_head lpfc_abts_nvmet_ctx_list;struct list_head lpfc_abts_scsi_buf_list;struct list_head lpfc_abts_nvme_buf_list; -struct list_head lpfc_nvmet_ctx_list; +struct list_head lpfc_nvmet_ctx_get_list; +struct list_head lpfc_nvmet_ctx_put_list;struct list_head lpfc_nvmet_io_wait_list;struct lpfc_sglq **lpfc_sglq_active_list;struct list_head lpfc_rpi_hdr_list;
drivers/scsi/lpfc/lpfc_sli4.h struct lpfc_sli4_hba { · line 671
Quoted 9 lines
drivers/scsi/lpfc/lpfc_sli4.h +2
-1@@ -662,7 +664,8 @@ struct lpfc_sli4_hba {spinlock_t abts_nvme_buf_list_lock;/* list of aborted SCSI IOs */ spinlock_t abts_scsi_buf_list_lock;/* list of aborted SCSI IOs */ spinlock_t sgl_list_lock;/* list of aborted els IOs */ -spinlock_t nvmet_io_lock; +spinlock_t nvmet_ctx_get_lock;/* list of avail XRI contexts */ +spinlock_t nvmet_ctx_put_lock;/* list of avail XRI contexts */ spinlock_t nvmet_io_wait_lock;/* IOs waiting for ctx resources */ uint32_t physical_port;
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 6/11 Fix SLI3 drivers attempting NVME ELS commands.
In reply to James SmartIn a server with an 8G adapter and a 32G adapter, running NVME and FCP, the server would crash with the following stack.
RIP: 0010: ... lpfc_nvme_register_port+0x38/0x420 [lpfc] lpfc_nlp_state_cleanup+0x154/0x4f0 [lpfc] lpfc_nlp_set_state+0x9d/0x1a0 [lpfc] lpfc_cmpl_prli_prli_issue+0x35f/0x440 [lpfc] lpfc_disc_state_machine+0x78/0x1c0 [lpfc] lpfc_cmpl_els_prli+0x17c/0x1f0 [lpfc] lpfc_sli_sp_handle_rspiocb+0x39b/0x6b0 [lpfc] lpfc_sli_handle_slow_ring_event_s3+0x134/0x2d0 [lpfc] lpfc_work_done+0x8ac/0x13b0 [lpfc] lpfc_do_work+0xf1/0x1b0 [lpfc]
Crash, on the 8G adapter, is due to a vport which does not have a nvme local port structure. It's not supposed to have one. NVME is not supported on the 8G adapter, so the NVME PRLI, which started this flow shouldn't have been sent in the first place.
Correct discovery engine to recognize when on an SLI3 rport, which doesn't support SLI3, if the rport supports only NVME, don't send a NVME PRLI. Instead, as no FC4 will be used, a LOGO is sent. If rport is FCP and NVME, only execute the SCSI PRLI.
--- drivers/scsi/lpfc/lpfc_els.c | 16 +++++++++++++++- drivers/scsi/lpfc/lpfc_hbadisc.c | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +15 -1
@@ -2168,6 +2168,19 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp->nlp_fc4_type, ndlp->nlp_DID);return 1 ; } + +/* SLI3 ports don't support NVME. If this rport is a strict NVME +* FC4 type, implicitly LOGO. +*/ +if (phba->sli_rev ==LPFC_SLI_REV3 && + ndlp->nlp_fc4_type ==NLP_FC4_NVME ) { +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +"3088 Rport fc4 type 0x%x not supported by SLI3 adapter\n" , + ndlp->nlp_type); +lpfc_disc_state_machine (vport, ndlp,NULL ,NLP_EVT_DEVICE_RM ); +return 1 ; + } + elsiocb =lpfc_prep_els_iocb (vport,1 , cmdsize, retry, ndlp, ndlp->nlp_DID, elscmd);if (!elsiocb)
@@ -2268,7 +2281,8 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* The driver supports 2 FC4 types. Make sure * a PRLI is issued for all types before exiting. */ -if (local_nlp_type & (NLP_FC4_FCP |NLP_FC4_NVME )) +if (phba->sli_rev ==LPFC_SLI_REV4 && + local_nlp_type & (NLP_FC4_FCP |NLP_FC4_NVME )) goto send_next_prli;return 0 ;
drivers/scsi/lpfc/lpfc_hbadisc.c +2 -1
@@ -4194,7 +4194,8 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,lpfc_register_remote_port (vport, ndlp); }/* Notify the NVME transport of this new rport. */ -if (ndlp->nlp_fc4_type &NLP_FC4_NVME ) { +if (vport->phba->sli_rev >=LPFC_SLI_REV4 && + ndlp->nlp_fc4_type &NLP_FC4_NVME ) {if (vport->phba->nvmet_support ==0 ) {/* Register this rport with the transport. * Initiators take the NDLP ref count in
Signature · 1 line
2.11.0
Re: [PATCH 06/11] Fix SLI3 drivers attempting NVME ELS commands.
Quoted 71 lines · James Smart
In a server with an 8G adapter and a 32G adapter, running NVME and FCP, the server would crash with the following stack.
RIP: 0010: ... lpfc_nvme_register_port+0x38/0x420 [lpfc] lpfc_nlp_state_cleanup+0x154/0x4f0 [lpfc] lpfc_nlp_set_state+0x9d/0x1a0 [lpfc] lpfc_cmpl_prli_prli_issue+0x35f/0x440 [lpfc] lpfc_disc_state_machine+0x78/0x1c0 [lpfc] lpfc_cmpl_els_prli+0x17c/0x1f0 [lpfc] lpfc_sli_sp_handle_rspiocb+0x39b/0x6b0 [lpfc] lpfc_sli_handle_slow_ring_event_s3+0x134/0x2d0 [lpfc] lpfc_work_done+0x8ac/0x13b0 [lpfc] lpfc_do_work+0xf1/0x1b0 [lpfc]Crash, on the 8G adapter, is due to a vport which does not have a nvme local port structure. It's not supposed to have one. NVME is not supported on the 8G adapter, so the NVME PRLI, which started this flow shouldn't have been sent in the first place.
Correct discovery engine to recognize when on an SLI3 rport, which doesn't support SLI3, if the rport supports only NVME, don't send a NVME PRLI. Instead, as no FC4 will be used, a LOGO is sent. If rport is FCP and NVME, only execute the SCSI PRLI.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_els.c | 16 +++++++++++++++- drivers/scsi/lpfc/lpfc_hbadisc.c | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)drivers/scsi/lpfc/lpfc_els.c +15
-1@@ -2168,6 +2168,19 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp->nlp_fc4_type, ndlp->nlp_DID);return 1 ; } + +/* SLI3 ports don't support NVME. If this rport is a strict NVME +* FC4 type, implicitly LOGO. +*/ +if (phba->sli_rev ==LPFC_SLI_REV3 && + ndlp->nlp_fc4_type ==NLP_FC4_NVME ) { +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +"3088 Rport fc4 type 0x%x not supported by SLI3 adapter\n" , + ndlp->nlp_type); +lpfc_disc_state_machine (vport, ndlp,NULL ,NLP_EVT_DEVICE_RM ); +return 1 ; + } + elsiocb =lpfc_prep_els_iocb (vport,1 , cmdsize, retry, ndlp, ndlp->nlp_DID, elscmd);if (!elsiocb)@@ -2268,7 +2281,8 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* The driver supports 2 FC4 types. Make sure * a PRLI is issued for all types before exiting. */ -if (local_nlp_type & (NLP_FC4_FCP |NLP_FC4_NVME )) +if (phba->sli_rev ==LPFC_SLI_REV4 && + local_nlp_type & (NLP_FC4_FCP |NLP_FC4_NVME )) goto send_next_prli;return 0 ;drivers/scsi/lpfc/lpfc_hbadisc.c +0
-0
drivers/scsi/lpfc/lpfc_hbadisc.c lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · line 4201
Quoted 9 lines
drivers/scsi/lpfc/lpfc_hbadisc.c +2
-1@@ -4194,7 +4194,8 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,lpfc_register_remote_port (vport, ndlp); }/* Notify the NVME transport of this new rport. */ -if (ndlp->nlp_fc4_type &NLP_FC4_NVME ) { +if (vport->phba->sli_rev >=LPFC_SLI_REV4 && + ndlp->nlp_fc4_type &NLP_FC4_NVME ) {if (vport->phba->nvmet_support ==0 ) {/* Register this rport with the transport. * Initiators take the NDLP ref count in
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 7/11 Fix crash after firmware flash when IO is running.
In reply to James SmartOS crashes after the completion of firmware download.
Failure in posting SCSI SGL buffers because number of SGL buffers is less than total count. Some of the pending IOs are not completed by driver. SGL buffers for these IOs are not added back to the list. Pending IOs are not completed because lpfc_wq_list list is initialized before completion of pending IOs.
Postpone lpfc_wq_list reinitialization by moving lpfc_sli4_queue_destroy() after lpfc_hba_down_post().
--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -4303,7 +4303,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba)/* Perform FCoE PCI function reset before freeing queue memory */ rc =lpfc_pci_function_reset (phba); -lpfc_sli4_queue_destroy (phba);/* Restore PCI cmd register */ pci_write_config_word (phba->pcidev,PCI_COMMAND , cfg_value);
@@ -4428,6 +4427,7 @@ lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)pci_disable_pcie_error_reporting (phba->pcidev);lpfc_hba_down_post (phba); +lpfc_sli4_queue_destroy (phba);return rc; }
Signature · 1 line
2.11.0
Re: [PATCH 07/11] Fix crash after firmware flash when IO is running.
Quoted 31 lines · James Smart
OS crashes after the completion of firmware download.
Failure in posting SCSI SGL buffers because number of SGL buffers is less than total count. Some of the pending IOs are not completed by driver. SGL buffers for these IOs are not added back to the list. Pending IOs are not completed because
lpfc_wq_listlist is initialized before completion of pending IOs.Postpone
lpfc_wq_listreinitialization by movinglpfc_sli4_queue_destroy()afterlpfc_hba_down_post().Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_sli.c +0
-1@@ -4303,7 +4303,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba)/* Perform FCoE PCI function reset before freeing queue memory */ rc =lpfc_pci_function_reset (phba); -lpfc_sli4_queue_destroy (phba);/* Restore PCI cmd register */ pci_write_config_word (phba->pcidev,PCI_COMMAND , cfg_value);
drivers/scsi/lpfc/lpfc_sli.c lpfc_sli_brdrestart_s4(struct lpfc_hba *phba) · line 4433
Quoted 7 lines
drivers/scsi/lpfc/lpfc_sli.c +1
-0@@ -4428,6 +4427,7 @@ lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)pci_disable_pcie_error_reporting (phba->pcidev);lpfc_hba_down_post (phba); +lpfc_sli4_queue_destroy (phba);return rc; }
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 8/11 Fix crash doing IO with resets
In reply to James SmartDuring every reset, IOCBs are allocated. So, at one point, number of allocated IOCBs reaches maximum limit and lpfc_sli_next_iotag fails.
Allocate IOCBs only during initialization. Reuse them after every reset instead of allocating new set of IOCBs.
--- drivers/scsi/lpfc/lpfc_sli.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +8 -14
@@ -6927,18 +6927,6 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) cnt = phba->cfg_iocb_cnt *1024 ;/* We need 1 iocbq for every SGL, for IO processing */ cnt += phba->sli4_hba.nvmet_xri_cnt; -/* Initialize and populate the iocb list per host */ -lpfc_printf_log (phba,KERN_INFO ,LOG_INIT , -"2821 initialize iocb list %d total %d\n" , - phba->cfg_iocb_cnt, cnt); - rc =lpfc_init_iocb_list (phba, cnt); -if (rc) { -lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , -"1413 Failed to init iocb list.\n" ); - goto out_destroy_queue; - } - -lpfc_nvmet_create_targetport (phba); }else {/* update host scsi xri-sgl sizes and mappings */ rc =lpfc_sli4_scsi_sgl_update (phba);
@@ -6959,18 +6947,24 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) } cnt = phba->cfg_iocb_cnt *1024 ; + } + +if (!phba->sli.iocbq_lookup) {/* Initialize and populate the iocb list per host */ lpfc_printf_log (phba,KERN_INFO ,LOG_INIT , -"2820 initialize iocb list %d total %d\n" , +"2821 initialize iocb list %d total %d\n" , phba->cfg_iocb_cnt, cnt); rc =lpfc_init_iocb_list (phba, cnt);if (rc) {lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , -"6301 Failed to init iocb list.\n" ); +"1413 Failed to init iocb list.\n" ); goto out_destroy_queue; } } +if (phba->nvmet_support) +lpfc_nvmet_create_targetport (phba); +if (phba->nvmet_support && phba->cfg_nvmet_mrq) {/* Post initial buffers to all RQs created */ for (i =0 ; i < phba->cfg_nvmet_mrq; i++) {
Signature · 1 line
2.11.0
Re: [PATCH 08/11] Fix crash doing IO with resets
Quoted 53 lines · James Smart
During every reset, IOCBs are allocated. So, at one point, number of allocated IOCBs reaches maximum limit and
lpfc_sli_next_iotagfails.Allocate IOCBs only during initialization. Reuse them after every reset instead of allocating new set of IOCBs.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_sli.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)drivers/scsi/lpfc/lpfc_sli.c +5
-14@@ -6927,18 +6927,6 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) cnt = phba->cfg_iocb_cnt *1024 ;/* We need 1 iocbq for every SGL, for IO processing */ cnt += phba->sli4_hba.nvmet_xri_cnt; -/* Initialize and populate the iocb list per host */ -lpfc_printf_log (phba,KERN_INFO ,LOG_INIT , -"2821 initialize iocb list %d total %d\n" , - phba->cfg_iocb_cnt, cnt); - rc =lpfc_init_iocb_list (phba, cnt); -if (rc) { -lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , -"1413 Failed to init iocb list.\n" ); - goto out_destroy_queue; - } - -lpfc_nvmet_create_targetport (phba); }else {/* update host scsi xri-sgl sizes and mappings */ rc =lpfc_sli4_scsi_sgl_update (phba);@@ -6959,18 +6947,24 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) } cnt = phba->cfg_iocb_cnt *1024 ; + } + +if (!phba->sli.iocbq_lookup) {/* Initialize and populate the iocb list per host */ lpfc_printf_log (phba,KERN_INFO ,LOG_INIT , -"2820 initialize iocb list %d total %d\n" , +"2821 initialize iocb list %d total %d\n" , phba->cfg_iocb_cnt, cnt); rc =lpfc_init_iocb_list (phba, cnt);if (rc) {lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , -"6301 Failed to init iocb list.\n" ); +"1413 Failed to init iocb list.\n" );
drivers/scsi/lpfc/lpfc_sli.c lpfc_sli4_hba_setup(struct lpfc_hba *phba) · line 6970
Quoted 10 lines
drivers/scsi/lpfc/lpfc_sli.c +3
-0goto out_destroy_queue; } } +if (phba->nvmet_support) +lpfc_nvmet_create_targetport (phba); +if (phba->nvmet_support && phba->cfg_nvmet_mrq) {/* Post initial buffers to all RQs created */ for (i =0 ; i < phba->cfg_nvmet_mrq; i++) {
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 9/11 Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort request.
In reply to James SmartWhen running nvme detach-ns /dev/nvme0n1 -n 1 command, the nvmet lpfc driver crashes with this stack dump:
kernel BUG at /root/NVME/lpfc_8.4/lpfc_sli.c:1393! invalid opcode: 0000 [#1] SMP
Workqueue: nvmet-fc-cpu0 nvmet_fc_do_work_on_cpu [nvmet_fc] lpfc_sli4_issue_wqe+0x357/0x440 [lpfc] lpfc_nvmet_xmt_fcp_abort+0x36b/0x5c0 [lpfc] nvmet_fc_abort_op+0x30/0x50 [nvmet_fc] nvmet_fc_do_work_on_cpu+0xd9/0x130 [nvmet_fc] process_one_work+0x14e/0x410 worker_thread+0x116/0x490 kthread+0xc7/0xe0 ret_from_fork+0x3f/0x70
Crash is due to an uninitialized iocbq->vport pointer.
Explicitly set the iocbq->vport field to phba->pport in lpfc_nvmet_sol_fcp_issue_abort as it does all abort iocbq initialization in the routine. Using phba->pport is ok because target does not support NPIV instances.
--- drivers/scsi/lpfc/lpfc_nvmet.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/lpfc/lpfc_nvmet.c +1 -0
@@ -2523,6 +2523,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, abts_wqeq->iocb_cmpl =0 ; abts_wqeq->iocb_flag |=LPFC_IO_NVME ; abts_wqeq->context2 = ctxp; + abts_wqeq->vport = phba->pport; rc =lpfc_sli4_issue_wqe (phba,LPFC_FCP_RING , abts_wqeq);spin_unlock_irqrestore (&phba->hbalock, flags);if (rc ==WQE_SUCCESS ) {
Signature · 1 line
2.11.0
Re: [PATCH 09/11] Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort request.
Quoted 34 lines · James Smart
When running nvme detach-ns
/dev/nvme0n1-n 1 command, the nvmet lpfc driver crashes with this stack dump:kernel BUG at
/root/NVME/lpfc_8.4/lpfc_sli.c:1393! invalid opcode: 0000 [#1] SMPWorkqueue: nvmet-fc-cpu0 nvmet_fc_do_work_on_cpu [nvmet_fc] lpfc_sli4_issue_wqe+0x357/0x440 [lpfc] lpfc_nvmet_xmt_fcp_abort+0x36b/0x5c0 [lpfc] nvmet_fc_abort_op+0x30/0x50 [nvmet_fc] nvmet_fc_do_work_on_cpu+0xd9/0x130 [nvmet_fc] process_one_work+0x14e/0x410 worker_thread+0x116/0x490 kthread+0xc7/0xe0 ret_from_fork+0x3f/0x70Crash is due to an uninitialized
iocbq->vportpointer.Explicitly set the
iocbq->vportfield tophba->pportinlpfc_nvmet_sol_fcp_issue_abortas it does all abort iocbq initialization in the routine. Usingphba->pportis ok because target does not support NPIV instances.Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_nvmet.c | 1 + 1 file changed, 1 insertion(+)drivers/scsi/lpfc/lpfc_nvmet.c +0
-0
drivers/scsi/lpfc/lpfc_nvmet.c lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, · line 2529
Quoted 7 lines
drivers/scsi/lpfc/lpfc_nvmet.c +1
-0@@ -2523,6 +2523,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, abts_wqeq->iocb_cmpl =0 ; abts_wqeq->iocb_flag |=LPFC_IO_NVME ; abts_wqeq->context2 = ctxp; + abts_wqeq->vport = phba->pport; rc =lpfc_sli4_issue_wqe (phba,LPFC_FCP_RING , abts_wqeq);spin_unlock_irqrestore (&phba->hbalock, flags);if (rc ==WQE_SUCCESS ) {
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 10/11 Driver responds LS_RJT to Beacon Off ELS - Linux
In reply to James SmartBeacon OFF from switch is rejected by driver.
Driver fails Beacon OFF if frequency is set to 0. As per fc-ls spec, status, capability, frequency and duration fields are only applicable for Beacon ON.
Remove frequency and type checks. Reject Beacon ON if duration is non zero.
--- drivers/scsi/lpfc/lpfc_els.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +4 -18
@@ -5703,27 +5703,13 @@ lpfc_els_rcv_lcb(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, rjt_err =LSRJT_CMD_UNSUPPORTED ; goto rjt; } -if (beacon->lcb_frequency ==0 ) { +if (beacon->lcb_sub_command !=LPFC_LCB_ON && + beacon->lcb_sub_command !=LPFC_LCB_OFF ) { rjt_err =LSRJT_CMD_UNSUPPORTED ; goto rjt; } -if ((beacon->lcb_type !=LPFC_LCB_GREEN ) && - (beacon->lcb_type !=LPFC_LCB_AMBER )) { - rjt_err =LSRJT_CMD_UNSUPPORTED ; - goto rjt; - } -if ((beacon->lcb_sub_command !=LPFC_LCB_ON ) && - (beacon->lcb_sub_command !=LPFC_LCB_OFF )) { - rjt_err =LSRJT_CMD_UNSUPPORTED ; - goto rjt; - } -if ((beacon->lcb_sub_command ==LPFC_LCB_ON ) && - (beacon->lcb_type !=LPFC_LCB_GREEN ) && - (beacon->lcb_type !=LPFC_LCB_AMBER )) { - rjt_err =LSRJT_CMD_UNSUPPORTED ; - goto rjt; - } -if (be16_to_cpu (beacon->lcb_duration) !=0 ) { +if (beacon->lcb_sub_command ==LPFC_LCB_ON && +be16_to_cpu (beacon->lcb_duration) !=0 ) { rjt_err =LSRJT_CMD_UNSUPPORTED ; goto rjt; }
Signature · 1 line
2.11.0
Re: [PATCH 10/11] Driver responds LS_RJT to Beacon Off ELS - Linux
Quoted 42 lines · James Smart
Beacon OFF from switch is rejected by driver.
Driver fails Beacon OFF if frequency is set to 0. As per fc-ls spec, status, capability, frequency and duration fields are only applicable for Beacon ON.
Remove frequency and type checks. Reject Beacon ON if duration is non zero.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_els.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)drivers/scsi/lpfc/lpfc_els.c +2
-13@@ -5703,27 +5703,13 @@ lpfc_els_rcv_lcb(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, rjt_err =LSRJT_CMD_UNSUPPORTED ; goto rjt; } -if (beacon->lcb_frequency ==0 ) { +if (beacon->lcb_sub_command !=LPFC_LCB_ON && + beacon->lcb_sub_command !=LPFC_LCB_OFF ) { rjt_err =LSRJT_CMD_UNSUPPORTED ; goto rjt; } -if ((beacon->lcb_type !=LPFC_LCB_GREEN ) && - (beacon->lcb_type !=LPFC_LCB_AMBER )) { - rjt_err =LSRJT_CMD_UNSUPPORTED ; - goto rjt; - } -if ((beacon->lcb_sub_command !=LPFC_LCB_ON ) && - (beacon->lcb_sub_command !=LPFC_LCB_OFF )) { - rjt_err =LSRJT_CMD_UNSUPPORTED ; - goto rjt; - } - if ((beacon->lcb_sub_command == LPFC_LCB_ON) && - (beacon->lcb_type != LPFC_LCB_GREEN) &&
drivers/scsi/lpfc/lpfc_els.c lpfc_els_rcv_lcb(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, · line 5715
Quoted 10 lines
drivers/scsi/lpfc/lpfc_els.c +2
-5- (beacon->lcb_type != LPFC_LCB_AMBER)) { - rjt_err =LSRJT_CMD_UNSUPPORTED ; - goto rjt; - } -if (be16_to_cpu (beacon->lcb_duration) !=0 ) { +if (beacon->lcb_sub_command ==LPFC_LCB_ON && +be16_to_cpu (beacon->lcb_duration) !=0 ) { rjt_err =LSRJT_CMD_UNSUPPORTED ; goto rjt; }
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH 11/11 lpfc: update to revision to 11.4.0.1
In reply to James SmartSet lpfc driver revision to 11.4.0.1
--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "11.4.0.0" +#define LPFC_DRIVER_VERSION "11.4.0.1"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.11.0
Re: [PATCH 11/11] lpfc: update to revision to 11.4.0.1
Quoted 14 lines · James Smart
Set lpfc driver revision to 11.4.0.1
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_version.h +0
-0
drivers/scsi/lpfc/lpfc_version.h line 26
Quoted 8 lines
drivers/scsi/lpfc/lpfc_version.h +1
-1@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "11.4.0.0" +#define LPFC_DRIVER_VERSION "11.4.0.1"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Martin K. Petersen
AppliedJames,
Quoted 3 lines
The patches were cut against the Martin's 4.13/scsi-queue tree. There are no outside dependencies. The patches should merge via Martin's tree.
Applied to 4.13/scsi-queue, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering