linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] trace-cmd: Add a recorder readable feature for virtio-trace
@ 2012-08-22  8:42 Yoshihiro YUNOMAE
  2012-08-22  8:43 ` [PATCH 1/5] trace-cmd: Use TRACE_DIR envrionment variable if defined Yoshihiro YUNOMAE
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Yoshihiro YUNOMAE @ 2012-08-22  8:42 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Amit Shah, Anthony Liguori, Arnd Bergmann, Borislav Petkov,
	Franch Ch. Eigler, Frederic Weisbecker, Greg Kroah-Hartman,
	Herbert Xu, Ingo Molnar, Masami Hiramatsu, Mathieu Desnoyers,
	Rusty Russell, linux-kernel, virtualization, qemu-devel,
	yrl.pp-manager.tt

Hi Steven,

The following patch set provides a feature which can read trace data of a guest
using virtio-trace (https://lkml.org/lkml/2012/8/9/210) for a recorder
function of trace-cmd. This patch set depends on the trace-agent running on a
guest in the virtio-trace system.

To translate raw data of a guest to text data on a host, information of debugfs
in the guest is also needed on the host. In other words, the guest's debugfs
must be exposed (mounted) on the host via other serial line (we don't like to
depend on network connection). For this purpose, we'll use DIOD 9pfs server
(http://code.google.com/p/diod/) as below.

***HOW TO USE***
We explain about how to translate raw data to text data on a host using
trace-cmd applied this patch set and virtio-trace.

- Preparation
1. Make FIFO in a host
 virtio-trace uses virtio-serial pipe as trace data paths as to the number
of CPUs and a control path, so FIFO (named pipe) should be created as follows:
        # mkdir /tmp/virtio-trace/
        # mkfifo /tmp/virtio-trace/trace-path-cpu{0,1,2,...,X}.{in,out}
        # mkfifo /tmp/virtio-trace/agent-ctl-path.{in,out}

Here, if we assign 1VCPU for a guest, then we set as follows:
        trace-path-cpu0.{in.out}
and
        agent-ctl-path.{in,out}.

2. Set up of virtio-serial pipe and unix in a host
 Add qemu option to use virtio-serial pipe for tracing and unix for debugfs.

 ##virtio-serial device##
     -device virtio-serial-pci,id=virtio-serial0\
 ##control path##
     -chardev pipe,id=charchannel0,path=/tmp/virtio-trace/agent-ctl-path\
     -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\
      id=channel0,name=agent-ctl-path\
 ##data path##
     -chardev pipe,id=charchannel1,path=/tmp/virtio-trace/trace-path-cpu0\
     -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,\
      id=channel1,name=trace-path-cpu0\
 ##9pfs path##
     -device virtio-serial \
     -chardev socket,path=/tmp/virtio-trace/trace-9pfs,server,nowait, \
      id=trace-9pfs \
     -device virtserialport,chardev=trace-9pfs,name=virtioserial

If you manage guests with libvirt, add the following tags to domain XML files.
Then, libvirt passes the same command option to qemu.

        <channel type='pipe'>
           <source path='/tmp/virtio-trace/agent-ctl-path'/>
           <target type='virtio' name='agent-ctl-path'/>
           <address type='virtio-serial' controller='0' bus='0' port='0'/>
        </channel>
        <channel type='pipe'>
           <source path='/tmp/virtio-trace/trace-path-cpu0'/>
           <target type='virtio' name='trace-path-cpu0'/>
           <address type='virtio-serial' controller='0' bus='0' port='1'/>
        </channel>
	<channel type='unix'>
           <source mode='bind' path='/tmp/virtio-trace/trace-9pfs'/>
           <target type='virtio' name='trace-9pfs'/>
           <address type='virtio-serial' controller='0' bus='0' port='2'/>
        </channel>
Here, chardev names are restricted to trace-path-cpu0 and agent-ctl-path. UNIX
domain socket is automatically created on a host.

3. Boot the guest
 You can find some chardev in /dev/virtio-ports/ in the guest.

4. Create symbolic link for trace-cmd on the host
	# ln -s /tmp/virtio-trace/trace-path-cpu0.out \
	  /tmp/virtio-tracing/tracing/per_cpu/cpu0/trace_pipe_raw

5. Wait for 9pfs server on the host
	# mount -t 9p -o trans=unix,access=any,uname=root, \
	  aname=/sys/kernel/debug,version=9p2000.L \
	  /tmp/virtio-trace/trace-9pfs /tmp/virtio-trace/debugfs

6. Run DIOD on the guest
	# diod -E -Nn -u 0

7. Connect DIOD to virtio-console on the guest
	# socat TCP4:127.0.0.1:564 /dev/virtio-ports/trace-9pfs

- Execution
1. Run trace-agent on the guest
	# ./trace-agent

2. Execute trace-cmd on the host
	# AGENT_READ_DIR=/tmp/virtio-trace/tracing \
	  AGENT_CTL=/tmp/virtio-trace/agent-ctl-path.in \
	  TRACE_DIR=/tmp/virtio-trace/debugfs/tracing \
	  ./trace-cmd record -e "sched:*

3. Translate raw data to text data on the host
	# ./trace-cmd report trace.dat

***Just enhancement ideas***
 - Support for trace-cmd => done
 - Support for 9pfs protocol
 - Support for non-blocking mode in QEMU

Thank you,

---

Masami Hiramatsu (2):
      trace-cmd: Use tracing directory to count CPUs
      trace-cmd: Use TRACE_DIR envrionment variable if defined

Yoshihiro YUNOMAE (3):
      trace-cmd: Use polling function
      trace-cmd: Add non-blocking option for open() and splice_read()
      trace-cmd: Support trace-agent of virtio-trace


 trace-cmd.h      |    1 
 trace-record.c   |   41 ++++++++++++++++++++
 trace-recorder.c |  112 ++++++++++++++++++++++++++++++++++++++++++++++++------
 trace-util.c     |   27 +++++++++++++
 4 files changed, 169 insertions(+), 12 deletions(-)

-- 
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae.ez@hitachi.com


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-08-23 12:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22  8:42 [PATCH 0/5] trace-cmd: Add a recorder readable feature for virtio-trace Yoshihiro YUNOMAE
2012-08-22  8:43 ` [PATCH 1/5] trace-cmd: Use TRACE_DIR envrionment variable if defined Yoshihiro YUNOMAE
2012-08-22 13:37   ` Steven Rostedt
2012-08-22  8:43 ` [PATCH 2/5] trace-cmd: Use tracing directory to count CPUs Yoshihiro YUNOMAE
2012-08-22 13:41   ` Steven Rostedt
2012-08-23  2:01     ` Masami Hiramatsu
2012-08-23  3:00       ` Masami Hiramatsu
2012-08-23  9:08         ` Steven Rostedt
2012-08-23 12:30           ` Masami Hiramatsu
2012-08-22  8:43 ` [PATCH 3/5] trace-cmd: Support trace-agent of virtio-trace Yoshihiro YUNOMAE
2012-08-22 13:51   ` Steven Rostedt
2012-08-23  3:13     ` Yoshihiro YUNOMAE
2012-08-22  8:43 ` [PATCH 4/5] trace-cmd: Add non-blocking option for open() and splice_read() Yoshihiro YUNOMAE
2012-08-22  8:43 ` [PATCH 5/5] trace-cmd: Use polling function Yoshihiro YUNOMAE

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).