cryptospore / rpms / qemu-kvm

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