Parav Pandit
2023-Mar-10 13:36 UTC
[PATCH v2 1/3] virtio_pci_modern: Allow non power of 2 sizes for virtqueues
> From: Feng Liu <feliu at nvidia.com> > Sent: Friday, March 10, 2023 12:34 AM> > - if (!is_power_of_2(num)) { > - dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", > num); > - return ERR_PTR(-EINVAL); > - } > -The check is still valid for split q. Maybe the right place for such a check is not the pci transport driver. But layer below where split vs packed q knowledge resides and hence, power of 2 check can be omitted for packed vq.
Feng Liu
2023-Mar-10 15:23 UTC
[PATCH v2 1/3] virtio_pci_modern: Allow non power of 2 sizes for virtqueues
On 2023-03-10 a.m.8:36, Parav Pandit wrote:> > >> From: Feng Liu <feliu at nvidia.com> >> Sent: Friday, March 10, 2023 12:34 AM > >> >> - if (!is_power_of_2(num)) { >> - dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", >> num); >> - return ERR_PTR(-EINVAL); >> - } >> - > > The check is still valid for split q. > Maybe the right place for such a check is not the pci transport driver. > But layer below where split vs packed q knowledge resides and hence, power of 2 check can be omitted for packed vq.Hi, Parav I think you are right, I checked the virtio spec, only packed virtqueue can use queue size which is not power_of_2; so, I think the check can be reserved only for split queue here, something like struct virtio_device *vdev = &vp_dev->vdev; if (!virtio_has_feature(vdev, VIRTIO_F_RING_PACKED) && !is_power_of_2(num)){ dev_warn(&vp_dev->pci_dev->dev, "bad queue size %u", num); return ERR_PTR(-EINVAL); } I will fix it in next version Hi, Michael and Jason Do you have any comments on this?
Reasonably Related Threads
- [PATCH v2 1/3] virtio_pci_modern: Allow non power of 2 sizes for virtqueues
- [PATCH v2 1/3] virtio_pci_modern: Allow non power of 2 sizes for virtqueues
- [PATCH v2 1/3] virtio_pci_modern: Allow non power of 2 sizes for virtqueues
- [PATCH v2 1/3] virtio_ring: Allow non power of 2 sizes for packed virtqueue
- [PATCH v2 1/3] virtio_ring: Allow non power of 2 sizes for packed virtqueue