Skip to content

trce-cmd: add virtual machine tracing

Masami Hiramatsu lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest7 patches 0 repliesNew
  2. v56 patches 7 repliesSuperseded
  3. v16 patches 14 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7trace-cmd: Support -N option for trace-cmd extracttrace-record.c+6 -20 replies
2/7trace-cmd/listen: Introduce trace-msg protocol (protocol v2)Documentation/Protocol.txt Makefile trace-cmd.h +5 more+982 -370 replies
3/7trace-cmd/msg: Use poll(2) to wait for a messagetrace-msg.c+36 -60 replies
4/7trace-cmd/virt-server: Add virt-server mode for a virtualization environmentDocumentation/Protocol.txt Documentation/trace-cmd-virt-server.1.txt trace-cmd.c +5 more+667 -1030 replies
5/7trace-cmd/record: Add --virt option for record modeDocumentation/trace-cmd-record.1.txt trace-cmd.h trace-msg.c +3 more+160 -130 replies
6/7trace-cmd/virt-server: Add --dom option which makes a domain directory to virt-serverDocumentation/trace-cmd-virt-server.1.txt trace-listen.c trace-usage.c+179 -350 replies
7/7trace-cmd: Use pid instead of libvirt virt domain nametrace-listen.c+34 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH trace-cmd V6 0/7] trce-cmd: add virtual machine tracing

Hi,

This is the version 6 series of virtio-trace for trace-cmd. The previous series is here; https://lkml.org/lkml/2014/12/22/79

I took over this work from Yoshihiro Yunomae. This version updates previous patch on the latest trace-cmd tree and recover Yoshihiro's signed-off and original authorship.

How to use
==========
1. Run virt-server on a host

   # trace-cmd virt-server --dom guest1 -c 2

2. Set up of virtio-serial pipe of guest1 on the host Add the following tags to domain XML files.

   # virsh edit guest1
   <channel type='unix'>
      <source mode='connect' path='/tmp/trace-cmd/virt/agent-ctl-path'/>
      <target type='virtio' name='agent-ctl-path'/>
   </channel>
   <channel type='pipe'>
      <source path='/tmp/trace-cmd/virt/guest1/trace-path-cpu0'/>
      <target type='virtio' name='trace-path-cpu0'/>
   </channel>
   <channel type='pipe'>
      <source path='/tmp/trace-cmd/virt/guest1/trace-path-cpu1'/>
      <target type='virtio' name='trace-path-cpu1'/>
   </channel>

3. Boot the guest

   # virsh start guest1

4. Run the guest1's client(see trace-cmd-record(1) with the *--virt* option)

   # trace-cmd record -e sched* --virt

If you want to boot another guest sends trace-data via virtio-serial, you will manually make the guest domain directory and trace data I/Fs.

- Make guest domain directory on the host

   # mkdir -p /tmp/trace-cmd/virt/<DOMAIN>
   # chmod 710 /tmp/trace-cmd/virt/<DOMAIN>
   # chgrp qemu /tmp/trace-cmd/virt/<DOMAIN>

- Make FIFO on the host

   # mkfifo /tmp/trace-cmd/virt/<DOMAIN>/trace-path-cpu{0,1,...,X}.{in,out}

TODO
====
- Don't use fixed directory and fifos. Make it flexible.
- Don't depend on the libvirt. We can find fifos in /proc/<pid>/fd/*.
- Cleanup the code. It is not well structured now.

Thank you,

---

Yoshihiro YUNOMAE (7):
trace-cmd: Support -N option for trace-cmd extract
trace-cmd/listen: Introduce trace-msg protocol (protocol v2) trace-cmd/msg: Use poll(2) to wait for a message trace-cmd/virt-server: Add virt-server mode for a virtualization environment trace-cmd/record: Add --virt option for record mode trace-cmd/virt-server: Add --dom option which makes a domain directory to virt-server
trace-cmd: Use pid instead of libvirt virt domain name

 Documentation/Protocol.txt                |  163 +++++
 Documentation/trace-cmd-record.1.txt      |   12 
 Documentation/trace-cmd-virt-server.1.txt |  113 ++++
 Makefile                                  |    3 
 trace-cmd.c                               |    3 
 trace-cmd.h                               |   15 +
 trace-listen.c                            |  687 +++++++++++++++++++----
 trace-msg.c                               |  870 +++++++++++++++++++++++++++++
 trace-msg.h                               |   31 +
 trace-output.c                            |    4 
 trace-record.c                            |  158 +++++
 trace-recorder.c                          |   50 +-
 trace-usage.c                             |   18 +
 13 files changed, 1991 insertions(+), 136 deletions(-)
 create mode 100644 Documentation/Protocol.txt
 create mode 100644 Documentation/trace-cmd-virt-server.1.txt
 create mode 100644 trace-msg.c
 create mode 100644 trace-msg.h
Signature · 5 lines
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering 
Hitachi, Ltd., Research & Development Group
E-mail: [email protected]