All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1
@ 2019-11-11 23:03 James Smart
  2019-11-11 23:03 ` [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences James Smart
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: James Smart @ 2019-11-11 23:03 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart

Update lpfc to revision 12.6.0.2

This patch set contains:
two fixes for coverity reports
one fix for a compilation error
a driver fix to address hot-cpu add conditions
and a oneliner that is cleanup

The patches were cut against Martin's 5.5/scsi-queue tree


James Smart (6):
  lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences
  lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): Null pointer dereferences
  lpfc: fix inlining of lpfc_sli4_cleanup_poll_list()
  lpfc: Initialize cpu_map for not present cpus
  lpfc: revise nvme max queues to be hdwq count
  lpfc: Update lpfc version to 12.6.0.2

 drivers/scsi/lpfc/lpfc_crtn.h    |  2 +-
 drivers/scsi/lpfc/lpfc_els.c     |  2 +-
 drivers/scsi/lpfc/lpfc_init.c    | 19 ++++++++++++++++++-
 drivers/scsi/lpfc/lpfc_nvme.c    | 10 ++++------
 drivers/scsi/lpfc/lpfc_scsi.c    |  2 +-
 drivers/scsi/lpfc/lpfc_sli.c     |  2 +-
 drivers/scsi/lpfc/lpfc_version.h |  2 +-
 7 files changed, 27 insertions(+), 12 deletions(-)

-- 
2.13.7


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
@ 2019-11-11 23:03 ` James Smart
  2019-11-12 18:30   ` Ewan D. Milne
  2019-11-11 23:03 ` [PATCH 2/6] lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): " James Smart
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: James Smart @ 2019-11-11 23:03 UTC (permalink / raw)
  To: linux-scsi
  Cc: James Smart, Dick Kennedy, Martin K. Petersen,
	Gustavo A. R. Silva, linux-next

Coverity reported the following:

*** CID 1487391:  Null pointer dereferences  (FORWARD_NULL)
/drivers/scsi/lpfc/lpfc_scsi.c: 614 in lpfc_get_scsi_buf_s3()
608     		spin_unlock(&phba->scsi_buf_list_put_lock);
609     	}
610     	spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
611
612     	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
613     		atomic_inc(&ndlp->cmd_pending);
vvv     CID 1487391:  Null pointer dereferences  (FORWARD_NULL)
vvv     Dereferencing null pointer "lpfc_cmd".
614     		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
615     	}
616     	return  lpfc_cmd;
617     }
618     /**
619      * lpfc_get_scsi_buf_s4 - Get a scsi buffer from io_buf_list of the HBA

Fix by checking lpfc_cmd to be non-NULL as part of line 612

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1487391 ("Null pointer dereferences")
Fixes: 2a5b7d626ed2 ("scsi: lpfc: Limit tracking of tgt queue depth in fast path")

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
CC: linux-next@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 959ef471d758..ba26df90a36a 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -611,7 +611,7 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
 	}
 	spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
 
-	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
+	if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {
 		atomic_inc(&ndlp->cmd_pending);
 		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
 	}
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/6] lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): Null pointer dereferences
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
  2019-11-11 23:03 ` [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences James Smart
@ 2019-11-11 23:03 ` James Smart
  2019-11-12 18:30   ` Ewan D. Milne
  2019-11-11 23:03 ` [PATCH 3/6] lpfc: fix inlining of lpfc_sli4_cleanup_poll_list() James Smart
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: James Smart @ 2019-11-11 23:03 UTC (permalink / raw)
  To: linux-scsi
  Cc: James Smart, Dick Kennedy, James Bottomley, Gustavo A. R. Silva,
	linux-next

Coverity reported the following:

*** CID 101747:  Null pointer dereferences  (FORWARD_NULL)
/drivers/scsi/lpfc/lpfc_els.c: 4439 in lpfc_cmpl_els_rsp()
4433     			kfree(mp);
4434     		}
4435     		mempool_free(mbox, phba->mbox_mem_pool);
4436     	}
4437     out:
4438     	if (ndlp && NLP_CHK_NODE_ACT(ndlp)) {
vvv     CID 101747:  Null pointer dereferences  (FORWARD_NULL)
vvv     Dereferencing null pointer "shost".
4439     		spin_lock_irq(shost->host_lock);
4440     		ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI);
4441     		spin_unlock_irq(shost->host_lock);
4442
4443     		/* If the node is not being used by another discovery thread,
4444     		 * and we are sending a reject, we are done with it.

Fix by adding a check for non-null shost in line 4438.
The scenario when shost is set to null is when ndlp is null.
As such, the ndlp check present was sufficient. But better safe
than sorry so add the shost check.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 101747 ("Null pointer dereferences")
Fixes: 2e0fef85e098 ("[SCSI] lpfc: NPIV: split ports")

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
CC: James Bottomley <James.Bottomley@SteelEye.com>
CC: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
CC: linux-next@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_els.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 9a570c15b2a1..42a2bf38eaea 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4445,7 +4445,7 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 		mempool_free(mbox, phba->mbox_mem_pool);
 	}
 out:
-	if (ndlp && NLP_CHK_NODE_ACT(ndlp)) {
+	if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) {
 		spin_lock_irq(shost->host_lock);
 		ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI);
 		spin_unlock_irq(shost->host_lock);
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] lpfc: fix inlining of lpfc_sli4_cleanup_poll_list()
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
  2019-11-11 23:03 ` [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences James Smart
  2019-11-11 23:03 ` [PATCH 2/6] lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): " James Smart
@ 2019-11-11 23:03 ` James Smart
  2019-11-12 18:31   ` Ewan D. Milne
  2019-11-11 23:03 ` [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus James Smart
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: James Smart @ 2019-11-11 23:03 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart, Dick Kennedy

Compilation can fail due to having an inline function
reference where the function body is not present.

Fix by removing the inline tag.

Fixes: 93a4d6f40198 ("scsi: lpfc: Add registration for CPU Offline/Online events")

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
patch is in the 12.6.0.1 set which is in 5.5/scsi-queue
---
 drivers/scsi/lpfc/lpfc_crtn.h | 2 +-
 drivers/scsi/lpfc/lpfc_sli.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index d91aa5330306..ee353c84a097 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -215,7 +215,7 @@ irqreturn_t lpfc_sli_fp_intr_handler(int, void *);
 irqreturn_t lpfc_sli4_intr_handler(int, void *);
 irqreturn_t lpfc_sli4_hba_intr_handler(int, void *);
 
-inline void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba);
+void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba);
 int lpfc_sli4_poll_eq(struct lpfc_queue *q, uint8_t path);
 void lpfc_sli4_poll_hbtimer(struct timer_list *t);
 void lpfc_sli4_start_polling(struct lpfc_queue *q);
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index fad890cea21a..6d82ad9380db 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -14466,7 +14466,7 @@ static inline void lpfc_sli4_remove_from_poll_list(struct lpfc_queue *eq)
 		del_timer_sync(&phba->cpuhp_poll_timer);
 }
 
-inline void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba)
+void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba)
 {
 	struct lpfc_queue *eq, *next;
 
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
                   ` (2 preceding siblings ...)
  2019-11-11 23:03 ` [PATCH 3/6] lpfc: fix inlining of lpfc_sli4_cleanup_poll_list() James Smart
@ 2019-11-11 23:03 ` James Smart
  2019-11-12 18:32   ` Ewan D. Milne
  2019-11-11 23:04 ` [PATCH 5/6] lpfc: revise nvme max queues to be hdwq count James Smart
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: James Smart @ 2019-11-11 23:03 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart, Dick Kennedy

Currently, cpu_map[cpu#]->hdwq is left to equal
LPFC_VECTOR_MAP_EMPTY for not present CPUs.  If a CPU
is dynamically hot-added, it is possible we may crash due to
not assigning an allocated hdwq.

Correct by assigning a hdwq at initialization for all
not-present cpu's.

Fixes: dcaa21367938 ("scsi: lpfc: Change default IRQ model on AMD architectures")
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
Issue applies as of the 12.2.0.0 patch kit, but this fix requires
the above patch set for resolution. Referenced patch is in the
5.5/scsi-queue branch
---
 drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 480d5a28c4f5..2b0e1097f727 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -11004,7 +11004,7 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
 				cpu, cpup->phys_id, cpup->core_id,
 				cpup->hdwq, cpup->eq, cpup->flag);
 	}
-	/* Finally we need to associate a hdwq with each cpu_map entry
+	/* Associate a hdwq with each cpu_map entry
 	 * This will be 1 to 1 - hdwq to cpu, unless there are less
 	 * hardware queues then CPUs. For that case we will just round-robin
 	 * the available hardware queues as they get assigned to CPUs.
@@ -11083,6 +11083,23 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
 				cpup->hdwq, cpup->eq, cpup->flag);
 	}
 
+	/*
+	 * Initialize the cpu_map slots for not-present cpus in case
+	 * a cpu is hot-added. Perform a simple hdwq round robin assignment.
+	 */
+	idx = 0;
+	for_each_possible_cpu(cpu) {
+		cpup = &phba->sli4_hba.cpu_map[cpu];
+		if (cpup->hdwq != LPFC_VECTOR_MAP_EMPTY)
+			continue;
+
+		cpup->hdwq = idx++ % phba->cfg_hdw_queue;
+		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+				"3340 Set Affinity: not present "
+				"CPU %d hdwq %d\n",
+				cpu, cpup->hdwq);
+	}
+
 	/* The cpu_map array will be used later during initialization
 	 * when EQ / CQ / WQs are allocated and configured.
 	 */
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] lpfc: revise nvme max queues to be hdwq count
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
                   ` (3 preceding siblings ...)
  2019-11-11 23:03 ` [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus James Smart
@ 2019-11-11 23:04 ` James Smart
  2019-11-11 23:04 ` [PATCH 6/6] lpfc: Update lpfc version to 12.6.0.2 James Smart
  2019-11-13  2:14 ` [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 Martin K. Petersen
  6 siblings, 0 replies; 13+ messages in thread
From: James Smart @ 2019-11-11 23:04 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart, Dick Kennedy

Driver is setting the initiator nvme template with a max hw
queues value of the present cpu count which is odd. It should
be registering the number of hdwq queues (queues created on the adapter).

Change to set nvme tempate, in all cases, to the number of hardware
queues.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/lpfc/lpfc_nvme.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 328ddce87f12..db4a04a207ec 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -2148,12 +2148,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
 	 */
 	lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
 
-	/* Advertise how many hw queues we support based on fcp_io_sched */
-	if (phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_HDWQ)
-		lpfc_nvme_template.max_hw_queues = phba->cfg_hdw_queue;
-	else
-		lpfc_nvme_template.max_hw_queues =
-			phba->sli4_hba.num_present_cpu;
+	/* Advertise how many hw queues we support based on cfg_hdw_queue,
+	 * which will not exceed cpu count.
+	 */
+	lpfc_nvme_template.max_hw_queues = phba->cfg_hdw_queue;
 
 	if (!IS_ENABLED(CONFIG_NVME_FC))
 		return ret;
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] lpfc: Update lpfc version to 12.6.0.2
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
                   ` (4 preceding siblings ...)
  2019-11-11 23:04 ` [PATCH 5/6] lpfc: revise nvme max queues to be hdwq count James Smart
@ 2019-11-11 23:04 ` James Smart
  2019-11-12 18:32   ` Ewan D. Milne
  2019-11-13  2:14 ` [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 Martin K. Petersen
  6 siblings, 1 reply; 13+ messages in thread
From: James Smart @ 2019-11-11 23:04 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart, Dick Kennedy

Update lpfc version to 12.6.0.2

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/lpfc/lpfc_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index 1532390770f5..9e5ff58edaca 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -20,7 +20,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "12.6.0.1"
+#define LPFC_DRIVER_VERSION "12.6.0.2"
 #define LPFC_DRIVER_NAME		"lpfc"
 
 /* Used for SLI 2/3 */
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences
  2019-11-11 23:03 ` [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences James Smart
@ 2019-11-12 18:30   ` Ewan D. Milne
  0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2019-11-12 18:30 UTC (permalink / raw)
  To: James Smart, linux-scsi
  Cc: Dick Kennedy, Martin K. Petersen, Gustavo A. R. Silva, linux-next

On Mon, 2019-11-11 at 15:03 -0800, James Smart wrote:
> Coverity reported the following:
> 
> *** CID 1487391:  Null pointer dereferences  (FORWARD_NULL)
> /drivers/scsi/lpfc/lpfc_scsi.c: 614 in lpfc_get_scsi_buf_s3()
> 608     		spin_unlock(&phba->scsi_buf_list_put_lock);
> 609     	}
> 610     	spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
> 611
> 612     	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
> 613     		atomic_inc(&ndlp->cmd_pending);
> vvv     CID 1487391:  Null pointer dereferences  (FORWARD_NULL)
> vvv     Dereferencing null pointer "lpfc_cmd".
> 614     		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
> 615     	}
> 616     	return  lpfc_cmd;
> 617     }
> 618     /**
> 619      * lpfc_get_scsi_buf_s4 - Get a scsi buffer from io_buf_list of the HBA
> 
> Fix by checking lpfc_cmd to be non-NULL as part of line 612
> 
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1487391 ("Null pointer dereferences")
> Fixes: 2a5b7d626ed2 ("scsi: lpfc: Limit tracking of tgt queue depth in fast path")
> 
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> CC: "Martin K. Petersen" <martin.petersen@oracle.com>
> CC: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
> CC: linux-next@vger.kernel.org
> ---
>  drivers/scsi/lpfc/lpfc_scsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
> index 959ef471d758..ba26df90a36a 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -611,7 +611,7 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
>  	}
>  	spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
>  
> -	if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
> +	if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {
>  		atomic_inc(&ndlp->cmd_pending);
>  		lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
>  	}

Reviewed-by: Ewan D. Milne <emilne@redhat.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/6] lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): Null pointer dereferences
  2019-11-11 23:03 ` [PATCH 2/6] lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): " James Smart
@ 2019-11-12 18:30   ` Ewan D. Milne
  0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2019-11-12 18:30 UTC (permalink / raw)
  To: James Smart, linux-scsi
  Cc: Dick Kennedy, James Bottomley, Gustavo A. R. Silva, linux-next

On Mon, 2019-11-11 at 15:03 -0800, James Smart wrote:
> Coverity reported the following:
> 
> *** CID 101747:  Null pointer dereferences  (FORWARD_NULL)
> /drivers/scsi/lpfc/lpfc_els.c: 4439 in lpfc_cmpl_els_rsp()
> 4433     			kfree(mp);
> 4434     		}
> 4435     		mempool_free(mbox, phba->mbox_mem_pool);
> 4436     	}
> 4437     out:
> 4438     	if (ndlp && NLP_CHK_NODE_ACT(ndlp)) {
> vvv     CID 101747:  Null pointer dereferences  (FORWARD_NULL)
> vvv     Dereferencing null pointer "shost".
> 4439     		spin_lock_irq(shost->host_lock);
> 4440     		ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI);
> 4441     		spin_unlock_irq(shost->host_lock);
> 4442
> 4443     		/* If the node is not being used by another discovery thread,
> 4444     		 * and we are sending a reject, we are done with it.
> 
> Fix by adding a check for non-null shost in line 4438.
> The scenario when shost is set to null is when ndlp is null.
> As such, the ndlp check present was sufficient. But better safe
> than sorry so add the shost check.
> 
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 101747 ("Null pointer dereferences")
> Fixes: 2e0fef85e098 ("[SCSI] lpfc: NPIV: split ports")
> 
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> CC: James Bottomley <James.Bottomley@SteelEye.com>
> CC: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
> CC: linux-next@vger.kernel.org
> ---
>  drivers/scsi/lpfc/lpfc_els.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
> index 9a570c15b2a1..42a2bf38eaea 100644
> --- a/drivers/scsi/lpfc/lpfc_els.c
> +++ b/drivers/scsi/lpfc/lpfc_els.c
> @@ -4445,7 +4445,7 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
>  		mempool_free(mbox, phba->mbox_mem_pool);
>  	}
>  out:
> -	if (ndlp && NLP_CHK_NODE_ACT(ndlp)) {
> +	if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) {
>  		spin_lock_irq(shost->host_lock);
>  		ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI);
>  		spin_unlock_irq(shost->host_lock);

Reviewed-by: Ewan D. Milne <emilne@redhat.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/6] lpfc: fix inlining of lpfc_sli4_cleanup_poll_list()
  2019-11-11 23:03 ` [PATCH 3/6] lpfc: fix inlining of lpfc_sli4_cleanup_poll_list() James Smart
@ 2019-11-12 18:31   ` Ewan D. Milne
  0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2019-11-12 18:31 UTC (permalink / raw)
  To: James Smart, linux-scsi; +Cc: Dick Kennedy

On Mon, 2019-11-11 at 15:03 -0800, James Smart wrote:
> Compilation can fail due to having an inline function
> reference where the function body is not present.
> 
> Fix by removing the inline tag.
> 
> Fixes: 93a4d6f40198 ("scsi: lpfc: Add registration for CPU Offline/Online events")
> 
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> ---
> patch is in the 12.6.0.1 set which is in 5.5/scsi-queue
> ---
>  drivers/scsi/lpfc/lpfc_crtn.h | 2 +-
>  drivers/scsi/lpfc/lpfc_sli.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
> index d91aa5330306..ee353c84a097 100644
> --- a/drivers/scsi/lpfc/lpfc_crtn.h
> +++ b/drivers/scsi/lpfc/lpfc_crtn.h
> @@ -215,7 +215,7 @@ irqreturn_t lpfc_sli_fp_intr_handler(int, void *);
>  irqreturn_t lpfc_sli4_intr_handler(int, void *);
>  irqreturn_t lpfc_sli4_hba_intr_handler(int, void *);
>  
> -inline void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba);
> +void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba);
>  int lpfc_sli4_poll_eq(struct lpfc_queue *q, uint8_t path);
>  void lpfc_sli4_poll_hbtimer(struct timer_list *t);
>  void lpfc_sli4_start_polling(struct lpfc_queue *q);
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index fad890cea21a..6d82ad9380db 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -14466,7 +14466,7 @@ static inline void lpfc_sli4_remove_from_poll_list(struct lpfc_queue *eq)
>  		del_timer_sync(&phba->cpuhp_poll_timer);
>  }
>  
> -inline void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba)
> +void lpfc_sli4_cleanup_poll_list(struct lpfc_hba *phba)
>  {
>  	struct lpfc_queue *eq, *next;
>  

Reviewed-by: Ewan D. Milne <emilne@redhat.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus
  2019-11-11 23:03 ` [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus James Smart
@ 2019-11-12 18:32   ` Ewan D. Milne
  0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2019-11-12 18:32 UTC (permalink / raw)
  To: James Smart, linux-scsi; +Cc: Dick Kennedy

On Mon, 2019-11-11 at 15:03 -0800, James Smart wrote:
> Currently, cpu_map[cpu#]->hdwq is left to equal
> LPFC_VECTOR_MAP_EMPTY for not present CPUs.  If a CPU
> is dynamically hot-added, it is possible we may crash due to
> not assigning an allocated hdwq.
> 
> Correct by assigning a hdwq at initialization for all
> not-present cpu's.
> 
> Fixes: dcaa21367938 ("scsi: lpfc: Change default IRQ model on AMD architectures")
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> ---
> Issue applies as of the 12.2.0.0 patch kit, but this fix requires
> the above patch set for resolution. Referenced patch is in the
> 5.5/scsi-queue branch
> ---
>  drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 480d5a28c4f5..2b0e1097f727 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -11004,7 +11004,7 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
>  				cpu, cpup->phys_id, cpup->core_id,
>  				cpup->hdwq, cpup->eq, cpup->flag);
>  	}
> -	/* Finally we need to associate a hdwq with each cpu_map entry
> +	/* Associate a hdwq with each cpu_map entry
>  	 * This will be 1 to 1 - hdwq to cpu, unless there are less
>  	 * hardware queues then CPUs. For that case we will just round-robin
>  	 * the available hardware queues as they get assigned to CPUs.
> @@ -11083,6 +11083,23 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
>  				cpup->hdwq, cpup->eq, cpup->flag);
>  	}
>  
> +	/*
> +	 * Initialize the cpu_map slots for not-present cpus in case
> +	 * a cpu is hot-added. Perform a simple hdwq round robin assignment.
> +	 */
> +	idx = 0;
> +	for_each_possible_cpu(cpu) {
> +		cpup = &phba->sli4_hba.cpu_map[cpu];
> +		if (cpup->hdwq != LPFC_VECTOR_MAP_EMPTY)
> +			continue;
> +
> +		cpup->hdwq = idx++ % phba->cfg_hdw_queue;
> +		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
> +				"3340 Set Affinity: not present "
> +				"CPU %d hdwq %d\n",
> +				cpu, cpup->hdwq);
> +	}
> +
>  	/* The cpu_map array will be used later during initialization
>  	 * when EQ / CQ / WQs are allocated and configured.
>  	 */

Reviewed-by: Ewan D. Milne <emilne@redhat.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] lpfc: Update lpfc version to 12.6.0.2
  2019-11-11 23:04 ` [PATCH 6/6] lpfc: Update lpfc version to 12.6.0.2 James Smart
@ 2019-11-12 18:32   ` Ewan D. Milne
  0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2019-11-12 18:32 UTC (permalink / raw)
  To: James Smart, linux-scsi; +Cc: Dick Kennedy

On Mon, 2019-11-11 at 15:04 -0800, James Smart wrote:
> Update lpfc version to 12.6.0.2
> 
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> ---
>  drivers/scsi/lpfc/lpfc_version.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
> index 1532390770f5..9e5ff58edaca 100644
> --- a/drivers/scsi/lpfc/lpfc_version.h
> +++ b/drivers/scsi/lpfc/lpfc_version.h
> @@ -20,7 +20,7 @@
>   * included with this package.                                     *
>   *******************************************************************/
>  
> -#define LPFC_DRIVER_VERSION "12.6.0.1"
> +#define LPFC_DRIVER_VERSION "12.6.0.2"
>  #define LPFC_DRIVER_NAME		"lpfc"
>  
>  /* Used for SLI 2/3 */

Reviewed-by: Ewan D. Milne <emilne@redhat.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1
  2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
                   ` (5 preceding siblings ...)
  2019-11-11 23:04 ` [PATCH 6/6] lpfc: Update lpfc version to 12.6.0.2 James Smart
@ 2019-11-13  2:14 ` Martin K. Petersen
  6 siblings, 0 replies; 13+ messages in thread
From: Martin K. Petersen @ 2019-11-13  2:14 UTC (permalink / raw)
  To: James Smart; +Cc: linux-scsi


James,

> Update lpfc to revision 12.6.0.2

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-11-13  2:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 23:03 [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 James Smart
2019-11-11 23:03 ` [PATCH 1/6] lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences James Smart
2019-11-12 18:30   ` Ewan D. Milne
2019-11-11 23:03 ` [PATCH 2/6] lpfc: fix: Coverity: lpfc_cmpl_els_rsp(): " James Smart
2019-11-12 18:30   ` Ewan D. Milne
2019-11-11 23:03 ` [PATCH 3/6] lpfc: fix inlining of lpfc_sli4_cleanup_poll_list() James Smart
2019-11-12 18:31   ` Ewan D. Milne
2019-11-11 23:03 ` [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus James Smart
2019-11-12 18:32   ` Ewan D. Milne
2019-11-11 23:04 ` [PATCH 5/6] lpfc: revise nvme max queues to be hdwq count James Smart
2019-11-11 23:04 ` [PATCH 6/6] lpfc: Update lpfc version to 12.6.0.2 James Smart
2019-11-12 18:32   ` Ewan D. Milne
2019-11-13  2:14 ` [PATCH 0/6] lpfc: Update lpfc to revision 12.6.0.1 Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.