From patchwork Wed May 5 09:22:53 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: 12239475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9601DC433ED for ; Wed, 5 May 2021 09:26:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3591613C7 for ; Wed, 5 May 2021 09:26:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3591613C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDnP-0002xs-VF for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:26:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDkQ-0000ru-S7 for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:15 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:36830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkJ-00058T-Mc for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:12 -0400 Received: by mail-wm1-x333.google.com with SMTP id l24-20020a7bc4580000b029014ac3b80020so2991083wmi.1 for ; Wed, 05 May 2021 02:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CQ8679cFYPFRKCt5xKP0d5J4rP4I/8eL7P8Ydf6Ygrc=; b=wIOIhpeRlnuvzo+stWllXWq7BKZFMNPUGyIigHtKCeVdRzFCvdjkuHJGZtsInNHJ9d CdfcbyVBYL5gbvUq+IkyNPFpGA6nY0fVgszNGrnz1Bg5gi8yP32tjpk/Zg48giCmeMqW SODq5wpoxHmJsxEl2v8FthPvTxq6o2YxfYAm5ARVZMCZXIWPuSLJ2mNxSlwG2BKNY3w8 HRTE1C7L61jmSssy2dc2oQyAvbLIqmOuuakb4d+QpfAnfdnYXtNueaXQRY1jZsV47Xb1 BCLFpl8hJa22MtvcAGOdPmKgE/U4hPro8XRvSTMEf98iANGZovyuN+hP0WoBItOmFn17 /N2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CQ8679cFYPFRKCt5xKP0d5J4rP4I/8eL7P8Ydf6Ygrc=; b=OaleXpDnvI6RKNRr30gQqMz1OJL8f0Q5KjOgSaUZSC+mEVoVEm95b0e297CHNojWbI kGQNfcQxUiryfMbqewgc/mWJkkOlrMoLoCQXRfKo6gL1JkMqwdekLfGLJoUYhsBnTLrb n345o1Ex3E/lPqx21TI0JhtfNhnX4eai0qQWE8VeBzCm9ODtQ2/3YVumiOYLL78xZJA7 dIAFpuGR98Ox2vNnFPRaGDtWWe0BfuGvoQdtSMWrDkLHGi/ixBnh97TJp+CZDoRWwqYR BnQixcWstzN+FZV4dNeOjrLF36RPhQGFV2YELe2hccf1XrtIY6oOpsSTKVLMdO2HEGyo 6G8g== X-Gm-Message-State: AOAM532qrtu1OEZdjuHi+LuNG904Vq/NvpiRsM0Y0LBGv3oYgzurGpRK vxXe9OKq+8idjvOAWZYR05G6tw== X-Google-Smtp-Source: ABdhPJzV78qEZBe0CVJsVPNpV/S197CDRHFjY2HO83fl4/+PooANSgZY89DGjh16BmeWL50/R0F2Zw== X-Received: by 2002:a1c:731a:: with SMTP id d26mr9070351wmb.36.1620206585443; Wed, 05 May 2021 02:23:05 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c15sm19212753wrr.3.2021.05.05.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DBDA71FF87; Wed, 5 May 2021 10:22:59 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/7] plugins: Update qemu-plugins.symbols to match qemu-plugins.h Date: Wed, 5 May 2021 10:22:53 +0100 Message-Id: <20210505092259.8202-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.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: =?utf-8?q?Alex_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, matheus.ferst@eldorado.org.br, Yonggang Luo Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Yonggang Luo Reorder the function symbols that consistence with qemu-plugins.h Signed-off-by: Yonggang Luo Signed-off-by: Alex Bennée Message-Id: <20210318185555.434-2-luoyonggang@gmail.com> --- plugins/qemu-plugins.symbols | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 4bdb381f48..a0ac1df62a 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -5,35 +5,34 @@ qemu_plugin_register_vcpu_exit_cb; qemu_plugin_register_vcpu_idle_cb; qemu_plugin_register_vcpu_resume_cb; - qemu_plugin_register_vcpu_insn_exec_cb; - qemu_plugin_register_vcpu_insn_exec_inline; - qemu_plugin_register_vcpu_mem_cb; - qemu_plugin_register_vcpu_mem_haddr_cb; - qemu_plugin_register_vcpu_mem_inline; - qemu_plugin_ram_addr_from_host; qemu_plugin_register_vcpu_tb_trans_cb; qemu_plugin_register_vcpu_tb_exec_cb; qemu_plugin_register_vcpu_tb_exec_inline; - qemu_plugin_register_flush_cb; - qemu_plugin_register_vcpu_syscall_cb; - qemu_plugin_register_vcpu_syscall_ret_cb; - qemu_plugin_register_atexit_cb; + qemu_plugin_register_vcpu_insn_exec_cb; + qemu_plugin_register_vcpu_insn_exec_inline; qemu_plugin_tb_n_insns; - qemu_plugin_tb_get_insn; qemu_plugin_tb_vaddr; + qemu_plugin_tb_get_insn; qemu_plugin_insn_data; qemu_plugin_insn_size; qemu_plugin_insn_vaddr; qemu_plugin_insn_haddr; - qemu_plugin_insn_disas; qemu_plugin_mem_size_shift; qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_big_endian; qemu_plugin_mem_is_store; qemu_plugin_get_hwaddr; qemu_plugin_hwaddr_is_io; - qemu_plugin_hwaddr_to_raddr; + qemu_plugin_hwaddr_phys_addr; + qemu_plugin_hwaddr_device_name; + qemu_plugin_register_vcpu_mem_cb; + qemu_plugin_register_vcpu_mem_inline; + qemu_plugin_register_vcpu_syscall_cb; + qemu_plugin_register_vcpu_syscall_ret_cb; + qemu_plugin_insn_disas; qemu_plugin_vcpu_for_each; + qemu_plugin_register_flush_cb; + qemu_plugin_register_atexit_cb; qemu_plugin_n_vcpus; qemu_plugin_n_max_vcpus; qemu_plugin_outs; From patchwork Wed May 5 09:22:54 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: 12239483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A75FC433ED for ; Wed, 5 May 2021 09:32:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 558C96115C for ; Wed, 5 May 2021 09:32:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 558C96115C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDt9-0000d8-AA for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:32:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDkX-0000v3-3R for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:22 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:40633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkJ-00056x-NZ for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:19 -0400 Received: by mail-wr1-x433.google.com with SMTP id d4so1018950wru.7 for ; Wed, 05 May 2021 02:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LZutPtgpTaHldKZk578MIAzGwCkCBrqhiKcMaWSBcng=; b=TiFI+UyGZ7w1cyvlAinQVZaEUeY9HCRwQaJXkTgqrMH+3X6hASYTeXshyLEmC0ivr0 GdaRL5SW6M3hIGQj7W6aHu2IDD/a7rGjkQgcOw0Sk4Uo85SREAFWZ27fQ8HNsHJcKXIc weyj1A8oDlpFI2mUUkKeVcyp8S1G3NCH+v4yGFg8KC/bunPf/FCAE6Xrb2ar3lkmvPp6 KigP3FClwL/vDIAP9qbd/9FRAnN135odlZnkr54wf4gcpYjrDgSp4Uv+CX+PIa2SKCqA X/O3Mdg2g7zzyaWnaTIDDNSMHX7YlLwDMz3H8r2+GZYAHEV7h83qREmu4p+gdtMg8ufL rPww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LZutPtgpTaHldKZk578MIAzGwCkCBrqhiKcMaWSBcng=; b=GQM+JAm/D4AqjYzl6Zxma/7nZBFpi6rihlJMGQUQvEMZRnOhjn+1ri+3OHcZ59iVCp aUQbEq2lP/Np3QTIBx601j6Gl2gXtABfjOjlbHgRDvwf5LHRQEdMxQZ9goX6HgwUTuNn /jjfXX6UqYCgxoZZ7O5t3g7xVPeAu4qjxD+1zd6zxtOtqqWNlMtSZ9GDHlyS+4VZmy2s 0GPaDWMzomd/QhZpGVgW0GwnWhkXiFziDB5P9+/t/fZHDK6BEjJ3vGn8OcISs+M8VhFj vKHNcd6ljiyzd1rWYT/txsOzJ1ojLxDPKcs8znJuq+xvY1DdP0SGXXrD91Mzklx3dDcA yxKA== X-Gm-Message-State: AOAM533fhuT8jGa+dDWs6AbF8bZunOZlzNodtjJK9+s0D3qRhk/fry7H 5sKrrdvPOAG/2Aw/8wnlOZ8AbQ== X-Google-Smtp-Source: ABdhPJzXwfqJ+SGVkmBcw05TcjXmB0udbrBA5oECDFen+o6ShPGVfrwjJ1wJg1Yw2oQw7h4WO9p31A== X-Received: by 2002:adf:cd8c:: with SMTP id q12mr36770964wrj.328.1620206582722; Wed, 05 May 2021 02:23:02 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b8sm19307077wrx.15.2021.05.05.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F24E81FF8C; Wed, 5 May 2021 10:22:59 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/7] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h Date: Wed, 5 May 2021 10:22:54 +0100 Message-Id: <20210505092259.8202-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.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=unavailable 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: =?utf-8?q?Alex_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, matheus.ferst@eldorado.org.br, Yonggang Luo Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Yonggang Luo Signed-off-by: Yonggang Luo Signed-off-by: Alex Bennée Message-Id: <20210318185555.434-3-luoyonggang@gmail.com> --- include/qemu/qemu-plugin.h | 187 ++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 95 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 97cdfd7761..2cb17f3051 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -81,27 +81,6 @@ typedef struct qemu_info_t { }; } qemu_info_t; -/** - * qemu_plugin_install() - Install a plugin - * @id: this plugin's opaque ID - * @info: a block describing some details about the guest - * @argc: number of arguments - * @argv: array of arguments (@argc elements) - * - * All plugins must export this symbol which is called when the plugin - * is first loaded. Calling qemu_plugin_uninstall() from this function - * is a bug. - * - * Note: @info is only live during the call. Copy any information we - * want to keep. @argv remains valid throughout the lifetime of the - * loaded plugin. - * - * Return: 0 on successful loading, !0 for an error. - */ -QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, - const qemu_info_t *info, - int argc, char **argv); - /** * typedef qemu_plugin_simple_cb_t - simple callback * @id: the unique qemu_plugin_id_t @@ -135,6 +114,98 @@ typedef void (*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id, typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index, void *userdata); +/** struct qemu_plugin_tb - Opaque handle for a translation block */ +struct qemu_plugin_tb; +/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ +struct qemu_plugin_insn; + +/** + * enum qemu_plugin_cb_flags - type of callback + * + * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs + * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs + * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs + * + * Note: currently unused, plugins cannot read or change system + * register state. + */ +enum qemu_plugin_cb_flags { + QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_CB_R_REGS, + QEMU_PLUGIN_CB_RW_REGS, +}; + +enum qemu_plugin_mem_rw { + QEMU_PLUGIN_MEM_R = 1, + QEMU_PLUGIN_MEM_W, + QEMU_PLUGIN_MEM_RW, +}; + +/** + * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback + * @id: unique plugin id + * @tb: opaque handle used for querying and instrumenting a block. + */ +typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, + struct qemu_plugin_tb *tb); + +/** + * enum qemu_plugin_op - describes an inline op + * + * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t + * + * Note: currently only a single inline op is supported. + */ + +enum qemu_plugin_op { + QEMU_PLUGIN_INLINE_ADD_U64, +}; + +/** + * typedef qemu_plugin_meminfo_t - opaque memory transaction handle + * + * This can be further queried using the qemu_plugin_mem_* query + * functions. + */ +typedef uint32_t qemu_plugin_meminfo_t; +/** struct qemu_plugin_hwaddr - opaque hw address handle */ +struct qemu_plugin_hwaddr; + +typedef void +(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, + qemu_plugin_meminfo_t info, uint64_t vaddr, + void *userdata); + +typedef void +(*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index, + int64_t num, uint64_t a1, uint64_t a2, + uint64_t a3, uint64_t a4, uint64_t a5, + uint64_t a6, uint64_t a7, uint64_t a8); +typedef void +(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, + int64_t num, int64_t ret); + +/** + * qemu_plugin_install() - Install a plugin + * @id: this plugin's opaque ID + * @info: a block describing some details about the guest + * @argc: number of arguments + * @argv: array of arguments (@argc elements) + * + * All plugins must export this symbol which is called when the plugin + * is first loaded. Calling qemu_plugin_uninstall() from this function + * is a bug. + * + * Note: @info is only live during the call. Copy any information we + * want to keep. @argv remains valid throughout the lifetime of the + * loaded plugin. + * + * Return: 0 on successful loading, !0 for an error. + */ +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, + int argc, char **argv); + /** * qemu_plugin_uninstall() - Uninstall a plugin * @id: this plugin's opaque ID @@ -205,41 +276,6 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_simple_cb_t cb); -/** struct qemu_plugin_tb - Opaque handle for a translation block */ -struct qemu_plugin_tb; -/** struct qemu_plugin_insn - Opaque handle for a translated instruction */ -struct qemu_plugin_insn; - -/** - * enum qemu_plugin_cb_flags - type of callback - * - * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs - * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs - * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs - * - * Note: currently unused, plugins cannot read or change system - * register state. - */ -enum qemu_plugin_cb_flags { - QEMU_PLUGIN_CB_NO_REGS, - QEMU_PLUGIN_CB_R_REGS, - QEMU_PLUGIN_CB_RW_REGS, -}; - -enum qemu_plugin_mem_rw { - QEMU_PLUGIN_MEM_R = 1, - QEMU_PLUGIN_MEM_W, - QEMU_PLUGIN_MEM_RW, -}; - -/** - * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback - * @id: unique plugin id - * @tb: opaque handle used for querying and instrumenting a block. - */ -typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, - struct qemu_plugin_tb *tb); - /** * qemu_plugin_register_vcpu_tb_trans_cb() - register a translate cb * @id: plugin ID @@ -269,18 +305,6 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, enum qemu_plugin_cb_flags flags, void *userdata); -/** - * enum qemu_plugin_op - describes an inline op - * - * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t - * - * Note: currently only a single inline op is supported. - */ - -enum qemu_plugin_op { - QEMU_PLUGIN_INLINE_ADD_U64, -}; - /** * qemu_plugin_register_vcpu_tb_exec_inline() - execution inline op * @tb: the opaque qemu_plugin_tb handle for the translation @@ -393,16 +417,6 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); */ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); -/** - * typedef qemu_plugin_meminfo_t - opaque memory transaction handle - * - * This can be further queried using the qemu_plugin_mem_* query - * functions. - */ -typedef uint32_t qemu_plugin_meminfo_t; -/** struct qemu_plugin_hwaddr - opaque hw address handle */ -struct qemu_plugin_hwaddr; - /** * qemu_plugin_mem_size_shift() - get size of access * @info: opaque memory transaction handle @@ -480,11 +494,6 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr); */ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h); -typedef void -(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, - qemu_plugin_meminfo_t info, uint64_t vaddr, - void *userdata); - void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, qemu_plugin_vcpu_mem_cb_t cb, enum qemu_plugin_cb_flags flags, @@ -496,21 +505,9 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, enum qemu_plugin_op op, void *ptr, uint64_t imm); - - -typedef void -(*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index, - int64_t num, uint64_t a1, uint64_t a2, - uint64_t a3, uint64_t a4, uint64_t a5, - uint64_t a6, uint64_t a7, uint64_t a8); - void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_syscall_cb_t cb); -typedef void -(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, - int64_t num, int64_t ret); - void qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_syscall_ret_cb_t cb); From patchwork Wed May 5 09:22:55 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: 12239471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B201C433ED for ; Wed, 5 May 2021 09:25:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5A98613F0 for ; Wed, 5 May 2021 09:25:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5A98613F0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDn2-0002Ux-ML for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:25:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDkR-0000sk-Cz for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:15 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:45807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkJ-00056l-Jp for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:15 -0400 Received: by mail-wm1-x32c.google.com with SMTP id s5-20020a7bc0c50000b0290147d0c21c51so691975wmh.4 for ; Wed, 05 May 2021 02:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ydPT0ztE2Bw0rnFw4k7WbHBh286HstrN5c/fEJLUTGA=; b=lw51i2KQmYSfL0VWNhGU3wOMQBgyQFZX0BgQM/hi01D5Y8+JpKHa0w1gxyt4Zt49YV FAMmIx/3na9aLo8darGgFiQCkHHPKy+ccM8ZrKsPPdYO6WqA8+2Bm3hRjTyEPECEQX+V 9Jh37+oraB6WniA23aTExmbQhqWe2Ejodaq+0sIuriQPsxxrzcFigGZvmL82G3siZHjB Blf2jNP6CbInfZPSOs0AuP9c4/2h9MyYR2AB9eHWpi4qVuQY6BNZvy3AN2oy2/pfp9UB 0RkBzmnJCAbd/DXZD9KXc4M2Zs+WQuEcPqJrJtdrYvGOsrZOvvX7gGdRuiWuvjKYPjIe rscQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ydPT0ztE2Bw0rnFw4k7WbHBh286HstrN5c/fEJLUTGA=; b=tyxcjE+j8GnWIWNd5UVF6nDIYLjrddD0/2EkPhplIYSBdpOho49fU+h6Yie5jpFsY1 aPlqENTdJItAR1EQgbcn7iVYliDDJFKZAp1irZO80VVQ2027LDPMFO6RLjoMRlYCSHxl D/p4w5FAqSdeIspcYk9YisuG3Hd50vhpPgw/ix72gCG9CnccZi0NR9Xr5h87MbdGTwmr hqkjeELrX7QWD26HibD6FEDFIqSd5//VcCL1RSLbnyPkYFjo8YH+CoNKgOeQWR/BjUL3 MaA2XjR+Zjudo5cLwQhgFuVVNEqbxmD+f3TtkP1tZP0WG/UGcUnyz8Ls8SNOj3k7XFLl XP/A== X-Gm-Message-State: AOAM532ZvmGvs/5ktCx59if1q3j/nsCjVZMILdYCW6Ff5A5bPaYy/ftg kfuFbpOxjPEuoX7xgwKA2DJ3LQ== X-Google-Smtp-Source: ABdhPJyCwdVIrdEerNQtPOGB5ST68y8ICf2cJFHLN2yY5rYVbYlen8oa8SXRtgGzTZvEBwdFZR+xIw== X-Received: by 2002:a1c:4302:: with SMTP id q2mr8887749wma.1.1620206581890; Wed, 05 May 2021 02:23:01 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f11sm5363048wmq.41.2021.05.05.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 149DE1FF8F; Wed, 5 May 2021 10:23:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/7] plugins/hotblocks: Properly freed the hash table values Date: Wed, 5 May 2021 10:22:55 +0100 Message-Id: <20210505092259.8202-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.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: =?utf-8?q?Alex_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, Mahmoud Mandour , matheus.ferst@eldorado.org.br Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mahmoud Mandour Freed the values stored in the hash table ``hotblocks`` returned by ``g_hash_table_get_values()`` by freeing the sorted list and destroyed the hash table afterward. Signed-off-by: Mahmoud Mandour Signed-off-by: Alex Bennée Message-Id: <20210422005043.3569-2-ma.mandourr@gmail.com> --- contrib/plugins/hotblocks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index 4b08340143..64692c0670 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -68,10 +68,11 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) rec->insns, rec->exec_count); } - g_list_free(it); + g_list_free_full(it, g_free); g_mutex_unlock(&lock); } + g_hash_table_destroy(hotblocks); qemu_plugin_outs(report->str); } From patchwork Wed May 5 09:22:56 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: 12239473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F221C433ED for ; Wed, 5 May 2021 09:26:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 815EC6140F for ; Wed, 5 May 2021 09:26:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 815EC6140F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDnE-0002oL-E6 for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:26:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDkR-0000sr-FT for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:16 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:55252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkL-000590-Cw for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:15 -0400 Received: by mail-wm1-x334.google.com with SMTP id o127so980599wmo.4 for ; Wed, 05 May 2021 02:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XOXXbFmKIzYlDZ6gGIuWNND3ouYEXltv7aZzivzNlxo=; b=lZQaQ31DtmHH3Nv+Tffdkue0yQmcHhmQkKipg0uXJqlrWKUHT8p5Yb01grtmWLYsi0 hfbrk6QDyG03MB8Oj77xXg2GwQS6RZzS6W6U0SAynHTx5kYiyvnh3xpZCuJgGBAtBYr8 7u266fmne/7hN43dvSuCWYgfUZ2qiQcR4kA09manT0YOt1RMVCBVA4O5rObqD4WuFOmi Dc+QzywvYbNqAnJC4sNd10dswGCALIZXprcSahVlxCl8BMFv2ghV+yddtLnh53D6FRZD yqmWFucqPrOD4jkY4vov2hU9DZbhSND2uiGnlTGxkGVfMVRskK0Sxlb9mmH9ESze1Th2 BX2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XOXXbFmKIzYlDZ6gGIuWNND3ouYEXltv7aZzivzNlxo=; b=d3mUjvk4mQd8XSmUJA3eUlYSnyYUCJNKrFzsmS0lXjAW6MaVZhObMSByAj2O1LZTSQ xh48KFf+xE+0ElwPrznVlzri9A5CRfWbNiAgoXUywDDatOUBydiQjNjpjivz63sIqssG G3n8le8NZKPCD/Yc81pPrhUogHeI7tg2xI3YTnULnVz6jGk7RMAOazUi+JYFm8WSR2We fK5clikmwU/1Jk+CNaZszaXRC4uvcG0PBG1bCPrIyA+lkFtfdlNeUXP3eX8estUyMXwJ PVS/8Faa09+TYy3daoWCPO8GCpLh/bq0AZJ8oaMCYB1ky/zTgUz4TgkNkMGOc0fk7q9X y2WQ== X-Gm-Message-State: AOAM5337p3PuT3N3OXsgIQ4lTGN/Tw81ictnYax739iIu9w6WQuWFVGc v96KhywZQc5ZeS+wqsJWx3ZzUQ== X-Google-Smtp-Source: ABdhPJx81BFahmoruKwtYyzySQ0OUECmYtdxRR7z4wHC2vvyDd9L/LZA0VY8VRmYTqk9o8qRLHrpjw== X-Received: by 2002:a7b:c24a:: with SMTP id b10mr8896908wmj.157.1620206587379; Wed, 05 May 2021 02:23:07 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o13sm4335362wmh.34.2021.05.05.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2B5D11FF90; Wed, 5 May 2021 10:23:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/7] plugins/hotpages: Properly freed the hash table values Date: Wed, 5 May 2021 10:22:56 +0100 Message-Id: <20210505092259.8202-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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: =?utf-8?q?Alex_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, Mahmoud Mandour , matheus.ferst@eldorado.org.br Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mahmoud Mandour Allocated ``pages`` hash table through ``g_hash_table_new_full`` to add a freeing function & destroyed the hash table on exit. Signed-off-by: Mahmoud Mandour Signed-off-by: Alex Bennée Message-Id: <20210422005043.3569-3-ma.mandourr@gmail.com> --- contrib/plugins/hotpages.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c index bf53267532..9cf7f02c77 100644 --- a/contrib/plugins/hotpages.c +++ b/contrib/plugins/hotpages.c @@ -97,13 +97,14 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) g_list_free(it); } + g_hash_table_destroy(pages); qemu_plugin_outs(report->str); } static void plugin_init(void) { page_mask = (page_size - 1); - pages = g_hash_table_new(NULL, g_direct_equal); + pages = g_hash_table_new_full(NULL, g_direct_equal, NULL, g_free); } static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, From patchwork Wed May 5 09:22:57 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: 12239485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 570A5C433ED for ; Wed, 5 May 2021 09:32:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9272B61029 for ; Wed, 5 May 2021 09:32:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9272B61029 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDtQ-000169-Gy for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:32:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDka-0000wO-Qi for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:24 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:38419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkO-0005Ar-3H for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:24 -0400 Received: by mail-wm1-x330.google.com with SMTP id a10-20020a05600c068ab029014dcda1971aso879342wmn.3 for ; Wed, 05 May 2021 02:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=djikfsvzpevIoT9ZhL//tIh35KLunxCT5zbeziHmb1o=; b=RaWqM373kh+NfkiwzPJZ9jon/Wo8I9ynFTowezuYvqOo852c5BUARA9KIwcdHfUgdT UHhzyF82jMhFXksVx7/87ibsG+lvlgUb7aGCVg25kLpzTNtfujA/c1JiyRb/sT0ZLAWS MBCavFxUDbiSB5SooEzR/7IBhkegnEZv9tDenoIjHu0A992rG14e7Q1WJsIUHU0F++S+ xwkMI6EhYpc09ccuoVBFGUH9cAMWccZ8JAKA+L0SDLpVcMvNHli/TZtPFnKhejUeIu12 hiZPBhQ7rVyY92b8iKEq1+NDtUmqSOedIOl6GSPfE4fvhTK+hcNcW1lqN5rxB5EIsNBy Zggg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=djikfsvzpevIoT9ZhL//tIh35KLunxCT5zbeziHmb1o=; b=oSdiziud/kqVa9Vs3XjMW5d2ibRwkq9EaeROyMOUUeopiFmF9USJbCx5tefHoObBpX u3rpNmuBDyO0htDUmejGrIvJ7h2Zaw6y8kYRZHBHiFukOd8OYrszsV7WqhKTZkXxauVY g/EnksG93S3cmVomxbVCJ5ogaYBTlPBF2IlT59ahX0Gyc2ZiBB03M/VVnUVRkpl4FzTi JxSxFR1EIespX3JSMa0ESt5RgxZ2f0xbIViWi1cLQkpyoV3TmGyFxjELB1xaKHGCa0ek pyV7m369rt9wI4gXI54+qCuqQLE//Ay1oHwoD7lBvRnrDR6OTTovMIEQ0enZP4LWprO+ PMfg== X-Gm-Message-State: AOAM533jwQplpZ9d74cr/FR2Ln5N/aMPYRapfj0QGA5/2H0GvXlPsFxp yDnxjdnK/FlaiB2s20vcN9jy4w== X-Google-Smtp-Source: ABdhPJx1SHeNu3qDX2ml4vSmvFrnfK6rpiSfO2qJFMtTFjB64mkVkqqNWsmTziDB3/gbffAYXlMbog== X-Received: by 2002:a7b:c119:: with SMTP id w25mr8482662wmi.87.1620206590380; Wed, 05 May 2021 02:23:10 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f7sm19374075wrg.34.2021.05.05.02.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 455AD1FF91; Wed, 5 May 2021 10:23:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/7] docs: mark intention to deprecate TCG tracing functionality Date: Wed, 5 May 2021 10:22:57 +0100 Message-Id: <20210505092259.8202-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.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: "reviewer:Incompatible changes" , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, matheus.ferst@eldorado.org.br Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Currently attempts to add a new TCG trace events results in failures to build. Previous discussions have suggested maybe it's time to mark the feature as deprecated and push people towards using plugins. Signed-off-by: Alex Bennée Cc: Luis Vilanova Cc: Stefan Hajnoczi --- docs/devel/tcg-plugins.rst | 2 ++ docs/devel/tracing.rst | 7 +++++++ docs/system/deprecated.rst | 13 +++++++++++++ 3 files changed, 22 insertions(+) diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 18c6581d85..edf04e3091 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -3,6 +3,8 @@ Copyright (c) 2019, Linaro Limited Written by Emilio Cota and Alex Bennée +.. _tcgplugin-ref: + ================ QEMU TCG Plugins ================ diff --git a/docs/devel/tracing.rst b/docs/devel/tracing.rst index ba83954899..6b0f46cd54 100644 --- a/docs/devel/tracing.rst +++ b/docs/devel/tracing.rst @@ -414,6 +414,13 @@ disabled, this check will have no performance impact. "tcg" ----- +.. warning:: + The ability to add new TCG trace points relies on a having a good + understanding of the TCG internals. In the meantime TCG plugins + have been introduced which solve many of the same problems with + more of a focus on analysing guest code. See :ref:`tcgplugin-ref` + for more details. + Guest code generated by TCG can be traced by defining an event with the "tcg" event property. Internally, this property generates two events: "_trans" to trace the event at translation time, and diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 80cae86252..0c9d3c1e1e 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -312,6 +312,19 @@ The ``I7200`` guest CPU relies on the nanoMIPS ISA, which is deprecated (the ISA has never been upstreamed to a compiler toolchain). Therefore this CPU is also deprecated. +TCG introspection features +-------------------------- + +TCG trace-events (since 6.1) +'''''''''''''''''''''''''''' + +The ability to add new TCG trace points has bit rotted and as the +feature can be replicated with TCG plugins it will be deprecated. If +any user is currently using this feature and needs help with +converting to using TCG plugins they should contact the qemu-devel +mailing list. + + Related binaries ---------------- From patchwork Wed May 5 09:22:58 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: 12239487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E9EC433B4 for ; Wed, 5 May 2021 09:34:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0DCB86115C for ; Wed, 5 May 2021 09:34:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DCB86115C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDvD-0002hH-PL for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:34:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDka-0000wN-Hw for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:25 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:34579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkQ-0005C0-TA for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:23 -0400 Received: by mail-wr1-x429.google.com with SMTP id t18so1038793wry.1 for ; Wed, 05 May 2021 02:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+Rw6OGQrVJGw3XC/foHAisgB3VI31AwIvMNzYonwovA=; b=qeP7/ybCYH1wzVDrDLRBnkTBwAV04Hs70pHEaHj7uqrFgdmecAOZZgFtVowmwGqM9P UlvWuwqkBshA89X+17IsKvfQiPJjXI4KZUl++XtkewE9VkKTe8ocmz4hRHP0mRbK7rbD Y69i+VX0scN5CUHPCa0mbRZLbv0ArjwKwu99QL9qij1fstlVr10CaUO5G68fwpAXcIsy PPwCq0JxQfshDEytFtygdMl/2pm/yrdeIaOOEX3lcq40grZWQsdnDHdtImJpafDsp3Bs T9IX02L6ZL6qcaHmqcVmF0KIPMV84RF5d61qlWWFiZ6v3/qcCaP9YDuT9rU6vuMKctoP o2Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Rw6OGQrVJGw3XC/foHAisgB3VI31AwIvMNzYonwovA=; b=OH60UETXE8Md1/r2KWfbBP4hRzieJVDyROIt6oThejKsjpwiXWIw+Rd3Yqcv4amdUS iEfaEOFw5rdbUUqbHeLrVGYiU/nk6cFaE7h/io9Z9Cu/1wPanYm4FSvjhhGzLb2l8Zu6 Hgu/c2P6sq/+HNQQPD5v6pafOmYyLSLhFnlE4HYp6slYPVqvVI05pJRnEEhZ6VxZ+AM9 t8O+v5CvIIKfa5j54KAaQTXwQH5jXVMcX7wUOtWILb7wiF1CIQCgKmWyH84sHAi+y8G6 e4X6O021TRg7GvX8REzyYtWWLCJ7FxXVHlk/1RPpiXDCoe/XzvJFMOSX/pShs5xTAoiF bo0g== X-Gm-Message-State: AOAM531c4Uzygn6YRklwZHzL0eW/vkJsc2eqhZqaecLMc2IRFgNCowAi Cbqfoj4IPQoF/GPLQ9EIzZ5Ziw== X-Google-Smtp-Source: ABdhPJxKBjIKFIRVICTt+T5dRPcjvNMkbMnutk59LWL9zch9eKlQOiQh/+VJ+6xRqpY4GxtgjijDgg== X-Received: by 2002:adf:8046:: with SMTP id 64mr36246315wrk.176.1620206593179; Wed, 05 May 2021 02:23:13 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b10sm5999462wrr.27.2021.05.05.02.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5BC2A1FF92; Wed, 5 May 2021 10:23:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 6/7] scripts/tracetool: don't barf validating TCG types Date: Wed, 5 May 2021 10:22:58 +0100 Message-Id: <20210505092259.8202-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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: =?utf-8?q?Alex_Benn=C3=A9e?= , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, matheus.ferst@eldorado.org.br Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" TCG types will be transformed into the appropriate host types later on in the tool. For example adding the following trace point: tcg goto_ptr(TCGv_ptr ptr) "", "ptr=%p" would trigger: ValueError: Error at /home/alex/lsrc/qemu.git/./trace-events:149: Argument type 'TCGv_ptr' is not allowed. Only standard C types and fixed size integer types should be used. struct, union, and other complex pointer types should be declared as 'void *' Rather than expand ALLOWED_TYPES just directly handle TCGv types in validate_type. Fixes: 73ff061032 ("trace: only permit standard C types and fixed size integer types") Signed-off-by: Alex Bennée Cc: Matheus Ferst Message-Id: <20210406165307.5993-1-alex.bennee@linaro.org> --- v2 - do workaround directly in validate_type --- scripts/tracetool/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 5bc94d95cf..ce5fd23191 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -87,10 +87,9 @@ def out(*lines, **kwargs): "ssize_t", "uintptr_t", "ptrdiff_t", - # Magic substitution is done by tracetool - "TCGv", ] + def validate_type(name): bits = name.split(" ") for bit in bits: @@ -99,6 +98,10 @@ def validate_type(name): continue if bit == "const": continue + # Magic substitution of TCGv types will be done later + # using tracetool.transform.TCG_2_HOST + if bit.startswith("TCGv") and bit != "TCGv_vec": + continue if bit not in ALLOWED_TYPES: raise ValueError("Argument type '%s' is not allowed. " "Only standard C types and fixed size integer " From patchwork Wed May 5 09:22:59 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: 12239481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA819C433B4 for ; Wed, 5 May 2021 09:30:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 631FA613EB for ; Wed, 5 May 2021 09:30:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 631FA613EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leDqx-0006HI-EW for qemu-devel@archiver.kernel.org; Wed, 05 May 2021 05:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leDkX-0000vP-M6 for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:22 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:56177) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leDkP-0005BA-Bf for qemu-devel@nongnu.org; Wed, 05 May 2021 05:23:21 -0400 Received: by mail-wm1-x330.google.com with SMTP id i128so974538wma.5 for ; Wed, 05 May 2021 02:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pzxmZD4B0lAUAH8sN7d3Ghe+Y5XcNwSkO4kOPPQi1iI=; b=t1EZxG0Kl7tkdZSzFCP0uMUFnfkTaFbuymR9dzujn3bMHkACC5jCW9WcMz0u8fnsuM nJngLqz53vTPL/YJTU09S0UrQF5Ejc2cPMz0j4gq+CWXRfQM7OYw4r/+8WKKusY+12XG rAjTJJYmhNyoT4UZujcLswiNcfZLWg7aBFxE2img1h1DwC/43zE08GUf2D87uR6LcLxz 8ix6SaeNo5eYpqrnPBp7BxJ/BoqAFS8QfxME8tHpe3BjSPaoOvsmHEwt12nDKF3RnQuw tRYrA60I4QgqOiKg+yihypAVl4WnaWJ0NpLh2Fy8aVO3oDc/R41W7T1TJk3eqGCSWEiB ltsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pzxmZD4B0lAUAH8sN7d3Ghe+Y5XcNwSkO4kOPPQi1iI=; b=gx+5HMJ7LdQJhNU6yi2JzK8rmoCEt5bijy7Fo2bG0UubhFMtc+2EKlF5quHGWTdxRo OolL+SpgULoVKPi5g72K3MyZcDNFfwzoC8tuxhiQwF/X6ErXf/4hhtfK9bw2VvzLAc8p fOoZi0SIItEcxh+y7QwADGlTe91yl1ECE/UtKYsNUpVLcJc7HH0xlFEE8wekvoQMdvl1 XYtHLh+Wp+CHdkKvO6loxkwa25KbcGARvae4bVX/dkOokbmek1ZvMwaD1xdqeQlOkRO8 N1aIREOFinCby+MBWAuYRyzTsx+AlZwroBTbEo8OK3xnN5RNe+eYOVTv+m00LLlJtKyf tAxQ== X-Gm-Message-State: AOAM532PAlnSL4c+fiwnrw7HPfeayU9Dso9m/XlYWPa65Bs1qHKK6DGp DejcfbIKPwuhxTout57wE54q1w== X-Google-Smtp-Source: ABdhPJwDQOPyfxu88Zpg/uD+cmrF7lOWMiDpMfZDMxMBCCR2TRDJixsoRkfUXwYzFlXy30chvV7iaA== X-Received: by 2002:a1c:6646:: with SMTP id a67mr8705560wmc.11.1620206591236; Wed, 05 May 2021 02:23:11 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 61sm20282645wrm.52.2021.05.05.02.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 02:23:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 75B7E1FF93; Wed, 5 May 2021 10:23:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 7/7] tcg: add trace events for [exit|goto]_tb and goto_ptr Date: Wed, 5 May 2021 10:22:59 +0100 Message-Id: <20210505092259.8202-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505092259.8202-1-alex.bennee@linaro.org> References: <20210505092259.8202-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , minyihh@uci.edu, robhenry@microsoft.com, vilanova@imperial.ac.uk, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, mohamad.gebai@gmail.com, kuhn.chenqun@huawei.com, matheus.ferst@eldorado.org.br Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" These are generic trace points in common helper functions used by all front ends. They mainly serve as additional in-tree examples of TCG trace points and can be used to compare and contrast with getting similar information from the TCG plugins. Signed-off-by: Alex Bennée --- tcg/tcg-op.c | 8 ++++++++ trace-events | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 70475773f4..46b00f6e9b 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2687,6 +2687,8 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) tcg_debug_assert(idx == TB_EXIT_REQUESTED); } + trace_exit_tb_tcg(val & ~TB_EXIT_MASK, val & TB_EXIT_MASK); + plugin_gen_disable_mem_helpers(); tcg_gen_op1i(INDEX_op_exit_tb, val); } @@ -2703,6 +2705,9 @@ void tcg_gen_goto_tb(unsigned idx) plugin_gen_disable_mem_helpers(); /* When not chaining, we simply fall through to the "fallback" exit. */ if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + + trace_goto_tb_tcg(idx); + tcg_gen_op1i(INDEX_op_goto_tb, idx); } } @@ -2715,6 +2720,9 @@ void tcg_gen_lookup_and_goto_ptr(void) plugin_gen_disable_mem_helpers(); ptr = tcg_temp_new_ptr(); gen_helper_lookup_tb_ptr(ptr, cpu_env); + + trace_goto_ptr_tcg(ptr); + tcg_gen_op1i(INDEX_op_goto_ptr, tcgv_ptr_arg(ptr)); tcg_temp_free_ptr(ptr); } else { diff --git a/trace-events b/trace-events index ac7cef9335..1fcb8c4dda 100644 --- a/trace-events +++ b/trace-events @@ -136,6 +136,18 @@ vcpu guest_cpu_reset(void) # Targets: TCG(all) vcpu tcg guest_mem_before(TCGv vaddr, uint16_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d" +# Mode: user, softmmu +# Targets: TCG(all) +tcg exit_tb(uint64_t ptr, uint64_t idx) "tb=0x%016"PRIx64"/%"PRId64"", "tb=0x%016"PRIx64"/%"PRId64"" + +# Mode: user, softmmu +# Targets: TCG(all) +tcg goto_tb(uint64_t idx) "idx=%"PRId64"", "idx=%"PRId64"" + +# Mode: user, softmmu +# Targets: TCG(all) +tcg goto_ptr(TCGv_ptr ptr) "", "ptr=%p" + # include/user/syscall-trace.h # @num: System call number.