Re: [RFC][Patch V7 0/7] KVM: Guest Page Hinting

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

 



On Sat, 30 Jun 2018 01:10:53 +0300
"Michael S. Tsirkin" <mst@xxxxxxxxxx> wrote:

> > Hi Michael,
> > 
> > We have been studying KSM in the last week. Recently we also had a
> > discussion with Andrea about the same. There are certain issues with the
> > current implementation of KSM which are listed below:
> >     - It is prone to side-channel attack  
> 
> Limit KSM to zero pages only? Comparisons to zero or
> a constant poison value can be special-cased
> and done more efficiently than the generic tree lookup.
> 
> >     - As KSM needs time to scan and merge the pages it may not work well
> > for immediate memory requirements  
> 
> Kick off KSM when host starts getting short on memory?
> 
> > or in a situation where there is a
> > single guest running  
> 
> A per-VM KSM then?
> 
> >     - For the same reason mentioned above the CPU requirements for KSM
> > is also higher  
> 
> Won't it be possible to quantify this?
> 
> > Due to these reasons, it may not be ideal to replace the guest page
> > hinting approach with it. Although it is true that all of the
> > above-mentioned issues could be fixed and it would certainly be a good
> > enhancement but it may be more suitable to do these changes as a
> > separate project. Without the changes, it may not even be possible to
> > compare the two solutions.  
> 
> Interesting. How wouldn't it be possible? It's literally a question
> of building the kernel, enabling KSM and re-running your test.
> 
> It might not be an apples-to-apples comparison but I would really
> like to see the number.

Michael,

I'm going to try to answer all your questions.

I did try KSM & zero-poisoning a few weeks ago exactly the way you're
suggesting: just run it with our current test-case. Our current test-case
causes memory pressure in the host within seconds which will lead to
swapping of gigas without page hinting. KSM made no difference in this
case, meaning, we got the same amount of swapping with and without KSM.

Then we tried to create a scenario that would be favourable for KSM:
we set it to scan several gigas of pages with very little sleep time.
Also, we'd start VMs with a delay between them to give KSM some time
to do its work. This improved things just a tiny bit (ie. less swapping),
but then the ksmd thread was taking around 80% of the CPU all the time.

I did miss the zero-page configuration in sysfs. However, we talked to
Andrea about this and the conclusion is that KSM would need some considerable
amount of work to be used in this test-case. The most important first
thing is that side-channel attacks is possible with KSM. Secondly,
we need a number of other improvements such as multi-thread support,
optimizing it for scanning zero pages and other details. Still, we
don't believe KSM would ever do well in the "need memory instantly"
test-case.

Our conclusion is that, while this may all be worthwhile, this isn't
necessarily mutual-exclusive to page hinting. Giving that we have a
new idea to solve page hinting locking, we'd prefer to invest our time
in that idea instead of working on KSM. At least for the time being.

> 
> > In our discussion with Andrea, he has also made a few suggestions about
> > the ways using which I can remove the locking issue. I have started
> > working on it and will post an update soon.  
> 
> Sounds good.
> 
> > >  
> > 
> > -- 
> > Regards
> > Nitesh
> >   
> 
> 
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux