On Thu, Oct 03, 2019 at 04:42:20PM +0000, Mircea CIRJALIU - MELIU wrote: > > On 03/10/19 17:42, Jerome Glisse wrote: > > > All that is needed is to make sure that vm_normal_page() will see > > > those pte (inside the process that is mirroring the other process) as > > > special which is the case either because insert_pfn() mark the pte as > > > special or the kvm device driver which control the vm_operation struct > > > set a > > > find_special_page() callback that always return NULL, or the vma has > > > either VM_PFNMAP or VM_MIXEDMAP set (which is the case with > > insert_pfn). > > > > > > So you can keep the existing kvm code unmodified. > > > > Great, thanks. And KVM is already able to handle > > VM_PFNMAP/VM_MIXEDMAP, so that should work. > > This means setting VM_PFNMAP/VM_MIXEDMAP on the anon VMA that acts as the VM's system RAM. > Will it have any side effects? You do not set it up on the anonymous vma but on the mmap of the kvm device file, the resulting vma is under the control of the kvm device file and is not an anonymous vma but a "device" special vma. So in summary, the source qemu process has anonymous vma (regular libc malloc for instance). The introspector qemu process which mirror the the source qemu use mmap on /dev/kvm (assuming you can reuse the kvm device file for this otherwise you can introduce a new kvm device file). The resulting mmap inside the introspector qemu process is a vma which has vma->vm_file pointing to the kvm device file and has VM_PFNMAP or VM_MIXEDMAP (i think you want the former). On architecture with ARCH_SPECIAL_PTE the pte will be mark as special when using insert_pfn() on other architecture you can either rely on VM_PFNMAP/VM_MIXEDMAP flag or set a specific find_special_page() callbacks in vm_ops. I am at a conference right now but i will put an example of what i mean next week. Cheers, Jérôme _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization