From patchwork Wed Jul 26 16:56:30 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: 9865401 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 67F1F6038C for ; Wed, 26 Jul 2017 16:57:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ABCC28798 for ; Wed, 26 Jul 2017 16:57:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F24E2879C; Wed, 26 Jul 2017 16:57:22 +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 A378B28798 for ; Wed, 26 Jul 2017 16:57:21 +0000 (UTC) Received: from localhost ([::1]:39239 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daPcd-0003vT-3M for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Jul 2017 12:57:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daPc6-0003vN-6J for qemu-devel@nongnu.org; Wed, 26 Jul 2017 12:56:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daPc1-0005jW-8m for qemu-devel@nongnu.org; Wed, 26 Jul 2017 12:56:46 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:50428 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daPc0-0005ik-Qz for qemu-devel@nongnu.org; Wed, 26 Jul 2017 12:56:41 -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 v6QGucLR000606; Wed, 26 Jul 2017 18:56:38 +0200 Received: from localhost (unknown [31.210.188.120]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id 1B0821A2; Wed, 26 Jul 2017 18:56:32 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 26 Jul 2017 19:56:30 +0300 Message-Id: <150108819035.11502.13406314529518835262.stgit@frigg.lan> X-Mailer: git-send-email 2.13.2 In-Reply-To: <150108770564.11502.9555409719195740021.stgit@frigg.lan> References: <150108770564.11502.9555409719195740021.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 v6QGucLR000606 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 v5 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 | 7 ++++--- Makefile.objs | 2 ++ configure | 34 ++++++++++++++++++++++++++++++++++ trace-events | 11 +++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 38814f9a61..d45158cf29 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,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 +92,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 +101,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 +534,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/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). #