From: sashiko-bot@kernel.org
To: "Aaron Tomlin" <atomlin@atomlin.com>
Cc: linux-scsi@vger.kernel.org, virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v17 10/10] genirq/affinity: Confine pre and post vectors to housekeeping CPUs
Date: Sun, 29 Nov 2026 07:41:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-239397@kernel.org> (raw)
In-Reply-To: <20261129072612.257915-5-atomlin@atomlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] genirq/affinity: pre/post vector masks lost in
irq_update_affinity_desc()
--
commit e45cd1796d752098cee854c7f5d5fc65f6221300
Author: Ionut Nechita <ionut.nechita@windriver.com>
genirq/affinity: Confine pre and post vectors to housekeeping CPUs
When HK_TYPE_MANAGED_IRQ is enabled, this commit confines unmanaged
pre_vectors and post_vectors in irq_create_affinity_masks() to the
housekeeping cpumask (intersected with irq_default_affinity) instead of
copying irq_default_affinity directly.
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index a4bbcaafbe366..e1d64657a3c3d 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -16,6 +16,30 @@ static void default_calc_sets(struct irq_affinity *affd, unsigned int affvecs)
> affd->set_size[0] = affvecs;
> }
>
> +/**
> + * irq_set_reserved_mask - Populate affinity mask for reserved pre/post vectors
> + * @dst: Destination cpumask to populate
> + * @hk_mask: Housekeeping cpumask for HK_TYPE_MANAGED_IRQ
> + * @hk_enabled: True when HK_TYPE_MANAGED_IRQ isolation is active
> + *
> + * Confine unmanaged pre/post vectors (e.g. the NVMe admin queue) to
> + * housekeeping CPUs while still honouring irq_default_affinity when the
> + * intersection contains at least one online CPU.
> + */
> +static void irq_set_reserved_mask(struct cpumask *dst,
> + const struct cpumask *hk_mask,
> + bool hk_enabled)
> +{
> + if (!hk_enabled) {
> + cpumask_copy(dst, irq_default_affinity);
> + return;
> + }
> +
> + if (!cpumask_and(dst, irq_default_affinity, hk_mask) ||
> + !cpumask_intersects(dst, cpu_online_mask))
> + cpumask_copy(dst, hk_mask);
> +}
> +
> /**
> * irq_create_affinity_masks - Create affinity masks for multiqueue spreading
> * @nvecs: The total number of vectors
> @@ -65,7 +89,7 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
>
> /* Fill out vectors at the beginning that don't need affinity */
> for (curvec = 0; curvec < affd->pre_vectors; curvec++)
> - cpumask_copy(&masks[curvec].mask, irq_default_affinity);
> + irq_set_reserved_mask(&masks[curvec].mask, hk_mask, hk_enabled);
>
> /*
> * Spread on present CPUs starting from affd->pre_vectors. If we
> @@ -104,7 +128,7 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
> else
> curvec = affd->pre_vectors + usedvecs;
> for (; curvec < nvecs; curvec++)
> - cpumask_copy(&masks[curvec].mask, irq_default_affinity);
> + irq_set_reserved_mask(&masks[curvec].mask, hk_mask, hk_enabled);
[Severity: Medium]
Are the housekeeping-confined masks for pre_vectors and post_vectors
discarded on the platform IRQ path?
Unlike alloc_descs(), which sets IRQD_AFFINITY_SET on every descriptor
initialized from a struct irq_affinity_desc,
devm_platform_get_irqs_affinity() applies the masks via
irq_update_affinity_desc(), which does not set IRQD_AFFINITY_SET when
affinity->is_managed is false:
kernel/irq/manage.c:irq_update_affinity_desc() {
...
if (affinity->is_managed) {
irqd_set(&desc->irq_data, IRQD_AFFINITY_MANAGED);
irqd_set(&desc->irq_data, IRQD_MANAGED_SHUTDOWN);
}
cpumask_copy(desc->irq_common_data.affinity, &affinity->mask);
...
}
When a platform driver requests and starts an unmanaged pre/post vector,
irq_startup() -> irq_setup_affinity() sees neither IRQD_AFFINITY_MANAGED
nor IRQD_AFFINITY_SET and overwrites desc->irq_common_data.affinity with
irq_default_affinity, allowing the interrupt to target isolated CPUs.
Setting IRQD_AFFINITY_SET in irq_update_affinity_desc() to match
alloc_descs() would preserve the confined mask on startup.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261129045436.255364-1-atomlin@atomlin.com?part=10
next prev parent reply other threads:[~2026-11-29 7:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 4:54 [PATCH v17 00/10] blk: honor isolcpus configuration Aaron Tomlin
2026-11-29 4:54 ` [PATCH v17 01/10] scsi: aacraid: use block layer helpers to calculate num of queues Aaron Tomlin
2026-11-29 4:54 ` [PATCH v17 02/10] lib/group_cpus: remove dead !SMP code Aaron Tomlin
2026-11-29 4:54 ` [PATCH v17 03/10] lib/group_cpus: Add group_mask_cpus_evenly() Aaron Tomlin
2026-11-29 7:33 ` sashiko-bot
2026-11-29 17:32 ` Aaron Tomlin
2026-11-29 4:54 ` [PATCH v17 04/10] sched/isolation: Prevent out-of-bounds read in isolcpus= boot parameter parser Aaron Tomlin
2026-11-29 21:45 ` Frederic Weisbecker
2026-11-30 2:36 ` Aaron Tomlin
2026-11-29 4:54 ` [PATCH v17 05/10] blk-mq: use hk cpus only when isolcpus=managed_irq is enabled Aaron Tomlin
2026-11-29 7:58 ` sashiko-bot
2026-11-29 20:45 ` Aaron Tomlin
2026-11-29 7:26 ` [PATCH v17 06/10] blk-mq: prevent offlining hk CPUs with associated online isolated CPUs Aaron Tomlin
2026-11-29 7:46 ` sashiko-bot
2026-11-30 1:11 ` Aaron Tomlin
2026-11-29 7:26 ` [PATCH v17 07/10] virtio-fs: honour isolcpus=managed_irq in queue mapping Aaron Tomlin
2026-11-29 7:26 ` [PATCH v17 08/10] genirq/affinity: Restrict managed IRQ affinity to housekeeping CPUs Aaron Tomlin
2026-11-29 7:48 ` sashiko-bot
2026-11-30 1:42 ` Aaron Tomlin
2026-11-29 7:26 ` [PATCH v17 09/10] docs: update isolcpus=managed_irq documentation Aaron Tomlin
2026-11-29 7:26 ` [PATCH v17 10/10] genirq/affinity: Confine pre and post vectors to housekeeping CPUs Aaron Tomlin
2026-11-29 7:41 ` sashiko-bot [this message]
2026-11-30 2:33 ` Aaron Tomlin
2026-11-29 7:58 ` [PATCH v17 00/10] blk: honor isolcpus configuration sashiko-bot
2026-11-29 22:15 ` Frederic Weisbecker
2026-11-30 2:52 ` Aaron Tomlin
2026-11-30 9:37 ` Frederic Weisbecker
2026-11-30 9:53 ` Marco Crivellari
2026-11-30 17:00 ` Aaron Tomlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-239397@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=atomlin@atomlin.com \
--cc=eperezma@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.