From patchwork Wed Sep 28 13:05:41 2016 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: 676256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3skf8W1P9Wz9sC4 for ; Wed, 28 Sep 2016 23:44:59 +1000 (AEST) Received: from localhost ([::1]:58952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpFAN-0005Bl-Km for incoming@patchwork.ozlabs.org; Wed, 28 Sep 2016 09:44:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpEdK-0003oo-1a for qemu-devel@nongnu.org; Wed, 28 Sep 2016 09:10:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpEdC-0000QD-No for qemu-devel@nongnu.org; Wed, 28 Sep 2016 09:10:44 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:57526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpEdC-0000NU-Bl for qemu-devel@nongnu.org; Wed, 28 Sep 2016 09:10:38 -0400 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u8SD5fZT032473; Wed, 28 Sep 2016 15:05:41 +0200 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id A6F107CE; Wed, 28 Sep 2016 15:05:41 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 28 Sep 2016 15:05:41 +0200 Message-Id: <147506794138.18187.6480611518997322451.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.9.3 In-Reply-To: <147506793053.18187.11460694747365824870.stgit@fimbulvetr.bsc.es> References: <147506793053.18187.11460694747365824870.stgit@fimbulvetr.bsc.es> 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 u8SD5fZT032473 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v3 2/6] 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.objs | 2 ++ configure | 34 ++++++++++++++++++++++++++++++++++ trace-events | 11 +++++++++++ trace/Makefile.objs | 2 +- 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Makefile.objs b/Makefile.objs index 7301544..1879409 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -160,3 +160,5 @@ trace-events-y += target-s390x/trace-events trace-events-y += target-ppc/trace-events trace-events-y += qom/trace-events trace-events-y += linux-user/trace-events + +trace-events-gen-y = hypertrace/trace-events diff --git a/configure b/configure index 8fa62ad..a25c33e 100755 --- a/configure +++ b/configure @@ -273,6 +273,7 @@ pie="" qom_cast_debug="yes" trace_backends="log" trace_file="trace" +hypertrace="1" spice="" rbd="" smartcard="" @@ -785,6 +786,8 @@ for opt do ;; --with-trace-file=*) trace_file="$optarg" ;; + --with-hypertrace-args=*) hypertrace="$optarg" + ;; --enable-gprof) gprof="yes" ;; --enable-gcov) gcov="yes" @@ -1309,6 +1312,8 @@ Advanced options (experts only): Available backends: $($python $source_path/scripts/tracetool.py --list-backends) --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 @@ -4171,6 +4176,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 @@ -4844,6 +4859,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" @@ -5480,6 +5496,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 1cb9d37..8c8f7a1 100644 --- a/trace-events +++ b/trace-events @@ -157,6 +157,17 @@ colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=%u\n" ### Guest events, keep at bottom +# @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). # diff --git a/trace/Makefile.objs b/trace/Makefile.objs index 4d91b3b..b71ec54 100644 --- a/trace/Makefile.objs +++ b/trace/Makefile.objs @@ -8,7 +8,7 @@ tracetool-y = $(SRC_PATH)/scripts/tracetool.py tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py") -$(BUILD_DIR)/trace-events-all: $(trace-events-y:%=$(SRC_PATH)/%) +$(BUILD_DIR)/trace-events-all: $(trace-events-y:%=$(SRC_PATH)/%) $(trace-events-gen-y:%=$(BUILD_DIR)/%) $(call quiet-command,cat $^ > $@) ######################################################################