Re: KVM PMU virtualization

Jes Sorensen
2010-02-26T12:57:18Z

On 02/26/10 13:20, Avi Kivity wrote:
> On 02/26/2010 02:07 PM, Ingo Molnar wrote:
>> ... which is why i suggested the soft-PMU approach.
>
> Not sure I understand it completely.
>
> Do you mean to take the model specific host pmu events, and expose them
> to the guest via trap'n'emulate? In that case we may as well assign the
> host pmu to the guest if the host isn't using it, and avoid the traps.
>
> Do you mean to choose some older pmu and emulate it using whatever pmu
> model the host has? I haven't checked, but aren't there mutually
> exclusive events in every model pair? The closest thing would be the
> architectural pmu thing.

You cannot do this, as you say there is no guarantee that there are no
overlaps, and the current host may have different counter sizes two
which makes emulating it even more costly.

The cpuid bits basically tells you which version of the counters are
available, how many counters are there, word size of the counters and
I believe there are bits also stating which optional features are
available to be counted.

> Or do you mean to define a new, kvm-specific pmu model and feed it off
> the host pmu? In this case all the guests will need to be taught about
> it, which raises the compatibility problem.

Cannot be done in a reasonable manner due to the above.

The key to all of this is that guests OSes, including that other OS,
should be able to use the performance counters without needing special
para virt drivers or other OS modifications. If we start requering that
kind of stuff, the whole point of having the feature goes down the
toilet.

Cheers,
Jes