From 9ebef95082db7852d8e610be9051dd9c4dfd1da3 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 11 Jul 2014 17:18:30 +0200 Subject: [PATCH 42/44] trace: add SystemTap init scripts for simpletrace bridge RH-Author: Stefan Hajnoczi Message-id: <1405099110-10975-8-git-send-email-stefanha@redhat.com> Patchwork-id: 59865 O-Subject: [RHEL6.6 qemu-kvm PATCH 7/7] trace: add SystemTap init scripts for simpletrace bridge Bugzilla: 905761 RH-Acked-by: Laszlo Ersek RH-Acked-by: Miroslav Rezanina RH-Acked-by: Paolo Bonzini Add example files for use with the systemtap-initscript package. These example files set up the SystemTap flight recorder with our simpletrace bridge script. In other words, they set up always-on simpletrace. The example file enables a small subset of trace events across all qemu-kvm processes with 4MB per CPU trace buffers. This example configuration may be useful to customers who wish to run with always-on tracing. To enable it: # yum install systemtap-initscript # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/ # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/ # service systemtap start qemu_kvm Note that due to systemtap-initscript naming restrictions the scripts are called "qemu_kvm" instead of "qemu-kvm". Once installed the script will be activated on boot. Note that since gitignore(1) hides *.d we explicitly unhide scripts/systemtap/{conf.d,script.d} in this patch. Signed-off-by: Stefan Hajnoczi --- .gitignore | 2 ++ Makefile | 4 ++++ redhat/qemu-kvm.spec.template | 2 ++ scripts/systemtap/conf.d/qemu_kvm.conf | 4 ++++ scripts/systemtap/script.d/qemu_kvm.stp | 1 + 5 files changed, 13 insertions(+) create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp Signed-off-by: Miroslav Rezanina --- .gitignore | 2 ++ Makefile | 4 ++++ redhat/qemu-kvm.spec.template | 2 ++ scripts/systemtap/conf.d/qemu_kvm.conf | 4 ++++ scripts/systemtap/script.d/qemu_kvm.stp | 1 + 5 files changed, 13 insertions(+), 0 deletions(-) create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp diff --git a/Makefile b/Makefile index e3278c3..9ff226d 100644 --- a/Makefile +++ b/Makefile @@ -411,6 +411,10 @@ endif $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ done $(INSTALL_DATA) $(SRC_PATH)/trace-events "$(DESTDIR)$(datadir)" + $(INSTALL_DIR) "$(DESTDIR)$(datadir)/systemtap/script.d" + $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/script.d/qemu_kvm.stp "$(DESTDIR)$(datadir)/systemtap/script.d/" + $(INSTALL_DIR) "$(DESTDIR)$(datadir)/systemtap/conf.d" + $(INSTALL_DATA) $(SRC_PATH)/scripts/systemtap/conf.d/qemu_kvm.conf "$(DESTDIR)$(datadir)/systemtap/conf.d/" $(INSTALL_PROG) $(SRC_PATH)/scripts/simpletrace.py "$(DESTDIR)$(datadir)" for d in $(TARGET_DIRS); do \ $(MAKE) -C $$d $@ || exit 1 ; \ diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf new file mode 100644 index 0000000..372d816 --- /dev/null +++ b/scripts/systemtap/conf.d/qemu_kvm.conf @@ -0,0 +1,4 @@ +# Force load uprobes (see BZ#1118352) +stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true + +qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp new file mode 100644 index 0000000..c04abf9 --- /dev/null +++ b/scripts/systemtap/script.d/qemu_kvm.stp @@ -0,0 +1 @@ +probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {} -- 1.7.1