On Sat, Aug 15, 2026 at 04:13:37AM +0000, Feifan Qian wrote:
Each SHMEM_MAP request creates a separate RAM MemoryRegion that consumes a KVM memory slot. Once all KVM slots are in use, processing another SHMEM_MAP request would make the KVM memory listener fail while registering the new region.Shared memory mappings are filtered out of the vhost memory table (vhost_section() skips TYPE_VIRTIO_SHARED_MEMORY_MAPPING regions), so they never count against the negotiated vhost-user slot limit; only the KVM slot budget applies. Reject the request with ENOSPC before changing the memory topology when KVM has no free slot left. Also validate each vhost memory table against the slot limit negotiated with the backend before sending regions via SET_MEM_TABLE or ADD_MEM_REG. Fixes: b52e1896e764 ("vhost-user: Add VirtIO Shared Memory map request") Signed-off-by: Feifan Qian <[email protected]> --- Based-on: <[email protected]> ("vhost-user-gpu: Add blob resource and shared memory support" v4, which filters TYPE_VIRTIO_SHARED_MEMORY_MAPPING regions out of vhost_section())
Acked-by: Stefano Garzarella <[email protected]>
