On Thu, Aug 07, 2025 at 11:05:46AM +0200, Laurent Vivier wrote: > On 07/08/2025 08:10, David Gibson wrote: > > > @@ -437,12 +437,12 @@ static bool vu_set_mem_table_exec(struct vu_dev *vdev, > > > r->size + r->mmap_offset); > > > } > > > } > > > - vdev->nregions = memory->nregions; > > > + vdev->memory.nregions = memory->nregions; > > > debug("vhost-user nregions: %u", memory->nregions); > > > - for (i = 0; i < vdev->nregions; i++) { > > > + for (i = 0; i < vdev->memory.nregions; i++) { > > > struct vhost_user_memory_region *msg_region = &memory->regions[i]; > > > - struct vu_dev_region *dev_region = &vdev->regions[i]; > > > + struct vu_dev_region *dev_region = &vdev->memory.regions[i]; > > > void *mmap_addr; > > > debug("vhost-user region %d", i); > > > @@ -484,13 +484,7 @@ static bool vu_set_mem_table_exec(struct vu_dev *vdev, > > > } > > > } > > > - /* As vu_packet_check_range() has no access to the number of > > > - * memory regions, mark the end of the array with mmap_addr = 0 > > > - */ > > > - ASSERT(vdev->nregions < VHOST_USER_MAX_RAM_SLOTS - 1); > > > - vdev->regions[vdev->nregions].mmap_addr = 0; > > > - > > > - tap_sock_update_pool(vdev->regions, 0); > > > + ASSERT(vdev->memory.nregions < VHOST_USER_MAX_RAM_SLOTS); > > It looks like the assertion is changing threshold by one, and I'm not > > sure why. > > It's because previous version was using the last slot to mark the end of the > array with a NULL memory region. Now, we have a counter, it's not needed > anymore. Ah, ok. Might be worth mentioning that in the commit message. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson