yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-trace-add-SystemTap-init-scripts-for-simpletrace-bri.patch

9ae3a8
From a8ebb2f69df031099116afebca2fb2a2cb3ec678 Mon Sep 17 00:00:00 2001
9ae3a8
From: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Date: Tue, 7 Oct 2014 14:06:58 +0200
9ae3a8
Subject: [PATCH 40/43] trace: add SystemTap init scripts for simpletrace
9ae3a8
 bridge
9ae3a8
9ae3a8
Message-id: <1412690820-31016-10-git-send-email-stefanha@redhat.com>
9ae3a8
Patchwork-id: 61614
9ae3a8
O-Subject: [RHEL7.1 qemu-kvm PATCH 09/11] trace: add SystemTap init scripts for simpletrace bridge
9ae3a8
Bugzilla: 1088112
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
Add example files for use with the systemtap-initscript package.  These
9ae3a8
example files set up the SystemTap flight recorder with our simpletrace
9ae3a8
bridge script.  In other words, they set up always-on simpletrace.
9ae3a8
9ae3a8
The example file enables a small subset of trace events across all
9ae3a8
qemu-kvm processes with 4MB per CPU trace buffers.  This example
9ae3a8
configuration may be useful to customers who wish to run with always-on
9ae3a8
tracing.
9ae3a8
9ae3a8
To enable it:
9ae3a8
9ae3a8
  # yum install systemtap-initscript
9ae3a8
  # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
9ae3a8
  # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
9ae3a8
  # service systemtap start qemu_kvm
9ae3a8
9ae3a8
Note that due to systemtap-initscript naming restrictions the scripts
9ae3a8
are called "qemu_kvm" instead of "qemu-kvm".
9ae3a8
9ae3a8
Once installed the script will be activated on boot.
9ae3a8
9ae3a8
Note that since gitignore(1) hides *.d we explicitly unhide
9ae3a8
scripts/systemtap/{conf.d,script.d} in this patch.
9ae3a8
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 3a83a60ee0fd25580499695e4781fc473de147c5)
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	Makefile
9ae3a8
	redhat/qemu-kvm.spec.template
9ae3a8
9ae3a8
This downstream commit from RHEL 6.6 was forwarded-ported to RHEL 7.1
9ae3a8
where the Makefile and qemu-kvm.spec.template are organized differently.
9ae3a8
---
9ae3a8
 .gitignore                              | 2 ++
9ae3a8
 Makefile                                | 4 ++++
9ae3a8
 redhat/qemu-kvm.spec.template           | 4 +++-
9ae3a8
 scripts/systemtap/conf.d/qemu_kvm.conf  | 4 ++++
9ae3a8
 scripts/systemtap/script.d/qemu_kvm.stp | 1 +
9ae3a8
 5 files changed, 14 insertions(+), 1 deletion(-)
9ae3a8
 create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf
9ae3a8
 create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp
9ae3a8
9ae3a8
diff --git a/.gitignore b/.gitignore
9ae3a8
index 4f2345c..454561e 100644
9ae3a8
--- a/.gitignore
9ae3a8
+++ b/.gitignore
9ae3a8
@@ -74,6 +74,8 @@ fsdev/virtfs-proxy-helper.pod
9ae3a8
 *.vr
9ae3a8
 *.d
9ae3a8
 !scripts/qemu-guest-agent/fsfreeze-hook.d
9ae3a8
+!scripts/systemtap/script.d
9ae3a8
+!scripts/systemtap/conf.d
9ae3a8
 *.o
9ae3a8
 *.lo
9ae3a8
 *.la
9ae3a8
diff --git a/Makefile b/Makefile
9ae3a8
index 1b0b4f7..8407945 100644
9ae3a8
--- a/Makefile
9ae3a8
+++ b/Makefile
9ae3a8
@@ -407,6 +407,10 @@ endif
9ae3a8
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
9ae3a8
 	done
9ae3a8
 	$(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(qemu_datadir)/trace-events"
9ae3a8
+	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/script.d"
9ae3a8
+	$(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/script.d/qemu_kvm.stp "$(DESTDIR)$(qemu_datadir)/systemtap/script.d/"
9ae3a8
+	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d"
9ae3a8
+	$(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/conf.d/qemu_kvm.conf "$(DESTDIR)$(qemu_datadir)/systemtap/conf.d/"
9ae3a8
 	for d in $(TARGET_DIRS); do \
9ae3a8
 	$(MAKE) -C $$d $@ || exit 1 ; \
9ae3a8
         done
9ae3a8
diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf
9ae3a8
new file mode 100644
9ae3a8
index 0000000..372d816
9ae3a8
--- /dev/null
9ae3a8
+++ b/scripts/systemtap/conf.d/qemu_kvm.conf
9ae3a8
@@ -0,0 +1,4 @@
9ae3a8
+# Force load uprobes (see BZ#1118352)
9ae3a8
+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true
9ae3a8
+
9ae3a8
+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes
9ae3a8
diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp
9ae3a8
new file mode 100644
9ae3a8
index 0000000..c04abf9
9ae3a8
--- /dev/null
9ae3a8
+++ b/scripts/systemtap/script.d/qemu_kvm.stp
9ae3a8
@@ -0,0 +1 @@
9ae3a8
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8