From patchwork Sun Jul 30 11:28:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 795319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xL0j468Vtz9s81 for ; Sun, 30 Jul 2017 21:29:11 +1000 (AEST) Received: from localhost ([::1]:54888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbmPE-0008UQ-R5 for incoming@patchwork.ozlabs.org; Sun, 30 Jul 2017 07:29:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbmOw-0008U7-5W for qemu-devel@nongnu.org; Sun, 30 Jul 2017 07:28:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbmOs-0000II-4L for qemu-devel@nongnu.org; Sun, 30 Jul 2017 07:28:50 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:39057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbmOr-0000Hh-Jm for qemu-devel@nongnu.org; Sun, 30 Jul 2017 07:28:46 -0400 Received: from correu-1.ac.upc.es (correu-1.ac.upc.es [147.83.30.91]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v6UBSiYZ015015; Sun, 30 Jul 2017 13:28:44 +0200 Received: from localhost (unknown [132.68.137.196]) by correu-1.ac.upc.es (Postfix) with ESMTPSA id 1321C1B8; Sun, 30 Jul 2017 13:28:38 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Sun, 30 Jul 2017 14:28:37 +0300 Message-Id: <150141411773.9857.15398228126805985214.stgit@frigg.lan> X-Mailer: git-send-email 2.13.2 In-Reply-To: <150141363372.9857.9055094189388759132.stgit@frigg.lan> References: <150141363372.9857.9055094189388759132.stgit@frigg.lan> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v6UBSiYZ015015 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v7 2/5] hypertrace: Add tracing event "guest_hypertrace" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , Luiz Capitulino Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Generates the "guest_hypertrace" event with a user-configurable number of arguments. Signed-off-by: LluĂ­s Vilanova --- Makefile | 6 ++++-- Makefile.objs | 2 ++ configure | 34 ++++++++++++++++++++++++++++++++++ rules.mak | 2 +- trace-events | 11 +++++++++++ 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 38814f9a61..f08f498f79 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,7 @@ endif GENERATED_FILES += $(TRACE_HEADERS) GENERATED_FILES += $(TRACE_SOURCES) GENERATED_FILES += $(BUILD_DIR)/trace-events-all +GENERATED_FILES += $(BUILD_DIR)/hypertrace/trace.h trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g') @@ -92,7 +93,7 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") %/trace.h: %/trace.h-timestamp @cmp $< $@ >/dev/null 2>&1 || cp $< $@ -%/trace.h-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) +%/trace.h-timestamp: %/trace-events $(tracetool-y) $(call quiet-command,$(TRACETOOL) \ --group=$(call trace-group-name,$@) \ --format=h \ @@ -101,7 +102,7 @@ tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") %/trace.c: %/trace.c-timestamp @cmp $< $@ >/dev/null 2>&1 || cp $< $@ -%/trace.c-timestamp: $(SRC_PATH)/%/trace-events $(tracetool-y) +%/trace.c-timestamp: %/trace-events $(tracetool-y) $(call quiet-command,$(TRACETOOL) \ --group=$(call trace-group-name,$@) \ --format=c \ @@ -534,6 +535,7 @@ distclean: clean rm -Rf .sdk if test -f pixman/config.log; then $(MAKE) -C pixman distclean; fi if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi + rm -f hypertrace/trace-events KEYMAPS=da en-gb et fr fr-ch is lt modifiers no pt-br sv \ ar de en-us fi fr-be hr it lv nl pl ru th \ diff --git a/Makefile.objs b/Makefile.objs index bfd5a6ceb1..ce9a60137b 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -170,9 +170,11 @@ trace-events-subdirs += accel/kvm trace-events-subdirs += nbd trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events) +trace-events-files += $(BUILD_DIR)/hypertrace/trace-events trace-obj-y = trace-root.o trace-obj-y += $(trace-events-subdirs:%=%/trace.o) trace-obj-$(CONFIG_TRACE_UST) += trace-ust-all.o trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace-root.o trace-obj-$(CONFIG_TRACE_DTRACE) += $(trace-events-subdirs:%=%/trace-dtrace.o) +trace-obj-y += $(BUILD_DIR)/hypertrace/trace.o diff --git a/configure b/configure index a3f0522e8f..e6f752c242 100755 --- a/configure +++ b/configure @@ -351,6 +351,7 @@ pie="" qom_cast_debug="yes" trace_backends="log" trace_file="trace" +hypertrace="1" spice="" rbd="" smartcard="" @@ -895,6 +896,8 @@ for opt do ;; --with-trace-file=*) trace_file="$optarg" ;; + --with-hypertrace-args=*) hypertrace="$optarg" + ;; --enable-gprof) gprof="yes" ;; --enable-gcov) gcov="yes" @@ -1425,6 +1428,8 @@ Advanced options (experts only): Available backends: $trace_backend_list --with-trace-file=NAME Full PATH,NAME of file to store traces Default:trace- + --with-hypertrace-args=NUMBER + number of hypertrace arguments (default: $hypertrace) --disable-slirp disable SLIRP userspace network connectivity --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) --oss-lib path to OSS library @@ -4434,6 +4439,16 @@ if test "$?" -ne 0 ; then fi ########################################## +# check hypertrace arguments +case "$hypertrace" in + ''|*[!0-9]*) error_exit "invalid number of hypertrace arguments" ;; + *) ;; +esac +if test $hypertrace = 0; then + error_exit "hypertrace arguments must be greater than zero" +fi + +########################################## # For 'ust' backend, test if ust headers are present if have_backend "ust"; then cat > $TMPC << EOF @@ -5282,6 +5297,7 @@ echo "Trace backends $trace_backends" if have_backend "simple"; then echo "Trace output file $trace_file-" fi +echo "Hypertrace arguments $hypertrace" echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" echo "rbd support $rbd" echo "xfsctl support $xfs" @@ -5989,6 +6005,24 @@ else fi QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES" +# hypertrace +echo "CONFIG_HYPERTRACE_ARGS=$hypertrace" >> $config_host_mak +hypertrace_events=hypertrace/trace-events +mkdir -p $(dirname $hypertrace_events) +echo "# See docs/trace-events.txt for syntax documentation." >$hypertrace_events +echo -n 'vcpu guest_hypertrace(' >>$hypertrace_events +for i in `seq $hypertrace`; do + if test $i != 1; then + echo -n ", " >>$hypertrace_events + fi + echo -n "uint64_t arg$i" >>$hypertrace_events +done +echo -n ') ' >>$hypertrace_events +for i in `seq $hypertrace`; do + echo -n "\" arg$i=0x%016\"PRIx64" >>$hypertrace_events +done +echo >>$hypertrace_events + echo "TOOLS=$tools" >> $config_host_mak echo "ROMS=$roms" >> $config_host_mak echo "MAKE=$make" >> $config_host_mak diff --git a/rules.mak b/rules.mak index 6e943335f3..8d3915070b 100644 --- a/rules.mak +++ b/rules.mak @@ -139,7 +139,7 @@ cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ cc-c-option = $(if $(shell $(CC) $1 $2 -c -o /dev/null -xc /dev/null \ >/dev/null 2>&1 && echo OK), $2, $3) -VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc +VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc %trace-events set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) # install-prog list, dir diff --git a/trace-events b/trace-events index f9dbd7f509..aeb7b6807d 100644 --- a/trace-events +++ b/trace-events @@ -88,6 +88,17 @@ vcpu guest_cpu_exit(void) # Targets: all vcpu guest_cpu_reset(void) +# @argX: Hypertrace arguments. +# +# Event explicitly triggered by guest code. The event definition is +# auto-generated from the "--with-hypertrace-args" configuration argument (see +# "docs/hypertrace.txt"): +# +# vcpu guest_hypertrace(uint64_t arg0, ..., uint64_t argN-1) +# +# Mode: all +# Targets: all + # @vaddr: Access' virtual address. # @info : Access' information (see below). #