On 06/06/2018 16:18, xuyandong wrote: >> We don't. It's generally a guest bug if they do, but the problem here is that >> QEMU is splitting a memory region in two parts and that is not atomic. >> >> One fix could be to add a KVM_SET_USER_MEMORY_REGIONS ioctl that >> replaces the entire memory map atomically. >> >> Paolo > After we add a KVM_SET_USER_MEMORY_REGIONS ioctl that replaces the entire > memory map atomically, how to use it in address_space_update_topology? > Shall we checkout the spilt memory region before > " address_space_update_topology_pass(as, old_view, new_view, false); > address_space_update_topology_pass(as, old_view, new_view, true); You would add the regions to an array in kvm_region_add, and send the ioctl in the .commit callback of MemoryListener. kvm_region_del would disappear. The .commit callback would also look at the array from the previous execution, and call memory_region_unref on the regions in there. Paolo