|
|
9bac43 |
From 2fcb1e48dc05cd801a85b70972b0a0e7182fb522 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
Date: Thu, 8 Oct 2015 09:50:17 +0200
|
|
|
9bac43 |
Subject: Add support for simpletrace
|
|
|
9bac43 |
|
|
|
9bac43 |
As simpletrace is upstream, we just need to properly handle it during rpmbuild.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Rebase notes (2.9.0):
|
|
|
9bac43 |
- Added group argument for tracetool.py (upstream)
|
|
|
9bac43 |
|
|
|
9bac43 |
Rebase notes (2.8.0):
|
|
|
9bac43 |
- Changed tracetool.py parameters
|
|
|
9bac43 |
|
|
|
9bac43 |
Merged patches (2.3.0):
|
|
|
9bac43 |
- db959d6 redhat/qemu-kvm.spec.template: Install qemu-kvm-simpletrace.stp
|
|
|
9bac43 |
- 5292fc3 trace: add SystemTap init scripts for simpletrace bridge
|
|
|
9bac43 |
- eda9e5e simpletrace: install simpletrace.py
|
|
|
9bac43 |
- 85c4c8f trace: add systemtap-initscript README file to RPM
|
|
|
9bac43 |
|
|
|
9bac43 |
(cherry picked from commit bfc1d7f3628f2ffbabbae71d57a506cea6663ddf)
|
|
|
9bac43 |
---
|
|
|
9bac43 |
.gitignore | 2 ++
|
|
|
9bac43 |
Makefile | 4 +++
|
|
|
9bac43 |
README.systemtap | 43 +++++++++++++++++++++++++++++++++
|
|
|
9bac43 |
redhat/qemu-kvm.spec.template | 27 +++++++++++++++++++--
|
|
|
9bac43 |
scripts/systemtap/conf.d/qemu_kvm.conf | 4 +++
|
|
|
9bac43 |
scripts/systemtap/script.d/qemu_kvm.stp | 1 +
|
|
|
9bac43 |
6 files changed, 79 insertions(+), 2 deletions(-)
|
|
|
9bac43 |
create mode 100644 README.systemtap
|
|
|
9bac43 |
create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf
|
|
|
9bac43 |
create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/Makefile b/Makefile
|
|
|
9bac43 |
index 2cb2442..ba31124 100644
|
|
|
9bac43 |
--- a/Makefile
|
|
|
9bac43 |
+++ b/Makefile
|
|
|
9bac43 |
@@ -629,6 +629,10 @@ endif
|
|
|
9bac43 |
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
|
|
|
9bac43 |
done
|
|
|
9bac43 |
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
|
|
|
9bac43 |
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/script.d"
|
|
|
9bac43 |
+ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/script.d/qemu_kvm.stp "$(DESTDIR)$(qemu_datadir)/systemtap/script.d/"
|
|
|
9bac43 |
+ $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d"
|
|
|
9bac43 |
+ $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/conf.d/qemu_kvm.conf "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d/"
|
|
|
9bac43 |
for d in $(TARGET_DIRS); do \
|
|
|
9bac43 |
$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
|
|
|
9bac43 |
done
|
|
|
9bac43 |
diff --git a/README.systemtap b/README.systemtap
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..ad913fc
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/README.systemtap
|
|
|
9bac43 |
@@ -0,0 +1,43 @@
|
|
|
9bac43 |
+QEMU tracing using systemtap-initscript
|
|
|
9bac43 |
+---------------------------------------
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+You can capture QEMU trace data all the time using systemtap-initscript. This
|
|
|
9bac43 |
+uses SystemTap's flight recorder mode to trace all running guests to a
|
|
|
9bac43 |
+fixed-size buffer on the host. Old trace entries are overwritten by new
|
|
|
9bac43 |
+entries when the buffer size wraps.
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+1. Install the systemtap-initscript package:
|
|
|
9bac43 |
+ # yum install systemtap-initscript
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+2. Install the systemtap scripts and the conf file:
|
|
|
9bac43 |
+ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
|
|
|
9bac43 |
+ # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+The set of trace events to enable is given in qemu_kvm.stp. This SystemTap
|
|
|
9bac43 |
+script can be customized to add or remove trace events provided in
|
|
|
9bac43 |
+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+SystemTap customizations can be made to qemu_kvm.conf to control the flight
|
|
|
9bac43 |
+recorder buffer size and whether to store traces in memory only or disk too.
|
|
|
9bac43 |
+See stap(1) for option documentation.
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+3. Start the systemtap service.
|
|
|
9bac43 |
+ # service systemtap start qemu_kvm
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+4. Make the service start at boot time.
|
|
|
9bac43 |
+ # chkconfig systemtap on
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+5. Confirm that the service works.
|
|
|
9bac43 |
+ # service systemtap status qemu_kvm
|
|
|
9bac43 |
+ qemu_kvm is running...
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+When you want to inspect the trace buffer, perform the following steps:
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+1. Dump the trace buffer.
|
|
|
9bac43 |
+ # staprun -A qemu_kvm >/tmp/trace.log
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+2. Start the systemtap service because the preceding step stops the service.
|
|
|
9bac43 |
+ # service systemtap start qemu_kvm
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+3. Translate the trace record to readable format.
|
|
|
9bac43 |
+ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
|
|
|
9bac43 |
diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..372d816
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/scripts/systemtap/conf.d/qemu_kvm.conf
|
|
|
9bac43 |
@@ -0,0 +1,4 @@
|
|
|
9bac43 |
+# Force load uprobes (see BZ#1118352)
|
|
|
9bac43 |
+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes
|
|
|
9bac43 |
diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..c04abf9
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/scripts/systemtap/script.d/qemu_kvm.stp
|
|
|
9bac43 |
@@ -0,0 +1 @@
|
|
|
9bac43 |
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|