From patchwork Sun Jul 30 14:16:23 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: 9870521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0130360353 for ; Sun, 30 Jul 2017 14:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4E82285B3 for ; Sun, 30 Jul 2017 14:17:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D85F3285B7; Sun, 30 Jul 2017 14:17:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C193285B3 for ; Sun, 30 Jul 2017 14:17:17 +0000 (UTC) Received: from localhost ([::1]:55485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbp1w-00013y-2d for patchwork-qemu-devel@patchwork.kernel.org; Sun, 30 Jul 2017 10:17:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbp1I-00013f-QI for qemu-devel@nongnu.org; Sun, 30 Jul 2017 10:16:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbp1F-0000Xc-Ko for qemu-devel@nongnu.org; Sun, 30 Jul 2017 10:16:36 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:42269 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbp1F-0000Wd-7O for qemu-devel@nongnu.org; Sun, 30 Jul 2017 10:16:33 -0400 Received: from correu-2.ac.upc.es (correu-2.ac.upc.es [147.83.30.92]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v6UEGTPV017763; Sun, 30 Jul 2017 16:16:30 +0200 Received: from localhost (unknown [132.68.137.196]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id 3BF81203; Sun, 30 Jul 2017 16:16:24 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Sun, 30 Jul 2017 17:16:23 +0300 Message-Id: <150142418286.12995.12421376896640234390.stgit@frigg.lan> X-Mailer: git-send-email 2.13.2 In-Reply-To: <150142369849.12995.11229612194223213120.stgit@frigg.lan> References: <150142369849.12995.11229612194223213120.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 v6UEGTPV017763 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 v8 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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). #