From: Jens Axboe <axboe@kernel.dk>
To: Bjorn Helgaas <helgaas@kernel.org>, Daniel Wagner <wagi@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
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 <dwagner@suse.de>,
20240912-do-not-overwrite-pci-mapping-v1-1-85724b6cec49@suse.de,
Ming Lei <ming.lei@redhat.com>
Subject: Re: [PATCH 1/6] blk-mq: introduce blk_mq_hctx_map_queues
Date: Sun, 15 Sep 2024 14:32:30 -0600 [thread overview]
Message-ID: <0bd0be63-5595-4aae-829f-6b278a5b5e60@kernel.dk> (raw)
In-Reply-To: <20240913162654.GA713813@bhelgaas>
On 9/13/24 10:26 AM, Bjorn Helgaas wrote:
> On Fri, Sep 13, 2024 at 09:41:59AM +0200, Daniel Wagner wrote:
>> From: Ming Lei <ming.lei@redhat.com>
>>
>> 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 code which only differs on how the affinity information
>> is retrieved. Also there is the hisi_sas which open codes the same loop.
>>
>> Thus introduce a new helper function for creating these mappings which
>> takes an callback function for fetching the affinity mask. Also
>> introduce common helper function for PCI and virtio devices to retrieve
>> affinity masks.
>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index e3a49f66982d..84f9c16b813b 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -6370,6 +6370,26 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
>> return 0;
>> }
>>
>> +#ifdef CONFIG_BLK_MQ_PCI
>> +/**
>> + * pci_get_blk_mq_affinity - get affinity mask queue mapping for PCI device
>> + * @dev_data: Pointer to struct pci_dev.
>> + * @offset: Offset to use for the pci irq vector
>> + * @queue: Queue index
>> + *
>> + * This function returns for a queue the affinity mask for a PCI device.
>> + * It is usually used as callback for blk_mq_hctx_map_queues().
>> + */
>> +const struct cpumask *pci_get_blk_mq_affinity(void *dev_data, int offset,
>> + int queue)
>> +{
>> + struct pci_dev *pdev = dev_data;
>> +
>> + return pci_irq_get_affinity(pdev, offset + queue);
>> +}
>> +EXPORT_SYMBOL_GPL(pci_get_blk_mq_affinity);
>> +#endif
>
> IMO this doesn't really fit well in drivers/pci since it doesn't add
> any PCI-specific knowledge or require any PCI core internals, and the
> parameters are blk-specific. I don't object to the code, but it seems
> like it could go somewhere in block/?
Probably not a bad idea.
Unrelated to that topic, but Daniel, all your email gets marked as spam.
I didn't see your series before this reply. This has been common
recently for people that haven't kept up with kernel.org changes, please
check for smtp changes there.
--
Jens Axboe
next prev parent reply other threads:[~2024-09-15 20:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 7:41 [PATCH 0/6] EDITME: blk: refactor queue affinity helpers Daniel Wagner
2024-09-13 7:41 ` [PATCH 1/6] blk-mq: introduce blk_mq_hctx_map_queues Daniel Wagner
2024-09-13 16:26 ` Bjorn Helgaas
2024-09-15 20:32 ` Jens Axboe [this message]
2024-09-16 6:26 ` Daniel Wagner
2024-09-16 6:48 ` Christoph Hellwig
2024-09-13 7:42 ` [PATCH 2/6] scsi: replace blk_mq_pci_map_queues with blk_mq_hctx_map_queues Daniel Wagner
2024-09-13 7:42 ` [PATCH 3/6] scsi: hisi_sas: " Daniel Wagner
2024-09-13 7:42 ` [PATCH 4/6] nvme: " Daniel Wagner
2024-09-13 7:42 ` [PATCH 5/6] virtio: blk/scsi: replace blk_mq_virtio_map_queues " Daniel Wagner
2024-09-13 7:42 ` [PATCH 6/6] blk-mq: remove unused queue mapping helpers Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0bd0be63-5595-4aae-829f-6b278a5b5e60@kernel.dk \
--to=axboe@kernel.dk \
--cc=20240912-do-not-overwrite-pci-mapping-v1-1-85724b6cec49@suse.de \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=bhelgaas@google.com \
--cc=dwagner@suse.de \
--cc=hch@lst.de \
--cc=helgaas@kernel.org \
--cc=jasowang@redhat.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=ming.lei@redhat.com \
--cc=mpi3mr-linuxdrv.pdl@broadcom.com \
--cc=mst@redhat.com \
--cc=sagi@grimberg.me \
--cc=storagedev@microchip.com \
--cc=virtualization@lists.linux.dev \
--cc=wagi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).