[PATCH V3 06/14] scsi: lpfc: use blk_mq_max_nr_hw_queues() to calculate io vectors
Ming Lei
ming.lei at redhat.com
Tue Aug 8 03:42:31 PDT 2023
Take blk-mq's knowledge into account for calculating io queues.
Fix wrong queue mapping in case of kdump kernel.
On arm and ppc64, 'maxcpus=1' is passed to kdump kernel command line,
see `Documentation/admin-guide/kdump/kdump.rst`, so num_possible_cpus()
still returns all CPUs because 'maxcpus=1' just bring up one single
cpu core during booting.
blk-mq sees single queue in kdump kernel, and in driver's viewpoint
there are still multiple queues, this inconsistency causes driver to apply
wrong queue mapping for handling IO, and IO timeout is triggered.
Meantime, single queue makes much less resource utilization, and reduce
risk of kernel failure.
Reviewed-by: Justin Tee <justin.tee at broadcom.com>
Cc: Justin Tee <justintee8345 at gmail.com>
Cc: James Smart <james.smart at broadcom.com>
Signed-off-by: Ming Lei <ming.lei at redhat.com>
---
drivers/scsi/lpfc/lpfc_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 3221a934066b..961ff392f1c5 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -13025,6 +13025,8 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
flags |= PCI_IRQ_AFFINITY;
}
+ vectors = min_t(unsigned int, vectors, scsi_max_nr_hw_queues());
+
rc = pci_alloc_irq_vectors(phba->pcidev, 1, vectors, flags);
if (rc < 0) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
--
2.40.1
More information about the Linux-nvme
mailing list