From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2DB0FAD3F3 for ; Thu, 23 Apr 2026 03:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=b1ioYCYAoZXZHFgjFhTL9LMHDkQaQnE0c0CtuflEgds=; b=tTQKAq4va5MlRCIn4o3AhrPD1+ KkpK0LzRSE53tmJlLkNRsn2SyPySca5L6fNCr1FRNpMAU7ZAYO6xYW7j7y3ag83wiT6jAxf26BqPg m+1gfJYRDNko3Vwe+0BuxKGWRW0REsy6KUfS77wq8MVr02+nrWIWMPhIiZl3dSP5j1EzZ5suknGbm pAJh5yOd+C0Yj5qqj8rwnyCZA+npseXGg6bMmhri/NS7BVIKEW8yVJyQ4N+7EL5KlYfWYBBxpTNIL 52/bOLBObGs7U/xeAAWUr7F0AOlQx3e5L38DBUQx66o2uVuG3ywHh/x2N4jViGssBhy+wy86YNhNV WcZlw+GQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wFkQo-0000000Awmi-3ogw; Thu, 23 Apr 2026 03:08:46 +0000 Received: from mail-uksouthazon11021140.outbound.protection.outlook.com ([52.101.95.140] helo=LO2P265CU024.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wFcgs-0000000AeSN-4BI1 for linux-nvme@lists.infradead.org; Wed, 22 Apr 2026 18:52:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FkaK1fa66ls/6RXH0UOGihZEIhDLcxTlCjROlaZ2Q6zrivs+TDGSSFIba5RBjwr6saAYYgPPGoIupf0scMnh0RsOUa/lpVa6nl4RC2sZY8tsRfL/R+nfr2NmNsYCpJ2uTeciZ19TAQPCt2QmqVr3NpreyG5U7i7tHrUoPKNxMGihBDlDf9Sj2ib8/iz94s+wFFJysRSGjYmj3UC/yzwyamOcA+YBeqybkAX5wJ+9yYoVCEj5rXg4HbbAJQ9FvHYvx3XiQ6XxyUFQpC0DDcgNuxYjtyRcHY2knopfj9jXtQx0+mfXLkJxOSUVozzdKgSLiMqkqvK4RJ/FzknHCA1CGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b1ioYCYAoZXZHFgjFhTL9LMHDkQaQnE0c0CtuflEgds=; b=ywlgEgTaZmpf/ii/m2d/BNYeCN21QlEym1F6KLZOpVdf5jaHJsq/9SeWxHapju/wMt3UOf5RASj0SmyDhLhMgFUsEAJCSeYcYJtcutmAW4YoYKMfYNkJysOZV5IEO4Ycd4vyE9Xc/H6AUFKs+O81SmZX1gPCjPc5gLvHttii5N7/wII57p3HFHvDAzbPxfV2HEDvfgCWTRokT8qvyC59O09Kzu3Hu7UNCXjHMnjpCacmqmz9s4IdJYJ52reyGWRziMCcCls+2qduVyQwbMape3kOF5uz0zF8492Yh44uOcIbCLss7uptMmZbXqwMuI8rcbB4t2vWa7l0EkMDzk14NQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=atomlin.com; dmarc=pass action=none header.from=atomlin.com; dkim=pass header.d=atomlin.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=atomlin.com; Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) by LO0P123MB7717.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:407::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.19; Wed, 22 Apr 2026 18:52:49 +0000 Received: from CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf]) by CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM ([fe80::de8e:2e4f:6c6:f3bf%2]) with mapi id 15.20.9846.019; Wed, 22 Apr 2026 18:52:49 +0000 From: Aaron Tomlin To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, mst@redhat.com Cc: atomlin@atomlin.com, aacraid@microsemi.com, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com, liyihang9@h-partners.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, chandrakanth.patil@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, ranjan.kumar@broadcom.com, jinpu.wang@cloud.ionos.com, tglx@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, akpm@linux-foundation.org, maz@kernel.org, ruanjinjie@huawei.com, bigeasy@linutronix.de, yphbchou0911@gmail.com, wagi@kernel.org, frederic@kernel.org, longman@redhat.com, chenridong@huawei.com, hare@suse.de, kch@nvidia.com, ming.lei@redhat.com, tom.leiming@gmail.com, steve@abita.co, sean@ashe.io, chjohnst@gmail.com, neelx@suse.com, mproche@gmail.com, nick.lange@gmail.com, marco.crivellari@suse.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v12 07/13] scsi: Use block layer helpers to constrain queue affinity Date: Wed, 22 Apr 2026 14:52:09 -0400 Message-ID: <20260422185215.100929-8-atomlin@atomlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260422185215.100929-1-atomlin@atomlin.com> References: <20260422185215.100929-1-atomlin@atomlin.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO4P265CA0323.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:390::11) To CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:70::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLP123MB3523:EE_|LO0P123MB7717:EE_ X-MS-Office365-Filtering-Correlation-Id: 04576310-c4ea-4f75-d67e-08dea0a059b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024|22082099003|56012099003|18002099003; X-Microsoft-Antispam-Message-Info: u3lRV7HiZz7EIPKXOpFOLNB85bpPkqzEGxTJk6yeTE0y4gRO65Ah05BjdeiOxd3Z7qouhiAXaxJVQla5mrQS1Tq5hShRnvzAZ5eIsqcC77B+GYl9Hz+PaT7h76AGkPQdLOHhkUoBuAYFyRWUtfQt71m+MU88/zO7aWlu0S/7Q/y4gfWKxf1w7N0sfLupPKXA3e5oiXvYmVq9BjwS2roGQm9AICtcsrbJUILAL0W81O1eBukaGyOV829HFh9vB6K+xeQ+dau0JNNHYmUe3wHzsiFMJ/QFZ8VSqOHxh+1O5MoRbJN5i/EGcpeS7fbamHFuvFkDFSF+IR+FU1qI8IEeQW19VBSC4wqHiqKfqnOWtcOb03c7v8vgdZj8IMrJEbNawEV+1643hz1rooZtc8RmzGGFdEcOFmSlVkQZrW7iDTdNb/JjSCEK+OBgT0BBoHpigXk6bPLdAO2ELyvT/oEkP+X+ES3mJE8JFPnjXPvnM08+OLFSeLsNccvX4+uYMjooqRSo+ckihZBlZ4hONxoFzcitT76Mz1lgK7ZYrqK1g/LfO6TnIcsn0qM7BwQzfXjspK8IpkN/pC8RKs7M2GpGJGi1E8FoaqhnTuLAUoma6TEi9I5PjQSHAAyhk70/gkvL6hhIw6QVvGoJiuNrtZSLvHZ8JDhuEwSuWxZf1AH5UcCs6zFXFp5dpzLqnzf4nV8wAbCXUOOc+XJq0z74soVRmcj31e2s0lFOFT9GTQy8GCY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024)(22082099003)(56012099003)(18002099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NdoZgGbuF4Br5ZTZU4H9sT1GwHSMFmAceuKGdB7U2Jsdp+77vasgOtQS68uH?= =?us-ascii?Q?Ozvi5WPIiJdnCVV7gwwaYDThg3i3mGMxESoYJkbh/sY37Glp3uj5izJRYeLQ?= =?us-ascii?Q?1kfV1GXXJgILsYAsXi0LZig9arEC8TJIMLSjTZ/AjBtYn/p9birj8GN5bKmV?= =?us-ascii?Q?Im91dRHpUblKeRWtFeCJ1Ezt+N9V5uSGf1eXKoTSYbkPhHchFIasEY39VUIJ?= =?us-ascii?Q?x5WVPFbP49bLbYxjaw3y+ac/w6fSSGAXdA7WrEBHNJtEI/Mac93a02AkWFxY?= =?us-ascii?Q?LSCA/pdKygm4JeDA15xG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ii?Q?uX03yToWHSTRd5uslDWLNrqxD47XAMAI+0aopiVyE2bKWenef5U+QHTEbTod?= =?us-ascii?Q?7iL/XCbrLuQ9n7Luyahorv9kAwzHAA+mje3nR1+1crtbeRWYuDAauSCUP8h9?= =?us-ascii?Q?DLEJj9+0bwb/stLexEaE45W722I7RO7At0T+QIPnC/2lKnbr3owo49Qdp9Eo?= =?us-ascii?Q?naoTBE6sXpc0noQccXXZhIBvExTlhjFm9bWVfjAMeE+Q2UjBgHCnxLXRWH6r?= =?us-ascii?Q?Milo5NLqVwILMnWVt7y7xWZnrfPCWotzb+YmMV4pCmH3xgT1XXK1H6A5rFjH?= =?us-ascii?Q?fVVhFSXqWH35Zv3CS1KTdQK4XCm5kPygXGlz5HYE6W0yqA/jdhCkgTSVxUSu?= =?us-ascii?Q?dYgnZ9kLMtKJ4s2t3L6XLeH4NAHvhq4OXWOEB9xteY/ae1f8MZGkL4QAiOOm?= =?us-ascii?Q?VtdWaa4Ro1LbJtrsc1nnASHdf2mXWLYXe1QnNY9inICp+eD7o8PL9toSeVMY?= =?us-ascii?Q?+GKq6F1N5Be8PPxaa6nQzke9ERWEXWJHOrTSn+VZoD07IWbvVmTqi0IhrGmN?= =?us-ascii?Q?dprtVa7kXg=3D=3D?= X-OriginatorOrg: atomlin.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04576310-c4ea-4f75-d67e-08dea0a059b3 X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB3523.GBRP123.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2026 18:52:49.6989 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e6a32402-7d7b-4830-9a2b-76945bbbcb57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l02qOg7eZyp1rnkW3XCW26MY8ei1F9zw5VevBCR7hT2om9OedKh9JGgpfr1dqvxO4BczzoPsRsKsKF9weakSsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P123MB7717 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260422_115251_040606_06A67151 X-CRM114-Status: GOOD ( 15.35 ) X-Mailman-Approved-At: Wed, 22 Apr 2026 20:08:43 -0700 X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Daniel Wagner Ensure that IRQ affinity setup also respects the queue-to-CPU mapping constraints provided by the block layer. This allows the SCSI drivers to avoid assigning interrupts to CPUs that the block layer has excluded (e.g., isolated CPUs). Only convert drivers which are already using the pci_alloc_irq_vectors_affinity with the PCI_IRQ_AFFINITY flag set. Because these drivers are enabled to let the IRQ core code to set the affinity. Also don't update qla2xxx because the nvme-fabrics code is not ready yet. Signed-off-by: Daniel Wagner Reviewed-by: Martin K. Petersen Reviewed-by: Hannes Reinecke Signed-off-by: Aaron Tomlin --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- drivers/scsi/mpi3mr/mpi3mr_fw.c | 6 +++++- drivers/scsi/mpt3sas/mpt3sas_base.c | 5 ++++- drivers/scsi/pm8001/pm8001_init.c | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index fda07b193137..4873c66b9f98 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2605,6 +2605,7 @@ static int interrupt_preinit_v3_hw(struct hisi_hba *hisi_hba) struct pci_dev *pdev = hisi_hba->pci_dev; struct irq_affinity desc = { .pre_vectors = BASE_VECTORS_V3_HW, + .mask = blk_mq_online_queue_affinity(), }; min_msi = MIN_AFFINE_VECTORS_V3_HW; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index ecd365d78ae3..006a3bf0cb06 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5925,7 +5925,10 @@ static int __megasas_alloc_irq_vectors(struct megasas_instance *instance) { int i, irq_flags; - struct irq_affinity desc = { .pre_vectors = instance->low_latency_index_start }; + struct irq_affinity desc = { + .pre_vectors = instance->low_latency_index_start, + .mask = blk_mq_online_queue_affinity(), + }; struct irq_affinity *descp = &desc; irq_flags = PCI_IRQ_MSIX; diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 31b19ed1528e..156323ab9465 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -830,7 +830,11 @@ static int mpi3mr_setup_isr(struct mpi3mr_ioc *mrioc, u8 setup_one) int max_vectors, min_vec; int retval; int i; - struct irq_affinity desc = { .pre_vectors = 1, .post_vectors = 1 }; + struct irq_affinity desc = { + .pre_vectors = 1, + .post_vectors = 1, + .mask = blk_mq_online_queue_affinity(), + }; if (mrioc->is_intr_info_set) return 0; diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 79052f2accbd..91e1622b5b77 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -3370,7 +3370,10 @@ static int _base_alloc_irq_vectors(struct MPT3SAS_ADAPTER *ioc) { int i, irq_flags = PCI_IRQ_MSIX; - struct irq_affinity desc = { .pre_vectors = ioc->high_iops_queues }; + struct irq_affinity desc = { + .pre_vectors = ioc->high_iops_queues, + .mask = blk_mq_online_queue_affinity(), + }; struct irq_affinity *descp = &desc; /* * Don't allocate msix vectors for poll_queues. diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index e93ea76b565e..6360fa95bcf4 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -978,6 +978,7 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) */ struct irq_affinity desc = { .pre_vectors = 1, + .mask = blk_mq_online_queue_affinity(), }; rc = pci_alloc_irq_vectors_affinity( pm8001_ha->pdev, 2, PM8001_MAX_MSIX_VEC, -- 2.51.0