On Tue, Oct 6, 2020 at 5:48 AM Igor Mammedov <imamm...@redhat.com> wrote: > > On Mon, 28 Sep 2020 21:17:31 +0800 > Jiajun Chen <chenjiaj...@huawei.com> wrote: > > > Used_memslots is equal to dev->mem->nregions now, it is true for > > vhost kernel, but not for vhost user, which uses the memory regions > > that have file descriptor. In fact, not all of the memory regions > > have file descriptor. > > It is usefully in some scenarios, e.g. used_memslots is 8, and only > > 5 memory slots can be used by vhost user, it is failed to hot plug > > a new memory RAM because vhost_has_free_slot just returned false, > > but we can hot plug it safely in fact. > > I had an impression that all guest RAM has to be shared with vhost, > so combination of anon and fd based RAM couldn't work. > Am I wrong?
I'm not sure about the kernel backend, but I've tested adding anon memory to a VM with a vhost-user-scsi device and it works (eventually the VM crashed, but I could see the guest recognized the anon RAM). The vhost-user code is designed to work with both. I'm not sure I see a use case, but if there is one, this would be a valid issue. Maybe Jiajun or Jianjay can elaborate. > > > > > -- > > ChangeList: > > v3: > > -make used_memslots a member of struct vhost_dev instead of a global static > > value > it's global resource, so why? I suggested it because I thought it made the code a little cleaner. I'm not opposed to changing it back, or having it stored at the vhost_user level.