Re: [PATCH] cpuidle-haltpoll: Enable kvm guest polling when dedicated physical CPUs are available

From: Marcelo Tosatti
Date: Wed Aug 28 2019 - 10:52:53 EST


On Wed, Aug 28, 2019 at 11:48:58AM -0300, Marcelo Tosatti wrote:
> On Tue, Aug 27, 2019 at 08:43:13AM +0800, Wanpeng Li wrote:
> > > > kvm adaptive halt-polling will compete with
> > > > vhost-kthreads, however, poll in guest unaware other runnable tasks in
> > > > the host which will defeat vhost-kthreads.
> > >
> > > It depends on how much work vhost-kthreads needs to do, how successful
> > > halt-poll in the guest is, and what improvement halt-polling brings.
> > > The amount of polling will be reduced to zero if polling
> > > is not successful.
> >
> > We observe vhost-kthreads compete with vCPUs adaptive halt-polling in
> > kvm, it hurt performance in over-subscribe product environment,
> > polling in guest can make it worse.
> >
> > Regards,
> > Wanpeng Li
>
> Wanpeng,
>
> Polling should not be performed if there is other work to do. For
> example, halt-polling could check a host/guest shared memory
> region indicating whether there are other runnable tasks in the host.
>
> Disabling polling means you will not achieve the improvement
> even in the transitional periods where the system is not
> overcommitted (which should be frequent given that idling
> is common).
>
> Again, about your patch: it brings no benefit to anyone.
>
> Guest halt polling should be already disabled by default
> (the driver has to be loaded for guest polling to take place).

The most efficient solution would be to mwait on a memory
region that both host and guest would write to.

No cpu cycles burned, full efficiency.

However both host and guest would have to write to this region, which
brings security concerns.