From patchwork Sun Sep 10 16:39:21 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: 812167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xqxcB75jvz9s0Z for ; Mon, 11 Sep 2017 02:39:54 +1000 (AEST) Received: from localhost ([::1]:53602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr5Gz-0003I0-5D for incoming@patchwork.ozlabs.org; Sun, 10 Sep 2017 12:39:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr5Ge-0003Hd-Ma for qemu-devel@nongnu.org; Sun, 10 Sep 2017 12:39:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dr5Gb-0000gP-K9 for qemu-devel@nongnu.org; Sun, 10 Sep 2017 12:39:32 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:55976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr5Gb-0000g9-9G for qemu-devel@nongnu.org; Sun, 10 Sep 2017 12:39:29 -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 v8AGdSvJ020703; Sun, 10 Sep 2017 18:39:28 +0200 Received: from localhost (unknown [132.68.137.153]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id ACAEB1683; Sun, 10 Sep 2017 18:39:22 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Sun, 10 Sep 2017 19:39:21 +0300 Message-Id: <150506156146.19604.7064966029596517363.stgit@frigg.lan> X-Mailer: git-send-email 2.14.1 In-Reply-To: <150505986682.19604.11937392314067517230.stgit@frigg.lan> References: <150505986682.19604.11937392314067517230.stgit@frigg.lan> User-Agent: StGit/0.18 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v8AGdSvJ020703 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 7/7] trace: Add event "guest_inst_info_after" 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: Paolo Bonzini , Richard Henderson , Stefan Hajnoczi , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: LluĂ­s Vilanova --- accel/tcg/translator.c | 18 ++++++++++++++---- trace-events | 8 ++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index c010aeee45..d3039e7fd2 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -36,6 +36,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb) { target_ulong pc_bbl, pc_insn = 0; + unsigned int insn_size = 0; bool translated_insn = false; int max_insns; @@ -82,6 +83,8 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, /* Tracing after (previous instruction) */ if (db->num_insns > 0) { trace_guest_inst_after_tcg(cpu, tcg_ctx.tcg_env, pc_insn); + trace_guest_inst_info_after_tcg( + cpu, tcg_ctx.tcg_env, pc_insn, insn_size); } pc_insn = db->pc_next; @@ -145,7 +148,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, translated_insn = true; /* Tracing after (patched values) */ if (TRACE_GUEST_INST_INFO_BEFORE_EXEC_ENABLED) { - unsigned int insn_size = db->pc_next - pc_insn; + insn_size = db->pc_next - pc_insn; tcg_set_insn_param(insn_size_opcode_idx, 1, insn_size); } @@ -164,7 +167,8 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, /* Tracing after */ if (TRACE_GUEST_BBL_AFTER_ENABLED || - TRACE_GUEST_INST_AFTER_ENABLED) { + TRACE_GUEST_INST_AFTER_ENABLED || + TRACE_GUEST_INST_INFO_AFTER_ENABLED) { tcg_ctx.disas.in_guest_code = false; if (tcg_ctx.disas.inline_label == NULL) { tcg_ctx.disas.inline_label = gen_new_inline_label(); @@ -175,6 +179,10 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, if (TRACE_GUEST_INST_AFTER_ENABLED && translated_insn) { trace_guest_inst_after_tcg(cpu, tcg_ctx.tcg_env, pc_insn); } + if (TRACE_GUEST_INST_INFO_AFTER_ENABLED && translated_insn) { + trace_guest_inst_info_after_tcg( + cpu, tcg_ctx.tcg_env, pc_insn, insn_size); + } if (TRACE_GUEST_BBL_AFTER_ENABLED) { trace_guest_bbl_after_tcg(cpu, tcg_ctx.tcg_env, pc_bbl); } @@ -207,7 +215,8 @@ void translator__gen_goto_tb(TCGContext *ctx) { if (ctx->disas.in_guest_code && (TRACE_GUEST_BBL_AFTER_ENABLED || - TRACE_GUEST_INST_AFTER_ENABLED)) { + TRACE_GUEST_INST_AFTER_ENABLED || + TRACE_GUEST_INST_INFO_AFTER_ENABLED)) { if (ctx->disas.inline_label == NULL) { ctx->disas.inline_label = gen_new_inline_label(); } @@ -221,7 +230,8 @@ void translator__gen_exit_tb(TCGContext *ctx) { if (ctx->disas.in_guest_code && !ctx->disas.seen_goto_tb && (TRACE_GUEST_BBL_AFTER_ENABLED || - TRACE_GUEST_INST_AFTER_ENABLED)) { + TRACE_GUEST_INST_AFTER_ENABLED || + TRACE_GUEST_INST_INFO_AFTER_ENABLED)) { if (ctx->disas.inline_label == NULL) { ctx->disas.inline_label = gen_new_inline_label(); } diff --git a/trace-events b/trace-events index c477302d8d..73d797cb48 100644 --- a/trace-events +++ b/trace-events @@ -135,6 +135,14 @@ vcpu tcg guest_inst_after(uint64_t vaddr) "vaddr=0x%016"PRIx64, "vaddr=0x%016"PR # Targets: TCG(all) disable vcpu tcg guest_inst_info_before(uint64_t vaddr, TCGv_i32 size) "vaddr=0x%016"PRIx64, "vaddr=0x%016"PRIx64" size=%d" +# @vaddr: Instruction's virtual address +# @size: Instruction's size in bytes +# +# Same as 'guest_inst_after', with additional information. +# +# Targets: TCG(all) +disable vcpu tcg guest_inst_info_after(uint64_t vaddr, uint32_t size) "vaddr=0x%016"PRIx64" size=%d", "vaddr=0x%016"PRIx64" size=%d" + # @vaddr: Access' virtual address. # @info : Access' information (see below). #