Re: [PATCH v17 00/10] blk: honor isolcpus configuration

From: Aaron Tomlin

Date: Sun Nov 29 2026 - 21:53:41 EST


On Sun, Nov 29, 2026 at 11:15:48PM +0100, Frederic Weisbecker wrote:
> Le Sat, Nov 28, 2026 at 11:54:24PM -0500, Aaron Tomlin a écrit :
> > Hi Thomas, Jens, Sebastian, Frederic,
> >
> > This is version 17 of the series enabling multiqueue devices and managed
> > interrupts to adhere to CPU isolation constraints. The series has been
> > rebased on v7.4-rc1-3893-g946d9ed1aa02.
> >
> > Background and Problem
> > ======================
> >
> > Modern multiqueue storage controllers (e.g. NVMe devices) typically
> > allocate one hardware queue and interrupt vector per possible CPU. When
> > CPU isolation is requested via "isolcpus=managed_irq", vector spreading in
> > irq_create_affinity_masks() still distributes vectors across all possible
> > CPUs, relying on irq_do_set_affinity() to strip isolated CPUs afterwards.
> > However, that filtering only works when a vector's affinity mask contains
> > both housekeeping and isolated CPUs. When per-CPU queues are allocated,
> > isolated CPUs receive dedicated vectors whose masks contain no housekeeping
> > CPUs; irq_do_set_affinity() then falls back to the unfiltered mask, leaving
> > completion interrupts for I/O submitted on isolated CPUs targeted directly
> > at those isolated cores.
> >
> > Proposed solution and architecture
> > ==================================
> >
> > Rather than introducing a separate "isolcpus=" sub-parameter as explored in
> > earlier iterations, this series fixes "isolcpus=managed_irq"
> > (HK_TYPE_MANAGED_IRQ) directly in place across the CPU grouping library,
> > generic IRQ affinity allocator, block layer, and virtio-fs:
> >
> > 1. Bounded topological CPU grouping
> >
> > lib/group_cpus introduces group_mask_cpus_evenly(), a bounded
> > counterpart to group_cpus_evenly() that confines NUMA and CPU
> > locality grouping strictly to a caller-supplied cpumask while
> > preserving two-stage (present-first, non-present second)
> > spreading for CPU hotplug safety.
> >
> > 2. Managed and reserved IRQ affinity confinement
> >
> > The genirq/affinity subsystem queries
> > housekeeping_cpumask(HK_TYPE_MANAGED_IRQ) directly and passes
> > it to group_mask_cpus_evenly(), restricting managed interrupt
> > vector calculation and distribution exclusively to housekeeping
> > CPUs. Unmanaged pre and post vectors (e.g. NVMe admin or device
> > configuration queues) are also confined to housekeeping CPUs by
> > default via irq_set_reserved_mask(), while remaining unmanaged
> > so user space can adjust their affinity after probe.
> >
> > 3. Block layer and virtio-fs queue mapping
> >
> > Both blk-mq and virtio-fs bound their queue counts to the
> > HK_TYPE_MANAGED_IRQ housekeeping CPU mask and map housekeeping
> > CPUs to hardware/request queues first. Any remaining possible
> > CPUs (including isolated CPUs) are then distributed evenly
> > across the active housekeeping-backed queues, allowing tasks on
> > isolated CPUs to submit I/O while completion interrupts fire
> > exclusively on housekeeping cores.
> >
> > 4. CPU hotplug protection
> >
> > To prevent I/O stalls, the block layer rejects hotplug requests
> > that attempt to offline the last online housekeeping CPU
> > serving a hardware context (hctx) while any isolated CPU mapped
> > to that hctx remains online (with system suspend and
> > hibernation exempted via cpuhp_tasks_frozen).
> >
> > Please let me know your thoughts.
>
> I don't get all the details but I like the idea. Also I like that
> this is enhancing managed_irq instead of introducing yet another flag.
>
> Acked-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
>
> Thanks!

Hi Frederic,

Thank you.

Please note that the next iteration will include a few localised
corner-case fixes in blk-mq and genirq (i.e. patches 5, 6, 8, and 10)
caught by Sashiko AI review, with no changes to the overall
isolcpus=managed_irq design.

Kind regards,
--
Aaron Tomlin