[PATCH V3 13/14] scsi: storvsc: limit max allowed nr_hw_queues
Ming Lei
ming.lei at redhat.com
Tue Aug 8 03:42:38 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 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.
Signed-off-by: Ming Lei <ming.lei at redhat.com>
---
drivers/scsi/storvsc_drv.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index f2823218670a..50df040b100d 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -2040,6 +2040,9 @@ static int storvsc_probe(struct hv_device *device,
host->nr_hw_queues = storvsc_max_hw_queues;
else
host->nr_hw_queues = num_present_cpus;
+ if (host->nr_hw_queues > scsi_max_nr_hw_queues())
+ host->nr_hw_queues = scsi_max_nr_hw_queues();
+
}
/*
--
2.40.1
More information about the Linux-nvme
mailing list