Skip to content

Commit a86c71b

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Fix crash when cpu count is 1 and null irq affinity mask
When a configurations runs with a single cpu (such as a kdump kernel), which causes the driver to request a single vector, when the driver subsequently requests an irq affinity mask, the mask comes back null. The driver currently does nothing in this scenario, which leaves mappings to hardware queues incomplete and crashes the system. Fix by recognizing the null mask and assigning the vector to the first cpu in the system. Signed-off-by: Dick Kennedy <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e82f04e commit a86c71b

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10776,12 +10776,31 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
1077610776
/* This loop sets up all CPUs that are affinitized with a
1077710777
* irq vector assigned to the driver. All affinitized CPUs
1077810778
* will get a link to that vectors IRQ and EQ.
10779+
*
10780+
* NULL affinity mask handling:
10781+
* If irq count is greater than one, log an error message.
10782+
* If the null mask is received for the first irq, find the
10783+
* first present cpu, and assign the eq index to ensure at
10784+
* least one EQ is assigned.
1077910785
*/
1078010786
for (idx = 0; idx < phba->cfg_irq_chann; idx++) {
1078110787
/* Get a CPU mask for all CPUs affinitized to this vector */
1078210788
maskp = pci_irq_get_affinity(phba->pcidev, idx);
10783-
if (!maskp)
10784-
continue;
10789+
if (!maskp) {
10790+
if (phba->cfg_irq_chann > 1)
10791+
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
10792+
"3329 No affinity mask found "
10793+
"for vector %d (%d)\n",
10794+
idx, phba->cfg_irq_chann);
10795+
if (!idx) {
10796+
cpu = cpumask_first(cpu_present_mask);
10797+
cpup = &phba->sli4_hba.cpu_map[cpu];
10798+
cpup->eq = idx;
10799+
cpup->irq = pci_irq_vector(phba->pcidev, idx);
10800+
cpup->flag |= LPFC_CPU_FIRST_IRQ;
10801+
}
10802+
break;
10803+
}
1078510804

1078610805
i = 0;
1078710806
/* Loop through all CPUs associated with vector idx */

0 commit comments

Comments
 (0)