The VPP code tries to set all userspace memory in the table via IOCTL
to VHOST_SET_MEM_TABLE. But on aarch64, the userspace address range is
larger (48 bits) than that on x86 (47 bits). Below is an segment from
/proc/[vpp]/maps.
fffb41200000-
fffb43a00000 rw-s
00000000 00:0e 532232
/anon_hugepage (deleted)
Instead of setting all userspace memory space to vhost-net, will only set
the address space reserved by pmalloc module during initialization.
Type: fix
Change-Id: I91cb35e990869b42094cf2cd0512593733d33677
Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com>
Reviewed-by: Steve Capper <Steve.Capper@arm.com>
if (vpm->base_addr == 0)
vpm->base_addr = VLIB_PHYSMEM_DEFAULT_BASE_ADDDR;
if (vpm->base_addr == 0)
vpm->base_addr = VLIB_PHYSMEM_DEFAULT_BASE_ADDDR;
- clib_pmalloc_init (vpm->pmalloc_main, vpm->base_addr, 0);
+ clib_pmalloc_init (vpm->pmalloc_main, vpm->base_addr, vpm->max_size);
+
+ /* update base_addr and max_size per actual allocation */
+ vpm->base_addr = (uword) vpm->pmalloc_main->base;
+ vpm->max_size = (uword) vpm->pmalloc_main->max_pages <<
+ vpm->pmalloc_main->def_log2_page_sz;
{
u32 flags;
uword base_addr;
{
u32 flags;
uword base_addr;
#define VLIB_PHYSMEM_MAIN_F_HAVE_PAGEMAP (1 << 0)
#define VLIB_PHYSMEM_MAIN_F_HAVE_IOMMU (1 << 1)
vlib_physmem_map_t *maps;
#define VLIB_PHYSMEM_MAIN_F_HAVE_PAGEMAP (1 << 0)
#define VLIB_PHYSMEM_MAIN_F_HAVE_IOMMU (1 << 1)
vlib_physmem_map_t *maps;
#include <linux/rtnetlink.h>
#include <vlib/vlib.h>
#include <linux/rtnetlink.h>
#include <vlib/vlib.h>
+#include <vlib/physmem.h>
#include <vlib/unix/unix.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/ip4_packet.h>
#include <vlib/unix/unix.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/ip4_packet.h>
void
tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
{
void
tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
{
+ vlib_physmem_main_t *vpm = &vm->physmem_main;
vnet_main_t *vnm = vnet_get_main ();
virtio_main_t *vim = &virtio_main;
tap_main_t *tm = &tap_main;
vnet_main_t *vnm = vnet_get_main ();
virtio_main_t *vim = &virtio_main;
tap_main_t *tm = &tap_main;
vhost_mem = clib_mem_alloc (i);
clib_memset (vhost_mem, 0, i);
vhost_mem->nregions = 1;
vhost_mem = clib_mem_alloc (i);
clib_memset (vhost_mem, 0, i);
vhost_mem->nregions = 1;
- vhost_mem->regions[0].memory_size = (1ULL << 47) - 4096;
+ vhost_mem->regions[0].memory_size = vpm->max_size;
+ vhost_mem->regions[0].guest_phys_addr = vpm->base_addr;
+ vhost_mem->regions[0].userspace_addr =
+ vhost_mem->regions[0].guest_phys_addr;
_IOCTL (vif->fd, VHOST_SET_MEM_TABLE, vhost_mem);
if ((args->error =
_IOCTL (vif->fd, VHOST_SET_MEM_TABLE, vhost_mem);
if ((args->error =