Re: Tracing KVM with Systemtap

Stefan Hajnoczi
2010-09-20T13:36:03Z

On Mon, Sep 20, 2010 at 2:19 PM, Rayson Ho <rho@redhat.com> wrote:
> On Wed, 2010-09-08 at 15:08 +0100, Stefan Hajnoczi wrote:
>> Hi Rayson,
>> For the KVM kernel module Linux trace events are already used.  For
>> example, see arch/x86/kvm/trace.h and check out
>> /sys/kernel/debug/tracing/events/kvm/*.  There is a set of useful
>> static trace points for vm_exit/vm_enter, pio, mmio, etc.
>>
>> For the KVM guest there is perf-kvm(1).  This allows perf(1) to look
>> up addresses inside the guest (kernel only?).  It produces system-wide
>> performance profiles including guests.  Perhaps someone can comment on
>> perf-kvm's full feature set and limitations?
>>
>> For QEMU userspace Prerna Saxena and I are proposing a static tracing
>> patchset.  It abstracts the trace backend (SystemTap, LTTng UST,
>> DTrace, etc) from the actual tracepoints so that portability can be
>> achieved.  There is a built-in trace backend that has a basic feature
>> set but isn't as fancy as SystemTap.  I have implemented LTTng
>> Userspace Tracer support, perhaps you'd like to add SystemTap/DTrace
>> support with sdt.h?
>
> Thanks Stefan for the reply!
>
> I've looked at the tracing additions in QEMU, including the "Simple
> trace backend" (simpletrace.c) and the "tracetool" script, and I think
> the SystemTap version can be implemented in a straightforward way.
>
> One thing I was wondering, there seems to be not a lot of probes (except
> the examples?) in the QEMU code, are we expected to see more probes in
> the next release, or this work will be a long-term project that will not
> be added to the official QEMU code in the near future?
>
> (I believe if we can get the tracing framework integrated, then specific
> probes can be added on-demand -- but of course that is just my own
> opinion :-D )

Right now there are few pre-defined probes ("trace events" in QEMU
tracing speak). As I develop I try to be mindful of new ones I create
and whether they would be generally useful. I intend to contribute
more probes and hope others will too!

Prerna is also looking at adding useful probes.

Stefan