[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 24/26] translator: always pair plugin_gen_insn_{start, end} calls
From: |
Alex Bennée |
Subject: |
[PATCH 24/26] translator: always pair plugin_gen_insn_{start, end} calls |
Date: |
Tue, 10 Jan 2023 17:39:20 +0000 |
From: Emilio Cota <cota@braap.org>
Related: #1381
Signed-off-by: Emilio Cota <cota@braap.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230108164731.61469-3-cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
accel/tcg/translator.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index 061519691f..ef5193c67e 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -100,19 +100,24 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb,
int max_insns,
ops->translate_insn(db, cpu);
}
- /* Stop translation if translate_insn so indicated. */
- if (db->is_jmp != DISAS_NEXT) {
- break;
- }
-
/*
* We can't instrument after instructions that change control
* flow although this only really affects post-load operations.
+ *
+ * Calling plugin_gen_insn_end() before we possibly stop translation
+ * is important. Even if this ends up as dead code, plugin generation
+ * needs to see a matching plugin_gen_insn_{start,end}() pair in order
+ * to accurately track instrumented helpers that might access memory.
*/
if (plugin_enabled) {
plugin_gen_insn_end();
}
+ /* Stop translation if translate_insn so indicated. */
+ if (db->is_jmp != DISAS_NEXT) {
+ break;
+ }
+
/* Stop translation if the output buffer is full,
or we have executed all of the allowed instructions. */
if (tcg_op_buf_full() || db->num_insns >= db->max_insns) {
--
2.34.1
- Re: [PATCH 07/26] configure: replace Perl usage with sed, (continued)
- [PATCH 17/26] tests/tcg: add memory-sve test for aarch64, Alex Bennée, 2023/01/10
- [PATCH 13/26] semihosting: Write back semihosting data before completion callback, Alex Bennée, 2023/01/10
- [PATCH 18/26] cpu: free cpu->tb_jmp_cache with RCU, Alex Bennée, 2023/01/10
- [PATCH 14/26] semihosting: add O_BINARY flag in host_open for NT compatibility, Alex Bennée, 2023/01/10
- [PATCH 15/26] docs: add a proper feature overview in "About QEMU", Alex Bennée, 2023/01/10
- [PATCH 09/26] docs: drop texinfo options, Alex Bennée, 2023/01/10
- [PATCH 23/26] plugins: fix optimization in plugin_gen_disable_mem_helpers, Alex Bennée, 2023/01/10
- [PATCH 19/26] util/qht: add missing atomic_set(hashes[i]), Alex Bennée, 2023/01/10
- [PATCH 12/26] lcitool: drop texinfo from QEMU project/dependencies, Alex Bennée, 2023/01/10
- [PATCH 24/26] translator: always pair plugin_gen_insn_{start, end} calls,
Alex Bennée <=
- [PATCH 21/26] util/qht: use striped locks under TSAN, Alex Bennée, 2023/01/10
- [PATCH 25/26] tcg: exclude lookup_tb_ptr from helper instrumentation, Alex Bennée, 2023/01/10
- [PATCH 11/26] lcitool: drop perl from QEMU project/dependencies, Alex Bennée, 2023/01/10
- [PATCH 16/26] semihosting: add semihosting section to the docs, Alex Bennée, 2023/01/10
[PATCH 20/26] thread: de-const qemu_spin_destroy, Alex Bennée, 2023/01/10