From 56f238488e7465d68d626fc0d596e1e119f31c49 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 2 Feb 2023 13:55:59 +0800 Subject: [PATCH] lib/virtio_vfio_user: use VIRTIO_PCI_VRING_ALIGN aligned vring address We don't need to allocate 2MiB aligned memory address for vrings, this will waste memory and may invoke dynamic memory allocation in DPDK sometimes. Fix issue #2846. Change-Id: I6410d417f92623b44c375359d5e2b5ec8ed815c0 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16651 Reviewed-by: Tomasz Zawadzki Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris --- lib/virtio/virtio_vfio_user.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/virtio/virtio_vfio_user.c b/lib/virtio/virtio_vfio_user.c index 7c1b25b23..bead06b18 100644 --- a/lib/virtio/virtio_vfio_user.c +++ b/lib/virtio/virtio_vfio_user.c @@ -229,15 +229,7 @@ virtio_vfio_user_setup_queue(struct virtio_dev *vdev, struct virtqueue *vq) uint64_t queue_mem_phys_addr; int rc; - /* To ensure physical address contiguity we make the queue occupy - * only a single hugepage (2MB). As of Virtio 1.0, the queue size - * always falls within this limit. - */ - if (vq->vq_ring_size > VALUE_2MB) { - return -ENOMEM; - } - - queue_mem = spdk_zmalloc(vq->vq_ring_size, VALUE_2MB, NULL, + queue_mem = spdk_zmalloc(vq->vq_ring_size, VIRTIO_PCI_VRING_ALIGN, NULL, SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA); if (queue_mem == NULL) { return -ENOMEM;