Re: [PATCH v3 kvm/queue 06/16] KVM: Implement fd-based memory using MEMFD_OPS interfaces
From: Sean Christopherson
Date: Tue Dec 28 2021 - 17:14:51 EST
On Fri, Dec 24, 2021, Chao Peng wrote:
> On Fri, Dec 24, 2021 at 12:09:47AM +0100, Paolo Bonzini wrote:
> > On 12/23/21 19:34, Sean Christopherson wrote:
> > > > select HAVE_KVM_PM_NOTIFIER if PM
> > > > + select MEMFD_OPS
> > > MEMFD_OPS is a weird Kconfig name given that it's not just memfd() that can
> > > implement the ops.
> > >
> >
> > Or, it's kvm that implements them to talk to memfd?
>
> The only thing is VFIO may also use the same set of callbacks, as
> discussed in the v2. But I think that's fine.
I'm objecting to assuming that KVM is talking to memfd. KVM shouldn't know or
care what is sitting behind the fd, KVM only cares whether or not the backing store
provides the necessary APIs.
I also think that the API as whole should be abstracted from memfd. It's mostly
cosmectic, e.g. tweak the struct and Kconfig name. I don't really care if it's
initially dependent on MEMFD_CREATE, I just don't want to end up with an API and
KVM implementation that implies there's something fundamentally special about memfd.