Re: KVM PMU virtualization

Jes Sorensen
2010-02-26T13:14:06Z

On 02/26/10 14:04, Avi Kivity wrote:
> On 02/26/2010 02:38 PM, Ingo Molnar wrote:
>> Yes, something like Core2 with 2 generic events.
>>
>> That would leave 2 extra generic events on Nehalem and better. (which is
>> really the target CPU type for any new feature we are talking about
>> right now.
>> Plus performance analysis tends to skew towards more modern CPU types as
>> well.)
>
> Can you emulate the Core 2 pmu on, say, a P4? Those P4s have very
> different instruction caches so I imagine the events are very different
> as well.
>
> Agree about favouring modern processors.

You certainly cannot emulate the Core2 on a P4. The Core2 is Perfmon v2,
whereas Nehalem and Atom are v3 if I remember correctly. I am not even
100% sure a v3 is capable of emulating a v2, though I expect v3 to have
bigger counters then v2, but I don't think that is guaranteed. I can
only handle so many hours of reading Intel manuals per day, before I end
up in a padded cell, so I could be wrong on some of this.

>> Plus the emulation can be smart about it and only use up a given
>> number. Most
>> guest OSs dont use the full PMU - they use a single counter.
>
> But you have to expose all of the counters, no? Unless you go with a
> kvm-specific pmu as described below.

You have to, at least all the fixed ones (3 on Core2) and the two arch
ones. Thats the minimum and any guest being told it's running on a Core2
will expect to find those.

Cheers,
Jes