Re: KVM PMU virtualization

Jes Sorensen
2010-02-26T11:26:35Z

On 02/26/10 12:24, Ingo Molnar wrote:
> There is a way to query the CPU for 'architectural perfmon' though, via CPUID
> alone - that is how we set the X86_FEATURE_ARCH_PERFMON shortcut. The logic
> is:
>
> if (c->cpuid_level> 9) {
> unsigned eax = cpuid_eax(10);
> /* Check for version and the number of counters */
> if ((eax& 0xff)&& (((eax>>8)& 0xff)> 1))
> set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
> }
>
> But emulating that doesnt solve the problem: as OSs generally dont key their
> PMU drivers off the relatively new 'architectural perfmon' CPUID detail, but
> based on much higher level CPUID attributes. (like Intel/AMD)

Right, there is far more to it than just the arch-perfmon feature. They
still need to query cpuid 0x0a for counter size, number of counters and
stuff like that.

Cheers,
Jes