Re: KVM PMU virtualization

Joerg Roedel
2010-03-01T18:36:42Z

On Mon, Mar 01, 2010 at 06:17:40PM +0100, Peter Zijlstra wrote:
> On Mon, 2010-03-01 at 12:11 +0100, Joerg Roedel wrote:
> >
> > 1. Enhance perf to count pmu events only when cpu is in guest mode.
>
> No enhancements needed, only hardware support for Intel doesn't provide
> this iirc.

At least the guest-bit for AMD perfctl registers is not supported yet
;-) Implementing this eliminates the requirement to write the perfctl
msrs on every vmrun and every vmexit. But thats a minor change.

> > 4. Some additional magic to reinject pmu events into the guest
>
> Right, that is needed, and might be 'interesting' since we get them from
> NMI context.

I imagine some kind of callback which sets a flag in the kvm vcpu
structure. Since the NMI already triggered a vmexit the kvm code checks
for this bit on its path to re-entry.

Joerg