On 2023-03-10 a.m.8:36, Parav Pandit wrote:


From: Feng Liu <fe...@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?




_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to