public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>,
	Dick Kennedy <dick.kennedy@broadcom.com>
Subject: [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus
Date: Mon, 11 Nov 2019 15:03:59 -0800	[thread overview]
Message-ID: <20191111230401.12958-5-jsmart2021@gmail.com> (raw)
In-Reply-To: <20191111230401.12958-1-jsmart2021@gmail.com>

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


  parent reply	other threads:[~2019-11-11 23:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` James Smart [this message]
2019-11-12 18:32   ` [PATCH 4/6] lpfc: Initialize cpu_map for not present cpus 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191111230401.12958-5-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox