From patchwork Wed Nov 13 14:26:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843433 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 2337A200C82; Wed, 13 Nov 2024 14:26:31 +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=1731507992; cv=none; b=Lcw8TVP7OPrjfnDn5EBbl6CWIpyE0hAdMyLpF6M/pJ9SaWRBq556TDy2bJAuZtYv262aN7D9biHFJi/DUvCW/xK+GbyDMB/HKc/GNF5Z5aIS/SE0p55daOGNQtHxC8Ay8VfKVrlZlagiUht3Kibpq/r82kylCQTx4/8O14WsRNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731507992; c=relaxed/simple; bh=80LDPDpX9fi8j9wcH0xhw1xU3ocXiJTjjmEwdiRjBuY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qqzzV7Hk0/5+jfoDSKByrdHWHBLdi6jpYqmV4/NxO8kqtPDttNPb32B+4+7WYYyeyjrxqJUueosSJEIxawOlgYxjZNOxiKY6BxBRyiDZVpzms+ablS/ZTzDGQ//8cU9MiIjFD+j5vIV+IVD/tgiNLGZI1GxCjwxi5rJrHAcDw0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q5gmVPGM; 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="Q5gmVPGM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF306C4CEC3; Wed, 13 Nov 2024 14:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731507991; bh=80LDPDpX9fi8j9wcH0xhw1xU3ocXiJTjjmEwdiRjBuY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Q5gmVPGM5cZYvYsjszUPnVvC2YTs+vxd72MMdYs7VzgiwucoXKMZYWyNIBug1gLFc 3tVJ+3rte9AcGHpgunbV+WIrrjIFyTV8uPNBk1xzvvZGGriL3qfYAhC2G3hsBxXpb1 /tHNTz3B0MAsAJ1n7Cp6Df13/S+u2N8ogdI9DMqPSpEWEztftCfkbpsu5Ks+jKEDXJ UTdi8t0o1BiPOByiyyf6TfvVKmS0zKd/nOIYANlS8DlmGJdAQ4yHlxYeriRYYqHgNR wj7nSuuGLYoI99/JUYtsR4rh+wDa17Oda3bJYTMjFq2Hukld+zzBfkdO0W3Ntx8k3C 94mp34sGbuVBA== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:15 +0100 Subject: [PATCH v4 01/10] driver core: bus: add irq_get_affinity callback to bus_type Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-1-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 Introducing a callback in struct bus_type so that a subsystem can hook up the getters directly. This approach avoids exposing random getters in any subsystems APIs. Acked-by: Bjorn Helgaas Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner Reviewed-by: Ming Lei --- include/linux/device/bus.h | 3 +++ 1 file changed, 3 insertions(+) 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 Wed Nov 13 14:26:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843060 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 1E27C20125A; Wed, 13 Nov 2024 14:26:33 +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=1731507994; cv=none; b=MHl2BAAUKIMlkuiumuKGgK0G0dKZhft+kWiAxBuLGZRG9B8c+G2vG8oH1V3SQX6qaHyy7w0OuXkpAh2TvKsM/DxYTHuHSUtak52AbmD5HJaUMQiqy5HWpyYMOSveF1sqQkn03w6YugRntmPkt+sB/rx+9lna0JCliiezcgDtimo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731507994; c=relaxed/simple; bh=75UYmyTYuXcBh21qnxL8a7xEYVI0TRKMVuk8+5dIe0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GPQzYakJaUTClkdOk3+Ofgg/yfd4honGHY5XuwOhK7o+DGLNc5M5NJefAIP30SMt2LghUv8J0RaF9LijKgn9qc4mI4FY0L///4hfcH6aYz56zdOC10GusDqjEJbnguli3462L89O4TPiNKNbUfM0JsA7QPIZU13BXS8H1BJDA4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZpZ2ihZj; 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="ZpZ2ihZj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 528C6C4CEC3; Wed, 13 Nov 2024 14:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731507993; bh=75UYmyTYuXcBh21qnxL8a7xEYVI0TRKMVuk8+5dIe0A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZpZ2ihZjYywFiKV3/cRgPCdS8RYQSWApYb62AnXJE2Lzxj3NQum7QCIZxYW4Mq43s e2P2YpmeHIV5S7vXbe5vc/dLKC4Uz5h9pxIXwAn8DPkxWDrwUSKnQJ6Dtg3/p/rtbv A0QsZyQbD47QweEnMeYYeOYdSqzsDOO9P9sUdHZ7XbN23LqMt09unrh9tX7lNfAY9v XwWXExgqJSRb7JPHFmY3UWp81lrebBnhfNMFRArM+It13Twy7Z18+UdieImjU+z6Vs ltul7jBybBHLjfOL7bWCjvy70Lt395urjLj3o1aS/eLJ7Up7e747yTUO+1Bgs0s3vE F6Xi7QwqUO0Iw== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:16 +0100 Subject: [PATCH v4 02/10] driver core: add irq_get_affinity callback device_driver Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-2-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 Introducing a callback in struct device_driver so that a device driver can hook up the getters directly. This approach avoids exposing random getters in drivers. Signed-off-by: Daniel Wagner Reviewed-by: Ming Lei --- include/linux/device/driver.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 5c04b8e3833b995f9fd4d65b8732b3dfce2eba7e..0d1aee423f6c076ae102bdd0536233c259947fac 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -74,6 +74,7 @@ enum probe_type { * @suspend: Called to put the device to sleep mode. Usually to a * low power state. * @resume: Called to bring a device from sleep mode. + * @irq_get_affinity: Get IRQ affinity mask for the device. * @groups: Default attributes that get created by the driver core * automatically. * @dev_groups: Additional attributes attached to device instance once @@ -112,6 +113,8 @@ struct device_driver { void (*shutdown) (struct device *dev); int (*suspend) (struct device *dev, pm_message_t state); int (*resume) (struct device *dev); + const struct cpumask *(*irq_get_affinity)(struct device *dev, + unsigned int irq_vec); const struct attribute_group **groups; const struct attribute_group **dev_groups; From patchwork Wed Nov 13 14:26:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843432 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 F1C61202645; Wed, 13 Nov 2024 14:26:36 +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=1731507997; cv=none; b=TN0SZ9+FN/xSwmf4BhAb4L7KdOO+JDh/jlCoyz4LlXdIqd8ShNQ/g8yH/60pRDeOKaNorrUfmcy8mzGxA6T2zXRyaWV/2xiRrOlDJ8/JR5h8iXGgJbUV1RqZYfieYKWDTQU8nmjXKfV7SvIkgBN9UxVJ1quvEiTQJOG34aCAl34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731507997; c=relaxed/simple; bh=JR9s+9s4JVaf0Dm0rrSVFTiMXryGwL+tMrTpNDWY6Aw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fc1LZ4c46hVLgGa5FRMKTyTF1cqCr0kCMFePMIzXf3rJQGr7kkOO+GoSsMvm/6VXnHW8R4dCJGkJeo8vRxni2umA2P8VWGyKjEtKEkTaDlwMG7Y5pk9uOyGJZ8eMp9U2Y6r9/ENjmN38kWNkm4vlq6Au8MbCRgW1hp1wM2BZ9ls= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TeE6Jsyu; 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="TeE6Jsyu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6C17C4CED7; Wed, 13 Nov 2024 14:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731507996; bh=JR9s+9s4JVaf0Dm0rrSVFTiMXryGwL+tMrTpNDWY6Aw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TeE6Jsyu6aE4dc2hT/jSqj/MHJUI1U6Gnd6fiU959KdnyjKX1xSabZys4AQve+MD0 YtO8np8JCAMIY/wGIReivv4MFyeEYWnUewruK83tBsBie/1GjPOhpS0AKlifU0WmK9 0Fpwem/mbHuADFIm1X3EAhkUZUPXRQfV0ZS2l+W8jvtNpZUV1XtvHAPYToJe56O5L/ 8aV3XHKothLZhQKWFgz/YuOQMiWSZcX8fdBn1cL6wLG+JJm1j3Eva2S4c8xlRMNx8X aM6pfOyGfqVVrSsCuNers+D+O5sw5sutVHDwFT2HNCJXOfDDoK2EjyT3QAzHOOL1vt luqE1ZpdQk82w== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:17 +0100 Subject: [PATCH v4 03/10] PCI: hookup irq_get_affinity callback Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-3-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 struct bus_type has a new callback for retrieving the IRQ affinity for a device. Hook this callback up for PCI based devices. Acked-by: Bjorn Helgaas Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner Reviewed-by: Ming Lei --- drivers/pci/pci-driver.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 35270172c833186995aebdda6f95ab3ffd7c67a0..a9cb0e3ad2e6eca58c34683303b1242228e96909 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1670,6 +1670,19 @@ static void pci_dma_cleanup(struct device *dev) iommu_device_unuse_default_domain(dev); } +/** + * pci_device_irq_get_affinity - get IRQ affinity mask for device + * @dev: ptr to dev structure + * @irq_vec: interrupt vector number + * + * Return the CPU affinity mask for @dev and @irq_vec. + */ +static const struct cpumask *pci_device_irq_get_affinity(struct device *dev, + unsigned int irq_vec) +{ + return pci_irq_get_affinity(to_pci_dev(dev), irq_vec); +} + const struct bus_type pci_bus_type = { .name = "pci", .match = pci_bus_match, @@ -1677,6 +1690,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, From patchwork Wed Nov 13 14:26:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843059 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 B96292038B3; Wed, 13 Nov 2024 14:26: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=1731507999; cv=none; b=oQjvdmy0F44AhsjN3Oq5xjUgdmxrNaQ7TJztntSt9mUkHHDpSZ328ACHFi/3leBxu2JIjUaj5lpa2eE3nxxFXRRkjlCtfIDl2ehM7Mx5M7SzEqW+7rGMG3GHZ5N/vmfjdH1URFiM4uZZLwBBKmukhCNeFz2057rK0n3/MeReJzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731507999; c=relaxed/simple; bh=ykozEZT9S6rCqtY4BFNlhiPo2SLAkwdyL9yKIvPlm0Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VoePgvozQ61DXyEqHgyM8R9wfrkP/fCghS/mI0PfyKhDZ/LB6w8AAslhRr+akMEdoJkchZQr/46NR1hF3mwLd1i8I8NAmqDJHr3KhfkfSKOav1WzXRA7TxTSa8C0wJgzTLeKNBbZHlmJgITJ3QT+rsz4ejIJSgjAenbnfQsPtrg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LAho7g8S; 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="LAho7g8S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D77ABC4CEDC; Wed, 13 Nov 2024 14:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731507999; bh=ykozEZT9S6rCqtY4BFNlhiPo2SLAkwdyL9yKIvPlm0Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LAho7g8Sx8pHXhA/A3+lvNmYwqWF+/vwwUcpNhr3BWcFrfmNTwXtjzxd6yOX4o7Y4 tlsFNFiKqjYsnb/6akmCJklODLLX1AqfWoXw9txNJxXqYmc43UPiq3SNf0AQTm7NYx Mhp2CCSTlXRmixLyVraAtqo+2DvTGJ5MMrdXQhKgWWtcUPVx98jfMWeu+CXkhGV0vI OY49Zwyp0wqAkzwSWmIFbG5k8QlVtFpp6c6FoecbOVWcKjbHW4JMi1rFtwLu3fPpbG hP3SLoDnOCW5sIHtv4D3MpKltXNgTOND7b+nRzY8D4RSI2qhCKYpMXqYmKIpiq2jbX ZgyB9+whkOReg== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:18 +0100 Subject: [PATCH v4 04/10] virtio: hookup irq_get_affinity callback Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-4-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 struct bus_type has a new callback for retrieving the IRQ affinity for a device. Hook this callback up for virtio based devices. Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner Reviewed-by: Ming Lei --- drivers/virtio/virtio.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index b9095751e43bb7db5fc991b0cc0979d2e86f7b9b..4ca6ec84cb092eac7ddf4b86b4eacac099b480cf 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -377,6 +377,24 @@ static void virtio_dev_remove(struct device *_d) of_node_put(dev->dev.of_node); } +/** + * virtio_irq_get_affinity - get IRQ affinity mask for device + * @_d: ptr to dev structure + * @irq_vec: interrupt vector number + * + * Return the CPU affinity mask for @_d and @irq_vec. + */ +static const struct cpumask *virtio_irq_get_affinity(struct device *_d, + unsigned int irq_vec) +{ + struct virtio_device *dev = dev_to_virtio(_d); + + if (!dev->config->get_vq_affinity) + return NULL; + + return dev->config->get_vq_affinity(dev, irq_vec); +} + static const struct bus_type virtio_bus = { .name = "virtio", .match = virtio_dev_match, @@ -384,6 +402,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) From patchwork Wed Nov 13 14:26:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843431 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 A4BDE20402F; Wed, 13 Nov 2024 14:26:42 +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=1731508002; cv=none; b=g2EANU0ee7Yf12kaZtJX3VBmQmHeHvykrVr7o6a0KczchCzW4OErR/TaOUwkOyxpNAApTVnjf4SaYodSw7FxBhtc39lSGzoPPJFI7VOMjeaM7xxptRl6B+EQzclnYBM+osMYhUO8j7eqUtz80gz+5sf41pOY74PtYgS004JTDcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731508002; c=relaxed/simple; bh=ofx9glE+KKfPfE3vbCUElyASjdPTiaZBTdjXeeRdot8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kQMkh2C/pNN5wS3AGR1C693IKohHd9xa09qwbTzgPh12R+xDx/PhQweU/8KC3Pa68Cw/+o/5aO2gjW4Om7A5bt11abTP5rXs2pDr9x82zcGoXOQvDFATPXbojwfdP1n8Wo1AnCPk7rspiJ+uASLy4GMzu+Ui60x73CskGI8DQ9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ek8erP6u; 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="ek8erP6u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98734C4CEE0; Wed, 13 Nov 2024 14:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731508002; bh=ofx9glE+KKfPfE3vbCUElyASjdPTiaZBTdjXeeRdot8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ek8erP6ujKVuchhURI/oUFZn12QoJ5X9uu8bOqQj6pi3xEWDjxi8WTIWaQwTB+2N/ MsQd+9NV0PGoCY1U8OFjhKaEPdasIHqYhxTdXZpX1LIRMxciFe7Mlz/YmCSZb/zlpY oHkPamuOtIRmSmd0NOEd8FoTyOIpgVncnIVlhZnHnwXRIi7kWkJGFGHG/zFXbLc4wj x9KdJ76gmPMyj8Q0RxGKU2fntpNCu3rb7WWJZGq5zIKbtgojQgvHIFZ6w6fOPa/21Y eb0sxTMsUmABqtDJWEvAo+MomikiM2fnIC+u32CzJmU26TlWtKuuUkLl1HMBWsHdfX WjpwEz896Ed8Q== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:19 +0100 Subject: [PATCH v4 05/10] blk-mq: introduce blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-5-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 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. Thus introduce provide a generic mapping function which uses the irq_get_affinity callback from bus_type. Originally idea from Ming Lei Signed-off-by: Daniel Wagner --- block/blk-mq-cpumap.c | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/blk-mq.h | 2 ++ 2 files changed, 45 insertions(+) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 9638b25fd52124f0173e968ebdca5f1fe0b42ad9..3506f1c25a02d331d28212a2a97fb269cb21e738 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "blk.h" #include "blk-mq.h" @@ -54,3 +55,45 @@ 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. + * + * Create a CPU to hardware queue mapping in @qmap. The struct 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) + +{ + const struct cpumask *(*irq_get_affinity)(struct device *dev, + unsigned int irq_vec); + const struct cpumask *mask; + unsigned int queue, cpu; + + if (dev->driver->irq_get_affinity) + irq_get_affinity = dev->driver->irq_get_affinity; + else if (dev->bus->irq_get_affinity) + irq_get_affinity = dev->bus->irq_get_affinity; + else + goto fallback; + + for (queue = 0; queue < qmap->nr_queues; queue++) { + mask = 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/include/linux/blk-mq.h b/include/linux/blk-mq.h index 2035fad3131fb60781957095ce8a3a941dd104be..1a85fdcb443c154390cd29f2b1f2a807bf10bfe3 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -923,6 +923,8 @@ void blk_mq_unfreeze_queue_non_owner(struct request_queue *q); void blk_freeze_queue_start_non_owner(struct request_queue *q); 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); 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); From patchwork Wed Nov 13 14:26:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843058 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 408A81FF7B6; Wed, 13 Nov 2024 14:26: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=1731508005; cv=none; b=GwYaN3sD0eVZeyUlJGS3a+e6KelbK1exxShkpQb/+4OpfMlHIngdeZK2L7OUEbFv9PTqpMQMZUUOyU1jZf8qi5J6ebCmIR+HMrYKLf92VWstvgqKGy20gb94HiX4Md9XGfA1JjRVDwyZ9k430Ou6nvG8E4pXSSlHOXNMBLaXk+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731508005; c=relaxed/simple; bh=7A6Cw9JqDeW4Y+WZoHA5xCulsTOWr6gOsuPOumkbwmA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WokuQ1WM8790rbp1Z0S5SDX8Xh8lsa9PY6VSxhao8b6DfinmxIqJ3x27l5v1tin9BYFvo6AgriNhwgmx/Rhd9Sp2Qh7nyIzjDSDergYjS/jEgFQPuccexbORuwavaeG+PQqDhOjwT99tfW6N8FvbgsOy/O+CK/Bn/9lqh9/AHq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qULAlmGr; 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="qULAlmGr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 496BFC4CEC3; Wed, 13 Nov 2024 14:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731508004; bh=7A6Cw9JqDeW4Y+WZoHA5xCulsTOWr6gOsuPOumkbwmA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qULAlmGr2jfs4UXadkR1flr86Mhy+dubQ5m8zGyYeuy2BKjB5JXUCXJEp2cYF6B0R h2BsiOaqVs1Mrs49z2yhhtVu3OsVIzd8tW99K1UWNDyn4LhSY9lL4bQvogbCTdNM/8 I+TKyTWFYy1yhFSKKpyNp5g3dhL5JZwCc6a17nocWJcxin4stSwoM4yeMYKwW/1fao tnJOqlu7Yh9iowy2b14z1iY+/aOzyi4D47bKL3i+eivsAAV07t4MqUFx2RXpTqRM80 kVaGUI2g+/y+CVGp0xcVLfRZx1/l1tSONbNfNXRx6Y8+xzJjc5xlxo7/XhwCEaTXZl T2zzHiU9aj2Kg== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:20 +0100 Subject: [PATCH v4 06/10] scsi: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-6-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 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 Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner --- drivers/scsi/fnic/fnic_main.c | 3 +-- drivers/scsi/hisi_sas/hisi_sas.h | 1 - drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 ++-- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +-- drivers/scsi/mpi3mr/mpi3mr.h | 1 - drivers/scsi/mpi3mr/mpi3mr_os.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 3 +-- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pm8001/pm8001_sas.h | 1 - drivers/scsi/qla2xxx/qla_nvme.c | 3 +-- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- drivers/scsi/smartpqi/smartpqi_init.c | 7 +++---- 12 files changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index adec0df24bc475ea4d7d8089ea0f75fe96746956..74a782780cc4f8b298168bb14809973a8206095f 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); } static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 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_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 4cd3a3eab6f1c47c962565a74cd7284dad1db12e..a7810fb01403a812389fbd11f8b3bea2ea7c28eb 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->dev, + BASE_VECTORS_V3_HW); qoff += qmap->nr_queues; } } diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 8e75e2e279a40ae5fdc6b7b07a7aed15241a8d54..0180bb56de52bb57f15fae22df0d413cdd576ba3 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); 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..e898b476af6dc84eb150ec867e6be8dd1b2d4d8a 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -4042,7 +4042,7 @@ 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); else blk_mq_map_queues(map); diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index f2a55aa5fe65036a3beabae5c0c6e9db835d2aab..efb95fcef7ed71fc5daea215508e04b602d31663 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,7 @@ 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); else blk_mq_map_queues(map); diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 33e1eba62ca12c2555419197ecdbebad817e4a6d..035e102979f0de34b637be81e0f64b588a3893c8 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); 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..2b2eeec159880d0178eb07455a7eac0e63d66af4 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,7 @@ 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); } 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..acf26d09fa4563409d50fbba118f3b37732a7c8b 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); } 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..501af16d872b1295071a99208248f1d83f072ab5 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); 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 Wed Nov 13 14:26:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843430 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 AE09C205AB8; Wed, 13 Nov 2024 14:26:47 +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=1731508007; cv=none; b=AHyDWSjC09LyOI1RMqtI5GDhejRxyo0nFw7Sjg+MiJpHAEL1zZihSPuyfdEHysR2x0QmkhQFH7aq7gSj5g/UiqUFahvLjBVemNiu67B+0i9Z02D4sNr7p2LRMWRz2fdJRl8Vsx/qXhf3g9cdqyM7BQLoIXOu/cub1kfoFlc1PE4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731508007; c=relaxed/simple; bh=SpNSH5ZDRrOAxRiK/olTF7iQajBiX0Xq/z1Pk/ry918=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dH7Ni0oMjjkKxnBAQ7AxIPQMpH0OosWpjN7jvbYRFvq38vU+EZhXAQxgbT7JvsLyrzEz3zIxTKU9X+zIQcoNadj5oFOB1chmcJGZuF2N5S0Gy6G1jDYs8XHzi8BH26N9W8igAZN9jg+75NaywNKYdszy/oJSAYoUeHuBBW87m1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PrUHBpZy; 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="PrUHBpZy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB6DCC4CEC3; Wed, 13 Nov 2024 14:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731508007; bh=SpNSH5ZDRrOAxRiK/olTF7iQajBiX0Xq/z1Pk/ry918=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PrUHBpZyfuiOxauRWic7uNSBd0YcOsQkPsaAQLQVOpmaUWq4oX6rVpQKr4NHcM0gu Fmsl93jYMFkjDH8QJUmB/65Whp1YMFGRbKqb51U7hgi08YJq2Lo7B+FSucy8Myd/Wc m37m34alBNH7ca5GMjbNeqdhjqcbzN8c5hjl0ybkfWlx0OOQ9StXfzMC/QYMMB2w3N TW6Akra+rAyT1Ox1+6iQ2JDrzdw6mBeeulr/L/PlTwXRyZpDlT23iUUIDipmVNfGf6 WpRPWcCetr6Dsy04BMWVvkGWm6SE8w03UiwxHEG5HMWUHGoX9w0FyyjPoZRim4y1V4 4TIU+FkaVXcZw== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:21 +0100 Subject: [PATCH v4 07/10] scsi: hisi_sas: use blk_mq_hctx_map_queues to map queues Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-7-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 The PCI struct bus_type irq_get_affinity callback can't be used here as hisi_sas v2 implements its own irq affinity code. Thus install a driver specific irq_get_affinity callback. With this in place it's possible to replace the open coded queue mapping with blk_mq_hctx_map_queues function. Signed-off-by: Daniel Wagner --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 342d75f12051d28fb1a0692b45ff568dd5b6f814..faa85fbf3e267cf883568d1808207e9a56c70674 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 + COQ_IRQ_INDEX]; rc = devm_request_threaded_irq(dev, cq->irq_no, cq_interrupt_v2_hw, cq_thread_v2_hw, IRQF_ONESHOT, @@ -3389,6 +3389,14 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba) return rc; } +static const struct cpumask *hisi_sas_v2_irq_get_affinity(struct device *dev, + unsigned int irq_vec) +{ + struct hisi_hba *hisi_hba = dev->driver_data; + + return irq_get_affinity_mask(hisi_hba->irq_map[irq_vec]); +} + static int hisi_sas_v2_init(struct hisi_hba *hisi_hba) { int rc; @@ -3553,17 +3561,8 @@ 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); } static const struct scsi_host_template sht_v2_hw = { @@ -3636,6 +3635,7 @@ static struct platform_driver hisi_sas_v2_driver = { .name = DRV_NAME, .of_match_table = sas_v2_of_match, .acpi_match_table = ACPI_PTR(sas_v2_acpi_match), + .irq_get_affinity = hisi_sas_v2_irq_get_affinity, }, }; From patchwork Wed Nov 13 14:26:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843057 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 DC6D4200135; Wed, 13 Nov 2024 14:26: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=1731508010; cv=none; b=YfndIt1sAEiIe5nCL1YEpSwYQHBjJEPQlYIeRllZ4qiwZETSEEvNROrD+v3y7mbXqRjTfdGyftgL7GrnKz1KOdTCdDPpl0Dy5a+gUm7TXiBhFpoHYtBHYaiOk5YGfESzSHupmbBA9Y+6SxV8ox522+CSdkBg65+h7MHQfQMAqxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731508010; c=relaxed/simple; bh=jQ9O0QikRzwFUVzIaQzq4mxJR6t/DfALmYZuom48AdU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PtIMCgVeOczXRsMPsUMajKWM9CFpLjdtXWXAjnIPhLB0ZT7h4G3g8cPFH8sbPji6mP/bqXuB5EaQGUBPEnatQ1E9DWBIyfKa9Ayq7fS4v0XAMyxm/g1uADHrqsxv8wdLvRNk5Q2tVd9s3NzVvqNKHu3O03aQprke8d0U6/LY8bU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mIJjqnP8; 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="mIJjqnP8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A8A1C4CECD; Wed, 13 Nov 2024 14:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731508009; bh=jQ9O0QikRzwFUVzIaQzq4mxJR6t/DfALmYZuom48AdU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mIJjqnP8e0zg+ikPbF7mJOyRwyFO0IQkvRV2e0Ii8aI7cZlaZOBS76OEDGHSdCFIp uU19HusOCGY+xkhW5uWmMt4ershUb84JwC9VYC93Lh8/hnMQKlGHQXKi+D4swHaQ/M 0nQixyLWVMDX4uopsItajbOn+HelSTRseCdxpvty4kOBtG8Xd/P+SmOPTFYJzUn822 1Noyj3IXujIdtTntgphf1xR6hu4a2qcnsXv2tgnyyS4sCCe5iKbjgEmrn4B9hoSPhZ kmm6iVcH+4l3GPES5EChU1L6TH420EEfFyan4sR1m14AqY09RdyhuZCqBq6f0R9K6A keesib9JMbgrQ== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:22 +0100 Subject: [PATCH v4 08/10] nvme: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-8-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 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 Reviewed-by: Hannes Reinecke 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..cb8ca574594d7eb5f959cf9eb03be445223b2666 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); else blk_mq_map_queues(map); qoff += map->nr_queues; From patchwork Wed Nov 13 14:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843429 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 B8E521E1322; Wed, 13 Nov 2024 14:26:52 +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=1731508012; cv=none; b=eR+YRHPiTb87F4jSt08sHd3DALJuZgxAcDroupnQldj7CF69As8NAbnLci7HVAh0GO5YkDiqy7XfYu1D8gwMQjB5xfe3Bq4WvRtIrs0pGPk1HVJCAb0JCBP7yJPdh4q5wZE/XQhQD3o/Q5aoCaqSlYltzFdLj8J5h79WGiRuEIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731508012; c=relaxed/simple; bh=isXEskRzOrDBOyqDhvTRJ3NN+y1s+4Y0sHaHLEiBMKs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RGB2FJeUmVMfLh7KDIofos06Y2gXe98BOq+6S43eaEHFwJgevxt3kUmvIMlPrJrKjxli3pGs5rDPeX8vfztHVwxO2kydqHuGQ9F0IfX5OUgEEUiVIfXHce3PQJTw0XgYcFOV2zb4EKfxyvm8fvm7Zw9/zH7KgsUrmspXEB9Uh7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hT05r/4A; 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="hT05r/4A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0434CC4CEDA; Wed, 13 Nov 2024 14:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731508012; bh=isXEskRzOrDBOyqDhvTRJ3NN+y1s+4Y0sHaHLEiBMKs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hT05r/4Akowv5UVtw0lSdIZdgwiRCwwLCv37jl9XxNv88QiC9l9qLh04+1MhTwjMF Q89DwJCvIqL4gy/gXSKsNyyLM3FgbQxKhkK9aX5TO7ZeP0QUjec5UtDvY8Aykt9C3c sk0v58pnjGGhYWio6I0GJQimNu2fjyQlUOafzmBPOQ0Mkw76PluwMximYB/rL4kDWZ JYV2sgYUvNtfCacR5AcE5D98hyOOHDNAV8O3boZcrPtV6YATTPNPW/mkFTRBlgMZg4 izs2ObNZN1IydzY0qO2la2uDSTTzlDgTB405FCkvadf9pPpINSKwX/MyT5gCJTMlVB m8og4rB5WzOQQ== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:23 +0100 Subject: [PATCH v4 09/10] virtio: blk/scsi: replace blk_mq_virtio_map_queues with blk_mq_hctx_map_queues Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-9-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 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. Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner --- 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..fd997e3381526eb3d7a21eda296b3a8a2998c696 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); } } diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 8471f38b730e205eb57052305c154260864bee95..dcb83c15f90825bd7bdb3a5f541108b934a308f3 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); } } From patchwork Wed Nov 13 14:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 843056 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 BB156206E9B; Wed, 13 Nov 2024 14:26:55 +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=1731508015; cv=none; b=LECCbTVZ/jjzpe7+T9fFju97iCAQDYCZ3fiD+8Ws43QSpN9mTbXwPoHlxBF9n2fSCsyW/jYRUWlrTGZHRJ6WzR4ABZl6z5hO5nNqztzN/A0lg13RNC7UcaV3i+seJUbpi1NW/oFqsjQ2Iy7xO2+TMcs+89ohyNT4gQQEVsCNLM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731508015; c=relaxed/simple; bh=BgQfHLSyHthatLD+HxapCxTxAdxlPMnbJAVKOVCApgQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iNwVff45Q8pKfi+SOqA7SQotr4PIippsf5bfd2ET4IiPY1CoM6k93rtjg1RjQEmUjKURUZvZ3vgVz3zYHZY4ZGSM1xyKSc3P5SyNr8iQksHkH2MKxPP/zXeLqB7s9u/s2uZ/x6xQao7g1Q4jMeCYWzqoYA7/eGjvQueuFZIR8hE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VTkzTU23; 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="VTkzTU23" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEF8DC4CEC3; Wed, 13 Nov 2024 14:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731508015; bh=BgQfHLSyHthatLD+HxapCxTxAdxlPMnbJAVKOVCApgQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VTkzTU23HoR+IS+QrQ8OgwA7GRqdmPBc2tTig6ePViNqfVIIZysgIgwCd7a3yVtN5 3rpEg7XxPjHGn4EvFDlCP6Vtt+zbK6m4Ac9sbpqUlcnh0ew+PnNQYb6/rIYfQbm7OJ vqlGbS6mijUHKck9ItGfj7/r7LvjIwI3lbjTfMo2+vogVOJYjm3p5fiow1RaWNSutC z+BlHvmonTW+/V9ixHMr2g9//8iEMnYFSpvrNh/Hoa+rfEbJVaZ5j34j1rhulysze6 sMMDM7dRRnXegwJrzjo6EzTMPSLJ+s5V2LYHS8G6SckxIdcZ79EM0bh7R0Bdu2/SxD xfGsJCILNr1Tg== From: Daniel Wagner Date: Wed, 13 Nov 2024 15:26:24 +0100 Subject: [PATCH v4 10/10] blk-mq: remove unused queue mapping helpers Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241113-refactor-blk-affinity-helpers-v4-10-dd3baa1e267f@kernel.org> References: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> In-Reply-To: <20241113-refactor-blk-affinity-helpers-v4-0-dd3baa1e267f@kernel.org> To: Jens Axboe , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , "Martin K. Petersen" , Keith Busch , Christoph Hellwig , Sagi Grimberg , John Garry , Greg Kroah-Hartman , Hannes Reinecke 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 X-Mailer: b4 0.14.2 There are no users left of the pci and virtio queue mapping helpers. Thus remove them. Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Daniel Wagner --- 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 */