Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2)

Chris Wright
2010-12-02T20:40:39Z

* Anthony Liguori (anthony@codemonkey.ws) wrote:
> On 12/02/2010 01:14 PM, Chris Wright wrote:
> >* Anthony Liguori (aliguori@us.ibm.com) wrote:
> >>In certain use-cases, we want to allocate guests fixed time slices where idle
> >>guest cycles leave the machine idling. There are many approaches to achieve
> >>this but the most direct is to simply avoid trapping the HLT instruction which
> >>lets the guest directly execute the instruction putting the processor to sleep.
> >I like the idea, esp to keep from burning power.
> >
> >>Introduce this as a module-level option for kvm-vmx.ko since if you do this
> >>for one guest, you probably want to do it for all. A similar option is possible
> >>for AMD but I don't have easy access to AMD test hardware.
> >Perhaps it should be a VM level option. And then invert the notion.
> >Create one idle domain w/out hlt trap. Give that VM a vcpu per pcpu
> >(pin in place probably). And have that VM do nothing other than hlt.
> >Then it's always runnable according to scheduler, and can "consume" the
> >extra work that CFS wants to give away.
>
> That's an interesting idea. I think Vatsa had some ideas about how
> to do this with existing mechanisms.

Yeah, should Just Work (TM) w/ smth like evilcap.

> I'm interesting in comparing behavior with fixed allocation because
> one thing the above relies upon is that the filler VM loses it's
> time when one of the non-filler VCPU needs to run.

Priorites?

> This may all
> work correctly but I think it's easier to rationalize about having
> each non-filler VCPU have a fixed (long) time slice. If a VCPU
> needs to wake up to become non-idle, it can do so immediately
> because it already has the PCPU.

The flipside...dont' have to worry about the issues that Marcelo brought
up.

Should be pretty easy to compare though.

thanks,
-chris