Re: [PATCH v6 2/3] perf,kvm/powerpc: Port perf kvm stat to powerpc
From: Michael Ellerman
Date: Mon Sep 07 2015 - 02:30:46 EST
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.
cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/