qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: qemu-devel@nongnu.org, SystemTAP <systemtap@sources.redhat.com>
Subject: [Qemu-devel] Using the qemu tracepoints with SystemTap
Date: Mon, 12 Sep 2011 11:33:02 -0400	[thread overview]
Message-ID: <4E6E262E.6060400@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hi All,

The RHEL-6 version of qemu-kvm makes the tracepoints available to SystemTap. I have been working on useful examples for the SystemTap tracepoints in qemu. There doesn't seem to be a great number of examples showing the utility of the tracepoints in diagnosing problems. However, I came across the following blog entry that had several examples:

http://blog.vmsplice.net/2011/03/how-to-write-trace-analysis-scripts-for.html

I reimplemented the VirtqueueRequestTracker example from the blog in SystemTap (the attached virtqueueleaks.stp). I can run it on RHEL-6's qemu-kvm-0.12.1.2-2.160.el6_1.8.x86_64 and get output like the following. It outputs the pid and the address of the elem that leaked when the script is stopped like the following:

$ stap virtqueueleaks.stp 
^C
     pid     elem
   19503  1c4af28
   19503  1c56f88
   19503  1c62fe8
   19503  1c6f048
   19503  1c7b0a8
   19503  1c87108
   19503  1c93168
...

I am not that familiar with the internals of qemu. The script seems to indicates qemu is leaking, but is that really the case?  If there are resource leaks, what output would help debug those leaks? What enhancements can be done to this script to provide more useful information?

Are there other examples of qemu probing people would like to see?

-Will




[-- Attachment #2: virtqueueleaks.stp --]
[-- Type: text/plain, Size: 425 bytes --]

# virtqueueleaks.stp
#
# virtqueueleaks.stp is based on the VirtqueueRequestTracker from:
# http://blog.vmsplice.net/2011/03/how-to-write-trace-analysis-scripts-for.html

global elems
probe qemu.kvm.virtqueue_pop { elems[pid(),elem] = elem }
probe qemu.kvm.virtqueue_fill { delete elems[pid(),elem] }

probe end
{
  printf("\n%8s %8s\n", "pid", "elem")
  foreach([p+, elem] in elems) {
    printf("%8d %8x\n", p, elem)
  }
}

             reply	other threads:[~2011-09-12 15:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-12 15:33 William Cohen [this message]
2011-09-13 10:03 ` [Qemu-devel] Using the qemu tracepoints with SystemTap Stefan Hajnoczi
2011-09-13 16:10   ` William Cohen
2011-09-13 19:38     ` William Cohen
2011-09-14 14:51       ` Stefan Hajnoczi
2011-09-14 15:20         ` Frank Ch. Eigler
2011-09-14 16:02         ` William Cohen
2011-09-15 10:17           ` Stefan Hajnoczi
2011-09-14 15:32     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E6E262E.6060400@redhat.com \
    --to=wcohen@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).