From nobody Thu May 2 21:34:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492768506859569.8607921673611; Fri, 21 Apr 2017 02:55:06 -0700 (PDT) Received: from localhost ([::1]:58282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1VHN-0006eX-68 for importer@patchew.org; Fri, 21 Apr 2017 05:55:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1VG2-0005pa-SK for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1VG1-0002Ve-2m for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1VG0-0002VY-Pq for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF622B083A; Fri, 21 Apr 2017 09:53:39 +0000 (UTC) Received: from localhost (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4145D827B3; Fri, 21 Apr 2017 09:53:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF622B083A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AF622B083A From: Stefan Hajnoczi To: Date: Fri, 21 Apr 2017 10:53:32 +0100 Message-Id: <20170421095334.26692-2-stefanha@redhat.com> In-Reply-To: <20170421095334.26692-1-stefanha@redhat.com> References: <20170421095334.26692-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Apr 2017 09:53:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ./configure script should produce --help output even if Python is not installed. Listing trace backends is simple: show the names of all Python modules in scripts/tracetool/backend/ whose source code contains 'PUBLIC =3D True'. Perform the backend enumeration in shell instead of Python so that we can move the Python check until after ./configure --help. Reported-by: Peter Maydell Signed-off-by: Stefan Hajnoczi Reviewed-by: Peter Maydell Message-id: 20170328134418.3426-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- configure | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/configure b/configure index be4d326..6db3044 100755 --- a/configure +++ b/configure @@ -1191,21 +1191,6 @@ for opt do esac done =20 -if ! has $python; then - error_exit "Python not found. Use --python=3D/path/to/python" -fi - -# Note that if the Python conditional here evaluates True we will exit -# with status 1 which is a shell 'false' value. -if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.vers= ion_info >=3D (3,))'; then - error_exit "Cannot use '$python', Python 2.6 or later is required." \ - "Note that Python 3 or later is not yet supported." \ - "Use --python=3D/path/to/python to specify a supported Python." -fi - -# Suppress writing compiled files -python=3D"$python -B" - case "$cpu" in ppc) CPU_CFLAGS=3D"-m32" @@ -1280,6 +1265,9 @@ for config in $mak_wilds; do default_target_list=3D"${default_target_list} $(basename "$config" .ma= k)" done =20 +# Enumerate public trace backends for --help output +trace_backend_list=3D$(echo $(grep -le '^PUBLIC =3D True$' scripts/traceto= ol/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/')) + if test x"$show_help" =3D x"yes" ; then cat << EOF =20 @@ -1333,7 +1321,7 @@ Advanced options (experts only): set block driver read-only whitelist (affects only QEMU, not qemu-img) --enable-trace-backends=3DB Set trace backend - Available backends: $($python $source_path/scri= pts/tracetool.py --list-backends) + Available backends: $trace_backend_list --with-trace-file=3DNAME Full PATH,NAME of file to store traces Default:trace- --disable-slirp disable SLIRP userspace network connectivity @@ -1433,6 +1421,21 @@ EOF exit 0 fi =20 +if ! has $python; then + error_exit "Python not found. Use --python=3D/path/to/python" +fi + +# Note that if the Python conditional here evaluates True we will exit +# with status 1 which is a shell 'false' value. +if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.vers= ion_info >=3D (3,))'; then + error_exit "Cannot use '$python', Python 2.6 or later is required." \ + "Note that Python 3 or later is not yet supported." \ + "Use --python=3D/path/to/python to specify a supported Python." +fi + +# Suppress writing compiled files +python=3D"$python -B" + # Now we have handled --enable-tcg-interpreter and know we're not just # printing the help message, bail out if the host CPU isn't supported. if test "$ARCH" =3D "unknown"; then --=20 2.9.3 From nobody Thu May 2 21:34:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492768606606790.6707587182107; Fri, 21 Apr 2017 02:56:46 -0700 (PDT) Received: from localhost ([::1]:58292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1VIz-000818-1C for importer@patchew.org; Fri, 21 Apr 2017 05:56:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1VG5-0005rG-Na for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1VG4-0002WK-Iz for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1VG4-0002W5-9z for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28EF5C054938; Fri, 21 Apr 2017 09:53:43 +0000 (UTC) Received: from localhost (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BADB80710; Fri, 21 Apr 2017 09:53:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 28EF5C054938 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 28EF5C054938 From: Stefan Hajnoczi To: Date: Fri, 21 Apr 2017 10:53:33 +0100 Message-Id: <20170421095334.26692-3-stefanha@redhat.com> In-Reply-To: <20170421095334.26692-1-stefanha@redhat.com> References: <20170421095334.26692-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 21 Apr 2017 09:53:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL for-2.9 2/3] trace: Put all trace.o into libqemuutil.a 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: Peter Maydell , "Xu, Anthony" , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Xu, Anthony" Currently all trace.o are linked into qemu-system, qemu-img, qemu-nbd, qemu-io etc., even the corresponding components are not included. Put all trace.o into libqemuutil.a that the linker would only pull in .o files containing symbols that are actually referenced by the program. Signed-off -by: Anthony Xu Signed-off-by: Stefan Hajnoczi --- Makefile | 6 +++--- Makefile.target | 5 ++--- tests/Makefile.include | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6c359b2..31d41a7 100644 --- a/Makefile +++ b/Makefile @@ -346,7 +346,7 @@ dtc/%: mkdir -p $@ =20 $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(chardev-obj= -y) \ - $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) $(trace-obj-y) + $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) =20 ROMSUBDIR_RULES=3D$(patsubst %,romsubdir-%, $(ROMS)) # Only keep -O and -g cflags @@ -366,11 +366,11 @@ Makefile: $(version-obj-y) # Build libraries =20 libqemustub.a: $(stub-obj-y) -libqemuutil.a: $(util-obj-y) +libqemuutil.a: $(util-obj-y) $(trace-obj-y) =20 ###################################################################### =20 -COMMON_LDADDS =3D $(trace-obj-y) libqemuutil.a libqemustub.a +COMMON_LDADDS =3D libqemuutil.a libqemustub.a =20 qemu-img.o: qemu-img-cmds.h =20 diff --git a/Makefile.target b/Makefile.target index 7df2b8c..e62021d 100644 --- a/Makefile.target +++ b/Makefile.target @@ -188,8 +188,7 @@ dummy :=3D $(call unnest-vars,.., \ qom-obj-y \ io-obj-y \ common-obj-y \ - common-obj-m \ - trace-obj-y) + common-obj-m) target-obj-y :=3D $(target-obj-y-save) all-obj-y +=3D $(common-obj-y) all-obj-y +=3D $(target-obj-y) @@ -201,7 +200,7 @@ all-obj-$(CONFIG_SOFTMMU) +=3D $(io-obj-y) =20 $(QEMU_PROG_BUILD): config-devices.mak =20 -COMMON_LDADDS =3D $(trace-obj-y) ../libqemuutil.a ../libqemustub.a +COMMON_LDADDS =3D ../libqemuutil.a ../libqemustub.a =20 # build either PROG or PROGW $(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS) diff --git a/tests/Makefile.include b/tests/Makefile.include index f3de81f..579ec07 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -519,7 +519,7 @@ QEMU_CFLAGS +=3D -I$(SRC_PATH)/tests =20 =20 # Deps that are common to various different sets of tests below -test-util-obj-y =3D $(trace-obj-y) libqemuutil.a libqemustub.a +test-util-obj-y =3D libqemuutil.a libqemustub.a test-qom-obj-y =3D $(qom-obj-y) $(test-util-obj-y) test-qapi-obj-y =3D tests/test-qapi-visit.o tests/test-qapi-types.o \ tests/test-qapi-event.o tests/test-qmp-introspect.o \ --=20 2.9.3 From nobody Thu May 2 21:34:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492768512861442.21311090309644; Fri, 21 Apr 2017 02:55:12 -0700 (PDT) Received: from localhost ([::1]:58284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1VHT-0006jd-GV for importer@patchew.org; Fri, 21 Apr 2017 05:55:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1VG7-0005t0-ME for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1VG6-0002Wf-D7 for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1VG6-0002WQ-6O for qemu-devel@nongnu.org; Fri, 21 Apr 2017 05:53:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12F3BA3278; Fri, 21 Apr 2017 09:53:45 +0000 (UTC) Received: from localhost (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B331827B3; Fri, 21 Apr 2017 09:53:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 12F3BA3278 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 12F3BA3278 From: Stefan Hajnoczi To: Date: Fri, 21 Apr 2017 10:53:34 +0100 Message-Id: <20170421095334.26692-4-stefanha@redhat.com> In-Reply-To: <20170421095334.26692-1-stefanha@redhat.com> References: <20170421095334.26692-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Apr 2017 09:53:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL for-2.9 3/3] simpletrace: document Analyzer method signatures 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Users can inherit from the simpletrace.Analyzer class and receive callbacks when events of interest occur in a trace file. The method signature is a little magic because the timestamp and pid arguments are optional. Document this. Signed-off-by: Stefan Hajnoczi Reviewed-by: Alex Benn=C3=A9e Message-id: 20170411095654.18383-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- scripts/simpletrace.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 4c99004..d60b3a0 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -116,7 +116,28 @@ class Analyzer(object): is invoked. =20 If a method matching a trace event name exists, it is invoked to proce= ss - that trace record. Otherwise the catchall() method is invoked.""" + that trace record. Otherwise the catchall() method is invoked. + + Example: + The following method handles the runstate_set(int new_state) trace eve= nt:: + + def runstate_set(self, new_state): + ... + + The method can also take a timestamp argument before the trace event + arguments:: + + def runstate_set(self, timestamp, new_state): + ... + + Timestamps have the uint64_t type and are in nanoseconds. + + The pid can be included in addition to the timestamp and is useful when + dealing with traces from multiple processes:: + + def runstate_set(self, timestamp, pid, new_state): + ... + """ =20 def begin(self): """Called at the start of the trace.""" --=20 2.9.3