Re: [PATCH v5 3/9] KVM: guest_memfd: Allow host to map guest_memfd() pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 04, 2025 at 09:27:06AM +0000, Fuad Tabba wrote:
> Hi Kirill,
> 
> On Tue, 4 Mar 2025 at 08:58, Kirill A. Shutemov
> <kirill.shutemov@xxxxxxxxxxxxxxx> wrote:
> >
> > On Mon, Mar 03, 2025 at 05:10:07PM +0000, Fuad Tabba wrote:
> > > Add support for mmap() and fault() for guest_memfd backed memory
> > > in the host for VMs that support in-place conversion between
> > > shared and private. To that end, this patch adds the ability to
> > > check whether the VM type supports in-place conversion, and only
> > > allows mapping its memory if that's the case.
> > >
> > > Also add the KVM capability KVM_CAP_GMEM_SHARED_MEM, which
> > > indicates that the VM supports shared memory in guest_memfd, or
> > > that the host can create VMs that support shared memory.
> > > Supporting shared memory implies that memory can be mapped when
> > > shared with the host.
> > >
> > > This is controlled by the KVM_GMEM_SHARED_MEM configuration
> > > option.
> > >
> > > Signed-off-by: Fuad Tabba <tabba@xxxxxxxxxx>
> > > ---
> > >  include/linux/kvm_host.h |  11 ++++
> > >  include/uapi/linux/kvm.h |   1 +
> > >  virt/kvm/guest_memfd.c   | 105 +++++++++++++++++++++++++++++++++++++++
> > >  virt/kvm/kvm_main.c      |   4 ++
> > >  4 files changed, 121 insertions(+)
> > >
> > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > > index 7788e3625f6d..2d025b8ee20e 100644
> > > --- a/include/linux/kvm_host.h
> > > +++ b/include/linux/kvm_host.h
> > > @@ -728,6 +728,17 @@ static inline bool kvm_arch_has_private_mem(struct kvm *kvm)
> > >  }
> > >  #endif
> > >
> > > +/*
> > > + * Arch code must define kvm_arch_gmem_supports_shared_mem if support for
> > > + * private memory is enabled and it supports in-place shared/private conversion.
> > > + */
> > > +#if !defined(kvm_arch_gmem_supports_shared_mem) && !IS_ENABLED(CONFIG_KVM_PRIVATE_MEM)
> >
> > Hm. Do we expect any caller for !CONFIG_KVM_PRIVATE_MEM?

I think you missed this.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux