Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795938489; b=jLkX+Ie68cHrsv0v9DLKBx78OVpe2/w//ex6lC8XKw/6C0DMZFVm7LcbGrqsqoaM30kd El6cPu5OA85lMUJxOMlBFDoAqUHDN3ZZX3lB/NyMTX6EKFhshWRluoviDPqgkW2DpmP51 PQR1oefq1eh5t3efE8xhImoyydAUAdn3jx/O1SPZ6V1zZT/7ydudiidOan19sG+nkYQkV HlDYUqsxXCrCaLC1TX7TRJeppXgJEL75VET58BSzHuANnL3GTvrpGgxrQgiZhK5ZBgEQS llkYQvic3Iv7lPX4J+XH75QatN8yB2vwGgZpNoZVAWXwkKoVJP6767rBnJNUejdPCgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795938489; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=cEy3NF8iTczf+Cm8p6a1r1QWPoE3JRIo4lSpSPXqocs=; b=4trTqRLb1E2e883geZIxxpmzYctzwSS9bkAZkMmlHV+sPycQgpDW0xw2/4dm3EpXjRfB aKvk3xaDGV2TIFMJh3daHr17vA6AnfWsTC6OI9F5brXP4DMT8y0+Hci/bnRvbC+Xv8wNE Kct6pcIOa4gnboL4vo5nsU5BDDk7cRm5dw40iyfeyXG1viuuliLIeDVi3/dYGQxiOC0LD dUHm23F9TAhXQWSzcisdsqWtqgkS1/7yAwbNVLN5z18mLGN6qZ1hlOsuE9Hj9p1FC4N13 UukgBLoU4GRJ0dy2U60Z9huvET5Zg06sXIpo+J551zJONnlz5HVsxuV6zul0ukocsPw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kSah7UVD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FA8B606A31C; Sun, 29 Nov 2026 07:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kSah7UVD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FE201F000C1; Sun, 29 Nov 2026 07:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795938488; bh=cEy3NF8iTczf+Cm8p6a1r1QWPoE3JRIo4lSpSPXqocs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=kSah7UVD9WEbKybwlIhtoB/O0kfEm0cylpVjMU6J9JAvaqjH4AMDj4heAvTnV9+Q0 Hfa7YFq4OiNwjt6y4ZWEv92t3NravbgMQcT+Jsol7cC5gyKZMmwNGAoovUhrJEDMQO a7y2+5TKHspSk+lOsFR5PouV3Hd7NLXx9kiGLgbTTw067WVq3dycSkxOHa5i5uHTDg UskOM6pQpeiwTojEP9WeqFrNSRdK6M8w8SP3+jVDlwPX5eRfWAPnIsEzjLzYbm6/gV ZKU6T286Z1bifLTaUD2tf29eW/EyiKysHdIa8o3m5vXsDqKq+bMYATS+RUsQzJjZz6 n/5kyEDmDVyew== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v17 08/10] genirq/affinity: Restrict managed IRQ affinity to housekeeping CPUs Reply-To: sashiko-reviews@lists.linux.dev To: "Aaron Tomlin" Cc: linux-scsi@vger.kernel.org, virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261129072612.257915-3-atomlin@atomlin.com> References: <20261129045436.255364-1-atomlin@atomlin.com> <20261129072612.257915-3-atomlin@atomlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 07:48:07 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] genirq/affinity: padding excess vectors with full mask collapses queues -- commit 7b34278d7bc0891686d6faff17c09feec98bd7c5 Author: Aaron Tomlin genirq/affinity: Restrict managed IRQ affinity to housekeeping CPUs This commit restricts managed interrupt affinity masks and vector count calculations to HK_TYPE_MANAGED_IRQ housekeeping CPUs, while clamping the calculated vector count to at least minvec and padding excess vector slots with the housekeeping mask. > diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c > index 78f2418a89252..a4bbcaafbe366 100644 > --- a/kernel/irq/affinity.c > +++ b/kernel/irq/affinity.c [ ... ] > @@ -70,19 +73,29 @@ irq_create_affinity_masks(unsigned int nvecs, struct = irq_affinity *affd) > */ > for (i =3D 0, usedvecs =3D 0; i < affd->nr_sets; i++) { > unsigned int nr_masks, this_vecs =3D affd->set_size[i]; > - struct cpumask *result =3D group_cpus_evenly(this_vecs, &nr_masks); > + struct cpumask *result; > + const struct cpumask *mask; > =20 > + if (hk_enabled) > + mask =3D hk_mask; > + else > + mask =3D cpu_possible_mask; > + > + result =3D group_mask_cpus_evenly(this_vecs, mask, > + &nr_masks); > if (!result) { > kfree(masks); > return NULL; > } > - > - for (int j =3D 0; j < nr_masks; j++) > + for (j =3D 0; j < nr_masks; j++) > cpumask_copy(&masks[curvec + j].mask, &result[j]); > + for (j =3D nr_masks; j < this_vecs; j++) > + cpumask_copy(&masks[curvec + j].mask, mask); > + > kfree(result); > =20 > - curvec +=3D nr_masks; > - usedvecs +=3D nr_masks; > + curvec +=3D this_vecs; > + usedvecs +=3D this_vecs; > } [Severity: High] When this_vecs exceeds nr_masks, does copying the full mask into the trailing vector slots collapse all CPUs onto the last hardware queue in blk_mq_map_hw_queues()? This happens under isolcpus=3Dmanaged_irq whenever a set requests more vectors than the number of housekeeping CPUs, such as via a driver affd->calc_sets callback (e.g. nvme_calc_irq_sets()) or via the new max(minvec, ...) floor in irq_calc_affinity_vectors(). group_mask_cpus_evenly() returns nr_masks equal to the housekeeping CPU count, and the second loop assigns the full housekeeping mask to every remaining vector j >=3D nr_masks. In blk_mq_map_hw_queues(), each queue maps its affinity mask in order: block/blk-mq-cpumap.c:blk_mq_map_hw_queues() { ... for (queue =3D 0; queue < qmap->nr_queues; queue++) { ... for_each_cpu_and(cpu, affinity_mask, constraint) { qmap->mq_map[cpu] =3D qmap->queue_offset + queue; cpumask_set_cpu(cpu, mask); } } ... } Because the padded vectors cover every housekeeping CPU, the final vector (this_vecs - 1) overwrites qmap->mq_map[cpu] for all housekeeping CPUs (and subsequently all isolated CPUs), leaving queues 0 .. this_vecs - 2 unused. In addition, on architectures using the generic IRQ matrix allocator, irq_matrix_reserve_managed() reserves a vector slot on every CPU in the mask, so each excess vector consumes a vector on all housekeeping CPUs instead of one group. Wrapping the excess slots across the grouped masks (&result[j % nr_masks]) would keep each excess vector scoped to a single group. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129045436.2553= 64-1-atomlin@atomlin.com?part=3D8