From patchwork Tue Apr 6 16:00:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 415927 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp4764282jai; Tue, 6 Apr 2021 10:17:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6Phwf1TwAakTrHC1d2cONCe1bvQVo4ACap6bSRCSl0PHthpnz7a4KkV8bJXlFtaAswEzf X-Received: by 2002:a05:6e02:13b0:: with SMTP id h16mr11234344ilo.60.1617729426644; Tue, 06 Apr 2021 10:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617729426; cv=none; d=google.com; s=arc-20160816; b=ZcWspEijKNUdWRqknxS9ZWnbH5b2qtcEpW7v0ZdA+RpNe4CwhiDaMToSUoTqzAwYo1 qaWgSOrzwd3wD/+NluQrsks5Zt2X7Snsyey27GJdw1FeKmn/iB107U4s8CeCJqjh5mXh BqaxDX0d4XUuw6WBP9UQP1kwMbq46vFGH+8AEYr1PJng8CC9EHkx3P8XMg/hv7MnKKoA k5toBIoabC3Wq+vDTmrE9pLyss+KX/58c1h6KS4Pk7bZUEviOGcRja/KgDuiWs48zK/x +GJT/f4f9xXX6/856diGFuxwtQ4GpJbigo2nInPKfSysFIHmebhE8EHX4E7p7Pce1lnv hwlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:user-agent :dkim-signature; bh=NYpQr/0loJZsY6NjE8VW+WSByt6uiaPkmGftFbmj8io=; b=AjQJaGYjzoeIMA0qf2mlMdzQ/LT7iOV+yFuQ8pGVy2IX9kKuH+6xLipfADeIlB4i2A fPKkajKBY+q2Yb5peLBYdRZqarfVx25Ya9ZbOiowvWtxeu6lCXd7ZHfQNZN0lpUtjzm6 uYm4ef5bknStiLW88ZEwM5ld/D/zlQwPwPUq7xuA/eDt5j+Ehb6cJgzn0qDF2+8rKJj9 PgtP7lx3v1GhOjtj2u/yABsjkh3uTTckDlzArTA1KhEUc5cqNPh1A+QsODBFvP9v4NcN I1M4tYHElpUKStb6hRBr0XPwhtZ4i//MT83xcvr5jcCKbHy7tfEQvh2r0PHwOXpUQIvT hrRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lk8DE3P7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12si3778529ilv.88.2021.04.06.10.17.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Apr 2021 10:17:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lk8DE3P7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lTpK5-00073K-To for patch@linaro.org; Tue, 06 Apr 2021 13:17:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTpIR-00072s-Jw for qemu-devel@nongnu.org; Tue, 06 Apr 2021 13:15:24 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:34668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lTpIE-0007v9-CK for qemu-devel@nongnu.org; Tue, 06 Apr 2021 13:15:14 -0400 Received: by mail-wr1-x42f.google.com with SMTP id b9so7155795wrs.1 for ; Tue, 06 Apr 2021 10:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=user-agent:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NYpQr/0loJZsY6NjE8VW+WSByt6uiaPkmGftFbmj8io=; b=lk8DE3P7uB6tgqIuEnQk5rXv8RxGHFNXEymQV6sP3dJN85NVVzANgPRaeKe4DLQTxd +y2I6Db56atzmTrUwSeg3aHieJEKmnNYcjQJGjiyRBjWMebIAz/TBDf1gCken9y3EfgZ lluJ18e38DN0nSOiYBl31mhVBTZdBfeE36QaL09JzeEhS3am8VCQbJlHaUga8WSzqR8M grcOfSSRsI4hLtzv83NpKgaDF+Z2/GbZuY8jfpAlTprCTFGBMxKRreHlL7deC0JKGslE /yCvyUg4KSvH+WxXCkko/i3CJ9N83o5QEw5T1c2/ct9q9yFWhtpGqx6hDWjr1dWX6og6 vOUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=NYpQr/0loJZsY6NjE8VW+WSByt6uiaPkmGftFbmj8io=; b=K2whOkXB1Ckj4ot+9RjI0B8MIIhO30bTOH8aKYesjHU1mxEwqa5wB76ct50j0YGTpQ aX2JOFBsZakPfVzYWsAQd3TLFBPtxCB1Zc9rGi7DK74xTvBhMZU7+Ph4k8+RSXVi4fpq zzDQ+Q0ZMsn4wECoc8bNz+lYkr3zVjMhKudDs8VswiB45ctyiJZrvMapHKBa09u/nUiw WOV98d3gdfBubtM59Z0DIHCqSnVg+FHVsNUpF1BhtgQeC6dEOiknplHsE8FkIsKe+HZM sZtylTeIOvHd4blj4iUcN5UUiJp6K6SnODV0rbov3mgij86S069zuufarEmflKR7zE2k eDbg== X-Gm-Message-State: AOAM530fMsDIhimBrumg8HJTVGuYi/uGWV/ovc1qenkTZye+fTQXAFFc EMJLEygcpA+ZKCoPAuykvDlwgCx5hRZzJw== X-Received: by 2002:adf:fb42:: with SMTP id c2mr36511321wrs.83.1617729308817; Tue, 06 Apr 2021 10:15:08 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i127sm3962688wma.6.2021.04.06.10.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 10:15:07 -0700 (PDT) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B750C1FF7E; Tue, 6 Apr 2021 18:15:06 +0100 (BST) User-agent: mu4e 1.5.11; emacs 28.0.50 From: Alex =?utf-8?q?Benn=C3=A9e?= To: Stefan Hajnoczi , =?utf-8?b?TGx1w61z?= Vilanova Subject: trace_FOO_tcg bit-rotted? Date: Tue, 06 Apr 2021 17:00:20 +0100 Message-ID: <87eefnwd0l.fsf@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matheus.ferst@eldorado.org.br, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Hi, It's been awhile since I last played with this but I think we are suffering from not having some test cases for tracing code generation/execution in the tree. I tried adding a simple trace point to see if I could track ERET calls: --8<---------------cut here---------------start------------->8--- --8<---------------cut here---------------end--------------->8--- According to the tracing docs I the: trace_eret_tcg(s->current_el, dst); Should: Instead of using these two events, you should instead use the function "trace__tcg" during translation (TCG code generation). This function will automatically call "trace__trans", and will generate the necessary TCG code to call "trace__exec" during guest code execution. But it falls down with the following: ../../target/arm/translate-a64.c: In function ‘disas_uncond_b_reg’: ../../target/arm/translate-a64.c:2307:9: error: implicit declaration of function ‘trace_eret_tcg’; did you mean ‘trace_eret_exec’? [-Werror=implicit-function-declaration] trace_eret_tcg(s->current_el, dst); ^~~~~~~~~~~~~~ trace_eret_exec ../../target/arm/translate-a64.c:2307:9: error: nested extern declaration of ‘trace_eret_tcg’ [-Werror=nested-externs] cc1: all warnings being treated as errors ninja: build stopped: subcommand failed. So I'm wondering what needs to be done to fix this? Given the one other tracepoint is in the general tcg-op.c is this just some build stuff to do with how the tracepoint segments are generated? -- Alex Bennée diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 0b42e53500..0d643f78fe 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -36,6 +36,7 @@ #include "exec/log.h" #include "trace-tcg.h" +#include "trace.h" #include "translate-a64.h" #include "qemu/atomic128.h" @@ -2302,6 +2303,9 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) default: goto do_unallocated; } + + trace_eret_tcg(s->current_el, dst); + if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } diff --git a/target/arm/trace-events b/target/arm/trace-events index 41c63d7570..2d4fca16a1 100644 --- a/target/arm/trace-events +++ b/target/arm/trace-events @@ -1,5 +1,10 @@ # See docs/devel/tracing.txt for syntax documentation. +# translate-a64.c +# Mode: softmmu +# Targets: TCG(aarch64-softmmu) +tcg eret(int current_el, TCGv target_el) "trans_eret: from EL%d", "exec_eret: EL%d to EL%"PRId64 + # helper.c arm_gt_recalc(int timer, int irqstate, uint64_t nexttick) "gt recalc: timer %d irqstate %d next tick 0x%" PRIx64 arm_gt_recalc_disabled(int timer) "gt recalc: timer %d irqstate 0 timer disabled"