From: "Michael S. Tsirkin" <mst@redhat.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
Damien Le Moal <damien.lemoal@wdc.com>,
John Garry <john.garry@huawei.com>,
linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Daniel Wagner <dwagner@suse.de>,
linux-nvme@lists.infradead.org,
virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org, Keith Busch <kbusch@kernel.org>,
Wen Xiong <wenxiong@us.ibm.com>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH V2 5/6] virtio: add one field into virtio_device for recording if device uses managed irq
Date: Fri, 2 Jul 2021 11:55:40 -0400 [thread overview]
Message-ID: <20210702115430-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210702150555.2401722-6-ming.lei@redhat.com>
On Fri, Jul 02, 2021 at 11:05:54PM +0800, Ming Lei wrote:
> blk-mq needs to know if the device uses managed irq, so add one field
> to virtio_device for recording if device uses managed irq.
>
> If the driver use managed irq, this flag has to be set so it can be
> passed to blk-mq.
>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
The API seems somewhat confusing. virtio does not request
a managed irq as such, does it? I think it's a decision taken
by the irq core.
Any way to query the irq to find out if it's managed?
> ---
> drivers/block/virtio_blk.c | 2 ++
> drivers/scsi/virtio_scsi.c | 1 +
> drivers/virtio/virtio_pci_common.c | 1 +
> include/linux/virtio.h | 1 +
> 4 files changed, 5 insertions(+)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index e4bd3b1fc3c2..33b9c80ac475 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -764,6 +764,8 @@ static int virtblk_probe(struct virtio_device *vdev)
> vblk->tag_set.queue_depth = queue_depth;
> vblk->tag_set.numa_node = NUMA_NO_NODE;
> vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
> + if (vdev->use_managed_irq)
> + vblk->tag_set.flags |= BLK_MQ_F_MANAGED_IRQ;
> vblk->tag_set.cmd_size =
> sizeof(struct virtblk_req) +
> sizeof(struct scatterlist) * sg_elems;
> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> index b9c86a7e3b97..f301917abc84 100644
> --- a/drivers/scsi/virtio_scsi.c
> +++ b/drivers/scsi/virtio_scsi.c
> @@ -891,6 +891,7 @@ static int virtscsi_probe(struct virtio_device *vdev)
> shost->max_channel = 0;
> shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE;
> shost->nr_hw_queues = num_queues;
> + shost->use_managed_irq = vdev->use_managed_irq;
>
> #ifdef CONFIG_BLK_DEV_INTEGRITY
> if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) {
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index 222d630c41fc..f2ac48fb477b 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -128,6 +128,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
> if (desc) {
> flags |= PCI_IRQ_AFFINITY;
> desc->pre_vectors++; /* virtio config vector */
> + vdev->use_managed_irq = true;
> }
>
> err = pci_alloc_irq_vectors_affinity(vp_dev->pci_dev, nvectors,
> diff --git a/include/linux/virtio.h b/include/linux/virtio.h
> index b1894e0323fa..85cc773b2dc7 100644
> --- a/include/linux/virtio.h
> +++ b/include/linux/virtio.h
> @@ -109,6 +109,7 @@ struct virtio_device {
> bool failed;
> bool config_enabled;
> bool config_change_pending;
> + bool use_managed_irq;
> spinlock_t config_lock;
> struct device dev;
> struct virtio_device_id id;
> --
> 2.31.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-07-02 15:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210702150555.2401722-1-ming.lei@redhat.com>
2021-07-02 15:05 ` [PATCH V2 5/6] virtio: add one field into virtio_device for recording if device uses managed irq Ming Lei
2021-07-02 15:55 ` Michael S. Tsirkin [this message]
2021-07-05 2:48 ` Ming Lei
2021-07-05 3:59 ` Jason Wang
2021-07-06 5:42 ` Christoph Hellwig
2021-07-06 7:53 ` Ming Lei
2021-07-07 9:06 ` Thomas Gleixner
2021-07-07 9:42 ` Ming Lei
2021-07-07 14:05 ` Christoph Hellwig
2021-07-08 6:34 ` Ming Lei
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=20210702115430-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=dwagner@suse.de \
--cc=hch@lst.de \
--cc=john.garry@huawei.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
--cc=virtualization@lists.linux-foundation.org \
--cc=wenxiong@us.ibm.com \
/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).