[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after exec
From: |
Alex Bennée |
Subject: |
[PATCH v2 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution |
Date: |
Tue, 24 Jan 2023 18:01:26 +0000 |
From: Emilio Cota <cota@braap.org>
Fixes: #1381
Signed-off-by: Emilio Cota <cota@braap.org>
Message-Id: <20230108165107.62488-1-cota@braap.org>
[AJB: manually applied follow-up fix]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
include/qemu/plugin.h | 4 ++++
accel/tcg/cpu-exec.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h
index e0ebedef84..fb338ba576 100644
--- a/include/qemu/plugin.h
+++ b/include/qemu/plugin.h
@@ -59,6 +59,8 @@ get_plugin_meminfo_rw(qemu_plugin_meminfo_t i)
#ifdef CONFIG_PLUGIN
extern QemuOptsList qemu_plugin_opts;
+#define QEMU_PLUGIN_ASSERT(cond) g_assert(cond)
+
static inline void qemu_plugin_add_opts(void)
{
qemu_add_opts(&qemu_plugin_opts);
@@ -250,6 +252,8 @@ void qemu_plugin_user_postfork(bool is_child);
#else /* !CONFIG_PLUGIN */
+#define QEMU_PLUGIN_ASSERT(cond)
+
static inline void qemu_plugin_add_opts(void)
{ }
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 25ec73ef9a..9c857eeb07 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -504,6 +504,7 @@ static void cpu_exec_exit(CPUState *cpu)
if (cc->tcg_ops->cpu_exec_exit) {
cc->tcg_ops->cpu_exec_exit(cpu);
}
+ QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs == NULL);
}
void cpu_exec_step_atomic(CPUState *cpu)
@@ -980,6 +981,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
cpu_loop_exec_tb(cpu, tb, pc, &last_tb, &tb_exit);
+ QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs == NULL);
/* Try to align the host and virtual clocks
if the guest is in advance */
align_clocks(sc, cpu);
--
2.34.1
- Re: [PATCH v2 22/35] docs: add an introduction to the system docs, (continued)
- [PATCH v2 12/35] lcitool: drop texinfo from QEMU project/dependencies, Alex Bennée, 2023/01/24
- [PATCH v2 26/35] cpu: free cpu->tb_jmp_cache with RCU, Alex Bennée, 2023/01/24
- [PATCH v2 10/35] Update lcitool and fedora to 37, Alex Bennée, 2023/01/24
- [PATCH v2 32/35] translator: always pair plugin_gen_insn_{start, end} calls, Alex Bennée, 2023/01/24
- [PATCH v2 31/35] plugins: fix optimization in plugin_gen_disable_mem_helpers, Alex Bennée, 2023/01/24
- [PATCH v2 18/35] MAINTAINERS: Fix the entry for tests/tcg/nios2, Alex Bennée, 2023/01/24
- [PATCH v2 19/35] docs: add hotlinks to about preface text, Alex Bennée, 2023/01/24
- [PATCH v2 28/35] thread: de-const qemu_spin_destroy, Alex Bennée, 2023/01/24
- [PATCH v2 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution,
Alex Bennée <=
- [PATCH v2 24/35] semihosting: add O_BINARY flag in host_open for NT compatibility, Alex Bennée, 2023/01/24
- [PATCH v2 25/35] tests/tcg: add memory-sve test for aarch64, Alex Bennée, 2023/01/24
- [PATCH v2 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit, Alex Bennée, 2023/01/24
- [PATCH v2 27/35] util/qht: add missing atomic_set(hashes[i]), Alex Bennée, 2023/01/24
- [PATCH v2 30/35] plugins: make qemu_plugin_user_exit's locking order consistent with fork_start's, Alex Bennée, 2023/01/24
- [PATCH v2 13/35] tests/docker: Install flex in debian-tricore-cross, Alex Bennée, 2023/01/24
- [PATCH v2 23/35] semihosting: Write back semihosting data before completion callback, Alex Bennée, 2023/01/24