From nobody Mon Feb 9 09:53:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581088482390191.00932146548394; Fri, 7 Feb 2020 07:14:42 -0800 (PST) Received: from localhost ([::1]:59166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05L7-00078E-Cp for importer@patchew.org; Fri, 07 Feb 2020 10:14:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60353) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058L-0000zO-VN for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058H-0003yA-0P for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:29 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:40209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058G-0003tK-Pp for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:24 -0500 Received: by mail-wr1-x441.google.com with SMTP id t3so3050146wru.7 for ; Fri, 07 Feb 2020 07:01:24 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r14sm3595073wrj.26.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:19 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 033271FF8C; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) 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=/ZswA9Otu9vtfPLtWP689YkHSf+JvE188+hies8lU5M=; b=ncgrbPZhSiBQ/R5Vkz0ucSHt+Y6ZL1DKItYxxKSCAY1OrG7J9mSyFjzO6CLX/7hagI f+9tyPzRLU0pHlBuFLMlRa0E7/tD9RyRQZ8WK2+EZiU/GPJ70jbBJSJz3ZD79TcwvVgI I5LNMRXIOi9C44YyNDnZhrxo7ZaBDZtKR47dXRBJzNVDQcY7u5aCWiD1ft5maLVRwL/3 dI8UHnl7YimIhYMjvrEi7Foeli7NCsdjRAclY+UlKzlAMYStTwFbz5dwCm2RIuEx3/h6 NnHXifni6JuBfLhb/is3SBSc54N7R1Ib1tEx4R+9PluCt8Zp2NHXf6NzORnz35UlsO/U A7hA== 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=/ZswA9Otu9vtfPLtWP689YkHSf+JvE188+hies8lU5M=; b=DHYSXQVZ/mHzrhTza4LHhQN55fS5CDGwUhhYDAokBwMHx62pi5Uou9tOvkM2SYcrBi 2nx2hY4YazGdSe5PlGD2MJEPbZgf5eFwP7/M0YDy9CYaKUSJmchukrhb1AJW0CkgQN49 yzVdPpgIeAV9eKh7+4xlOVjIHUSW6rJt+iBJtFO9xcMWzpFa7NAMih0tXu7iTuoYHc6D JG75EvtjqRCSaA+5gkB/0AGTfkgWhM8JHKcQEsP7mnrSn4A2JK9zCD2fCOnHq0EwKrhW 0h982SwgeCHwFIn8eX/cbC1EL1DTAbJYP0h1Lqo4hXas81Iqa8z3j+CROEnIKWO/4vJH EepQ== X-Gm-Message-State: APjAAAUebOudGfMLhBKVJUJskuT7CJaultjAW/mjHP36V9lEKWbUEi77 Ru2Al020KkwU3h4L7Oy6zl3dTQ== X-Google-Smtp-Source: APXvYqylIFZGgwj+7zbjjqupasm0ZNmyYEAz1rz1jBFm7MYoxN9PeEmV2jGByB76xkBD5zh0K8ji0Q== X-Received: by 2002:a5d:40d1:: with SMTP id b17mr4958979wrq.93.1581087682781; Fri, 07 Feb 2020 07:01:22 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/5] docs/devel: document query handle lifetimes Date: Fri, 7 Feb 2020 15:01:14 +0000 Message-Id: <20200207150118.23007-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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: robert.foley@linaro.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) I forgot to document the lifetime of handles in the developer documentation. Do so now. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Reviewed-by: Robert Foley --- docs/devel/tcg-plugins.rst | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 718eef00f22..a05990906cc 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -51,8 +51,17 @@ about how QEMU's translation works to the plugins. While= there are conceptions such as translation time and translation blocks the details are opaque to plugins. The plugin is able to query select details of instructions and system configuration only through the -exported *qemu_plugin* functions. The types used to describe -instructions and events are opaque to the plugins themselves. +exported *qemu_plugin* functions. + +Query Handle Lifetime +--------------------- + +Each callback provides an opaque anonymous information handle which +can usually be further queried to find out information about a +translation, instruction or operation. The handles themselves are only +valid during the lifetime of the callback so it is important that any +information that is needed is extracted during the callback and saved +by the plugin. =20 Usage =3D=3D=3D=3D=3D --=20 2.20.1 From nobody Mon Feb 9 09:53:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581088111321689.6163536336637; Fri, 7 Feb 2020 07:08:31 -0800 (PST) Received: from localhost ([::1]:58972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05F8-0004d7-8A for importer@patchew.org; Fri, 07 Feb 2020 10:08:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058G-0000nN-Jd for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058E-0003ni-A4 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:24 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35171) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058E-0003gZ-3j for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:22 -0500 Received: by mail-wr1-x442.google.com with SMTP id w12so3087807wrt.2 for ; Fri, 07 Feb 2020 07:01:22 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a26sm3688453wmm.18.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:19 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1A7F21FF8F; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) 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=geflNNg5itN8dXnNJ+nN1Foj8Td7+gJztf5WRFw/CZI=; b=DH02ILyn31hWZDIn7PbXVwUTONERvvLND5bXRV94M7JO4SmRqYA0gjtHKA7eCS/xvc 52titBIzfHffSdrESWMFb6DrjvxZZzvzHf+0a/68KKicLArTWpDh+b31eDJSqBij72VW XiJZYh7qq3CuYVXxqbfOayOgPIF7IkhvoB1zyguZ4mgfyzYWOT743Vb9WKmS4EgI2bUB Pl3HR8GOr7rf1UGfk8wWj8F5OExi5Ylp6gWBLTisimWZEL1xxpky9OMeUljgOSfo2M1L n6ivpcAzndODuuBpkkf72+PPp5/8YvREoLb5qzgpOQYDkgKAHaZvMEjCnnMoOvc0u5aM xdlw== 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=geflNNg5itN8dXnNJ+nN1Foj8Td7+gJztf5WRFw/CZI=; b=HmL8C8kA+AsUN1TJTeZDcjj9pHOdd0bVkc8OBUSavw/sBFzgorkmacLMcQ3m5zUHs8 FSgGL3JxJhEP+V1LyRLwY95fXUWfEhrGlOGcxHlwoBgGJaZd3oNAFF/6G+03EOpGK53E Zq+jEU+75nCz8R0p8ox96JiRsdtfxxK6sWsbVwU7t5+Xe8MBUuxXOUZsWEVWb/Oa58UX hBOZP1kjhikSGCgOzfLvSSqEaxI2wTaF7T8KCuL6HVng1pKXdHj2/r8x2prsHI26HJB5 z5kVTcVyPwnrlhqqlhwdrMpANQ6t4AzuZuvZtIO9P+IQuqIr0NXxSsDa/J1HozRNzXpI YjHQ== X-Gm-Message-State: APjAAAX7hy8ZcgjyqEUZ6BObMXxRvObcsGrMaLi3ykArwXTTE3kJbWm3 suT/UgHDJW5cOyRyGhXxR3OA6A== X-Google-Smtp-Source: APXvYqwwsz0TekjGr2ewp2Wg/EFFUEAULdrWGs0PrslPC7+pXQHsjyqXyGPIkSyUwMVKe6H2m9CPKw== X-Received: by 2002:adf:f6c8:: with SMTP id y8mr5043627wrp.167.1581087680720; Fri, 07 Feb 2020 07:01:20 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/5] plugins/core: add missing break in cb_to_tcg_flags Date: Fri, 7 Feb 2020 15:01:15 +0000 Message-Id: <20200207150118.23007-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: robert.foley@linaro.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Reported-by: Robert Henry Signed-off-by: Emilio G. Cota Message-Id: <20200105072940.32204-1-cota@braap.org> Reviewed-by: Richard Henderson --- plugins/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/core.c b/plugins/core.c index 9e1b9e7a915..ed863011baf 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -286,6 +286,7 @@ static inline uint32_t cb_to_tcg_flags(enum qemu_plugin= _cb_flags flags) switch (flags) { case QEMU_PLUGIN_CB_RW_REGS: ret =3D 0; + break; case QEMU_PLUGIN_CB_R_REGS: ret =3D TCG_CALL_NO_WG; break; --=20 2.20.1 From nobody Mon Feb 9 09:53:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581088290822215.2756842188861; Fri, 7 Feb 2020 07:11:30 -0800 (PST) Received: from localhost ([::1]:59052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05I1-0001bK-Od for importer@patchew.org; Fri, 07 Feb 2020 10:11:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60286) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058I-0000rP-Ai for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058H-0003yi-4G for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:26 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38148) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058G-0003us-T9 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:25 -0500 Received: by mail-wr1-x442.google.com with SMTP id y17so3064128wrh.5 for ; Fri, 07 Feb 2020 07:01:24 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b10sm3706967wrt.90.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:20 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2F7EA1FF90; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) 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=NuT51ChIEQ4Kna0auqW3OS2c6axOB9q/YF3f1QpycFw=; b=WboE51SfCbCsN9Z4ZbYGqNSOhCeN32zDKYJ4nQEYHWwgsyeaIWcoZ0BpqncKpZy1Td XfE5NPZR9lszSRZ2gtpv8q2lzbV8bVDHKLunBSSaVpJyjl/AS4xBSZotrNNgLAHJ/Z9P qWQjilgeTpkXuswEN4LP348xFDlFPcr25CzLSARth60+x/CaHnf/DRYfuy2XpfVSgAXP CG4SJnxmw2M0wZs0SuH2bPDhOknMArsFL7baSMOQS4tWzdHye51y0vm0zu76DHiG0B3x 9mfHKAF9nkInFyD0DoXtfbsuELFBaweHc7rRC12H3mdT8Bs6H741h/ZQA9AVkijpREUl 7ZGw== 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=NuT51ChIEQ4Kna0auqW3OS2c6axOB9q/YF3f1QpycFw=; b=E2fASua470+wEUVWBd7VwUgc4R0Vv/MwiavhWnC10VU0Fki74h1G6omH/lQaAAa7Sp 5Vl0d0qy7u0u/ScfT7vxd1pZgb0333RYBa74hBTx3jvkBYikO84xJxYdVCdfovcnsOhK WKOs3IMDbsAnaWwoDrR7xxGmcavifz1FBeXX7YFqDw2kSnwo9SL51BMoXYW4ADeslfEI MAhzDhCp4vBhOtyKTEGnTCFBXNB2RgxHaDZAWTukc09tRdwkrjvda3MQajMNrUUQPeam sz6P14xNBVa+WI3rwDn+7QSgvf+nvswCPSnrTAfH0GKfd+cvcC1Siuep3mG8WucRP1Rn jkPw== X-Gm-Message-State: APjAAAXOC7WRB3yqdG03qLv0cztkb6j4wouBvtLZ5mf2RTL2pNkVWg7A 6LyujzG3gebUrkB0ApI14YHN/9rwgvc= X-Google-Smtp-Source: APXvYqwP7OaromFXTovkUlQMuqqkoDM7lBwG4jooBu9FcYwRa2tRN3v7UcrQ5UQrq2TaJaAEKaJI6g== X-Received: by 2002:adf:b193:: with SMTP id q19mr5099864wra.78.1581087683942; Fri, 07 Feb 2020 07:01:23 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/5] tests/plugin: prevent uninitialized warning Date: Fri, 7 Feb 2020 15:01:16 +0000 Message-Id: <20200207150118.23007-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: Thomas Huth , robert.foley@linaro.org, Euler Robot , robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Chen Qun According to the glibc function requirements, we need initialise the variable. Otherwise there will be compilation warnings: glib-autocleanups.h:28:3: warning: =E2=80=98out=E2=80=99 may be used uninitialized in this function [-Wmaybe-uninitialized] g_free (*pp); ^~~~~~~~~~~~ Reported-by: Euler Robot Signed-off-by: Chen Qun Reviewed-by: Thomas Huth Message-Id: <20200206093238.203984-1-kuhn.chenqun@huawei.com> [AJB: uses Thomas's single line allocation] Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- tests/plugin/bb.c | 6 +++--- tests/plugin/insn.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c index f30bea08dcc..df19fd359df 100644 --- a/tests/plugin/bb.c +++ b/tests/plugin/bb.c @@ -22,9 +22,9 @@ static bool do_inline; =20 static void plugin_exit(qemu_plugin_id_t id, void *p) { - g_autofree gchar *out; - out =3D g_strdup_printf("bb's: %" PRIu64", insns: %" PRIu64 "\n", - bb_count, insn_count); + g_autofree gchar *out =3D g_strdup_printf( + "bb's: %" PRIu64", insns: %" PRIu64 "\n", + bb_count, insn_count); qemu_plugin_outs(out); } =20 diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c index 0a8f5a0000e..a9a6e412373 100644 --- a/tests/plugin/insn.c +++ b/tests/plugin/insn.c @@ -44,8 +44,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qem= u_plugin_tb *tb) =20 static void plugin_exit(qemu_plugin_id_t id, void *p) { - g_autofree gchar *out; - out =3D g_strdup_printf("insns: %" PRIu64 "\n", insn_count); + g_autofree gchar *out =3D g_strdup_printf("insns: %" PRIu64 "\n", insn= _count); qemu_plugin_outs(out); } =20 --=20 2.20.1 From nobody Mon Feb 9 09:53:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581088387601465.2016118601033; Fri, 7 Feb 2020 07:13:07 -0800 (PST) Received: from localhost ([::1]:59098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05Ja-0004G5-Ha for importer@patchew.org; Fri, 07 Feb 2020 10:13:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60316) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058J-0000uF-Rj for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058I-000470-DI for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:27 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058I-00040s-50 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:26 -0500 Received: by mail-wm1-x344.google.com with SMTP id g1so2881177wmh.4 for ; Fri, 07 Feb 2020 07:01:26 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d23sm3790469wra.30.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:22 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4621E1FF91; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) 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=U6Am3X6OQTZ1x+tf20LucVI7jeDaV7FG5H5GI7lV8EE=; b=w2WmCj33W1pPjplq1vkGvP4r1LLm/qIZk/PhWqJ2Ao2pD2xj1LPBVu1ZAdDEC0C5DY YSKINVK4XvBick/c6PVD+n0aS729CVzuF+EaMguiB3oV3SVr2cUsNBHsfKg4X3am0xWu 0SNDwohlhnz72jbGkdz8/1TGMuO7NynmCQFEvjm/I/n9cMSybW/+ptVslwkXo86GEZJe mBv9yqp29GLdn4Da4ty9P3Ugw4R+2tFsADBU59s4WKiORfC1aaLw8jD/CHMOqR1VV+HL vZS3q1Dh5BtWtgB9SRwUs8SPiF/z2MhezuehcCB/sV3USuaqRSLTIMckwR86PqYuiouP Nd+Q== 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=U6Am3X6OQTZ1x+tf20LucVI7jeDaV7FG5H5GI7lV8EE=; b=VihXl8fffGRU1hx6+iybggOt6H8T81gVTt0FL4kNpXbhBcA1FKyd2+ZDqGzmQe81Mr m8+I4gHjnPS0mGCcSkm9xwknDhMui3dbknzpi3V0w9rpu8l4Bz5HWPcjxMm4Wx7IjUM1 TqzlfQXqLJLkeFUYZMlL4MVUIqCPilzeiaxUL6MdCfXuTDQKFdSWY63cC4RPFjt3EDmI KKVMrknEwohqahHWBwuwWhUtQ6Viao3uCH2leqhg+S5VgGViiI6Qg+kpBefDs7FKSwWc Ot8IULb7NAOpKLJuwgzdGeA6jcYoFEKzvbebUTmxm1R5sDDOa29rKoeFFypKF7+HwygC eMpw== X-Gm-Message-State: APjAAAWMINohVM4GMYO0zndUn3v+CQu5WAv+zA0mpgTVR88HzBUgrFS1 8V21kiqbnCdbjUeJ2rKi7LE3yw== X-Google-Smtp-Source: APXvYqxOMp8kveOFWUrZwYWQwbPSBkD6s7EKiNuV1LixsgOVeUhIHRE1vmd+9Be0JLtXQNSSaTScZw== X-Received: by 2002:a1c:7907:: with SMTP id l7mr4652088wme.37.1581087685087; Fri, 07 Feb 2020 07:01:25 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/5] target/riscv: progressively load the instruction during decode Date: Fri, 7 Feb 2020 15:01:17 +0000 Message-Id: <20200207150118.23007-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 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: Alistair Francis , "open list:RISC-V TCG CPUs" , robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, Palmer Dabbelt , kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The plugin system would throw up a harmless warning when it detected that a disassembly of an instruction didn't use all it's bytes. Fix the riscv decoder to only load the instruction bytes it needs as it needs them. This drops opcode from the ctx in favour if passing the appropriately sized opcode down a few levels of the decode. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- target/riscv/translate.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 14dc71156be..99f2bcf177c 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -44,7 +44,6 @@ typedef struct DisasContext { /* pc_succ_insn points to the instruction following base.pc_next */ target_ulong pc_succ_insn; target_ulong priv_ver; - uint32_t opcode; uint32_t mstatus_fs; uint32_t misa; uint32_t mem_idx; @@ -492,45 +491,45 @@ static void gen_set_rm(DisasContext *ctx, int rm) tcg_temp_free_i32(t0); } =20 -static void decode_RV32_64C0(DisasContext *ctx) +static void decode_RV32_64C0(DisasContext *ctx, uint16_t opcode) { - uint8_t funct3 =3D extract32(ctx->opcode, 13, 3); - uint8_t rd_rs2 =3D GET_C_RS2S(ctx->opcode); - uint8_t rs1s =3D GET_C_RS1S(ctx->opcode); + uint8_t funct3 =3D extract32(opcode, 13, 3); + uint8_t rd_rs2 =3D GET_C_RS2S(opcode); + uint8_t rs1s =3D GET_C_RS1S(opcode); =20 switch (funct3) { case 3: #if defined(TARGET_RISCV64) /* C.LD(RV64/128) -> ld rd', offset[7:3](rs1')*/ gen_load_c(ctx, OPC_RISC_LD, rd_rs2, rs1s, - GET_C_LD_IMM(ctx->opcode)); + GET_C_LD_IMM(opcode)); #else /* C.FLW (RV32) -> flw rd', offset[6:2](rs1')*/ gen_fp_load(ctx, OPC_RISC_FLW, rd_rs2, rs1s, - GET_C_LW_IMM(ctx->opcode)); + GET_C_LW_IMM(opcode)); #endif break; case 7: #if defined(TARGET_RISCV64) /* C.SD (RV64/128) -> sd rs2', offset[7:3](rs1')*/ gen_store_c(ctx, OPC_RISC_SD, rs1s, rd_rs2, - GET_C_LD_IMM(ctx->opcode)); + GET_C_LD_IMM(opcode)); #else /* C.FSW (RV32) -> fsw rs2', offset[6:2](rs1')*/ gen_fp_store(ctx, OPC_RISC_FSW, rs1s, rd_rs2, - GET_C_LW_IMM(ctx->opcode)); + GET_C_LW_IMM(opcode)); #endif break; } } =20 -static void decode_RV32_64C(DisasContext *ctx) +static void decode_RV32_64C(DisasContext *ctx, uint16_t opcode) { - uint8_t op =3D extract32(ctx->opcode, 0, 2); + uint8_t op =3D extract32(opcode, 0, 2); =20 switch (op) { case 0: - decode_RV32_64C0(ctx); + decode_RV32_64C0(ctx, opcode); break; } } @@ -709,22 +708,24 @@ static bool gen_shift(DisasContext *ctx, arg_r *a, /* Include the auto-generated decoder for 16 bit insn */ #include "decode_insn16.inc.c" =20 -static void decode_opc(DisasContext *ctx) +static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opc= ode) { /* check for compressed insn */ - if (extract32(ctx->opcode, 0, 2) !=3D 3) { + if (extract32(opcode, 0, 2) !=3D 3) { if (!has_ext(ctx, RVC)) { gen_exception_illegal(ctx); } else { ctx->pc_succ_insn =3D ctx->base.pc_next + 2; - if (!decode_insn16(ctx, ctx->opcode)) { + if (!decode_insn16(ctx, opcode)) { /* fall back to old decoder */ - decode_RV32_64C(ctx); + decode_RV32_64C(ctx, opcode); } } } else { + uint32_t opcode32 =3D opcode; + opcode32 =3D deposit32(opcode32, 16, 16, translator_lduw(env, ctx-= >base.pc_next + 2)); ctx->pc_succ_insn =3D ctx->base.pc_next + 4; - if (!decode_insn32(ctx, ctx->opcode)) { + if (!decode_insn32(ctx, opcode32)) { gen_exception_illegal(ctx); } } @@ -776,9 +777,9 @@ static void riscv_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cpu) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); CPURISCVState *env =3D cpu->env_ptr; + uint16_t opcode16 =3D translator_lduw(env, ctx->base.pc_next); =20 - ctx->opcode =3D translator_ldl(env, ctx->base.pc_next); - decode_opc(ctx); + decode_opc(env, ctx, opcode16); ctx->base.pc_next =3D ctx->pc_succ_insn; =20 if (ctx->base.is_jmp =3D=3D DISAS_NEXT) { --=20 2.20.1 From nobody Mon Feb 9 09:53:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581088546944936.0862193710517; Fri, 7 Feb 2020 07:15:46 -0800 (PST) Received: from localhost ([::1]:59230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05M9-0000bY-OY for importer@patchew.org; Fri, 07 Feb 2020 10:15:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60333) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058K-0000wL-JE for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058J-0004D6-BW for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:28 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55457) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058J-00047j-3I for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:27 -0500 Received: by mail-wm1-x343.google.com with SMTP id q9so2869375wmj.5 for ; Fri, 07 Feb 2020 07:01:26 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s22sm3535449wmh.4.2020.02.07.07.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5CAAE1FF92; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) 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=20w7i9jiAm5hvyfwFIkzlqbRcfX9RLZbq6NcYeukZyY=; b=OLxckoe3p/ZV52/++8NBWwJliB6tjTDM7yc0RH2OX4Wutq0kcWEFI1ohBipqxVjeRj DLZ14vPK1pUv9xrG3Ni1fGdTJgbDoSl5Ic09YpiYJFvyp/wfpwZWGsP2uhDjHjghj6Az k+p3PTKVBPDlMj6k5qbhVGZ1hjpf5JN6ABTtzz6S1O4vnQ5eguAczP4wTt57N7AgocUf zn62knDIgt5wFA7SXOfZfLSOaaUnRVgz6IN0H0wWUTJ29RUN6ybt5zmyb15qt+yYmxPb fS+sTqjgjlQqrxFJeVbMpF12Kx/m1jlbiqgmrGAvy0Bdae4CnE5GpHMWH201757AEEpt Hhpg== 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=20w7i9jiAm5hvyfwFIkzlqbRcfX9RLZbq6NcYeukZyY=; b=UJjlxpNEXXR82YibifaBWhawMTzHWxjMm1XiC5Z8wLMkGf/O9Zpc7QGMbTrBM5EWYS tohjlVewGddZahIyCGx65Jv8SkEGSSxI5m073i2P5Rje0i62S39CMBkoaocuLcZNv/b0 +5xoaHqypZfIVrbSHzWCqU6gkAuaiMM0faNffdiYdPxI6/3r90tQZRHVQeFsUImxmLto sGiJ66OqK5o8CaRnA37b8MpUErXsFB64swNwzGfHfB/UFbic2Nsi5rjRgvtcsDgec/O9 jdZQ+urpp9vcr4SvrDQLmB/f2mEl4m6pAdYVxxLYjxdUWvxiQapRxeHw9RM0h//Wmrw2 Q7Mg== X-Gm-Message-State: APjAAAVJ5p/HRnr84WVnXT0m0kZgycd5NnNkBwsuI7w04Uzb8gJNFc+L iHEZI8RxdRdjV/axBAof0kJdaA== X-Google-Smtp-Source: APXvYqwXNo0U8bhZTQ5u7VKINr4aWxa83nVQ2jiIacW88D7c3jN+q99h2VKAB0Pc3dYZ6whUEtkq0Q== X-Received: by 2002:a05:600c:d5:: with SMTP id u21mr4819763wmm.98.1581087686129; Fri, 07 Feb 2020 07:01:26 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/5] tests/plugins: make howvec clean-up after itself. Date: Fri, 7 Feb 2020 15:01:18 +0000 Message-Id: <20200207150118.23007-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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: robert.foley@linaro.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) TCG plugins are responsible for their own memory usage and although the plugin_exit is tied to the end of execution in this case it is still poor practice. Ensure we delete the hash table and related data when we are done to be a good plugin citizen. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Reviewed-by: Robert Foley --- tests/plugin/howvec.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/plugin/howvec.c b/tests/plugin/howvec.c index 4ca555e1239..7b77403559d 100644 --- a/tests/plugin/howvec.c +++ b/tests/plugin/howvec.c @@ -163,6 +163,13 @@ static gint cmp_exec_count(gconstpointer a, gconstpoin= ter b) return ea->count > eb->count ? -1 : 1; } =20 +static void free_record(gpointer data) +{ + InsnExecCount *rec =3D (InsnExecCount *) data; + g_free(rec->insn); + g_free(rec); +} + static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) report =3D g_string_new("Instruction Classes:\n"); @@ -213,12 +220,15 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) g_list_free(it); } =20 + g_list_free(counts); + g_hash_table_destroy(insns); + qemu_plugin_outs(report->str); } =20 static void plugin_init(void) { - insns =3D g_hash_table_new(NULL, g_direct_equal); + insns =3D g_hash_table_new_full(NULL, g_direct_equal, NULL, &free_reco= rd); } =20 static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata) --=20 2.20.1