[PATCH v12 06/13] nvme-pci: use block layer helpers to constrain queue affinity
Aaron Tomlin
atomlin at atomlin.com
Tue May 5 12:47:40 PDT 2026
On Wed, Apr 22, 2026 at 02:52:08PM -0400, Aaron Tomlin wrote:
> From: Daniel Wagner <wagi at kernel.org>
>
> Ensure that IRQ affinity setup also respects the queue-to-CPU mapping
> constraints provided by the block layer. This allows the NVMe driver
> to avoid assigning interrupts to CPUs that the block layer has excluded
> (e.g., isolated CPUs).
>
> Signed-off-by: Daniel Wagner <wagi at kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen at oracle.com>
> Reviewed-by: Hannes Reinecke <hare at suse.de>
> Signed-off-by: Aaron Tomlin <atomlin at atomlin.com>
> ---
> drivers/nvme/host/pci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index db5fc9bf6627..daa041d15d3c 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2862,6 +2862,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues)
> .pre_vectors = 1,
> .calc_sets = nvme_calc_irq_sets,
> .priv = dev,
> + .mask = blk_mq_possible_queue_affinity(),
> };
> unsigned int irq_queues, poll_queues;
> unsigned int flags = PCI_IRQ_ALL_TYPES | PCI_IRQ_AFFINITY;
> --
> 2.51.0
Hi Daniel, Martin, Hannes,
I think we can drop this patch, including other similar changes [1][2].
The next iteration of patch 12 [3] in my queue, irq_create_affinity_masks()
has been modified to respect the housekeeping CPU mask. By intersecting the
base affinity mask with the HK_TYPE_IO_QUEUE mask prior to topological
distribution (group_mask_cpus_evenly()), we ensure that managed interrupts
are kept off isolated CPUs.
[1]: https://lore.kernel.org/lkml/20260422185215.100929-8-atomlin@atomlin.com/
[2]: https://lore.kernel.org/lkml/20260422185215.100929-9-atomlin@atomlin.com/
[3]: https://lore.kernel.org/lkml/20260422185215.100929-13-atomlin@atomlin.com/
--
Aaron Tomlin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20260505/dfeab064/attachment-0001.sig>
More information about the Linux-nvme
mailing list