[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f396836d-9bbd-e3e2-c7b0-d921bf1c9ed1@redhat.com>
Date: Mon, 18 Feb 2019 19:29:44 +0100
From: David Hildenbrand <david@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Nitesh Narayan Lal <nitesh@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, pbonzini@...hat.com,
lcapitulino@...hat.com, pagupta@...hat.com, wei.w.wang@...el.com,
yang.zhang.wz@...il.com, riel@...riel.com, dodgen@...gle.com,
konrad.wilk@...cle.com, dhildenb@...hat.com, aarcange@...hat.com,
Alexander Duyck <alexander.duyck@...il.com>
Subject: Re: [RFC][Patch v8 0/7] KVM: Guest Free Page Hinting
On 18.02.19 18:54, Michael S. Tsirkin wrote:
> On Mon, Feb 18, 2019 at 05:59:06PM +0100, David Hildenbrand wrote:
>> On 18.02.19 17:49, Michael S. Tsirkin wrote:
>>> On Sat, Feb 16, 2019 at 10:40:15AM +0100, David Hildenbrand wrote:
>>>> It would be worth a try. My feeling is that a synchronous report after
>>>> e.g. 512 frees should be acceptable, as it seems to be acceptable on
>>>> s390x. (basically always enabled, nobody complains).
>>>
>>> What slips under the radar on an arch like s390 might
>>> raise issues for a popular arch like x86. My fear would be
>>> if it's only a problem e.g. for realtime. Then you get
>>> a condition that's very hard to trigger and affects
>>> worst case latencies.
>>
>> Realtime should never use free page hinting.
>
> OK maybe document this in commit log. RT project has
> enough work as it is without need to untangle
> complex dependencies with other features.
We most certainly should!!
>
>> Just like it should never
>> use ballooning.
>
> Well its an aside but why not ballooning? As long as hypervisor does not touch the balloon,
> and you don't touch the (weird, not really documented properly)
> deflate on oom, you are fine.
> Real time is violated when you reconfigure balloon,
> but after you are done guest is real time again.
> And management certainly knows it that it did something
> with balloon at the exact same time there was a latency spike.
Fair enough, this is a potential use case. But it goes hand in hand with
pinning/unpinning pages. So yes, while this would be possible - modify
balloon in "no real time period", I doubt this is a real life scenario.
As always, I like to be taught differently :)
Similar to "start reporting on !RT activity" and "stop reporting on RT
activity"
>
>
> I think this might not work well right now, but generally
> I think it should be fine. No?
>
>
>> Just like it should pin all pages in the hypervisor.
>
> BTW all this is absolutely interesting to fix.
> But I agree wrt hinting being kind of like pinning.
Yes, this is all interesting stuff :)
>
>
>>>
>>> But really what business has something that is supposedly
>>> an optimization blocking a VCPU? We are just freeing up
>>> lots of memory why is it a good idea to slow that
>>> process down?
>>
>> I first want to know that it is a problem before we declare it a
>> problem. I provided an example (s390x) where it does not seem to be a
>> problem. One hypercall ~every 512 frees. As simple as it can get.
>>
>> No trying to deny that it could be a problem on x86, but then I assume
>> it is only a problem in specific setups.
>
> But which setups? How are we going to identify them?
I guess is simple (I should be carefuly with this word ;) ): As long as
you don't isolate + pin your CPUs in the hypervisor, you can expect any
kind of sudden hickups. We're in a virtualized world. Real time is one
example.
Using kernel threads like Nitesh does right now? It can be scheduled
anytime by the hypervisor on the exact same cpu. Unless you isolate +
pin in the hypervor. So the same problem applies.
>
>> I would much rather prefer a simple solution that can eventually be
>> disabled in selected setup than a complicated solution that tries to fit
>> all possible setups.
>
> Well I am not sure just disabling it is reasonable. E.g. Alex shows
> drastic boot time speedups. You won't be able to come to people later
> and say oh you need to disable this feature yes you will stop getting
> packet loss once in a while but you also won't be able to boot your VMs
> quickly enough.
The guest is always free to disable once up. Yes, these are nice
details, but I consider these improvements we can work on later.
>
> So I'm fine with a simple implementation but the interface needs to
> allow the hypervisor to process hints in parallel while guest is
> running. We can then fix any issues on hypervisor without breaking
> guests.
Yes, I am fine with defining an interface that theoretically let's us
change the implementation in the guest later. I consider this even a
prerequisite. IMHO the interface shouldn't be different, it will be
exactly the same.
It is just "who" calls the batch freeing and waits for it. And as I
outlined here, doing it without additional threads at least avoids us
for now having to think about dynamic data structures and that we can
sometimes not report "because the thread is still busy reporting or
wasn't scheduled yet".
>
>
>> Realtime is one of the examples where such stuff is
>> to be disabled either way.
>
> OK so we have identified realtime. Nice even though it wasn't documented
> anywhere. Are there other workloads? What are they?
As stated above, I think these environments are easy to spot. As long as
you don't isolate and pin, surprises can happen anytime. Can you think
of others?
(this stuff really has to be documented)
>
>
>> Optimization of space comes with a price (here: execution time).
>
> I am not sure I agree. If hinting patches just slowed everyone down they
> would be useless. Note how Alex show-cased this by demonstrating
> faster boot times.
Of course, like compressing the whole guest memory, things you might not
want to do ;) In the end, there has to be a net benefit.
>
> Unlike regular ballooning, this doesn't do much to optimize space. There
> are no promises so host must still have enough swap to fit guest memory
> anyway.
>
> All free page hinting does is reduce IO on the hypervisor.
>
> So it's a tradeoff.
+1 to that.
The nice thing about this approach is that we can easily tweak "how many
to report in one shot" and "which sizes to report". We can play with it
fairly easily.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists