[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 20/50] translate-all: notify plugin code of tb_fl
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v3 20/50] translate-all: notify plugin code of tb_flush |
Date: |
Fri, 14 Jun 2019 18:11:30 +0100 |
From: "Emilio G. Cota" <address@hidden>
Plugins might allocate per-TB data that then they get passed each
time a TB is executed (via the *userdata pointer).
Notify plugin code every time a code cache flush occurs, so
that plugins can then reclaim the memory of the per-TB data.
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
accel/tcg/translate-all.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 54998e39c6..28a92e6d8b 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1231,6 +1231,8 @@ static gboolean tb_host_size_iter(gpointer key, gpointer
value, gpointer data)
/* flush all the translation blocks */
static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count)
{
+ bool did_flush = false;
+
mmap_lock();
/* If it is already been done on request of another CPU,
* just retry.
@@ -1238,6 +1240,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data
tb_flush_count)
if (tb_ctx.tb_flush_count != tb_flush_count.host_int) {
goto done;
}
+ did_flush = true;
if (DEBUG_TB_FLUSH_GATE) {
size_t nb_tbs = tcg_nb_tbs();
@@ -1262,6 +1265,9 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data
tb_flush_count)
done:
mmap_unlock();
+ if (did_flush) {
+ qemu_plugin_flush_cb();
+ }
}
void tb_flush(CPUState *cpu)
--
2.20.1
- [Qemu-devel] [PATCH v3 35/50] target/xtensa: fetch code with translator_ld, (continued)
- [Qemu-devel] [PATCH v3 35/50] target/xtensa: fetch code with translator_ld, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 43/50] tests/plugin: add a hotblocks plugin, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 23/50] cpu: hook plugin vcpu events, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 11/50] cputlb: document get_page_addr_code, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 44/50] plugin: add qemu_plugin_insn_disas helper, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 18/50] cpu_ldst_useronly_template: remove redundant #ifndef CODE_ACCESS, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 20/50] translate-all: notify plugin code of tb_flush,
Alex Bennée <=
- [Qemu-devel] [PATCH v3 46/50] tests/plugin: add hotpages plugin to breakdown memory access patterns, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 33/50] target/riscv: fetch code with translator_ld, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 42/50] tests/tcg: enable plugin testing, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 17/50] atomic_template: add inline trace/plugin helpers, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 40/50] linux-user: support -plugin option, Alex Bennée, 2019/06/14