Re: [RFC PATCH 2/4] kvm: Add host side support for free memory hints

From: Michael S. Tsirkin
Date: Mon Feb 11 2019 - 12:37:01 EST


On Mon, Feb 11, 2019 at 09:34:25AM -0800, Alexander Duyck wrote:
> On Sat, 2019-02-09 at 19:44 -0500, Michael S. Tsirkin wrote:
> > On Mon, Feb 04, 2019 at 10:15:46AM -0800, Alexander Duyck wrote:
> > > From: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx>
> > >
> > > Add the host side of the KVM memory hinting support. With this we expose a
> > > feature bit indicating that the host will pass the messages along to the
> > > new madvise function.
> > >
> > > This functionality is mutually exclusive with device assignment. If a
> > > device is assigned we will disable the functionality as it could lead to a
> > > potential memory corruption if a device writes to a page after KVM has
> > > flagged it as not being used.
> >
> > I really dislike this kind of tie-in.
> >
> > Yes right now assignment is not smart enough but generally
> > you can protect the unused page in the IOMMU and that's it,
> > it's safe.
> >
> > So the policy should not leak into host/guest interface.
> > Instead it is better to just keep the pages pinned and
> > ignore the hint for now.
>
> Okay, I can do that. It also gives me a means of benchmarking just the
> hypercall cost versus the extra page faults and zeroing.

Good point. Same goes for poisoning :)