[PATCH v6 2/3] perf,kvm/powerpc: Port perf kvm stat to powerpc
mpe at ellerman.id.au
Mon Sep 7 16:30:15 AEST 2015
On Mon, 2015-08-31 at 12:24 +0530, Hemant Kumar wrote:
> perf kvm can be used to analyze guest exit reasons. This support already
> exists in x86. Hence, porting it to powerpc.
> - To trace KVM events :
> perf kvm stat record
> If many guests are running, we can track for a specific guest by using
> --pid as in : perf kvm stat record --pid <pid>
> - To see the results :
> perf kvm stat report
> The result shows the number of exits (from the guest context to
> host/hypervisor context) grouped by their respective exit reasons with
> their frequency.
> Since, different powerpc machines have different KVM tracepoints, this
> patch discovers the machine type dynamically from /proc/cpuinfo's
> "machine" tag and accordingly sets kvm tracepoints. Right now, it only
> supports Book3S_HV tracepoints.
I'm not a big fan of parsing /proc/cpuinfo. I know you're not the first person
to do it, but can't we do something better?
Perf already knows how to find out what tracepoint events exist. You should be
able to just probe for the required events. eg. if 'kvm_hv:kvm_guest_enter'
exists then you use it. Otherwise there's no support.
When book3e wants to support 'perf kvm', you'd just add another event to probe
for, ie. something like 'kvm_book3e:kvm_guest_enter'.
And, if we ever want to change the name of any of the tracepoints you could
just add the new and the old names to the list of events to look for, and
depending on which you find, that is what you use.
More information about the Linuxppc-dev