From patchwork Mon Nov 11 18:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13871091 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 862901AA7B9; Mon, 11 Nov 2024 18:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348159; cv=none; b=Mv8WaBF0jXj7EUa2ZCGMwXaW27TWl6GU/Ap1dOhpJMkDzIw13Nw4OGdHWaHn1kArq2tHZkXx15wya2tEpfWGpQh/aVXeQPseyJaIMD5wedXrT7IfouxDNrSkBEXAr/qSX4l/2El+SwQS3edBPChRBYZbuJTPa54PYxzPoGllzWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348159; c=relaxed/simple; bh=mmnW/WydfD4NJklSfBY8igdZzRggi919xcCji69VW74=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JPzXYOjam4DgFYhLpKuht86yZjDqy85L7DaV33rlT0xOn75+YZ4p2ylx4wruaAVuE1SC4BVHJdYVZVACNWYPUR3l4ZR7j7LWcuQ2f8UnWYzXSzXm9QC/QlimBG7jF78OJkn757fKW8VRvrjPSZtIJ75VJj/gWQ3qRpJNxLlcP1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tPlOtI08; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tPlOtI08" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87634C4CED4; Mon, 11 Nov 2024 18:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731348159; bh=mmnW/WydfD4NJklSfBY8igdZzRggi919xcCji69VW74=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tPlOtI08aSykS4NmAVqpbM8hhEvo0QiryvDpT6Sf5GHxpL3KfeHVAMbJcJ+MHBrqy N4gCKMIYqZHJ6Z7M4He4Y63XkzmkedQxh7TGOCcjK24LT46buYjv4ve2qrkKH37Aj/ wIp7iKpG2kx782hJbGC9qF6mAlrKh+D/H3/+uoThs1bH43Sj5/TbTmQdbd10FGh4bF tmPOVZQIvNr0083uWg5Ju/a+LFNWsqqdSZPe9hamw82MJw1D1nq9B8jZ2t7uxQfKOp f9Z/qbpyL2uNWnI8/mVF+ZTG1NlefJDT0jqAuu/qqsvIm4ThmocQLD7aBHSDu/0zRE 6ONSqWBsmM15A== From: Daniel Wagner Date: Mon, 11 Nov 2024 19:02:09 +0100 Subject: [PATCH v2 1/6] blk-mq: introduce blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-refactor-blk-affinity-helpers-v2-1-f360ddad231a@kernel.org> References: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> In-Reply-To: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner , Daniel Wagner X-Mailer: b4 0.14.2 blk_mq_pci_map_queues and blk_mq_virtio_map_queues will create a CPU to hardware queue mapping based on affinity information. These two function share common code and only differ on how the affinity information is retrieved. Also, those functions are located in the block subsystem where it doesn't really fit in. They are virtio and pci subsystem specific. Introduce a new callback in struct bus_type to get the affinity mask. The callbacks can then be populated by the subsystem directly. All but one driver use the subsystem default affinity masks. hisi_sas v2 depends on a driver specific mapping, thus use the optional argument get_queue_affinity to retrieve the mapping. Original-by : Ming Lei Signed-off-by: Daniel Wagner Acked-by: Bjorn Helgaas --- block/blk-mq-cpumap.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/pci/pci-driver.c | 16 ++++++++++++++++ drivers/virtio/virtio.c | 12 ++++++++++++ include/linux/blk-mq.h | 5 +++++ include/linux/device/bus.h | 3 +++ 5 files changed, 76 insertions(+) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 9638b25fd52124f0173e968ebdca5f1fe0b42ad9..4dd703f5ee647fd1ba0b14ca11ddfdefa98a9a25 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -54,3 +54,43 @@ int blk_mq_hw_queue_to_node(struct blk_mq_queue_map *qmap, unsigned int index) return NUMA_NO_NODE; } + +/** + * blk_mq_hctx_map_queues - Create CPU to hardware queue mapping + * @qmap: CPU to hardware queue map. + * @dev: The device to map queues. + * @offset: Queue offset to use for the device. + * @get_irq_affinity: Optional callback to retrieve queue affinity. + * + * Create a CPU to hardware queue mapping in @qmap. For each queue + * @get_queue_affinity will be called. If @get_queue_affinity is not + * provided, then the bus_type irq_get_affinity callback will be + * used to retrieve the affinity. + */ +void blk_mq_hctx_map_queues(struct blk_mq_queue_map *qmap, + struct device *dev, unsigned int offset, + get_queue_affinity_fn *get_irq_affinity) +{ + const struct cpumask *mask = NULL; + unsigned int queue, cpu; + + for (queue = 0; queue < qmap->nr_queues; queue++) { + if (get_irq_affinity) + mask = get_irq_affinity(dev, queue + offset); + else if (dev->bus->irq_get_affinity) + mask = dev->bus->irq_get_affinity(dev, queue + offset); + + if (!mask) + goto fallback; + + for_each_cpu(cpu, mask) + qmap->mq_map[cpu] = qmap->queue_offset + queue; + } + + return; + +fallback: + WARN_ON_ONCE(qmap->nr_queues > 1); + blk_mq_clear_mq_map(qmap); +} +EXPORT_SYMBOL_GPL(blk_mq_hctx_map_queues); diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 35270172c833186995aebdda6f95ab3ffd7c67a0..59e5f430a380285162a87bd1a9b392bba8066450 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1670,6 +1670,21 @@ static void pci_dma_cleanup(struct device *dev) iommu_device_unuse_default_domain(dev); } +/** + * pci_device_irq_get_affinity - get affinity mask queue mapping for PCI device + * @dev: ptr to dev structure + * @irq_vec: interrupt vector number + * + * This function returns for a queue the affinity mask for a PCI device. + */ +static const struct cpumask *pci_device_irq_get_affinity(struct device *dev, + unsigned int irq_vec) +{ + struct pci_dev *pdev = to_pci_dev(dev); + + return pci_irq_get_affinity(pdev, irq_vec); +} + const struct bus_type pci_bus_type = { .name = "pci", .match = pci_bus_match, @@ -1677,6 +1692,7 @@ const struct bus_type pci_bus_type = { .probe = pci_device_probe, .remove = pci_device_remove, .shutdown = pci_device_shutdown, + .irq_get_affinity = pci_device_irq_get_affinity, .dev_groups = pci_dev_groups, .bus_groups = pci_bus_groups, .drv_groups = pci_drv_groups, diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index b9095751e43bb7db5fc991b0cc0979d2e86f7b9b..86390db7e74befa17c9fa146ab6b454bbae3b7f5 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -377,6 +377,17 @@ static void virtio_dev_remove(struct device *_d) of_node_put(dev->dev.of_node); } +static const struct cpumask *virtio_irq_get_affinity(struct device *_d, + unsigned int irq_veq) +{ + struct virtio_device *dev = dev_to_virtio(_d); + + if (!dev->config->get_vq_affinity) + return NULL; + + return dev->config->get_vq_affinity(dev, irq_veq); +} + static const struct bus_type virtio_bus = { .name = "virtio", .match = virtio_dev_match, @@ -384,6 +395,7 @@ static const struct bus_type virtio_bus = { .uevent = virtio_uevent, .probe = virtio_dev_probe, .remove = virtio_dev_remove, + .irq_get_affinity = virtio_irq_get_affinity, }; int __register_virtio_driver(struct virtio_driver *driver, struct module *owner) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 2035fad3131fb60781957095ce8a3a941dd104be..6b40af77bf44afa7112d274b731b591f2a67d68c 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -922,7 +922,12 @@ int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, void blk_mq_unfreeze_queue_non_owner(struct request_queue *q); void blk_freeze_queue_start_non_owner(struct request_queue *q); +typedef const struct cpumask *(get_queue_affinity_fn)(struct device *dev, + unsigned int queue); void blk_mq_map_queues(struct blk_mq_queue_map *qmap); +void blk_mq_hctx_map_queues(struct blk_mq_queue_map *qmap, + struct device *dev, unsigned int offset, + get_queue_affinity_fn *get_queue_affinity); void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); void blk_mq_quiesce_queue_nowait(struct request_queue *q); diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index cdc4757217f9bb4b36b5c3b8a48bab45737e44c5..b18658bce2c3819fc1cbeb38fb98391d56ec3317 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -48,6 +48,7 @@ struct fwnode_handle; * will never get called until they do. * @remove: Called when a device removed from this bus. * @shutdown: Called at shut-down time to quiesce the device. + * @irq_get_affinity: Get IRQ affinity mask for the device on this bus. * * @online: Called to put the device back online (after offlining it). * @offline: Called to put the device offline for hot-removal. May fail. @@ -87,6 +88,8 @@ struct bus_type { void (*sync_state)(struct device *dev); void (*remove)(struct device *dev); void (*shutdown)(struct device *dev); + const struct cpumask *(*irq_get_affinity)(struct device *dev, + unsigned int irq_vec); int (*online)(struct device *dev); int (*offline)(struct device *dev); From patchwork Mon Nov 11 18:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13871092 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D7651AB53F; Mon, 11 Nov 2024 18:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348162; cv=none; b=et3HOWnrPirRdLAUYzOpC0P52vB7nejVHz7euUMHhWmKXFjAA//YyIs8z8ZlY+e9woqi3AWrLmhRH0KK9jl0pK/WCUcTo9DatQ22TB+59EYbAvZZ5pFAoV6oB1XXnpisOgeC27RWszc0wTcyx7wjRhqE2/nkUmiGrcqLvVU/xes= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348162; c=relaxed/simple; bh=Q7fYE/xJlWDN03gBfQlsFtirezGmffiTBEXil1qb08I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qf1DKWNMfO8zQ+qNd9Vt4SRENCei4vEPWxiW11lqtdvruqunrUNrrqh7pDvs7W4FACieCBqOfyeVP5YVlHpXMeZfmT65x3XssIMVx0gv+1pSeuzc/JD/hNM/1ImYfS+USsBNMIo1W0J8khI1zcw+K8+1oDGGdRSJVERjaAtGPjI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E8gPEJ3e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E8gPEJ3e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ABE5C4CED4; Mon, 11 Nov 2024 18:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731348161; bh=Q7fYE/xJlWDN03gBfQlsFtirezGmffiTBEXil1qb08I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E8gPEJ3ef6mhNz+R4hf+B2dQyf6FMwCFFQR347b7vuZOLmZFUv11F2mzFMDEwqJPQ m718RBOQMu7sD2M9n7mdO7n9ur//hSd+tIEW4Zp1+5hsVZbh2PlBfkbjogZIaibIT+ BOz+9/qd1nJrWlTXJoJqa13ET2YEvBjLqy+5NnOAVF1+kRW2CES5BXArqZ9L231rNK IX8chxe0q4aqdIRKCduNiBAfJWmAxs/DqEV6TlBx1nZqqN0kl3eJCm2WtfKJub2YWd DeD+CwKKMRJ14ZqVNSa1+HGKU7NsF9hYXVZ/s4ZZHRuag7uv5waWjCW6jfhuKsrkda FpLya7WRq3T3Q== From: Daniel Wagner Date: Mon, 11 Nov 2024 19:02:10 +0100 Subject: [PATCH v2 2/6] scsi: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-refactor-blk-affinity-helpers-v2-2-f360ddad231a@kernel.org> References: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> In-Reply-To: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner , Daniel Wagner X-Mailer: b4 0.14.2 From: Daniel Wagner Replace all users of blk_mq_pci_map_queues with the more generic blk_mq_hctx_map_queues. This in preparation to retire blk_mq_pci_map_queues. Signed-off-by: Daniel Wagner Reviewed-by: Christoph Hellwig --- drivers/scsi/fnic/fnic_main.c | 3 +-- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +-- drivers/scsi/mpi3mr/mpi3mr.h | 1 - drivers/scsi/mpi3mr/mpi3mr_os.c | 3 ++- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 ++-- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pm8001/pm8001_sas.h | 1 - drivers/scsi/qla2xxx/qla_nvme.c | 4 ++-- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- drivers/scsi/smartpqi/smartpqi_init.c | 7 +++---- 10 files changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index adec0df24bc475ea4d7d8089ea0f75fe96746956..42033e08a233be67e64181b2461d05ab0cddd8f9 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -601,7 +600,7 @@ void fnic_mq_map_queues_cpus(struct Scsi_Host *host) return; } - blk_mq_pci_map_queues(qmap, l_pdev, FNIC_PCI_OFFSET); + blk_mq_hctx_map_queues(qmap, &l_pdev->dev, FNIC_PCI_OFFSET, NULL); } static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 8e75e2e279a40ae5fdc6b7b07a7aed15241a8d54..7979a8f5a50377c1af5d166ec23ac2e543c6c404 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -3193,7 +3192,7 @@ static void megasas_map_queues(struct Scsi_Host *shost) map = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; map->nr_queues = instance->msix_vectors - offset; map->queue_offset = 0; - blk_mq_pci_map_queues(map, instance->pdev, offset); + blk_mq_hctx_map_queues(map, &instance->pdev->dev, offset, NULL); qoff += map->nr_queues; offset += map->nr_queues; diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index 81bb408ce56d8f9599e6f62276666bedce6d0d32..57ccea42ece1ecf1c471ee744213453b13db0ea1 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -12,7 +12,6 @@ #include #include -#include #include #include #include diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 5f2f67acf8bf3194cb8ec78904096ffb4bdd7ff2..7aa631126d39d0d696c19943b78519f512a49751 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -4042,7 +4042,8 @@ static void mpi3mr_map_queues(struct Scsi_Host *shost) */ map->queue_offset = qoff; if (i != HCTX_TYPE_POLL) - blk_mq_pci_map_queues(map, mrioc->pdev, offset); + blk_mq_hctx_map_queues(map, &mrioc->pdev->dev, + offset, NULL); else blk_mq_map_queues(map); diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index f2a55aa5fe65036a3beabae5c0c6e9db835d2aab..3fa6b5295198e5a27acbb31dbc0becffdb21a9e1 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -53,7 +53,6 @@ #include #include #include -#include #include #include "mpt3sas_base.h" @@ -11890,7 +11889,8 @@ static void scsih_map_queues(struct Scsi_Host *shost) */ map->queue_offset = qoff; if (i != HCTX_TYPE_POLL) - blk_mq_pci_map_queues(map, ioc->pdev, offset); + blk_mq_hctx_map_queues(map, &ioc->pdev->dev, + offset, NULL); else blk_mq_map_queues(map); diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 33e1eba62ca12c2555419197ecdbebad817e4a6d..825f5ad29ebd13f6ef1e63e67e1a5e9ab0a45f86 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -101,7 +101,7 @@ static void pm8001_map_queues(struct Scsi_Host *shost) struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; if (pm8001_ha->number_of_intr > 1) { - blk_mq_pci_map_queues(qmap, pm8001_ha->pdev, 1); + blk_mq_hctx_map_queues(qmap, &pm8001_ha->pdev->dev, 1, NULL); return; } diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index ced6721380a85345a74a87ebd2facdaa513f8768..c46470e0cf63b7b18b9572c8d6b4f4ddf489aa2b 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -56,7 +56,6 @@ #include #include #include -#include #include "pm8001_defs.h" #define DRV_NAME "pm80xx" diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 8f4cc136a9c9c46f5f2d5408f9b7688ef520a8a3..8931e3c17e767954cfd2d0b5d14cc42a93d97e85 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -8,7 +8,6 @@ #include #include #include -#include #include static struct nvme_fc_port_template qla_nvme_fc_transport; @@ -841,7 +840,8 @@ static void qla_nvme_map_queues(struct nvme_fc_local_port *lport, { struct scsi_qla_host *vha = lport->private; - blk_mq_pci_map_queues(map, vha->hw->pdev, vha->irq_offset); + blk_mq_hctx_map_queues(map, &vha->hw->pdev->dev, + vha->irq_offset, NULL); } static void qla_nvme_localport_delete(struct nvme_fc_local_port *lport) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7f980e6141c28282d4c4a0123dda96e36e1f180e..de201f8e89922d9b931804ca3d491c45db05bb99 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -8070,7 +8069,8 @@ static void qla2xxx_map_queues(struct Scsi_Host *shost) if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) blk_mq_map_queues(qmap); else - blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); + blk_mq_hctx_map_queues(qmap, &vha->hw->pdev->dev, + vha->irq_offset, NULL); } struct scsi_host_template qla2xxx_driver_template = { diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 870f37b7054644426a2695e857c45a0a12aff051..78f097d4e33fcca553167febedd78e3de4798014 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -6547,10 +6546,10 @@ static void pqi_map_queues(struct Scsi_Host *shost) struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost); if (!ctrl_info->disable_managed_interrupts) - return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT], - ctrl_info->pci_dev, 0); + blk_mq_hctx_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT], + &ctrl_info->pci_dev->dev, 0, NULL); else - return blk_mq_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT]); + blk_mq_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT]); } static inline bool pqi_is_tape_changer_device(struct pqi_scsi_dev *device) From patchwork Mon Nov 11 18:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13871093 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B8871AC447; Mon, 11 Nov 2024 18:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348164; cv=none; b=MR0acV/VeIwtsB46gnDQcIM2b+6JpTdYQGad85+gSmuFgHRLySlixLaSMqC2CowOJnJ5/8bAfEIXXwrrFyVGtNfFGi2CAQVVR2DPM1ACqs0bb/Rq83WxsUGEFVGUCDwtxSC/v6R0BQSKEdVQsZ3Dl9Bt/9GmYAU5QS5uP7EoeWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348164; c=relaxed/simple; bh=9sP0iy9vNDvvulLRRTbPROgoFCL1cPRRjbHOX7L9p84=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gVuldEs3DjSgXso+D3x/gTvdwj8v7eVA0aNGyHGFJFXseM8NvpsDNc1p6scXcn5rmoYmpoSftqDmcM0T08QnM4u/aA6Sj96kGkJfW4c8jmFXlyu3cWN75+mlCJ5ekHwoYl7faELkiwIjaW9rzv+D1ju5n/cKOx9A/rCteAzuWqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O7VWKUmM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O7VWKUmM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DF57C4CED5; Mon, 11 Nov 2024 18:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731348163; bh=9sP0iy9vNDvvulLRRTbPROgoFCL1cPRRjbHOX7L9p84=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=O7VWKUmMXeZ7nUGRFniku/BXyk9vT5a5ksJLICMRhzu+Ax8h1/0Hoe0HqByE8WOwd Mhw0T222KrPnK9Y7LRPxx7qJb6/rOQ9/htYyPHhzHQjN08N81opjfFjRQdvbSA4ZsD pVnSE92OLZMGXaAUj/PWObivcIGmlV+ddC7H/krnQk8/lNkN6V9NTTTTyYPu2K8NFb uOQ/WpJPyJqGSLuZMp9XH3Kw1CvbncOQp5agInR7Bn/1MEr+ozad2C6tZCe+KsyV/y yfd0hGKKh0asKLmrSVJW7EDkTitfMdNf8b/vYTlRnjCDZBq5rYByqoe4pFj2p7+YFI xxHSqhkjFf4HQ== From: Daniel Wagner Date: Mon, 11 Nov 2024 19:02:11 +0100 Subject: [PATCH v2 3/6] scsi: hisi_sas: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-refactor-blk-affinity-helpers-v2-3-f360ddad231a@kernel.org> References: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> In-Reply-To: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner , Daniel Wagner X-Mailer: b4 0.14.2 From: Daniel Wagner Replace all users of blk_mq_pci_map_queues with the more generic blk_mq_hctx_map_queues. This in preparation to retire blk_mq_pci_map_queues. For his_sas_v2_hw.c needs its own callback for retrieving the affinity. The generic bus_type get queue affinity callback is using pci_irq_get_affinity and not irq_data_get_affinity_mask. This allows it to replace the open code loop with blk_mq_hctx_map_queues at least. Signed-off-by: Daniel Wagner --- drivers/scsi/hisi_sas/hisi_sas.h | 1 - drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 22 +++++++++++----------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index d223f482488fc6cebc2838e92ae7ec70fb4e1437..010479a354eeeb47bbee24102e450aa3b7ea6197 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -9,7 +9,6 @@ #include #include -#include #include #include #include diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 342d75f12051d28fb1a0692b45ff568dd5b6f814..fd2f63e64376d1a444efe511a3aaa0988d9747f2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3372,7 +3372,7 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba) for (queue_no = 0; queue_no < hisi_hba->cq_nvecs; queue_no++) { struct hisi_sas_cq *cq = &hisi_hba->cq[queue_no]; - cq->irq_no = hisi_hba->irq_map[queue_no + 96]; + cq->irq_no = hisi_hba->irq_map[queue_no + CQ0_IRQ_INDEX]; rc = devm_request_threaded_irq(dev, cq->irq_no, cq_interrupt_v2_hw, cq_thread_v2_hw, IRQF_ONESHOT, @@ -3549,21 +3549,21 @@ static const struct attribute_group *sdev_groups_v2_hw[] = { NULL }; +static const struct cpumask *hisi_hba_get_queue_affinity(struct device *dev, + unsigned int queue) +{ + struct hisi_hba *hba = dev->driver_data; + + return irq_get_affinity_mask(hba->irq_map[queue]); +} + static void map_queues_v2_hw(struct Scsi_Host *shost) { struct hisi_hba *hisi_hba = shost_priv(shost); struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; - const struct cpumask *mask; - unsigned int queue, cpu; - for (queue = 0; queue < qmap->nr_queues; queue++) { - mask = irq_get_affinity_mask(hisi_hba->irq_map[96 + queue]); - if (!mask) - continue; - - for_each_cpu(cpu, mask) - qmap->mq_map[cpu] = qmap->queue_offset + queue; - } + blk_mq_hctx_map_queues(qmap, hisi_hba->dev, CQ0_IRQ_INDEX, + hisi_hba_get_queue_affinity); } static const struct scsi_host_template sht_v2_hw = { diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 4cd3a3eab6f1c47c962565a74cd7284dad1db12e..031db7b744e6352eb23d0dcac2c4a947c56f63d1 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3322,8 +3322,8 @@ static void hisi_sas_map_queues(struct Scsi_Host *shost) if (i == HCTX_TYPE_POLL) blk_mq_map_queues(qmap); else - blk_mq_pci_map_queues(qmap, hisi_hba->pci_dev, - BASE_VECTORS_V3_HW); + blk_mq_hctx_map_queues(qmap, &hisi_hba->pci_dev->dev, + BASE_VECTORS_V3_HW, NULL); qoff += qmap->nr_queues; } } From patchwork Mon Nov 11 18:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13871094 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E63FC1B5820; Mon, 11 Nov 2024 18:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348167; cv=none; b=K+v85BNnlgImUcta2IWDkkV1pSmpkkWZ8MZ+OpyzVQWSzrGSb6cr9ZdmiovB8que6f2qkRjWpYdQWvroDLEdPz1iLqoF9WEbXgqPdGDZXCOwlqGNZWWplC7hLqgsQsDvec/vtUKo/M5EchkKHBSQIKbTEyZduEfNDoDpC/XOPaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348167; c=relaxed/simple; bh=WAeDsicX+euuIW0kqweV/QZoBg2yhq9mlxveHEyExKw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cKU0h6Aa3d9sSX0EgJUq8AdLo075llwqlch+ErZv+OO3iKW9tfCu23jICUYxc1B/By0cJAWtjUaL1XCWqrpFNJNe9jG8pjgBtv5CULKuypdS9MshhPYAF5+IMs8CTSdLC0QsLxrX3GLfNCh3gqDWrMO71U90ab61o+uQ/hKUQD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bq3mErFB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Bq3mErFB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE5EC4AF09; Mon, 11 Nov 2024 18:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731348166; bh=WAeDsicX+euuIW0kqweV/QZoBg2yhq9mlxveHEyExKw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Bq3mErFBO211kbc9/EzMp4ADTv5smrPyzd3ptoGPx7LmVPB72o7SOjlJqdOm7fwcN aKEYn11CpLFPdaHYl/wY87SF+596lyMZL1e+7iu1AgxSVu58E3vLN47tFsIoghG7P0 wmKG/tT0QdZVcRuFS5amZr+dK+F7GgxkNmixF94bbXT2tbFO2IjrmXohOPoZ5qfRGC 0DJXez0cshPfRmG9ty0jnODhXB2VrwL9lmfYSQYKDzOrhpiKDPYbhRJWRNZ35I4Zqj 8V32Z37iwUQK5qi4OoLGgtpKckEz1/6J1ji/3hXzubojvP1LcfSSJpEFpE0zO5WINi DSt/tpJroFktA== From: Daniel Wagner Date: Mon, 11 Nov 2024 19:02:12 +0100 Subject: [PATCH v2 4/6] nvme: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-refactor-blk-affinity-helpers-v2-4-f360ddad231a@kernel.org> References: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> In-Reply-To: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner , Daniel Wagner X-Mailer: b4 0.14.2 From: Daniel Wagner Replace all users of blk_mq_pci_map_queues with the more generic blk_mq_hctx_map_queues. This in preparation to retire blk_mq_pci_map_queues. Reviewed-by: Christoph Hellwig Signed-off-by: Daniel Wagner --- drivers/nvme/host/fc.c | 1 - drivers/nvme/host/pci.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index b81af7919e94c421387033bf8361a9cf8a867486..094be164ffdc0fb79050cfb92c32dfaee8d15622 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -16,7 +16,6 @@ #include #include "fc.h" #include -#include /* *************************** Data Structures/Defines ****************** */ diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 4b9fda0b1d9a33af4d7030b72532835b205e9cbb..2180ad4797923422361615d1387c2b5d3181d0a4 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -457,7 +456,7 @@ static void nvme_pci_map_queues(struct blk_mq_tag_set *set) */ map->queue_offset = qoff; if (i != HCTX_TYPE_POLL && offset) - blk_mq_pci_map_queues(map, to_pci_dev(dev->dev), offset); + blk_mq_hctx_map_queues(map, dev->dev, offset, NULL); else blk_mq_map_queues(map); qoff += map->nr_queues; From patchwork Mon Nov 11 18:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13871095 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86B691BBBDC; Mon, 11 Nov 2024 18:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348169; cv=none; b=PZgi7Z6KK2GPjDxds3TpBzKzpkjEOa2bE8ZnwDUVRn9ADGOzmGKstrahISrS/6E/qNLHmZzv50m/P9xGbkk1G7mCO/tC+9rD8/E/tauWMufBx7vEvgwcorqrZXhHXSK+cqRFlnQJ1bWyC9u2ms9vIB0UYGJ1b/9yTwwSZGnQHKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348169; c=relaxed/simple; bh=Vx5p+m9iGWXTMeWxv2yXtAZl1YKL5LF17c7Lkr/9Yws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PgQXuMJbh4H38Ll9cXL+C0Mn+n49AcEIdKNKNepnBNrLQLS+Hal0aJJQVqxe9xbdulIDL1zBJJA2KExR2v/yjCnzE6CjXxU+HGikQZfxW1MTkG42zU+B6wrgc6p0my9HqEg+b1W7qiakD9c8uJnI+ZFy3OLo083CDFuI6JJk6Rs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GhEe1Lzw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GhEe1Lzw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7065AC4CECF; Mon, 11 Nov 2024 18:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731348168; bh=Vx5p+m9iGWXTMeWxv2yXtAZl1YKL5LF17c7Lkr/9Yws=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GhEe1LzwYPDX8CvUWizPCEN2/5myM/JyJnn3utEFqQyogUErU2NZix93wKpQr+B0k 8YmaoQ/7TydDCWb/HLg8C8dk510GXNhsd0L04rgSbZaUzruuJ4+1lxA4Ic2RI1P6Z5 kB0mt3LEDD6o6ITa/PnfLVEjHc6MAXN/CSp0EwsNH9WYxdBFMsACPhKrDa0VZqRwq5 0SvMzYv11+qyV27uLTzaEtc6EJRoJVG9pfrth8h00Mf9Ac+0W/xLsz7Sw8sKok4KBT MtPJLgMUoVDhwYYKlWimFYYls3KWJiBCgw8oWsvnQEJhViCz1YqrGE381qCV7JkcT6 fXf1wyQk2wsAA== From: Daniel Wagner Date: Mon, 11 Nov 2024 19:02:13 +0100 Subject: [PATCH v2 5/6] virtio: blk/scsi: replace blk_mq_virtio_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-refactor-blk-affinity-helpers-v2-5-f360ddad231a@kernel.org> References: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> In-Reply-To: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner , Daniel Wagner X-Mailer: b4 0.14.2 From: Daniel Wagner Replace all users of blk_mq_virtio_map_queues with the more generic blk_mq_hctx_map_queues. This in preparation to retire blk_mq_virtio_map_queues. Signed-off-by: Daniel Wagner Reviewed-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 4 ++-- drivers/scsi/virtio_scsi.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 0e99a4714928478c1ba81777b8e98448eb5b992a..3fa1e982e4f225ae1dcc02b413459b3578d9d9ca 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -1186,7 +1185,8 @@ static void virtblk_map_queues(struct blk_mq_tag_set *set) if (i == HCTX_TYPE_POLL) blk_mq_map_queues(&set->map[i]); else - blk_mq_virtio_map_queues(&set->map[i], vblk->vdev, 0); + blk_mq_hctx_map_queues(&set->map[i], &vblk->vdev->dev, + 0, NULL); } } diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 8471f38b730e205eb57052305c154260864bee95..8fdac72212bd4864029231684bb4b297131cee31 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -29,7 +29,6 @@ #include #include #include -#include #include "sd.h" @@ -746,7 +745,7 @@ static void virtscsi_map_queues(struct Scsi_Host *shost) if (i == HCTX_TYPE_POLL) blk_mq_map_queues(map); else - blk_mq_virtio_map_queues(map, vscsi->vdev, 2); + blk_mq_hctx_map_queues(map, &vscsi->vdev->dev, 2, NULL); } } From patchwork Mon Nov 11 18:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13871096 X-Patchwork-Delegate: kw@linux.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D01511BC9F7; Mon, 11 Nov 2024 18:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348171; cv=none; b=hVlnIypmsAxKK7hyIJmAsst6VJ0/NkI/O1CteNz39Dm6a/AzNtQVj0TMK2exQVdLMZStlNni5zeF0Qm9NL5XyU06UuR55d1WQQOfBrp7ca8o2CYZrDg3xw7aP0nT99VW5qH1WCjzVM4bFjLzH929p72YyXRezHtMTwI3LImu7PY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731348171; c=relaxed/simple; bh=proCbUkTdFmH0IZ/EmgCIAZUp0dOvtqdeSuQWiYy3tQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IxjWRhhmrxLlWMQ2kNQZtM545oomBccz2nsSGSVSNHrT2vn4qDoL/xLzCQR0qfP9v58qK1ourgnB0+j4SjQgJUgOSds8NZ2FgJtNTmpH4ZA+sjVDQhh7Nrqpkcwboe0N8lCICsiR93BhIVdkZ7RyVMYlwMOYBCXHVeyFaNzNmm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LL2iDez3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LL2iDez3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19B31C4CECF; Mon, 11 Nov 2024 18:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731348171; bh=proCbUkTdFmH0IZ/EmgCIAZUp0dOvtqdeSuQWiYy3tQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LL2iDez358oJOVu5/TGTsf5lTvLB1Sl8lm+P6KhNY/OrPiM++/gss6SEB6/VOgWtv quPX351BC+j4tcs+0hNumqgf6PP6uAXGlvOuYRXHmaRHfLPHwkgeG/1LcR3P6oz89s Gq2A/MqMb8BYjpbu623PFEkR5+I+ZXjcyMVPNY7zTyAoaTxxQyBSOC7Jlni25wzwO3 PpsgkDV2qDx0XAnd9xFJc5LVYLRcB7GNiMV8v8Rn9B2tlMOpgT4HeeTmOyAFqZBMiJ YMTZubqutD4hOJm+7uFWSWjPrhsnlAUD2tFtja9jUM1o7vsgXRlSXc0+TrB4Zu/6VS sbaA0CVe49+pQ== From: Daniel Wagner Date: Mon, 11 Nov 2024 19:02:14 +0100 Subject: [PATCH v2 6/6] blk-mq: remove unused queue mapping helpers Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241111-refactor-blk-affinity-helpers-v2-6-f360ddad231a@kernel.org> References: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> In-Reply-To: <20241111-refactor-blk-affinity-helpers-v2-0-f360ddad231a@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, storagedev@microchip.com, linux-nvme@lists.infradead.org, Daniel Wagner , Daniel Wagner X-Mailer: b4 0.14.2 There are no users left of the pci and virtio queue mapping helpers. Thus remove them. Signed-off-by: Daniel Wagner Reviewed-by: Christoph Hellwig --- block/Makefile | 2 -- block/blk-mq-pci.c | 46 ------------------------------------------- block/blk-mq-virtio.c | 46 ------------------------------------------- include/linux/blk-mq-pci.h | 11 ----------- include/linux/blk-mq-virtio.h | 11 ----------- 5 files changed, 116 deletions(-) diff --git a/block/Makefile b/block/Makefile index ddfd21c1a9ffc9c4f49efca9875bd8a1cbf81e4d..33748123710b368a1a3a7b099bbd90d27b24c69b 100644 --- a/block/Makefile +++ b/block/Makefile @@ -27,8 +27,6 @@ bfq-y := bfq-iosched.o bfq-wf2q.o bfq-cgroup.o obj-$(CONFIG_IOSCHED_BFQ) += bfq.o obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o t10-pi.o -obj-$(CONFIG_BLK_MQ_PCI) += blk-mq-pci.o -obj-$(CONFIG_BLK_MQ_VIRTIO) += blk-mq-virtio.o obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o obj-$(CONFIG_BLK_WBT) += blk-wbt.o obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o diff --git a/block/blk-mq-pci.c b/block/blk-mq-pci.c deleted file mode 100644 index d47b5c73c9eb715be7627a2952ad0ef921dd5bc6..0000000000000000000000000000000000000000 --- a/block/blk-mq-pci.c +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2016 Christoph Hellwig. - */ -#include -#include -#include -#include -#include - -#include "blk-mq.h" - -/** - * blk_mq_pci_map_queues - provide a default queue mapping for PCI device - * @qmap: CPU to hardware queue map. - * @pdev: PCI device associated with @set. - * @offset: Offset to use for the pci irq vector - * - * This function assumes the PCI device @pdev has at least as many available - * interrupt vectors as @set has queues. It will then query the vector - * corresponding to each queue for it's affinity mask and built queue mapping - * that maps a queue to the CPUs that have irq affinity for the corresponding - * vector. - */ -void blk_mq_pci_map_queues(struct blk_mq_queue_map *qmap, struct pci_dev *pdev, - int offset) -{ - const struct cpumask *mask; - unsigned int queue, cpu; - - for (queue = 0; queue < qmap->nr_queues; queue++) { - mask = pci_irq_get_affinity(pdev, queue + offset); - if (!mask) - goto fallback; - - for_each_cpu(cpu, mask) - qmap->mq_map[cpu] = qmap->queue_offset + queue; - } - - return; - -fallback: - WARN_ON_ONCE(qmap->nr_queues > 1); - blk_mq_clear_mq_map(qmap); -} -EXPORT_SYMBOL_GPL(blk_mq_pci_map_queues); diff --git a/block/blk-mq-virtio.c b/block/blk-mq-virtio.c deleted file mode 100644 index 68d0945c0b08a2be116125f46c3a56fcdb02aea8..0000000000000000000000000000000000000000 --- a/block/blk-mq-virtio.c +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2016 Christoph Hellwig. - */ -#include -#include -#include -#include -#include "blk-mq.h" - -/** - * blk_mq_virtio_map_queues - provide a default queue mapping for virtio device - * @qmap: CPU to hardware queue map. - * @vdev: virtio device to provide a mapping for. - * @first_vec: first interrupt vectors to use for queues (usually 0) - * - * This function assumes the virtio device @vdev has at least as many available - * interrupt vectors as @set has queues. It will then query the vector - * corresponding to each queue for it's affinity mask and built queue mapping - * that maps a queue to the CPUs that have irq affinity for the corresponding - * vector. - */ -void blk_mq_virtio_map_queues(struct blk_mq_queue_map *qmap, - struct virtio_device *vdev, int first_vec) -{ - const struct cpumask *mask; - unsigned int queue, cpu; - - if (!vdev->config->get_vq_affinity) - goto fallback; - - for (queue = 0; queue < qmap->nr_queues; queue++) { - mask = vdev->config->get_vq_affinity(vdev, first_vec + queue); - if (!mask) - goto fallback; - - for_each_cpu(cpu, mask) - qmap->mq_map[cpu] = qmap->queue_offset + queue; - } - - return; - -fallback: - blk_mq_map_queues(qmap); -} -EXPORT_SYMBOL_GPL(blk_mq_virtio_map_queues); diff --git a/include/linux/blk-mq-pci.h b/include/linux/blk-mq-pci.h deleted file mode 100644 index ca544e1d3508f34ab6e198b0bb17efe88de4d14d..0000000000000000000000000000000000000000 --- a/include/linux/blk-mq-pci.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_BLK_MQ_PCI_H -#define _LINUX_BLK_MQ_PCI_H - -struct blk_mq_queue_map; -struct pci_dev; - -void blk_mq_pci_map_queues(struct blk_mq_queue_map *qmap, struct pci_dev *pdev, - int offset); - -#endif /* _LINUX_BLK_MQ_PCI_H */ diff --git a/include/linux/blk-mq-virtio.h b/include/linux/blk-mq-virtio.h deleted file mode 100644 index 13226e9b22dd53e4289d506d49c52671de036ee8..0000000000000000000000000000000000000000 --- a/include/linux/blk-mq-virtio.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_BLK_MQ_VIRTIO_H -#define _LINUX_BLK_MQ_VIRTIO_H - -struct blk_mq_queue_map; -struct virtio_device; - -void blk_mq_virtio_map_queues(struct blk_mq_queue_map *qmap, - struct virtio_device *vdev, int first_vec); - -#endif /* _LINUX_BLK_MQ_VIRTIO_H */