Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: mpt3sas: Determine smp affinity on per HBA basis

Even though 'smp_affinity_enable' module parameter is enabled, if the
number of online CPUs is bigger than the number of msix vectors enabled on
that HBA, then smp affinity settings should be disabled only for this HBA.

But currently the smp affinity setting is disabled globally and hence smp
affinity will be disabled for subsequent HBAs even though number of msix
vectors enabled for this HBA matches the number of online CPU.

To fix this, define a per HBA variable smp_affinity_enable. Initially this
variable is initialized with smp_affinity_enable module parameter value. If
this HBA has less number of msix vectors configured when compared to number
of online cpus, then only this HBA's variable smp_affinity_enable is set to
zero.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Sreekanth Reddy and committed by
Martin K. Petersen
610ef1e9 48d6f0a6

+7 -4
+6 -4
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 2813 2813 2814 2814 list_for_each_entry_safe(reply_q, next, &ioc->reply_queue_list, list) { 2815 2815 list_del(&reply_q->list); 2816 - if (smp_affinity_enable) 2816 + if (ioc->smp_affinity_enable) 2817 2817 irq_set_affinity_hint(pci_irq_vector(ioc->pdev, 2818 2818 reply_q->msix_index), NULL); 2819 2819 free_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index), ··· 2898 2898 if (!nr_msix) 2899 2899 return; 2900 2900 2901 - if (smp_affinity_enable) { 2901 + if (ioc->smp_affinity_enable) { 2902 2902 2903 2903 /* 2904 2904 * set irq affinity to local numa node for those irqs ··· 3033 3033 struct irq_affinity desc = { .pre_vectors = ioc->high_iops_queues }; 3034 3034 struct irq_affinity *descp = &desc; 3035 3035 3036 - if (smp_affinity_enable) 3036 + if (ioc->smp_affinity_enable) 3037 3037 irq_flags |= PCI_IRQ_AFFINITY; 3038 3038 else 3039 3039 descp = NULL; ··· 3091 3091 goto try_ioapic; 3092 3092 3093 3093 if (ioc->msix_vector_count < ioc->cpu_count) 3094 - smp_affinity_enable = 0; 3094 + ioc->smp_affinity_enable = 0; 3095 3095 3096 3096 r = _base_alloc_irq_vectors(ioc); 3097 3097 if (r < 0) { ··· 6896 6896 goto out_free_resources; 6897 6897 } 6898 6898 } 6899 + 6900 + ioc->smp_affinity_enable = smp_affinity_enable; 6899 6901 6900 6902 ioc->rdpq_array_enable_assigned = 0; 6901 6903 ioc->dma_mask = 0;
+1
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 1405 1405 1406 1406 u8 combined_reply_queue; 1407 1407 u8 combined_reply_index_count; 1408 + u8 smp_affinity_enable; 1408 1409 /* reply post register index */ 1409 1410 resource_size_t **replyPostRegisterIndex; 1410 1411