Commit bc227dde authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Initialize cpu_map for not present cpus

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 CPUs.

Fixes: dcaa2136 ("scsi: lpfc: Change default IRQ model on AMD architectures")
Link: https://lore.kernel.org/r/20191111230401.12958-5-jsmart2021@gmail.comReviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d480e578
...@@ -11004,7 +11004,7 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) ...@@ -11004,7 +11004,7 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
cpu, cpup->phys_id, cpup->core_id, cpu, cpup->phys_id, cpup->core_id,
cpup->hdwq, cpup->eq, cpup->flag); 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 * 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 * hardware queues then CPUs. For that case we will just round-robin
* the available hardware queues as they get assigned to CPUs. * the available hardware queues as they get assigned to CPUs.
...@@ -11083,6 +11083,23 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors) ...@@ -11083,6 +11083,23 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
cpup->hdwq, cpup->eq, cpup->flag); 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 /* The cpu_map array will be used later during initialization
* when EQ / CQ / WQs are allocated and configured. * when EQ / CQ / WQs are allocated and configured.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment