[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 32/35] translator: always pair plugin_gen_insn_{start, end} calls
From: |
Alex Bennée |
Subject: |
[PULL 32/35] translator: always pair plugin_gen_insn_{start, end} calls |
Date: |
Thu, 26 Jan 2023 11:22:47 +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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230108164731.61469-3-cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230124180127.1881110-33-alex.bennee@linaro.org>
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
- [PULL 28/35] thread: de-const qemu_spin_destroy, (continued)
- [PULL 28/35] thread: de-const qemu_spin_destroy, Alex Bennée, 2023/01/26
- [PULL 13/35] tests/docker: Install flex in debian-tricore-cross, Alex Bennée, 2023/01/26
- [PULL 15/35] tests/tcg: skip the vma-pthread test on CI, Alex Bennée, 2023/01/26
- [PULL 20/35] docs: add a new section to outline emulation support, Alex Bennée, 2023/01/26
- [PULL 29/35] util/qht: use striped locks under TSAN, Alex Bennée, 2023/01/26
- [PULL 09/35] gitlab: add lsan suppression file to workaround tcmalloc issues, Alex Bennée, 2023/01/26
- [PULL 16/35] tests/tcg: Use SIGKILL for timeout, Alex Bennée, 2023/01/26
- [PULL 30/35] plugins: make qemu_plugin_user_exit's locking order consistent with fork_start's, Alex Bennée, 2023/01/26
- [PULL 26/35] cpu: free cpu->tb_jmp_cache with RCU, Alex Bennée, 2023/01/26
- [PULL 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution, Alex Bennée, 2023/01/26
- [PULL 32/35] translator: always pair plugin_gen_insn_{start, end} calls,
Alex Bennée <=
- [PULL 31/35] plugins: fix optimization in plugin_gen_disable_mem_helpers, Alex Bennée, 2023/01/26
- [PULL 24/35] semihosting: add O_BINARY flag in host_open for NT compatibility, Alex Bennée, 2023/01/26
- [PULL 23/35] semihosting: Write back semihosting data before completion callback, Alex Bennée, 2023/01/26
- [PULL 19/35] docs: add hotlinks to about preface text, Alex Bennée, 2023/01/26
- [PULL 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit, Alex Bennée, 2023/01/26
- [PULL 27/35] util/qht: add missing atomic_set(hashes[i]), Alex Bennée, 2023/01/26
- [PULL 21/35] semihosting: add semihosting section to the docs, Alex Bennée, 2023/01/26
- [PULL 33/35] tcg: exclude non-memory effecting helpers from instrumentation, Alex Bennée, 2023/01/26
- [PULL 22/35] docs: add an introduction to the system docs, Alex Bennée, 2023/01/26
- [PULL 25/35] tests/tcg: add memory-sve test for aarch64, Alex Bennée, 2023/01/26