From nobody Sun Feb 8 23:02:11 2026 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 15301058086268.369139531498263; Wed, 27 Jun 2018 06:23:28 -0700 (PDT) Received: from localhost ([::1]:59164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYAPv-0005mz-QG for importer@patchew.org; Wed, 27 Jun 2018 09:23:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA2C-0003b5-2D for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:58:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYA2B-0003st-5O for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:58:56 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45800 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 1fYA2B-0003sd-0C for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:58:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76C59B5C4; Wed, 27 Jun 2018 12:58:54 +0000 (UTC) Received: from localhost (ovpn-117-219.ams2.redhat.com [10.36.117.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 603D21C5B9; Wed, 27 Jun 2018 12:58:52 +0000 (UTC) From: Stefan Hajnoczi To: Date: Wed, 27 Jun 2018 13:58:42 +0100 Message-Id: <20180627125847.5413-2-stefanha@redhat.com> In-Reply-To: <20180627125847.5413-1-stefanha@redhat.com> References: <20180627125847.5413-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 12:58:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 12:58:54 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' 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] [PULL 1/6] trace: fix misreporting of TCG access sizes for user-space 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 , Michael Roth , Juan Quintela , Peter Crosthwaite , "Dr. David Alan Gilbert" , Markus Armbruster , "Emilio G. Cota" , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson 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: "Emilio G. Cota" trace_mem_build_info expects a size_shift for its first argument. Fix it. Signed-off-by: Emilio G. Cota Message-id: 1527028012-21888-2-git-send-email-cota@braap.org Signed-off-by: Stefan Hajnoczi --- include/exec/cpu_ldst_useronly_template.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/exec/cpu_ldst_useronly_template.h b/include/exec/cpu_l= dst_useronly_template.h index c168f31bba..e30e58ed4a 100644 --- a/include/exec/cpu_ldst_useronly_template.h +++ b/include/exec/cpu_ldst_useronly_template.h @@ -33,20 +33,24 @@ #define SUFFIX q #define USUFFIX q #define DATA_TYPE uint64_t +#define SHIFT 3 #elif DATA_SIZE =3D=3D 4 #define SUFFIX l #define USUFFIX l #define DATA_TYPE uint32_t +#define SHIFT 2 #elif DATA_SIZE =3D=3D 2 #define SUFFIX w #define USUFFIX uw #define DATA_TYPE uint16_t #define DATA_STYPE int16_t +#define SHIFT 1 #elif DATA_SIZE =3D=3D 1 #define SUFFIX b #define USUFFIX ub #define DATA_TYPE uint8_t #define DATA_STYPE int8_t +#define SHIFT 0 #else #error unsupported data size #endif @@ -63,7 +67,7 @@ glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(CPUArchState *env,= target_ulong ptr) #if !defined(CODE_ACCESS) trace_guest_mem_before_exec( ENV_GET_CPU(env), ptr, - trace_mem_build_info(DATA_SIZE, false, MO_TE, false)); + trace_mem_build_info(SHIFT, false, MO_TE, false)); #endif return glue(glue(ld, USUFFIX), _p)(g2h(ptr)); } @@ -87,7 +91,7 @@ glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(CPUArchState *env,= target_ulong ptr) #if !defined(CODE_ACCESS) trace_guest_mem_before_exec( ENV_GET_CPU(env), ptr, - trace_mem_build_info(DATA_SIZE, true, MO_TE, false)); + trace_mem_build_info(SHIFT, true, MO_TE, false)); #endif return glue(glue(lds, SUFFIX), _p)(g2h(ptr)); } @@ -113,7 +117,7 @@ glue(glue(cpu_st, SUFFIX), MEMSUFFIX)(CPUArchState *env= , target_ulong ptr, #if !defined(CODE_ACCESS) trace_guest_mem_before_exec( ENV_GET_CPU(env), ptr, - trace_mem_build_info(DATA_SIZE, false, MO_TE, true)); + trace_mem_build_info(SHIFT, false, MO_TE, true)); #endif glue(glue(st, SUFFIX), _p)(g2h(ptr), v); } @@ -136,3 +140,4 @@ glue(glue(glue(cpu_st, SUFFIX), MEMSUFFIX), _ra)(CPUArc= hState *env, #undef SUFFIX #undef USUFFIX #undef DATA_SIZE +#undef SHIFT --=20 2.17.1 From nobody Sun Feb 8 23:02:11 2026 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 1530105178616228.73218463377202; Wed, 27 Jun 2018 06:12:58 -0700 (PDT) Received: from localhost ([::1]:59082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYAFl-0006Aj-Oo for importer@patchew.org; Wed, 27 Jun 2018 09:12:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA2D-0003ci-Re for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYA2C-0003uM-VA for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:58:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49662 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 1fYA2C-0003u5-Oz for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:58:56 -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 329C7805A530; Wed, 27 Jun 2018 12:58:56 +0000 (UTC) Received: from localhost (ovpn-117-219.ams2.redhat.com [10.36.117.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5C932026D5B; Wed, 27 Jun 2018 12:58:55 +0000 (UTC) From: Stefan Hajnoczi To: Date: Wed, 27 Jun 2018 13:58:43 +0100 Message-Id: <20180627125847.5413-3-stefanha@redhat.com> In-Reply-To: <20180627125847.5413-1-stefanha@redhat.com> References: <20180627125847.5413-1-stefanha@redhat.com> 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]); Wed, 27 Jun 2018 12:58:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 27 Jun 2018 12:58: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:'' 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] [PULL 2/6] trace: simplify trace_mem functions 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 , Michael Roth , Juan Quintela , Peter Crosthwaite , "Dr. David Alan Gilbert" , Markus Armbruster , "Emilio G. Cota" , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson 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: "Emilio G. Cota" Add some defines for the mem_info bits, simplify trace_mem_build_info, and also simplify trace_mem_get_info by making it a wrapper around trace_mem_build_info. This paves the way for increasing size_shift by one bit. Signed-off-by: Emilio G. Cota Message-id: 1527028012-21888-3-git-send-email-cota@braap.org Signed-off-by: Stefan Hajnoczi --- trace/mem-internal.h | 46 ++++++++++++++++++++------------------------ trace/mem.h | 2 +- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/trace/mem-internal.h b/trace/mem-internal.h index ddda934253..b684e2750c 100644 --- a/trace/mem-internal.h +++ b/trace/mem-internal.h @@ -10,37 +10,33 @@ #ifndef TRACE__MEM_INTERNAL_H #define TRACE__MEM_INTERNAL_H =20 -static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store) -{ - uint8_t res =3D op; - bool be =3D (op & MO_BSWAP) =3D=3D MO_BE; - - /* remove untraced fields */ - res &=3D (1ULL << 4) - 1; - /* make endianness absolute */ - res &=3D ~MO_BSWAP; - if (be) { - res |=3D 1ULL << 3; - } - /* add fields */ - if (store) { - res |=3D 1ULL << 4; - } - - return res; -} +#define TRACE_MEM_SZ_SHIFT_MASK 0x3 /* size shift mask */ +#define TRACE_MEM_SE (1ULL << 2) /* sign extended (y/n) */ +#define TRACE_MEM_BE (1ULL << 3) /* big endian (y/n) */ +#define TRACE_MEM_ST (1ULL << 4) /* store (y/n) */ =20 static inline uint8_t trace_mem_build_info( - TCGMemOp size, bool sign_extend, TCGMemOp endianness, bool store) + int size_shift, bool sign_extend, TCGMemOp endianness, bool store) { - uint8_t res =3D 0; - res |=3D size; - res |=3D (sign_extend << 2); + uint8_t res; + + res =3D size_shift & TRACE_MEM_SZ_SHIFT_MASK; + if (sign_extend) { + res |=3D TRACE_MEM_SE; + } if (endianness =3D=3D MO_BE) { - res |=3D (1ULL << 3); + res |=3D TRACE_MEM_BE; + } + if (store) { + res |=3D TRACE_MEM_ST; } - res |=3D (store << 4); return res; } =20 +static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store) +{ + return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN), + op & MO_BSWAP, store); +} + #endif /* TRACE__MEM_INTERNAL_H */ diff --git a/trace/mem.h b/trace/mem.h index 9c88bcb4e6..2b58196e53 100644 --- a/trace/mem.h +++ b/trace/mem.h @@ -25,7 +25,7 @@ static uint8_t trace_mem_get_info(TCGMemOp op, bool store= ); * * Return a value for the 'info' argument in guest memory access traces. */ -static uint8_t trace_mem_build_info(TCGMemOp size, bool sign_extend, +static uint8_t trace_mem_build_info(int size_shift, bool sign_extend, TCGMemOp endianness, bool store); =20 =20 --=20 2.17.1 From nobody Sun Feb 8 23:02:11 2026 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 1530105262073331.5606327231527; Wed, 27 Jun 2018 06:14:22 -0700 (PDT) Received: from localhost ([::1]:59090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYAH7-0007J8-88 for importer@patchew.org; Wed, 27 Jun 2018 09:14:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA2H-0003gJ-TC for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYA2E-0003v6-MU for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51942 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 1fYA2E-0003ur-HN for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:58:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDF8C4068031; Wed, 27 Jun 2018 12:58:57 +0000 (UTC) Received: from localhost (ovpn-117-219.ams2.redhat.com [10.36.117.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D6281C674; Wed, 27 Jun 2018 12:58:57 +0000 (UTC) From: Stefan Hajnoczi To: Date: Wed, 27 Jun 2018 13:58:44 +0100 Message-Id: <20180627125847.5413-4-stefanha@redhat.com> In-Reply-To: <20180627125847.5413-1-stefanha@redhat.com> References: <20180627125847.5413-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 27 Jun 2018 12:58:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 27 Jun 2018 12:58:57 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' 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] [PULL 3/6] trace: expand mem_info:size_shift to 3 bits 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 , Michael Roth , Juan Quintela , Peter Crosthwaite , "Dr. David Alan Gilbert" , Markus Armbruster , "Emilio G. Cota" , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson 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: "Emilio G. Cota" This will allow us to trace 16B-long memory accesses. Signed-off-by: Emilio G. Cota Message-id: 1527028012-21888-4-git-send-email-cota@braap.org Signed-off-by: Stefan Hajnoczi --- trace/mem-internal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trace/mem-internal.h b/trace/mem-internal.h index b684e2750c..a9e408eb2f 100644 --- a/trace/mem-internal.h +++ b/trace/mem-internal.h @@ -10,10 +10,10 @@ #ifndef TRACE__MEM_INTERNAL_H #define TRACE__MEM_INTERNAL_H =20 -#define TRACE_MEM_SZ_SHIFT_MASK 0x3 /* size shift mask */ -#define TRACE_MEM_SE (1ULL << 2) /* sign extended (y/n) */ -#define TRACE_MEM_BE (1ULL << 3) /* big endian (y/n) */ -#define TRACE_MEM_ST (1ULL << 4) /* store (y/n) */ +#define TRACE_MEM_SZ_SHIFT_MASK 0x7 /* size shift mask */ +#define TRACE_MEM_SE (1ULL << 3) /* sign extended (y/n) */ +#define TRACE_MEM_BE (1ULL << 4) /* big endian (y/n) */ +#define TRACE_MEM_ST (1ULL << 5) /* store (y/n) */ =20 static inline uint8_t trace_mem_build_info( int size_shift, bool sign_extend, TCGMemOp endianness, bool store) --=20 2.17.1 From nobody Sun Feb 8 23:02:11 2026 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 1530105347757852.1670185307582; Wed, 27 Jun 2018 06:15:47 -0700 (PDT) Received: from localhost ([::1]:59102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYAIU-0000Dw-RF for importer@patchew.org; Wed, 27 Jun 2018 09:15:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA2H-0003gL-TU for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYA2G-0003vp-56 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45814 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 1fYA2G-0003vc-0f for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 767C7C328; Wed, 27 Jun 2018 12:58:59 +0000 (UTC) Received: from localhost (ovpn-117-219.ams2.redhat.com [10.36.117.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25D4B1C678; Wed, 27 Jun 2018 12:58:58 +0000 (UTC) From: Stefan Hajnoczi To: Date: Wed, 27 Jun 2018 13:58:45 +0100 Message-Id: <20180627125847.5413-5-stefanha@redhat.com> In-Reply-To: <20180627125847.5413-1-stefanha@redhat.com> References: <20180627125847.5413-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 12:58:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 12:58:59 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' 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] [PULL 4/6] trace: add trace_mem_build_info_no_se_be/le 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 , Michael Roth , Juan Quintela , Peter Crosthwaite , "Dr. David Alan Gilbert" , Markus Armbruster , "Emilio G. Cota" , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson 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: "Emilio G. Cota" These will be used by the following commit. Signed-off-by: Emilio G. Cota Message-id: 1527028012-21888-5-git-send-email-cota@braap.org Signed-off-by: Stefan Hajnoczi --- trace/mem-internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/trace/mem-internal.h b/trace/mem-internal.h index a9e408eb2f..f6efaf6d6b 100644 --- a/trace/mem-internal.h +++ b/trace/mem-internal.h @@ -39,4 +39,16 @@ static inline uint8_t trace_mem_get_info(TCGMemOp op, bo= ol store) op & MO_BSWAP, store); } =20 +static inline +uint8_t trace_mem_build_info_no_se_be(int size_shift, bool store) +{ + return trace_mem_build_info(size_shift, false, MO_BE, store); +} + +static inline +uint8_t trace_mem_build_info_no_se_le(int size_shift, bool store) +{ + return trace_mem_build_info(size_shift, false, MO_LE, store); +} + #endif /* TRACE__MEM_INTERNAL_H */ --=20 2.17.1 From nobody Sun Feb 8 23:02:11 2026 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 1530104711844273.5373712297744; Wed, 27 Jun 2018 06:05:11 -0700 (PDT) Received: from localhost ([::1]:59030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA8F-0007wb-24 for importer@patchew.org; Wed, 27 Jun 2018 09:05:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA2J-0003j6-Sq for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYA2I-0003xI-B0 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36658 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 1fYA2I-0003wf-5u for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:02 -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 8AF584023337; Wed, 27 Jun 2018 12:59:01 +0000 (UTC) Received: from localhost (ovpn-117-219.ams2.redhat.com [10.36.117.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CDC22026D5B; Wed, 27 Jun 2018 12:59:00 +0000 (UTC) From: Stefan Hajnoczi To: Date: Wed, 27 Jun 2018 13:58:46 +0100 Message-Id: <20180627125847.5413-6-stefanha@redhat.com> In-Reply-To: <20180627125847.5413-1-stefanha@redhat.com> References: <20180627125847.5413-1-stefanha@redhat.com> 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.6]); Wed, 27 Jun 2018 12:59:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 12:59:01 +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:'' 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] [PULL 5/6] trace: enable tracing of TCG atomics 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 , Michael Roth , Juan Quintela , Peter Crosthwaite , "Dr. David Alan Gilbert" , Markus Armbruster , "Emilio G. Cota" , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson 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: "Emilio G. Cota" We do not trace guest atomic accesses. Fix it. Tested with a modified atomic_add-bench so that it executes a deterministic number of instructions, i.e. fixed seeding, no threading and fixed number of loop iterations instead of running for a certain time. Before: - With parallel_cpus =3D false (no clone syscall so it is never set to true= ): 220070 memory accesses - With parallel_cpus =3D true (hard-coded): 212105 memory accesses <-- we're not tracing the atomics! After: 220070 memory accesses regardless of parallel_cpus. Signed-off-by: Emilio G. Cota Message-id: 1527028012-21888-6-git-send-email-cota@braap.org Signed-off-by: Stefan Hajnoczi --- accel/tcg/atomic_template.h | 87 ++++++++++++++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 6 deletions(-) diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h index 3f41ef2782..d751bcba48 100644 --- a/accel/tcg/atomic_template.h +++ b/accel/tcg/atomic_template.h @@ -18,30 +18,37 @@ * License along with this library; if not, see . */ =20 +#include "trace/mem.h" + #if DATA_SIZE =3D=3D 16 # define SUFFIX o # define DATA_TYPE Int128 # define BSWAP bswap128 +# define SHIFT 4 #elif DATA_SIZE =3D=3D 8 # define SUFFIX q # define DATA_TYPE uint64_t # define SDATA_TYPE int64_t # define BSWAP bswap64 +# define SHIFT 3 #elif DATA_SIZE =3D=3D 4 # define SUFFIX l # define DATA_TYPE uint32_t # define SDATA_TYPE int32_t # define BSWAP bswap32 +# define SHIFT 2 #elif DATA_SIZE =3D=3D 2 # define SUFFIX w # define DATA_TYPE uint16_t # define SDATA_TYPE int16_t # define BSWAP bswap16 +# define SHIFT 1 #elif DATA_SIZE =3D=3D 1 # define SUFFIX b # define DATA_TYPE uint8_t # define SDATA_TYPE int8_t # define BSWAP +# define SHIFT 0 #else # error unsupported data size #endif @@ -52,14 +59,37 @@ # define ABI_TYPE uint32_t #endif =20 +#define ATOMIC_TRACE_RMW do { \ + uint8_t info =3D glue(trace_mem_build_info_no_se, MEND)(SHIFT, fal= se); \ + \ + trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info); \ + trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, \ + info | TRACE_MEM_ST); \ + } while (0) + +#define ATOMIC_TRACE_LD do { \ + uint8_t info =3D glue(trace_mem_build_info_no_se, MEND)(SHIFT, fal= se); \ + \ + trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info); \ + } while (0) + +# define ATOMIC_TRACE_ST do { \ + uint8_t info =3D glue(trace_mem_build_info_no_se, MEND)(SHIFT, tru= e); \ + \ + trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info); \ + } while (0) + /* Define host-endian atomic operations. Note that END is used within the ATOMIC_NAME macro, and redefined below. */ #if DATA_SIZE =3D=3D 1 # define END +# define MEND _be /* either le or be would be fine */ #elif defined(HOST_WORDS_BIGENDIAN) # define END _be +# define MEND _be #else # define END _le +# define MEND _le #endif =20 ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr, @@ -67,7 +97,10 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_= ulong addr, { ATOMIC_MMU_DECLS; DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; - DATA_TYPE ret =3D atomic_cmpxchg__nocheck(haddr, cmpv, newv); + DATA_TYPE ret; + + ATOMIC_TRACE_RMW; + ret =3D atomic_cmpxchg__nocheck(haddr, cmpv, newv); ATOMIC_MMU_CLEANUP; return ret; } @@ -77,6 +110,8 @@ ABI_TYPE ATOMIC_NAME(ld)(CPUArchState *env, target_ulong= addr EXTRA_ARGS) { ATOMIC_MMU_DECLS; DATA_TYPE val, *haddr =3D ATOMIC_MMU_LOOKUP; + + ATOMIC_TRACE_LD; __atomic_load(haddr, &val, __ATOMIC_RELAXED); ATOMIC_MMU_CLEANUP; return val; @@ -87,6 +122,8 @@ void ATOMIC_NAME(st)(CPUArchState *env, target_ulong add= r, { ATOMIC_MMU_DECLS; DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; + + ATOMIC_TRACE_ST; __atomic_store(haddr, &val, __ATOMIC_RELAXED); ATOMIC_MMU_CLEANUP; } @@ -96,7 +133,10 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ul= ong addr, { ATOMIC_MMU_DECLS; DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; - DATA_TYPE ret =3D atomic_xchg__nocheck(haddr, val); + DATA_TYPE ret; + + ATOMIC_TRACE_RMW; + ret =3D atomic_xchg__nocheck(haddr, val); ATOMIC_MMU_CLEANUP; return ret; } @@ -107,7 +147,10 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulon= g addr, \ { \ ATOMIC_MMU_DECLS; \ DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; \ - DATA_TYPE ret =3D atomic_##X(haddr, val); \ + DATA_TYPE ret; \ + \ + ATOMIC_TRACE_RMW; \ + ret =3D atomic_##X(haddr, val); \ ATOMIC_MMU_CLEANUP; \ return ret; \ } @@ -126,6 +169,9 @@ GEN_ATOMIC_HELPER(xor_fetch) /* These helpers are, as a whole, full barriers. Within the helper, * the leading barrier is explicit and the trailing barrier is within * cmpxchg primitive. + * + * Trace this load + RMW loop as a single RMW op. This way, regardless + * of CF_PARALLEL's value, we'll trace just a read and a write. */ #define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ @@ -134,6 +180,8 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong= addr, \ ATOMIC_MMU_DECLS; \ XDATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; \ XDATA_TYPE cmp, old, new, val =3D xval; \ + \ + ATOMIC_TRACE_RMW; \ smp_mb(); \ cmp =3D atomic_read__nocheck(haddr); \ do { \ @@ -158,6 +206,7 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) #endif /* DATA SIZE >=3D 16 */ =20 #undef END +#undef MEND =20 #if DATA_SIZE > 1 =20 @@ -165,8 +214,10 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) within the ATOMIC_NAME macro. */ #ifdef HOST_WORDS_BIGENDIAN # define END _le +# define MEND _le #else # define END _be +# define MEND _be #endif =20 ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr, @@ -174,7 +225,10 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, targe= t_ulong addr, { ATOMIC_MMU_DECLS; DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; - DATA_TYPE ret =3D atomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(ne= wv)); + DATA_TYPE ret; + + ATOMIC_TRACE_RMW; + ret =3D atomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(newv)); ATOMIC_MMU_CLEANUP; return BSWAP(ret); } @@ -184,6 +238,8 @@ ABI_TYPE ATOMIC_NAME(ld)(CPUArchState *env, target_ulon= g addr EXTRA_ARGS) { ATOMIC_MMU_DECLS; DATA_TYPE val, *haddr =3D ATOMIC_MMU_LOOKUP; + + ATOMIC_TRACE_LD; __atomic_load(haddr, &val, __ATOMIC_RELAXED); ATOMIC_MMU_CLEANUP; return BSWAP(val); @@ -194,6 +250,8 @@ void ATOMIC_NAME(st)(CPUArchState *env, target_ulong ad= dr, { ATOMIC_MMU_DECLS; DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; + + ATOMIC_TRACE_ST; val =3D BSWAP(val); __atomic_store(haddr, &val, __ATOMIC_RELAXED); ATOMIC_MMU_CLEANUP; @@ -204,7 +262,10 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_u= long addr, { ATOMIC_MMU_DECLS; DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; - ABI_TYPE ret =3D atomic_xchg__nocheck(haddr, BSWAP(val)); + ABI_TYPE ret; + + ATOMIC_TRACE_RMW; + ret =3D atomic_xchg__nocheck(haddr, BSWAP(val)); ATOMIC_MMU_CLEANUP; return BSWAP(ret); } @@ -215,7 +276,10 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulon= g addr, \ { \ ATOMIC_MMU_DECLS; \ DATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; \ - DATA_TYPE ret =3D atomic_##X(haddr, BSWAP(val)); \ + DATA_TYPE ret; \ + \ + ATOMIC_TRACE_RMW; \ + ret =3D atomic_##X(haddr, BSWAP(val)); \ ATOMIC_MMU_CLEANUP; \ return BSWAP(ret); \ } @@ -232,6 +296,9 @@ GEN_ATOMIC_HELPER(xor_fetch) /* These helpers are, as a whole, full barriers. Within the helper, * the leading barrier is explicit and the trailing barrier is within * cmpxchg primitive. + * + * Trace this load + RMW loop as a single RMW op. This way, regardless + * of CF_PARALLEL's value, we'll trace just a read and a write. */ #define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ @@ -240,6 +307,8 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong= addr, \ ATOMIC_MMU_DECLS; \ XDATA_TYPE *haddr =3D ATOMIC_MMU_LOOKUP; \ XDATA_TYPE ldo, ldn, old, new, val =3D xval; \ + \ + ATOMIC_TRACE_RMW; \ smp_mb(); \ ldn =3D atomic_read__nocheck(haddr); \ do { \ @@ -271,11 +340,17 @@ GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new) #endif /* DATA_SIZE >=3D 16 */ =20 #undef END +#undef MEND #endif /* DATA_SIZE > 1 */ =20 +#undef ATOMIC_TRACE_ST +#undef ATOMIC_TRACE_LD +#undef ATOMIC_TRACE_RMW + #undef BSWAP #undef ABI_TYPE #undef DATA_TYPE #undef SDATA_TYPE #undef SUFFIX #undef DATA_SIZE +#undef SHIFT --=20 2.17.1 From nobody Sun Feb 8 23:02:11 2026 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 1530105445323673.5412904956668; Wed, 27 Jun 2018 06:17:25 -0700 (PDT) Received: from localhost ([::1]:59109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYAK4-0001PF-GH for importer@patchew.org; Wed, 27 Jun 2018 09:17:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYA2K-0003k9-P6 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYA2J-0003yz-OF for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51948 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 1fYA2J-0003xt-Ik for qemu-devel@nongnu.org; Wed, 27 Jun 2018 08:59:03 -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 E4643406E9BA; Wed, 27 Jun 2018 12:59:02 +0000 (UTC) Received: from localhost (ovpn-117-219.ams2.redhat.com [10.36.117.219]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D3AB2026D5B; Wed, 27 Jun 2018 12:59:02 +0000 (UTC) From: Stefan Hajnoczi To: Date: Wed, 27 Jun 2018 13:58:47 +0100 Message-Id: <20180627125847.5413-7-stefanha@redhat.com> In-Reply-To: <20180627125847.5413-1-stefanha@redhat.com> References: <20180627125847.5413-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.5]); Wed, 27 Jun 2018 12:59:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 27 Jun 2018 12:59:03 +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] [PULL 6/6] 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 , Michael Roth , Juan Quintela , Peter Crosthwaite , "Dr. David Alan Gilbert" , Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson 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: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela Message-id: 20180621150254.4922-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- 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