qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/2] New trace backend: ftrace
Date: Mon, 8 Apr 2013 16:12:34 +0200	[thread overview]
Message-ID: <20130408141234.GF4429@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1364970659-5715-1-git-send-email-eiichi.tsukata.xh@hitachi.com>

On Wed, Apr 03, 2013 at 03:30:57PM +0900, Eiichi Tsukata wrote:
> This patchset introduces a new tracing backend "ftrace".
> 
> Currently, QEMU tracing backends do not support userspace tracing with ftrace.
> Collecting QEMU trace data and kernel trace data simultaniouly is useful for
> latency analysis and debugging especially when using KVM.
> 
> With ftrace backend, you can easily collect QEMU-kernel merged trace data
> using existing ftrace event-based tracer. If you use KVM, you can effectively
> compare VM_EXIT and QEMU userspace handler.
> 
> To try it out, compile QEMU with tracing backend ftrace, then enable KVM events
> in ftrace:
> 
>     # echo 1 > /sys/kernel/debug/tracing/events/kvm/enable
>     
> After running qemu by root user, you can get the trace:
>     
>     # cat /sys/kernel/debug/tracing/trace
> 
> Example:
>  # tracer: nop
>  #
>  # entries-in-buffer/entries-written: 8434/345512   #P:4
>  #
>  #                              _-----=> irqs-off
>  #                             / _----=> need-resched
>  #                            | / _---=> hardirq/softirq
>  #                            || / _--=> preempt-depth
>  #                            ||| /     delay
>  #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
>  #              | |       |   ||||       |         |
>  <snip>
>  qemu-system-x86-31930 [000] d... 23580.595951: kvm_exit: reason IO_INSTRUCTION rip 0xc45d info 710048 0
>  qemu-system-x86-31930 [000] .... 23580.595954: kvm_emulate_insn: f0000:c45d:e4 71 (real)
>  qemu-system-x86-31930 [000] .... 23580.595955: kvm_pio: pio_read at 0x71 size 1 count 1
>  qemu-system-x86-31930 [000] .... 23580.595956: kvm_userspace_exit: reason KVM_EXIT_IO (2)
>  qemu-system-x86-31930 [000] ...1 23580.595959: tracing_mark_write: cpu_set_apic_base 00000000fee00900
>  qemu-system-x86-31930 [000] ...1 23580.595961: tracing_mark_write: cpu_in addr 0x71 value 0
>  qemu-system-x86-31930 [000] d... 23580.595964: kvm_entry: vcpu 0
>  <snip>
> 
> "tracing_mark_write: cpu_set_apic_base 00000000fee00900" and
> "tracing_mark_write: cpu_in addr 0x71 value 0" are QEMU trace data.
> Others are Kernel trace data.
> 
> Furthermore, the ftrace backend overhead is smaller than uprobe-based event
> tracer or SystemTap. My microbenchmark shows that ftrace tracing backend
> overhead is about 0.8us per tracepoint, whereas uprobe-based event tracer
> or SystemTap overhead is about 2.0us.
> 
> Eiichi Tsukata (2):
>   trace: Add ftrace tracing backend
>   trace: document frace backend
> 
>  configure                           |   8 +++
>  docs/tracing.txt                    |  16 ++++++
>  scripts/tracetool/backend/ftrace.py |  53 +++++++++++++++++++
>  trace/Makefile.objs                 |   1 +
>  trace/ftrace.c                      | 102 ++++++++++++++++++++++++++++++++++++
>  trace/ftrace.h                      |  10 ++++
>  6 files changed, 190 insertions(+)
>  create mode 100644 scripts/tracetool/backend/ftrace.py
>  create mode 100644 trace/ftrace.c
>  create mode 100644 trace/ftrace.h

Looks nice.  I posted two comments.

Stefan

  parent reply	other threads:[~2013-04-08 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03  6:30 [Qemu-devel] [PATCH 0/2] New trace backend: ftrace Eiichi Tsukata
2013-04-03  6:30 ` [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend Eiichi Tsukata
2013-04-08 14:10   ` Stefan Hajnoczi
2013-04-09 10:47     ` Eiichi Tsukata
2013-04-03  6:30 ` [Qemu-devel] [PATCH 2/2] trace: document frace backend Eiichi Tsukata
2013-04-08 14:12 ` Stefan Hajnoczi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-04-03  3:41 [Qemu-devel] [PATCH 0/2] New trace backend: ftrace Eiichi Tsukata

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=20130408141234.GF4429@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=eiichi.tsukata.xh@hitachi.com \
    --cc=qemu-devel@nongnu.org \
    /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).