aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-08-17 06:24:47 -0400
committerJens Axboe <axboe@kernel.dk>2017-08-18 10:08:14 -0400
commitc005390374957baacbc38eef96ea360559510aa7 (patch)
tree6055f163f22d993bcf03ed965510a45a8d28745b
parent6caa0503c43d65de92309b967b5b1aa289af303b (diff)
blk-mq-pci: add a fallback when pci_irq_get_affinity returns NULL
While pci_irq_get_affinity should never fail for SMP kernel that implement the affinity mapping, it will always return NULL in the UP case, so provide a fallback mapping of all queues to CPU 0 in that case. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Reviewed-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-mq-pci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/block/blk-mq-pci.c b/block/blk-mq-pci.c
index 0c3354cf3552..76944e3271bf 100644
--- a/block/blk-mq-pci.c
+++ b/block/blk-mq-pci.c
@@ -36,12 +36,18 @@ int blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev)
36 for (queue = 0; queue < set->nr_hw_queues; queue++) { 36 for (queue = 0; queue < set->nr_hw_queues; queue++) {
37 mask = pci_irq_get_affinity(pdev, queue); 37 mask = pci_irq_get_affinity(pdev, queue);
38 if (!mask) 38 if (!mask)
39 return -EINVAL; 39 goto fallback;
40 40
41 for_each_cpu(cpu, mask) 41 for_each_cpu(cpu, mask)
42 set->mq_map[cpu] = queue; 42 set->mq_map[cpu] = queue;
43 } 43 }
44 44
45 return 0; 45 return 0;
46
47fallback:
48 WARN_ON_ONCE(set->nr_hw_queues > 1);
49 for_each_possible_cpu(cpu)
50 set->mq_map[cpu] = 0;
51 return 0;
46} 52}
47EXPORT_SYMBOL_GPL(blk_mq_pci_map_queues); 53EXPORT_SYMBOL_GPL(blk_mq_pci_map_queues);