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 <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16651 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
9694127db6
commit
56f238488e
@ -229,15 +229,7 @@ virtio_vfio_user_setup_queue(struct virtio_dev *vdev, struct virtqueue *vq)
|
|||||||
uint64_t queue_mem_phys_addr;
|
uint64_t queue_mem_phys_addr;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* To ensure physical address contiguity we make the queue occupy
|
queue_mem = spdk_zmalloc(vq->vq_ring_size, VIRTIO_PCI_VRING_ALIGN, NULL,
|
||||||
* 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,
|
|
||||||
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||||
if (queue_mem == NULL) {
|
if (queue_mem == NULL) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user