Re: [PATCH v1 5/5] KVM: Expose a version 1 architectural PMU toguests

From: Ingo Molnar
Date: Wed May 18 2011 - 07:08:16 EST

* Avi Kivity <avi@xxxxxxxxxx> wrote:

> >> - some combinations of INV and CMASK are not supported
> >
> > Could you please describe this better, where does this limit come from? If
> > perf then this needs fixing.
> perf_event_attr does not support generic INV and CMASK at all. [...]

It does through raw events - which are indeed model specific.

> [...] I imagine you can get them through the model-specific hardware
> configuration, but that means we have to encode model specific information
> into kvm host code, which is (a) hard (b) counter to the spirit of perf.
> (INV and CMASK allow you to increment the counter only when > N or <
> N events occur simultaneously, for example count when 2 or more
> instructions are retired in a single clock).

Peter, what do you think about adding a inv and cmask attribute that is applied
to generic events automatically?

I *think* it should work just out of box: we recognize the fixed-purpose
counter events based on their raw value, so if one comes in with inv and cmask
set it will just be scheduled on a generic hw counter.

> > - we could do things like propagate guest side traces over to the host
> We support that already via 'perf kvm', no? [...]

Not without usability issues, if you remember that flamewa^W thread! :-)

> [...] This is more about the guest profiling itself without access to the
> host (which is the more common scenario, IMO).

Correct - so there would be interactions with virtio-perf. I think the two will
just have to be made to mix well, that's all.

> We're still missing tunnelling guest ftrace to the host, but a patch was
> recently posted to do that.

If you tunnel guest perf events then ftrace events are included automatically.
That's the primary/unified event transport model we are working towards.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at