On Thu, Sep 15, 2022 at 10:29:13PM +0800, Chao Peng wrote: > Expose KVM_MEM_PRIVATE and memslot fields private_fd/offset to > userspace. KVM will register/unregister private memslot to fd-based > memory backing store and response to invalidation event from > inaccessible_notifier to zap the existing memory mappings in the > secondary page table. > > Whether KVM_MEM_PRIVATE is actually exposed to userspace is determined > by architecture code which can turn on it by overriding the default > kvm_arch_has_private_mem(). > > A 'kvm' reference is added in memslot structure since in > inaccessible_notifier callback we can only obtain a memslot reference > but 'kvm' is needed to do the zapping. > > Co-developed-by: Yu Zhang > Signed-off-by: Yu Zhang > Signed-off-by: Chao Peng ld: arch/x86/../../virt/kvm/kvm_main.o: in function `kvm_free_memslot': kvm_main.c:(.text+0x1385): undefined reference to `inaccessible_unregister_notifier' ld: arch/x86/../../virt/kvm/kvm_main.o: in function `kvm_set_memslot': kvm_main.c:(.text+0x1b86): undefined reference to `inaccessible_register_notifier' ld: kvm_main.c:(.text+0x1c85): undefined reference to `inaccessible_unregister_notifier' ld: arch/x86/kvm/mmu/mmu.o: in function `kvm_faultin_pfn': mmu.c:(.text+0x1e38): undefined reference to `inaccessible_get_pfn' ld: arch/x86/kvm/mmu/mmu.o: in function `direct_page_fault': mmu.c:(.text+0x67ca): undefined reference to `inaccessible_put_pfn' make: *** [Makefile:1169: vmlinux] Error 1 I attached kernel config for reproduction. The problem is that CONFIG_MEMFD_CREATE does not get enabled: mm/Makefile:obj-$(CONFIG_MEMFD_CREATE) += memfd.o memfd_inaccessible.o BR, Jarkko