From nobody Sun May 5 08:08:36 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529593510962328.89936917247655; Thu, 21 Jun 2018 08:05:10 -0700 (PDT) Received: from localhost ([::1]:55969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fW18z-0005sJ-Dd for importer@patchew.org; Thu, 21 Jun 2018 11:05:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fW171-0004uO-0t for qemu-devel@nongnu.org; Thu, 21 Jun 2018 11:03:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fW16v-0008TP-5c for qemu-devel@nongnu.org; Thu, 21 Jun 2018 11:03:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53428 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fW16u-0008TD-Vx for qemu-devel@nongnu.org; Thu, 21 Jun 2018 11:02:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7ECCC81A4EA7; Thu, 21 Jun 2018 15:02:56 +0000 (UTC) Received: from localhost (ovpn-116-75.ams2.redhat.com [10.36.116.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id D64BE2026D6B; Thu, 21 Jun 2018 15:02:55 +0000 (UTC) From: Stefan Hajnoczi To: Date: Thu, 21 Jun 2018 16:02:54 +0100 Message-Id: <20180621150254.4922-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 21 Jun 2018 15:02:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 21 Jun 2018 15:02:56 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' 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: 66.187.233.73 Subject: [Qemu-devel] [PATCH] trace: forbid floating point types 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 , Juan Quintela , Markus Armbruster , Michael Roth , "Dr. David Alan Gilbert" , 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" Only one existing trace event uses a floating point type. Unfortunately float and double cannot be supported since SystemTap does not have floating point types. Remove float and double from the whitelist and document this limitation. Update the migrate_transferred trace event to use uint64_t instead of double. Cc: Dr. David Alan Gilbert Cc: Daniel P. Berrang=C3=A9 Cc: Peter Maydell Signed-off-by: Stefan Hajnoczi Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- docs/devel/tracing.txt | 5 +++++ migration/trace-events | 2 +- qapi/trace-events | 2 +- scripts/tracetool/__init__.py | 2 -- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/devel/tracing.txt b/docs/devel/tracing.txt index 07abbb345c..6f815ecbd7 100644 --- a/docs/devel/tracing.txt +++ b/docs/devel/tracing.txt @@ -104,6 +104,11 @@ Trace events should use types as follows: * For everything else, use primitive scalar types (char, int, long) with = the appropriate signedness. =20 + * Avoid floating point types (float and double) because SystemTap does not + support them. In most cases it is possible to round to an integer type + instead. This may require scaling the value first by multiplying it by= 1000 + or the like when digits after the decimal point need to be preserved. + Format strings should reflect the types defined in the trace event. Take special care to use PRId64 and PRIu64 for int64_t and uint64_t types, respectively. This ensures portability between 32- and 64-bit platforms. diff --git a/migration/trace-events b/migration/trace-events index 3f67758893..7ea522e453 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -133,7 +133,7 @@ migrate_global_state_post_load(const char *state) "load= ed state: %s" migrate_global_state_pre_save(const char *state) "saved state: %s" migration_thread_low_pending(uint64_t pending) "%" PRIu64 migrate_state_too_big(void) "" -migrate_transferred(uint64_t tranferred, uint64_t time_spent, double bandw= idth, uint64_t size) "transferred %" PRIu64 " time_spent %" PRIu64 " bandwi= dth %g max_size %" PRId64 +migrate_transferred(uint64_t tranferred, uint64_t time_spent, uint64_t ban= dwidth, uint64_t size) "transferred %" PRIu64 " time_spent %" PRIu64 " band= width %" PRIu64 " max_size %" PRId64 process_incoming_migration_co_end(int ret, int ps) "ret=3D%d postcopy-stat= e=3D%d" process_incoming_migration_co_postcopy_end_main(void) "" migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" diff --git a/qapi/trace-events b/qapi/trace-events index 9e9008a1dc..70e049ea80 100644 --- a/qapi/trace-events +++ b/qapi/trace-events @@ -29,6 +29,6 @@ visit_type_int64(void *v, const char *name, int64_t *obj)= "v=3D%p name=3D%s obj=3D%p" visit_type_size(void *v, const char *name, uint64_t *obj) "v=3D%p name=3D%= s obj=3D%p" visit_type_bool(void *v, const char *name, bool *obj) "v=3D%p name=3D%s ob= j=3D%p" visit_type_str(void *v, const char *name, char **obj) "v=3D%p name=3D%s ob= j=3D%p" -visit_type_number(void *v, const char *name, double *obj) "v=3D%p name=3D%= s obj=3D%p" +visit_type_number(void *v, const char *name, void *obj) "v=3D%p name=3D%s = obj=3D%p" visit_type_any(void *v, const char *name, void *obj) "v=3D%p name=3D%s obj= =3D%p" visit_type_null(void *v, const char *name, void *obj) "v=3D%p name=3D%s ob= j=3D%p" diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index b20fac34a3..0e3c9e146c 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -53,8 +53,6 @@ ALLOWED_TYPES =3D [ "bool", "unsigned", "signed", - "float", - "double", "int8_t", "uint8_t", "int16_t", --=20 2.17.1