From: David Edmondson <david.edmondson@oracle.com>
To: Feng Liu <feliu@nvidia.com>, virtualization@lists.linux-foundation.org
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
Jiri Pirko <jiri@nvidia.com>, Bodong Wang <bodong@nvidia.com>,
Gavin Li <gavinl@nvidia.com>
Subject: Re: [PATCH v2 1/3] virtio_ring: Allow non power of 2 sizes for packed virtqueue
Date: Fri, 17 Mar 2023 09:16:03 +0000 [thread overview]
Message-ID: <m2wn3fhh64.fsf@oracle.com> (raw)
In-Reply-To: <20230315185458.11638-2-feliu@nvidia.com>
Feng Liu <feliu@nvidia.com> writes:
> According to the Virtio Specification, the Queue Size parameter of a
> virtqueue corresponds to the maximum number of descriptors in that
> queue, and it does not have to be a power of 2 for packed virtqueues.
> However, the virtio_pci_modern driver enforced a power of 2 check for
> virtqueue sizes, which is unnecessary and restrictive for packed
> virtuqueue.
>
> Split virtqueue still needs to check the virtqueue size is power_of_2
> which has been done in vring_alloc_queue_split of the virtio_ring layer.
>
> To validate this change, we tested various virtqueue sizes for packed
> rings, including 128, 256, 512, 100, 200, 500, and 1000, with
> CONFIG_PAGE_POISONING enabled, and all tests passed successfully.
>
> Signed-off-by: Feng Liu <feliu@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
> ---
> v0 -> v1
> feedbacks from Jason Wang and Michael S. Tsirkin
> - remove power_of_2 check of virtqueue size
>
> v1 -> v2
> feedbacks from Parav Pandit and Jiri Pirko
> - keep power_of_2 check of split virtqueue in vring_alloc_queue_split of
> virtio_ring layer.
> ---
> drivers/virtio/virtio_pci_modern.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> index 9e496e288cfa..6e713904d8e8 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -310,11 +310,6 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
> if (!num || vp_modern_get_queue_enable(mdev, index))
> return ERR_PTR(-ENOENT);
>
> - if (!is_power_of_2(num)) {
> - dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", num);
> - return ERR_PTR(-EINVAL);
> - }
> -
> info->msix_vector = msix_vec;
>
> /* create the vring */
> --
> 2.34.1
--
Do not leave the building.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-03-17 9:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 18:54 [PATCH v2 0/3] virtio_ring: Clean up code for virtio ring and pci Feng Liu via Virtualization
2023-03-15 18:54 ` [PATCH v2 1/3] virtio_ring: Allow non power of 2 sizes for packed virtqueue Feng Liu via Virtualization
2023-03-17 3:16 ` Jason Wang
2023-03-30 18:21 ` Feng Liu via Virtualization
2023-03-17 9:16 ` David Edmondson [this message]
2023-03-15 18:54 ` [PATCH v2 2/3] virtio_ring: Avoid using inline for small functions Feng Liu via Virtualization
2023-03-17 3:16 ` Jason Wang
2023-03-30 18:22 ` Feng Liu via Virtualization
2023-03-17 9:16 ` David Edmondson
2023-03-15 18:54 ` [PATCH v2 3/3] virtio_ring: Use const to annotate read-only pointer params Feng Liu via Virtualization
2023-03-17 3:17 ` Jason Wang
2023-03-30 18:22 ` Feng Liu via Virtualization
2023-03-30 20:27 ` Michael S. Tsirkin
2023-03-30 23:46 ` Feng Liu via Virtualization
2023-03-17 9:20 ` David Edmondson
2023-03-31 4:20 ` [PATCH v2 0/3] virtio_ring: Clean up code for virtio ring and pci Xuan Zhuo
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=m2wn3fhh64.fsf@oracle.com \
--to=david.edmondson@oracle.com \
--cc=bodong@nvidia.com \
--cc=feliu@nvidia.com \
--cc=gavinl@nvidia.com \
--cc=jiri@nvidia.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.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).