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

Anthony Liguori
2010-12-02T22:28:04Z

On 12/02/2010 02:40 PM, Marcelo Tosatti wrote:
> Consuming the timeslice outside guest mode is less intrusive and easier
> to replace. Something like this should work?
>
> if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED) {
> while (!need_resched())
> default_idle();
> }
>
> But you agree this is no KVM business.
>

My initial inclination is that this would be inappropriate for KVM but I
think I'm slowly convincing myself otherwise.

Ultimately, hard limits and deterministic scheduling are related goals
but not quite the same. A hard limit is very specific, you want to
receive no more than an exit amount of CPU time per VCPU With
deterministic scheduling, you want to make sure that a set of VMs are
not influenced by each other's behavior.

You want hard limits when you want to hide the density/capacity of a
node from the end customer. You want determinism when you simply want
to isolate the performance of each customer from the other customers.

That is, the only thing that should affect the performance graph of a VM
is how many neighbors it has (which is controlled by management
software) rather than what its neighbors are doing.

If you have hard limits, you can approximate deterministic scheduling
but it's complex in the face of changing numbers of guests.
Additionally, hard limits present issues with directed yield that don't
exist with a deterministic scheduling approach.

You can still donate your time slice to another VCPU because the VCPUs
are not actually capped. That may mean that an individual VCPU gets
more PCPU time than an exact division but for the VM overall, it won't
get more than it's total share. So the principle of performance
isolation for the guest isn't impacted.

Regards,

Anthony Liguori