? 2016/10/9 15:27, Yuanhan Liu ??: > +static void > +add_guest_pages(struct virtio_net *dev, struct virtio_memory_region *reg, > + uint64_t page_size) > +{ > + uint64_t reg_size = reg->size; > + uint64_t host_user_addr = reg->host_user_addr; > + uint64_t guest_phys_addr = reg->guest_phys_addr; > + uint64_t host_phys_addr; > + uint64_t size; > + > + host_phys_addr = rte_mem_virt2phy((void *)(uintptr_t)host_user_addr); > + size = page_size - (guest_phys_addr & (page_size - 1)); > + size = RTE_MIN(size, reg_size);
Have you use 1G hugepage to create a VM with 25G memory? When I try, vhost crashed, use below code fixed: - size = page_size - (guest_phys_addr & (page_size - 1)); - size = RTE_MIN(size, reg_size); + size = reg_size % page_size;